{
"tiddlers": {
"$:/Acknowledgements": {
"title": "$:/Acknowledgements",
"text": "TiddlyWiki incorporates code from these fine OpenSource projects:\n\n* [[The Stanford Javascript Crypto Library|http://bitwiseshiftleft.github.io/sjcl/]]\n* [[The Jasmine JavaScript Test Framework|http://pivotal.github.io/jasmine/]]\n* [[Normalize.css by Nicolas Gallagher|http://necolas.github.io/normalize.css/]]\n\nAnd media from these projects:\n\n* World flag icons from [[Wikipedia|http://commons.wikimedia.org/wiki/Category:SVG_flags_by_country]]\n"
},
"$:/core/copyright.txt": {
"title": "$:/core/copyright.txt",
"type": "text/plain",
"text": "TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)\n\nCopyright (c) 2004-2007, Jeremy Ruston\nCopyright (c) 2007-2021, UnaMesa Association\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
},
"$:/core/icon": {
"title": "$:/core/icon",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\"><path d=\"M64 0l54.56 32v64L64 128 9.44 96V32L64 0zm21.127 95.408c-3.578-.103-5.15-.094-6.974-3.152l-1.42.042c-1.653-.075-.964-.04-2.067-.097-1.844-.07-1.548-1.86-1.873-2.8-.52-3.202.687-6.43.65-9.632-.014-1.14-1.593-5.17-2.157-6.61-1.768.34-3.546.406-5.34.497-4.134-.01-8.24-.527-12.317-1.183-.8 3.35-3.16 8.036-1.21 11.44 2.37 3.52 4.03 4.495 6.61 4.707 2.572.212 3.16 3.18 2.53 4.242-.55.73-1.52.864-2.346 1.04l-1.65.08c-1.296-.046-2.455-.404-3.61-.955-1.93-1.097-3.925-3.383-5.406-5.024.345.658.55 1.938.24 2.53-.878 1.27-4.665 1.26-6.4.47-1.97-.89-6.73-7.162-7.468-11.86 1.96-3.78 4.812-7.07 6.255-11.186-3.146-2.05-4.83-5.384-4.61-9.16l.08-.44c-3.097.59-1.49.37-4.82.628-10.608-.032-19.935-7.37-14.68-18.774.34-.673.664-1.287 1.243-.994.466.237.4 1.18.166 2.227-3.005 13.627 11.67 13.732 20.69 11.21.89-.25 2.67-1.936 3.905-2.495 2.016-.91 4.205-1.282 6.376-1.55 5.4-.63 11.893 2.276 15.19 2.37 3.3.096 7.99-.805 10.87-.615 2.09.098 4.143.483 6.16 1.03 1.306-6.49 1.4-11.27 4.492-12.38 1.814.293 3.213 2.818 4.25 4.167 2.112-.086 4.12.46 6.115 1.066 3.61-.522 6.642-2.593 9.833-4.203-3.234 2.69-3.673 7.075-3.303 11.127.138 2.103-.444 4.386-1.164 6.54-1.348 3.507-3.95 7.204-6.97 7.014-1.14-.036-1.805-.695-2.653-1.4-.164 1.427-.81 2.7-1.434 3.96-1.44 2.797-5.203 4.03-8.687 7.016-3.484 2.985 1.114 13.65 2.23 15.594 1.114 1.94 4.226 2.652 3.02 4.406-.37.58-.936.785-1.54 1.01l-.82.11zm-40.097-8.85l.553.14c.694-.27 2.09.15 2.83.353-1.363-1.31-3.417-3.24-4.897-4.46-.485-1.47-.278-2.96-.174-4.46l.02-.123c-.582 1.205-1.322 2.376-1.72 3.645-.465 1.71 2.07 3.557 3.052 4.615l.336.3z\" fill-rule=\"evenodd\"/></svg>"
},
"$:/core/images/add-comment": {
"title": "$:/core/images/add-comment",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-add-comment tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M56 56H36a8 8 0 100 16h20v20a8 8 0 1016 0V72h20a8 8 0 100-16H72V36a8 8 0 10-16 0v20zm-12.595 58.362c-6.683 7.659-20.297 12.903-36.006 12.903-2.196 0-4.35-.102-6.451-.3 9.652-3.836 17.356-12.24 21.01-22.874C8.516 94.28 0 79.734 0 63.5 0 33.953 28.206 10 63 10s63 23.953 63 53.5S97.794 117 63 117c-6.841 0-13.428-.926-19.595-2.638z\"/></svg>"
},
"$:/core/images/advanced-search-button": {
"title": "$:/core/images/advanced-search-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-advanced-search-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M74.565 87.985A47.776 47.776 0 0148 96C21.49 96 0 74.51 0 48S21.49 0 48 0s48 21.49 48 48c0 9.854-2.97 19.015-8.062 26.636l34.347 34.347a9.443 9.443 0 010 13.36 9.446 9.446 0 01-13.36 0l-34.36-34.358zM48 80c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32-17.673 0-32 14.327-32 32 0 17.673 14.327 32 32 32z\"/><circle cx=\"48\" cy=\"48\" r=\"8\"/><circle cx=\"28\" cy=\"48\" r=\"8\"/><circle cx=\"68\" cy=\"48\" r=\"8\"/></g></svg>"
},
"$:/core/images/auto-height": {
"title": "$:/core/images/auto-height",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-auto-height tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M67.987 114.356l-.029-14.477a4 4 0 00-2.067-3.494l-15.966-8.813-1.933 7.502H79.9c4.222 0 5.564-5.693 1.786-7.58L49.797 71.572 48.01 79.15h31.982c4.217 0 5.564-5.682 1.795-7.575L49.805 55.517l-1.795 7.575h31.982c4.212 0 5.563-5.67 1.805-7.57l-16.034-8.105 2.195 3.57V35.614l9.214 9.213a4 4 0 105.656-5.656l-16-16a4 4 0 00-5.656 0l-16 16a4 4 0 105.656 5.656l9.13-9.13v15.288a4 4 0 002.195 3.57l16.035 8.106 1.804-7.57H48.01c-4.217 0-5.564 5.682-1.795 7.574l31.982 16.059 1.795-7.575H48.01c-4.222 0-5.564 5.693-1.787 7.579l31.89 15.923 1.787-7.578H47.992c-4.133 0-5.552 5.504-1.933 7.501l15.966 8.813-2.067-3.494.029 14.436-9.159-9.158a4 4 0 00-5.656 5.656l16 16a4 4 0 005.656 0l16-16a4 4 0 10-5.656-5.656l-9.185 9.184zM16 20h96a4 4 0 100-8H16a4 4 0 100 8z\"/></svg>"
},
"$:/core/images/blank": {
"title": "$:/core/images/blank",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-blank tc-image-button\" viewBox=\"0 0 128 128\"/>"
},
"$:/core/images/bold": {
"title": "$:/core/images/bold",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-bold tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M41.146 51.81V21.87h26.353c2.51 0 4.93.21 7.26.628 2.33.418 4.392 1.165 6.185 2.24 1.793 1.076 3.227 2.57 4.302 4.482 1.076 1.913 1.614 4.363 1.614 7.35 0 5.379-1.613 9.263-4.84 11.653-3.227 2.39-7.35 3.586-12.37 3.586H41.146zM13 0v128h62.028a65.45 65.45 0 0016.762-2.151c5.438-1.434 10.278-3.645 14.52-6.633 4.244-2.988 7.62-6.842 10.13-11.563 2.51-4.721 3.764-10.308 3.764-16.762 0-8.008-1.942-14.85-5.826-20.527-3.884-5.677-9.77-9.65-17.658-11.921 5.737-2.75 10.069-6.275 12.997-10.577 2.928-4.303 4.392-9.681 4.392-16.135 0-5.976-.986-10.995-2.958-15.059-1.972-4.063-4.75-7.32-8.336-9.77-3.585-2.45-7.888-4.213-12.907-5.289C84.888.538 79.33 0 73.235 0H13zm28.146 106.129V70.992H71.8c6.095 0 10.995 1.404 14.7 4.212 3.705 2.81 5.558 7.5 5.558 14.073 0 3.347-.568 6.096-1.703 8.247-1.136 2.151-2.66 3.854-4.572 5.11-1.912 1.254-4.123 2.15-6.633 2.688-2.51.538-5.139.807-7.888.807H41.146z\"/></svg>"
},
"$:/core/images/cancel-button": {
"title": "$:/core/images/cancel-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-cancel-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M64 76.314l-16.97 16.97a7.999 7.999 0 01-11.314 0c-3.118-3.118-3.124-8.19 0-11.313L52.686 65l-16.97-16.97a7.999 7.999 0 010-11.314c3.118-3.118 8.19-3.124 11.313 0L64 53.686l16.97-16.97a7.999 7.999 0 0111.314 0c3.118 3.118 3.124 8.19 0 11.313L75.314 65l16.97 16.97a7.999 7.999 0 010 11.314c-3.118 3.118-8.19 3.124-11.313 0L64 76.314zM64 129c35.346 0 64-28.654 64-64 0-35.346-28.654-64-64-64C28.654 1 0 29.654 0 65c0 35.346 28.654 64 64 64zm0-16c26.51 0 48-21.49 48-48S90.51 17 64 17 16 38.49 16 65s21.49 48 48 48z\"/></svg>"
},
"$:/core/images/chevron-down": {
"title": "$:/core/images/chevron-down",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-chevron-down tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M64.053 85.456a7.889 7.889 0 01-5.6-2.316L2.473 27.16a7.92 7.92 0 010-11.196c3.086-3.085 8.105-3.092 11.196 0L64.05 66.344l50.382-50.382a7.92 7.92 0 0111.195 0c3.085 3.086 3.092 8.105 0 11.196l-55.98 55.98a7.892 7.892 0 01-5.595 2.317z\"/><path d=\"M64.053 124.069a7.889 7.889 0 01-5.6-2.316l-55.98-55.98a7.92 7.92 0 010-11.196c3.086-3.085 8.105-3.092 11.196 0l50.382 50.382 50.382-50.382a7.92 7.92 0 0111.195 0c3.085 3.086 3.092 8.104 0 11.196l-55.98 55.98a7.892 7.892 0 01-5.595 2.316z\"/></g></svg>"
},
"$:/core/images/chevron-left": {
"title": "$:/core/images/chevron-left",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-chevron-left tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M47.544 64.053c0-2.027.77-4.054 2.316-5.6l55.98-55.98a7.92 7.92 0 0111.196 0c3.085 3.086 3.092 8.105 0 11.196L66.656 64.05l50.382 50.382a7.92 7.92 0 010 11.195c-3.086 3.085-8.105 3.092-11.196 0l-55.98-55.98a7.892 7.892 0 01-2.317-5.595z\"/><path d=\"M8.931 64.053c0-2.027.77-4.054 2.316-5.6l55.98-55.98a7.92 7.92 0 0111.196 0c3.085 3.086 3.092 8.105 0 11.196L28.041 64.05l50.382 50.382a7.92 7.92 0 010 11.195c-3.086 3.085-8.104 3.092-11.196 0l-55.98-55.98a7.892 7.892 0 01-2.316-5.595z\"/></g></svg>"
},
"$:/core/images/chevron-right": {
"title": "$:/core/images/chevron-right",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-chevron-right tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M83.456 63.947c0 2.027-.77 4.054-2.316 5.6l-55.98 55.98a7.92 7.92 0 01-11.196 0c-3.085-3.086-3.092-8.105 0-11.196L64.344 63.95 13.963 13.567a7.92 7.92 0 010-11.195c3.086-3.085 8.105-3.092 11.196 0l55.98 55.98a7.892 7.892 0 012.317 5.595z\"/><path d=\"M122.069 63.947c0 2.027-.77 4.054-2.316 5.6l-55.98 55.98a7.92 7.92 0 01-11.196 0c-3.085-3.086-3.092-8.105 0-11.196l50.382-50.382-50.382-50.382a7.92 7.92 0 010-11.195c3.086-3.085 8.104-3.092 11.196 0l55.98 55.98a7.892 7.892 0 012.316 5.595z\"/></g></svg>"
},
"$:/core/images/chevron-up": {
"title": "$:/core/images/chevron-up",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-chevron-up tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M63.947 44.544c2.027 0 4.054.77 5.6 2.316l55.98 55.98a7.92 7.92 0 010 11.196c-3.086 3.085-8.105 3.092-11.196 0L63.95 63.656l-50.382 50.382a7.92 7.92 0 01-11.195 0c-3.085-3.086-3.092-8.105 0-11.196l55.98-55.98a7.892 7.892 0 015.595-2.317z\"/><path d=\"M63.947 5.931c2.027 0 4.054.77 5.6 2.316l55.98 55.98a7.92 7.92 0 010 11.196c-3.086 3.085-8.105 3.092-11.196 0L63.95 25.041 13.567 75.423a7.92 7.92 0 01-11.195 0c-3.085-3.086-3.092-8.104 0-11.196l55.98-55.98a7.892 7.892 0 015.595-2.316z\"/></g></svg>"
},
"$:/core/images/clone-button": {
"title": "$:/core/images/clone-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-clone-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M32.265 96v24.002A7.996 7.996 0 0040.263 128h79.74a7.996 7.996 0 007.997-7.998v-79.74a7.996 7.996 0 00-7.998-7.997H96V48h12.859a2.99 2.99 0 012.994 2.994v57.865a2.99 2.99 0 01-2.994 2.994H50.994A2.99 2.99 0 0148 108.859V96H32.265z\"/><path d=\"M40 56h-7.993C27.588 56 24 52.418 24 48c0-4.41 3.585-8 8.007-8H40v-7.993C40 27.588 43.582 24 48 24c4.41 0 8 3.585 8 8.007V40h7.993C68.412 40 72 43.582 72 48c0 4.41-3.585 8-8.007 8H56v7.993C56 68.412 52.418 72 48 72c-4.41 0-8-3.585-8-8.007V56zM8 0C3.58 0 0 3.588 0 8v80c0 4.419 3.588 8 8 8h80c4.419 0 8-3.588 8-8V8c0-4.419-3.588-8-8-8H8zM19 16A2.997 2.997 0 0016 19.001v57.998A2.997 2.997 0 0019.001 80h57.998A2.997 2.997 0 0080 76.999V19.001A2.997 2.997 0 0076.999 16H19.001z\"/></g></svg>"
},
"$:/core/images/close-all-button": {
"title": "$:/core/images/close-all-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-close-all-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M28 111.314l-14.144 14.143a8 8 0 01-11.313-11.313L16.686 100 2.543 85.856a8 8 0 0111.313-11.313L28 88.686l14.144-14.143a8 8 0 0111.313 11.313L39.314 100l14.143 14.144a8 8 0 01-11.313 11.313L28 111.314zM28 39.314L13.856 53.457A8 8 0 012.543 42.144L16.686 28 2.543 13.856A8 8 0 0113.856 2.543L28 16.686 42.144 2.543a8 8 0 0111.313 11.313L39.314 28l14.143 14.144a8 8 0 01-11.313 11.313L28 39.314zM100 39.314L85.856 53.457a8 8 0 01-11.313-11.313L88.686 28 74.543 13.856A8 8 0 0185.856 2.543L100 16.686l14.144-14.143a8 8 0 0111.313 11.313L111.314 28l14.143 14.144a8 8 0 01-11.313 11.313L100 39.314zM100 111.314l-14.144 14.143a8 8 0 01-11.313-11.313L88.686 100 74.543 85.856a8 8 0 0111.313-11.313L100 88.686l14.144-14.143a8 8 0 0111.313 11.313L111.314 100l14.143 14.144a8 8 0 01-11.313 11.313L100 111.314z\"/></g></svg>"
},
"$:/core/images/close-button": {
"title": "$:/core/images/close-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-close-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M65.086 75.41l-50.113 50.113c-3.121 3.121-8.192 3.126-11.316.002-3.118-3.118-3.123-8.19.002-11.316l50.114-50.114L3.659 13.982C.538 10.86.533 5.79 3.657 2.666c3.118-3.118 8.19-3.123 11.316.002l50.113 50.114L115.2 2.668c3.121-3.121 8.192-3.126 11.316-.002 3.118 3.118 3.123 8.19-.002 11.316L76.4 64.095l50.114 50.114c3.121 3.121 3.126 8.192.002 11.316-3.118 3.118-8.19 3.123-11.316-.002L65.086 75.409z\"/></svg>"
},
"$:/core/images/close-others-button": {
"title": "$:/core/images/close-others-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-close-others-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M64 128c35.346 0 64-28.654 64-64 0-35.346-28.654-64-64-64C28.654 0 0 28.654 0 64c0 35.346 28.654 64 64 64zm0-16c26.51 0 48-21.49 48-48S90.51 16 64 16 16 37.49 16 64s21.49 48 48 48zm0-16c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32-17.673 0-32 14.327-32 32 0 17.673 14.327 32 32 32zm0-16c8.837 0 16-7.163 16-16s-7.163-16-16-16-16 7.163-16 16 7.163 16 16 16z\"/></svg>"
},
"$:/core/images/copy-clipboard": {
"title": "$:/core/images/copy-clipboard",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-copy-clipboard tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"33\" height=\"8\" x=\"40\" y=\"40\" rx=\"4\"/><rect width=\"17\" height=\"8\" x=\"40\" y=\"82\" rx=\"4\"/><rect width=\"17\" height=\"8\" x=\"40\" y=\"54\" rx=\"4\"/><rect width=\"33\" height=\"8\" x=\"40\" y=\"96\" rx=\"4\"/><rect width=\"12\" height=\"8\" x=\"40\" y=\"68\" rx=\"4\"/><path d=\"M40 16H24c-4.419 0-8 3.59-8 8a8.031 8.031 0 000 .01v95.98a8.03 8.03 0 000 .01c0 4.41 3.581 8 8 8h80a7.975 7.975 0 005.652-2.34 7.958 7.958 0 002.348-5.652v-16.016c0-4.414-3.582-7.992-8-7.992-4.41 0-8 3.578-8 7.992V112H32V32h64v8.008C96 44.422 99.582 48 104 48c4.41 0 8-3.578 8-7.992V23.992a7.963 7.963 0 00-2.343-5.651A7.995 7.995 0 00104.001 16H88c0-4.41-3.585-8-8.007-8H48.007C43.588 8 40 11.582 40 16zm4-1.004A4.001 4.001 0 0148 11h32c2.21 0 4 1.797 4 3.996v4.008A4.001 4.001 0 0180 23H48c-2.21 0-4-1.797-4-3.996v-4.008z\"/><rect width=\"66\" height=\"16\" x=\"62\" y=\"64\" rx=\"8\"/><path d=\"M84.657 82.343l-16-16v11.314l16-16a8 8 0 10-11.314-11.314l-16 16a8 8 0 000 11.314l16 16a8 8 0 1011.314-11.314z\"/></g></svg>"
},
"$:/core/images/delete-button": {
"title": "$:/core/images/delete-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-delete-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\" transform=\"translate(12)\"><rect width=\"105\" height=\"16\" y=\"11\" rx=\"8\"/><rect width=\"48\" height=\"16\" x=\"28\" rx=\"8\"/><rect width=\"16\" height=\"112\" x=\"8\" y=\"16\" rx=\"8\"/><rect width=\"88\" height=\"16\" x=\"8\" y=\"112\" rx=\"8\"/><rect width=\"16\" height=\"112\" x=\"80\" y=\"16\" rx=\"8\"/><rect width=\"16\" height=\"112\" x=\"56\" y=\"16\" rx=\"8\"/><rect width=\"16\" height=\"112\" x=\"32\" y=\"16\" rx=\"8\"/></g></svg>"
},
"$:/core/images/done-button": {
"title": "$:/core/images/done-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-done-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M42.26 111.032c-2.051.001-4.103-.78-5.668-2.345L2.662 74.758a8 8 0 01-.005-11.32c3.118-3.117 8.192-3.12 11.32.007l28.278 28.278 72.124-72.124a8.002 8.002 0 0111.314-.001c3.118 3.118 3.124 8.19 0 11.315l-77.78 77.78a7.978 7.978 0 01-5.658 2.343z\"/></svg>"
},
"$:/core/images/down-arrow": {
"title": "$:/core/images/down-arrow",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-down-arrow tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M64.177 100.069a7.889 7.889 0 01-5.6-2.316l-55.98-55.98a7.92 7.92 0 010-11.196c3.086-3.085 8.105-3.092 11.196 0l50.382 50.382 50.382-50.382a7.92 7.92 0 0111.195 0c3.086 3.086 3.092 8.104 0 11.196l-55.98 55.98a7.892 7.892 0 01-5.595 2.316z\"/></svg>"
},
"$:/core/images/download-button": {
"title": "$:/core/images/download-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-download-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M64 128c35.346 0 64-28.654 64-64 0-35.346-28.654-64-64-64C28.654 0 0 28.654 0 64c0 35.346 28.654 64 64 64zm0-16c26.51 0 48-21.49 48-48S90.51 16 64 16 16 37.49 16 64s21.49 48 48 48z\" class=\"tc-image-download-button-ring\"/><path d=\"M34.35 66.43l26.892 27.205a4.57 4.57 0 006.516 0L94.65 66.43a4.7 4.7 0 000-6.593 4.581 4.581 0 00-3.258-1.365h-8.46c-2.545 0-4.608-2.087-4.608-4.661v-15.15c0-2.575-2.063-4.662-4.608-4.662H55.284c-2.545 0-4.608 2.087-4.608 4.662v15.15c0 2.574-2.063 4.661-4.608 4.661h-8.46c-2.545 0-4.608 2.087-4.608 4.662a4.69 4.69 0 001.35 3.296z\"/></g></svg>"
},
"$:/core/images/edit-button": {
"title": "$:/core/images/edit-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-edit-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M95.627 10.059l-5.656 5.657 11.313 11.313 5.657-5.656-11.314-11.314zm5.657-5.657l1.966-1.966c3.123-3.122 8.194-3.129 11.319-.005 3.117 3.118 3.122 8.192-.005 11.32l-1.966 1.965-11.314-11.314zm-16.97 16.97l-60.25 60.25a8.12 8.12 0 00-.322.342c-.1.087-.198.179-.295.275-5.735 5.735-10.702 22.016-10.702 22.016s16.405-5.09 22.016-10.702c.095-.096.186-.193.272-.292a8.12 8.12 0 00.345-.325l60.25-60.25-11.314-11.313zM35.171 124.19c6.788-.577 13.898-2.272 23.689-5.348 1.825-.573 3.57-1.136 6.336-2.04 16-5.226 21.877-6.807 28.745-7.146 8.358-.413 13.854 2.13 17.58 8.699a4 4 0 006.959-3.946c-5.334-9.406-13.745-13.296-24.933-12.744-7.875.39-14.057 2.052-30.835 7.533-2.739.894-4.46 1.45-6.25 2.012-19.46 6.112-30.77 7.072-39.597 1.747a4 4 0 10-4.132 6.85c6.333 3.82 13.754 5.12 22.438 4.383z\"/></g></svg>"
},
"$:/core/images/erase": {
"title": "$:/core/images/erase",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-erase tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M60.087 127.996l63.015-63.015c6.535-6.535 6.528-17.115-.003-23.646L99.466 17.702c-6.539-6.538-17.117-6.532-23.646-.003L4.898 88.62c-6.535 6.534-6.528 17.115.003 23.646l15.73 15.73h39.456zm-34.95-7.313l-14.324-14.325c-3.267-3.268-3.268-8.564-.008-11.824L46.269 59.07l35.462 35.462-26.15 26.15H25.137z\"/></svg>"
},
"$:/core/images/excise": {
"title": "$:/core/images/excise",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-excise tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M56 107.314l-2.343 2.343a8 8 0 11-11.314-11.314l16-16a8 8 0 0111.314 0l16 16a8 8 0 11-11.314 11.314L72 107.314v14.284c0 3.536-3.582 6.402-8 6.402s-8-2.866-8-6.402v-14.284zM0 40.007C0 35.585 3.59 32 8 32c4.418 0 8 3.588 8 8.007v31.986C16 76.415 12.41 80 8 80c-4.418 0-8-3.588-8-8.007V40.007zm32 0C32 35.585 35.59 32 40 32c4.418 0 8 3.588 8 8.007v31.986C48 76.415 44.41 80 40 80c-4.418 0-8-3.588-8-8.007V40.007zm48 0C80 35.585 83.59 32 88 32c4.418 0 8 3.588 8 8.007v31.986C96 76.415 92.41 80 88 80c-4.418 0-8-3.588-8-8.007V40.007zm-24-32C56 3.585 59.59 0 64 0c4.418 0 8 3.588 8 8.007v31.986C72 44.415 68.41 48 64 48c-4.418 0-8-3.588-8-8.007V8.007zm56 32c0-4.422 3.59-8.007 8-8.007 4.418 0 8 3.588 8 8.007v31.986c0 4.422-3.59 8.007-8 8.007-4.418 0-8-3.588-8-8.007V40.007z\"/></svg>"
},
"$:/core/images/export-button": {
"title": "$:/core/images/export-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-export-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M8.003 128H119.993a7.984 7.984 0 005.664-2.349v.007A7.975 7.975 0 00128 120V56c0-4.418-3.59-8-8-8-4.418 0-8 3.58-8 8v56H16V56c0-4.418-3.59-8-8-8-4.418 0-8 3.58-8 8v64c0 4.418 3.59 8 8 8h.003zm48.62-100.689l-8.965 8.966c-3.125 3.125-8.195 3.13-11.319.005-3.118-3.118-3.122-8.192.005-11.319L58.962 2.346A7.986 7.986 0 0164.625 0l-.006.002c2.05-.001 4.102.78 5.666 2.344l22.618 22.617c3.124 3.125 3.129 8.195.005 11.319-3.118 3.118-8.192 3.122-11.319-.005l-8.965-8.966v61.256c0 4.411-3.582 8-8 8-4.41 0-8-3.582-8-8V27.311z\"/></svg>"
},
"$:/core/images/file": {
"title": "$:/core/images/file",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-file tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M111.968 30.5H112V120a8 8 0 01-8 8H24a8 8 0 01-8-8V8a8 8 0 018-8h57v.02a7.978 7.978 0 015.998 2.337l22.627 22.627a7.975 7.975 0 012.343 5.516zM81 8H24v112h80V30.5H89c-4.418 0-8-3.578-8-8V8z\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"36\" rx=\"4\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"52\" rx=\"4\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"68\" rx=\"4\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"84\" rx=\"4\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"100\" rx=\"4\"/><rect width=\"40\" height=\"8\" x=\"32\" y=\"20\" rx=\"4\"/></svg>"
},
"$:/core/images/fixed-height": {
"title": "$:/core/images/fixed-height",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-fixed-height tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M60 35.657l-9.172 9.171a4 4 0 11-5.656-5.656l16-16a4 4 0 015.656 0l16 16a4 4 0 01-5.656 5.656L68 35.657v57.686l9.172-9.171a4 4 0 115.656 5.656l-16 16a4 4 0 01-5.656 0l-16-16a4 4 0 115.656-5.656L60 93.343V35.657zM16 116h96a4 4 0 100-8H16a4 4 0 100 8zm0-96h96a4 4 0 100-8H16a4 4 0 100 8z\"/></svg>"
},
"$:/core/images/fold-all-button": {
"title": "$:/core/images/fold-all-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-fold-all tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"128\" height=\"16\" rx=\"8\"/><rect width=\"128\" height=\"16\" y=\"64\" rx=\"8\"/><path d=\"M64.03 20.004c-2.05 0-4.102.78-5.667 2.344L35.746 44.966c-3.125 3.124-3.13 8.194-.005 11.318 3.118 3.118 8.192 3.122 11.319-.005l16.965-16.965 16.966 16.965c3.124 3.125 8.194 3.13 11.318.005 3.118-3.118 3.122-8.191-.005-11.318L69.687 22.348a7.986 7.986 0 00-5.663-2.346zM64.03 85.002c-2.05-.001-4.102.78-5.667 2.344l-22.617 22.617c-3.125 3.125-3.13 8.195-.005 11.319 3.118 3.118 8.192 3.122 11.319-.005l16.965-16.966 16.966 16.966c3.124 3.125 8.194 3.13 11.318.005 3.118-3.118 3.122-8.192-.005-11.319L69.687 87.346A7.986 7.986 0 0064.024 85z\"/></g></svg>"
},
"$:/core/images/fold-button": {
"title": "$:/core/images/fold-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-fold tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"128\" height=\"16\" rx=\"8\"/><path d=\"M64.03 25.004c-2.05 0-4.102.78-5.667 2.344L35.746 49.966c-3.125 3.124-3.13 8.194-.005 11.318 3.118 3.118 8.192 3.122 11.319-.005l16.965-16.965 16.966 16.965c3.124 3.125 8.194 3.13 11.318.005 3.118-3.118 3.122-8.191-.005-11.318L69.687 27.348a7.986 7.986 0 00-5.663-2.346zM64.005 67.379c-2.05 0-4.102.78-5.666 2.344L35.722 92.34c-3.125 3.125-3.13 8.195-.006 11.32 3.118 3.117 8.192 3.121 11.32-.006L64 86.69l16.965 16.965c3.125 3.125 8.195 3.13 11.319.005 3.118-3.118 3.122-8.192-.005-11.319L69.663 69.723A7.986 7.986 0 0064 67.377z\"/></g></svg>"
},
"$:/core/images/fold-others-button": {
"title": "$:/core/images/fold-others-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-fold-others tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"128\" height=\"16\" y=\"56.031\" rx=\"8\"/><path d=\"M86.632 79.976c-2.05 0-4.102.78-5.666 2.345L64 99.286 47.034 82.321a7.986 7.986 0 00-5.662-2.346l.005.001c-2.05 0-4.102.78-5.666 2.345l-22.618 22.617c-3.124 3.125-3.129 8.195-.005 11.319 3.118 3.118 8.192 3.122 11.319-.005l16.966-16.966 16.965 16.966a7.986 7.986 0 005.663 2.346l-.005-.002c2.05 0 4.102-.78 5.666-2.344l16.965-16.966 16.966 16.966c3.125 3.124 8.194 3.129 11.319.005 3.118-3.118 3.122-8.192-.005-11.319L92.289 82.321a7.986 7.986 0 00-5.663-2.346zM86.7 48.024c-2.05 0-4.102-.78-5.666-2.345L64.07 28.714 47.103 45.679a7.986 7.986 0 01-5.663 2.346l.005-.001c-2.05 0-4.101-.78-5.666-2.345L13.162 23.062c-3.125-3.125-3.13-8.195-.005-11.319 3.118-3.118 8.192-3.122 11.319.005L41.44 28.714l16.966-16.966a7.986 7.986 0 015.662-2.346l-.005.002c2.05 0 4.102.78 5.666 2.344l16.966 16.966 16.966-16.966c3.124-3.124 8.194-3.129 11.318-.005 3.118 3.118 3.122 8.192-.005 11.319L92.358 45.679a7.986 7.986 0 01-5.663 2.346z\"/></g></svg>"
},
"$:/core/images/folder": {
"title": "$:/core/images/folder",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-folder tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M55.694 128H8C3.58 128 0 124.414 0 119.996V48.004C0 43.584 3.584 40 7.999 40H16v-8c0-4.418 3.578-8 8-8h32a8 8 0 018 8v8h40.001c4.418 0 7.999 3.586 7.999 8.004V59.83l-8-.082v-7.749A4 4 0 0099.997 48H56V36c0-2.21-1.793-4-4.004-4H28.004A4 4 0 0024 36v12H12.003A4 4 0 008 52v64a4 4 0 004.003 4h46.76l-3.069 8z\"/><path d=\"M23.873 55.5h96.003c4.417 0 7.004 4.053 5.774 9.063l-13.344 54.374c-1.228 5.005-5.808 9.063-10.223 9.063H6.08c-4.417 0-7.003-4.053-5.774-9.063L13.65 64.563c1.228-5.005 5.808-9.063 10.223-9.063zm1.78 8.5h87.994c2.211 0 3.504 2.093 2.891 4.666l-11.12 46.668c-.614 2.577-2.902 4.666-5.115 4.666H12.31c-2.211 0-3.504-2.093-2.891-4.666l11.12-46.668C21.152 66.09 23.44 64 25.653 64z\"/></g></svg>"
},
"$:/core/images/full-screen-button": {
"title": "$:/core/images/full-screen-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-full-screen-button tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M0 8a8 8 0 018-8h32a8 8 0 110 16H16v24a8 8 0 11-16 0V8zM128 120a8 8 0 01-8 8H88a8 8 0 110-16h24V88a8 8 0 1116 0v32zM8 128a8 8 0 01-8-8V88a8 8 0 1116 0v24h24a8 8 0 110 16H8zM120 0a8 8 0 018 8v32a8 8 0 11-16 0V16H88a8 8 0 110-16h32z\"/></svg>"
},
"$:/core/images/github": {
"title": "$:/core/images/github",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-github tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M63.938 1.607c-35.336 0-63.994 28.69-63.994 64.084 0 28.312 18.336 52.329 43.768 60.802 3.202.59 4.37-1.388 4.37-3.088 0-1.518-.056-5.55-.087-10.897-17.802 3.871-21.558-8.591-21.558-8.591-2.911-7.404-7.108-9.375-7.108-9.375-5.81-3.973.44-3.895.44-3.895 6.424.453 9.803 6.606 9.803 6.606 5.709 9.791 14.981 6.963 18.627 5.322.582-4.138 2.236-6.963 4.063-8.564-14.211-1.617-29.153-7.117-29.153-31.672 0-6.995 2.495-12.718 6.589-17.195-.66-1.621-2.856-8.14.629-16.96 0 0 5.37-1.722 17.597 6.57 5.104-1.424 10.58-2.132 16.022-2.16 5.438.028 10.91.736 16.022 2.16 12.22-8.292 17.582-6.57 17.582-6.57 3.493 8.82 1.297 15.339.64 16.96 4.102 4.477 6.578 10.2 6.578 17.195 0 24.618-14.966 30.035-29.22 31.62 2.295 1.98 4.342 5.89 4.342 11.87 0 8.564-.079 15.476-.079 17.576 0 1.715 1.155 3.71 4.4 3.084 25.413-8.493 43.733-32.494 43.733-60.798 0-35.394-28.657-64.084-64.006-64.084\"/></svg>"
},
"$:/core/images/gitter": {
"title": "$:/core/images/gitter",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-gitter tc-image-button\" viewBox=\"0 0 18 25\"><path d=\"M15 5h2v10h-2zM10 5h2v20h-2zM5 5h2v20H5zM0 0h2v15H0z\"/></svg>"
},
"$:/core/images/globe": {
"title": "$:/core/images/globe",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-globe tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M72.811 37.128v2.554c0 2.196.978 6.881 0 8.832-1.466 2.928-4.65 3.54-6.394 5.867-1.182 1.577-4.618 10.601-3.69 12.92 3.969 9.922 11.534 3.187 17.962 9.293.864.821 2.887 2.273 3.296 3.296 3.29 8.223-7.576 15.009 3.757 26.3 1.245 1.24 3.813-3.817 4.079-4.614.852-2.563 6.725-5.45 9.088-7.053 2.02-1.37 4.873-2.667 6.328-4.745 2.27-3.244 1.48-7.514 3.098-10.745 2.139-4.274 3.828-9.635 5.998-13.966 3.898-7.781 4.721 2.093 5.067 2.439.358.357 1.011 0 1.517 0 .094 0 1.447.099 1.516 0 .65-.935-1.043-17.92-1.318-19.297-1.404-7.01-6.944-15.781-11.865-20.5-6.274-6.015-7.09-16.197-18.259-14.954-.204.022-5.084 10.148-7.777 13.512-3.728 4.657-2.47-4.153-6.526-4.153-.081 0-1.183-.103-1.253 0-.586.88-1.44 3.896-2.306 4.417-.265.16-1.722-.239-1.846 0-2.243 4.3 8.256 2.212 5.792 7.952-2.352 5.481-6.328-1.997-6.328 8.56M44.467 7.01c9.685 6.13.682 12.198 2.694 16.215 1.655 3.303 4.241 5.395 1.714 9.814-2.063 3.608-6.87 3.966-9.623 6.723-3.04 3.044-5.464 8.94-6.79 12.911-1.617 4.843 14.547 6.866 12.063 11.008-1.386 2.311-6.746 1.466-8.437.198-1.165-.873-3.593-.546-4.417-1.78-2.613-3.915-2.26-8.023-3.625-12.128-.938-2.822-6.313-2.12-7.844-.593-.523.522-.33 1.792-.33 2.505 0 5.285 7.12 3.316 7.12 6.46 0 14.636 3.927 6.534 11.14 11.336 10.036 6.683 7.844 7.303 14.946 14.404 3.673 3.673 7.741 3.686 9.425 9.294 1.602 5.331-9.327 5.339-11.716 7.448-1.123.991-2.813 4.146-4.219 4.615-1.792.598-3.234.496-4.944 1.78-2.427 1.82-3.9 4.932-4.02 4.81-2.148-2.147-3.52-15.479-3.89-18.257-.588-4.42-5.59-5.54-6.986-9.03-1.57-3.927 1.524-9.52-1.129-13.761-6.52-10.424-11.821-14.5-15.35-26.292-.942-3.148 3.342-6.529 4.877-8.833 1.877-2.816 2.662-5.854 4.746-8.635C22.147 24.19 40.855 9.461 43.857 8.635l.61-1.625z\"/><path d=\"M64 126c34.242 0 62-27.758 62-62 0-34.242-27.758-62-62-62C29.758 2 2 29.758 2 64c0 34.242 27.758 62 62 62zm0-6c30.928 0 56-25.072 56-56S94.928 8 64 8 8 33.072 8 64s25.072 56 56 56z\"/></g></svg>"
},
"$:/core/images/heading-1": {
"title": "$:/core/images/heading-1",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-heading-1 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M14 30h13.25v30.104H61.7V30h13.25v75.684H61.7V71.552H27.25v34.132H14V30zm70.335 13.78c2.544 0 5.017-.212 7.42-.636 2.403-.424 4.576-1.13 6.52-2.12 1.942-.99 3.603-2.261 4.981-3.816 1.378-1.555 2.28-3.463 2.703-5.724h9.858v74.2h-13.25V53.32H84.335v-9.54z\"/></svg>"
},
"$:/core/images/heading-2": {
"title": "$:/core/images/heading-2",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-heading-2 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M6 30h13.25v30.104H53.7V30h13.25v75.684H53.7V71.552H19.25v34.132H6V30zm119.52 75.684H74.85c.07-6.148 1.555-11.519 4.452-16.112 2.897-4.593 6.855-8.586 11.872-11.978a133.725 133.725 0 017.526-5.141 59.6 59.6 0 007.208-5.353c2.19-1.908 3.993-3.975 5.406-6.201 1.413-2.226 2.155-4.788 2.226-7.685 0-1.343-.159-2.774-.477-4.293a11.357 11.357 0 00-1.855-4.24c-.919-1.307-2.19-2.403-3.816-3.286-1.625-.883-3.745-1.325-6.36-1.325-2.403 0-4.399.477-5.989 1.431-1.59.954-2.862 2.261-3.816 3.922-.954 1.66-1.66 3.622-2.12 5.883-.46 2.261-.724 4.7-.795 7.314H76.23c0-4.099.548-7.897 1.643-11.395 1.095-3.498 2.738-6.519 4.93-9.063 2.19-2.544 4.857-4.54 8.002-5.989C93.95 30.724 97.606 30 101.775 30c4.523 0 8.303.742 11.342 2.226 3.039 1.484 5.494 3.357 7.367 5.618 1.873 2.261 3.198 4.717 3.975 7.367.777 2.65 1.166 5.176 1.166 7.579 0 2.968-.46 5.653-1.378 8.056a25.942 25.942 0 01-3.71 6.625 37.5 37.5 0 01-5.3 5.565 79.468 79.468 0 01-6.148 4.77 165.627 165.627 0 01-6.36 4.24 94.28 94.28 0 00-5.883 4.028c-1.802 1.343-3.374 2.738-4.717 4.187-1.343 1.449-2.261 2.986-2.756 4.611h36.146v10.812z\"/></svg>"
},
"$:/core/images/heading-3": {
"title": "$:/core/images/heading-3",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-heading-3 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M6 30h13.25v30.104H53.7V30h13.25v75.684H53.7V71.552H19.25v34.132H6V30zm88.885 32.224c1.979.07 3.957-.07 5.936-.424 1.979-.353 3.745-.972 5.3-1.855a10.365 10.365 0 003.763-3.657c.954-1.555 1.431-3.463 1.431-5.724 0-3.18-1.078-5.724-3.233-7.632-2.155-1.908-4.929-2.862-8.32-2.862-2.12 0-3.958.424-5.513 1.272a11.318 11.318 0 00-3.869 3.445c-1.025 1.449-1.784 3.074-2.279 4.876a18.335 18.335 0 00-.636 5.565H75.381c.141-3.604.813-6.943 2.014-10.017 1.201-3.074 2.844-5.742 4.93-8.003 2.084-2.261 4.61-4.028 7.578-5.3C92.871 30.636 96.228 30 99.973 30a29.2 29.2 0 018.533 1.272c2.791.848 5.3 2.085 7.526 3.71s4.01 3.692 5.353 6.201c1.343 2.509 2.014 5.388 2.014 8.639 0 3.745-.848 7.014-2.544 9.805-1.696 2.791-4.346 4.823-7.95 6.095v.212c4.24.848 7.544 2.95 9.911 6.307s3.551 7.438 3.551 12.243c0 3.533-.707 6.696-2.12 9.487a21.538 21.538 0 01-5.724 7.102c-2.403 1.943-5.194 3.445-8.374 4.505-3.18 1.06-6.537 1.59-10.07 1.59-4.31 0-8.074-.618-11.289-1.855s-5.9-2.986-8.056-5.247c-2.155-2.261-3.798-4.982-4.929-8.162-1.13-3.18-1.731-6.713-1.802-10.6h12.084c-.141 4.523.972 8.286 3.34 11.289 2.366 3.003 5.917 4.505 10.652 4.505 4.028 0 7.402-1.148 10.123-3.445 2.72-2.297 4.081-5.565 4.081-9.805 0-2.897-.565-5.194-1.696-6.89a10.97 10.97 0 00-4.452-3.869c-1.837-.883-3.904-1.431-6.2-1.643a58.067 58.067 0 00-7.05-.212v-9.01z\"/></svg>"
},
"$:/core/images/heading-4": {
"title": "$:/core/images/heading-4",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-heading-4 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M8 30h13.25v30.104H55.7V30h13.25v75.684H55.7V71.552H21.25v34.132H8V30zm76.59 48.548h22.471V45.9h-.212L84.59 78.548zm43.46 9.54h-9.54v17.596H107.06V88.088h-31.8V76.11l31.8-44.626h11.448v47.064h9.54v9.54z\"/></svg>"
},
"$:/core/images/heading-5": {
"title": "$:/core/images/heading-5",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-heading-5 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M6 30h13.25v30.104H53.7V30h13.25v75.684H53.7V71.552H19.25v34.132H6V30zm77.755 1.484h38.372v10.812H92.765L88.95 61.164l.212.212c1.625-1.837 3.692-3.233 6.201-4.187 2.509-.954 5-1.431 7.473-1.431 3.675 0 6.96.618 9.858 1.855 2.897 1.237 5.335 2.968 7.314 5.194s3.48 4.858 4.505 7.897c1.025 3.039 1.537 6.325 1.537 9.858 0 2.968-.477 6.024-1.43 9.169a25.161 25.161 0 01-4.559 8.586c-2.085 2.58-4.752 4.7-8.003 6.36-3.25 1.66-7.137 2.491-11.66 2.491-3.604 0-6.943-.477-10.017-1.431-3.074-.954-5.777-2.385-8.109-4.293-2.332-1.908-4.187-4.258-5.565-7.049-1.378-2.791-2.138-6.06-2.279-9.805h12.084c.353 4.028 1.731 7.12 4.134 9.275 2.403 2.155 5.583 3.233 9.54 3.233 2.544 0 4.7-.424 6.466-1.272 1.767-.848 3.198-2.014 4.293-3.498 1.095-1.484 1.873-3.215 2.332-5.194.46-1.979.69-4.099.69-6.36 0-2.05-.284-4.01-.849-5.883-.565-1.873-1.413-3.516-2.544-4.929-1.13-1.413-2.597-2.544-4.399-3.392-1.802-.848-3.904-1.272-6.307-1.272-2.544 0-4.929.477-7.155 1.431-2.226.954-3.834 2.738-4.823 5.353H75.805l7.95-40.598z\"/></svg>"
},
"$:/core/images/heading-6": {
"title": "$:/core/images/heading-6",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-heading-6 tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M6 30h13.25v30.104H53.7V30h13.25v75.684H53.7V71.552H19.25v34.132H6V30zm106.587 20.246c-.283-3.039-1.36-5.494-3.233-7.367-1.873-1.873-4.399-2.809-7.579-2.809-2.19 0-4.08.406-5.67 1.219a12.435 12.435 0 00-4.029 3.233c-1.095 1.343-1.979 2.88-2.65 4.611a37.696 37.696 0 00-1.643 5.459 46.08 46.08 0 00-.9 5.671 722.213 722.213 0 00-.478 5.247l.212.212c1.625-2.968 3.87-5.176 6.731-6.625 2.862-1.449 5.954-2.173 9.275-2.173 3.675 0 6.96.636 9.858 1.908 2.897 1.272 5.353 3.021 7.367 5.247 2.014 2.226 3.551 4.858 4.611 7.897 1.06 3.039 1.59 6.325 1.59 9.858 0 3.604-.583 6.943-1.749 10.017-1.166 3.074-2.844 5.76-5.035 8.056-2.19 2.297-4.805 4.081-7.844 5.353-3.039 1.272-6.395 1.908-10.07 1.908-5.441 0-9.91-1.007-13.409-3.021-3.498-2.014-6.254-4.77-8.268-8.268-2.014-3.498-3.41-7.597-4.187-12.296-.777-4.7-1.166-9.77-1.166-15.211 0-4.452.477-8.94 1.431-13.462.954-4.523 2.526-8.639 4.717-12.349 2.19-3.71 5.07-6.731 8.64-9.063C92.676 31.166 97.075 30 102.304 30c2.968 0 5.76.495 8.374 1.484 2.615.99 4.93 2.367 6.943 4.134 2.014 1.767 3.657 3.887 4.93 6.36 1.271 2.473 1.978 5.23 2.12 8.268h-12.085zm-11.66 46.852c2.19 0 4.099-.442 5.724-1.325a12.869 12.869 0 004.081-3.445c1.095-1.413 1.908-3.056 2.438-4.929.53-1.873.795-3.798.795-5.777s-.265-3.887-.795-5.724c-.53-1.837-1.343-3.445-2.438-4.823-1.095-1.378-2.456-2.491-4.08-3.339-1.626-.848-3.534-1.272-5.725-1.272-2.19 0-4.116.406-5.777 1.219-1.66.813-3.056 1.908-4.187 3.286-1.13 1.378-1.979 2.986-2.544 4.823-.565 1.837-.848 3.78-.848 5.83 0 2.05.283 3.993.848 5.83.565 1.837 1.413 3.48 2.544 4.929a12.39 12.39 0 004.187 3.445c1.66.848 3.586 1.272 5.777 1.272z\"/></svg>"
},
"$:/core/images/help": {
"title": "$:/core/images/help",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-help tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M36.055 111.441c-5.24 4.396-15.168 7.362-26.555 7.362-1.635 0-3.24-.06-4.806-.179 7.919-2.64 14.062-8.6 16.367-16.014C8.747 92.845 1.05 78.936 1.05 63.5c0-29.547 28.206-53.5 63-53.5s63 23.953 63 53.5-28.206 53.5-63 53.5c-10.055 0-19.56-2-27.994-5.559zm35.35-33.843a536.471 536.471 0 00.018-4.682 199.02 199.02 0 00-.023-3.042c.008-1.357.595-2.087 3.727-4.235.112-.077 1.085-.74 1.386-.948 3.093-2.133 5.022-3.786 6.762-6.187 2.34-3.228 3.558-7.077 3.558-11.649 0-13.292-9.86-21.952-21.455-21.952-11.103 0-22.499 9.609-24.066 22.295a6.023 6.023 0 1011.956 1.477c.806-6.527 6.972-11.726 12.11-11.726 5.265 0 9.408 3.64 9.408 9.906 0 3.634-1.1 5.153-5.111 7.919l-1.362.93c-2.682 1.84-4.227 3.1-5.7 4.931-2.109 2.62-3.242 5.717-3.258 9.314.013.892.02 1.86.022 2.981a470.766 470.766 0 01-.022 4.943 6.023 6.023 0 1012.046.12l.003-.395zm-6.027 24.499a7.529 7.529 0 100-15.058 7.529 7.529 0 000 15.058z\"/></svg>"
},
"$:/core/images/home-button": {
"title": "$:/core/images/home-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-home-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M112.985 119.502c.01-.165.015-.331.015-.499V67.568c3.137 2.948 8.076 2.884 11.134-.174a7.999 7.999 0 00-.002-11.316L70.396 2.343A7.978 7.978 0 0064.734 0a7.957 7.957 0 00-5.656 2.343L33 28.42V8.007C33 3.585 29.41 0 25 0c-4.418 0-8 3.59-8 8.007V44.42L5.342 56.078c-3.125 3.125-3.12 8.198-.002 11.316a7.999 7.999 0 0011.316-.003l.344-.343v52.945a8.11 8.11 0 000 .007c0 4.418 3.588 8 8 8h80c4.419 0 8-3.59 8-8a8.11 8.11 0 00-.015-.498zM97 112V51.574L64.737 19.31 33 51.048V112h64z\"/></svg>"
},
"$:/core/images/import-button": {
"title": "$:/core/images/import-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-import-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M114.832 60.436s3.235-3.27 6.921.417c3.686 3.686.231 7.14.231 7.14l-42.153 42.92s-30.765 32.367-58.798 4.333C-7 87.213 24.59 55.623 24.59 55.623L67.363 12.85s22.725-24.6 43.587-3.738c20.862 20.862-3.96 43.09-3.96 43.09l-35.04 35.04S49.903 112.546 36.426 99.07c-13.476-13.477 11.83-35.523 11.83-35.523l35.04-35.04s3.902-3.902 7.78-.023c3.879 3.878.118 7.921.118 7.921l-35.04 35.04s-13.212 13.212-8.872 17.551c4.34 4.34 16.77-9.653 16.77-9.653l35.04-35.04s16.668-14.598 3.966-27.3c-13.893-13.892-27.565 3.702-27.565 3.702l-42.91 42.91s-23.698 23.698-3.658 43.738 43.012-4.385 43.012-4.385l42.895-42.533z\"/></svg>"
},
"$:/core/images/info-button": {
"title": "$:/core/images/info-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-info-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\" transform=\"translate(.05)\"><path d=\"M64 128c35.346 0 64-28.654 64-64 0-35.346-28.654-64-64-64C28.654 0 0 28.654 0 64c0 35.346 28.654 64 64 64zm0-16c26.51 0 48-21.49 48-48S90.51 16 64 16 16 37.49 16 64s21.49 48 48 48z\"/><circle cx=\"64\" cy=\"32\" r=\"8\"/><rect width=\"16\" height=\"56\" x=\"56\" y=\"48\" rx=\"8\"/></g></svg>"
},
"$:/core/images/italic": {
"title": "$:/core/images/italic",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-italic tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M66.711 0h22.41L62.408 128H40z\"/></svg>"
},
"$:/core/images/left-arrow": {
"title": "$:/core/images/left-arrow",
"created": "20150315234410875",
"modified": "20150315235324760",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-left-arrow tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M0 64.177c0-2.026.771-4.054 2.317-5.6l55.98-55.98a7.92 7.92 0 0111.195.001c3.086 3.085 3.092 8.104.001 11.195L19.111 64.175l50.382 50.382a7.92 7.92 0 010 11.195c-3.086 3.086-8.105 3.092-11.196.001l-55.98-55.98A7.892 7.892 0 010 64.177z\"/></svg>"
},
"$:/core/images/line-width": {
"title": "$:/core/images/line-width",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-line-width tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M16 18h96a2 2 0 000-4H16a2 2 0 100 4zm0 17h96a4 4 0 100-8H16a4 4 0 100 8zm0 21h96a6 6 0 000-12H16a6 6 0 100 12zm0 29h96c5.523 0 10-4.477 10-10s-4.477-10-10-10H16c-5.523 0-10 4.477-10 10s4.477 10 10 10zm0 43h96c8.837 0 16-7.163 16-16s-7.163-16-16-16H16c-8.837 0-16 7.163-16 16s7.163 16 16 16z\"/></svg>"
},
"$:/core/images/link": {
"title": "$:/core/images/link",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-link tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M42.263 69.38a31.919 31.919 0 006.841 10.13c12.5 12.5 32.758 12.496 45.255 0l22.627-22.628c12.502-12.501 12.497-32.758 0-45.255-12.5-12.5-32.758-12.496-45.254 0L49.104 34.255a32.333 32.333 0 00-2.666 3.019 36.156 36.156 0 0121.94.334l14.663-14.663c6.25-6.25 16.382-6.254 22.632-.004 6.248 6.249 6.254 16.373-.004 22.631l-22.62 22.62c-6.25 6.25-16.381 6.254-22.631.004a15.93 15.93 0 01-4.428-8.433 11.948 11.948 0 00-7.59 3.48l-6.137 6.137z\"/><path d=\"M86.35 59.234a31.919 31.919 0 00-6.84-10.13c-12.5-12.5-32.758-12.497-45.255 0L11.627 71.732c-12.501 12.5-12.496 32.758 0 45.254 12.5 12.5 32.758 12.497 45.255 0L79.51 94.36a32.333 32.333 0 002.665-3.02 36.156 36.156 0 01-21.94-.333l-14.663 14.663c-6.25 6.25-16.381 6.253-22.63.004-6.25-6.249-6.255-16.374.003-22.632l22.62-22.62c6.25-6.25 16.381-6.253 22.631-.003a15.93 15.93 0 014.428 8.432 11.948 11.948 0 007.59-3.48l6.137-6.136z\"/></g></svg>"
},
"$:/core/images/linkify": {
"title": "$:/core/images/linkify",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-linkify-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M17.031 31.919H9.048V96.85h7.983v6.92H0V25h17.031v6.919zm24.66 0h-7.983V96.85h7.983v6.92H24.66V25h17.03v6.919zM67.77 56.422l11.975-3.903 2.306 7.096-12.063 3.903 7.628 10.379-6.12 4.435-7.63-10.467-7.45 10.2-5.943-4.523L58.1 63.518 45.95 59.35l2.306-7.096 12.064 4.17V43.825h7.45v12.596zM86.31 96.85h7.982V31.92H86.31V25h17.031v78.77H86.31v-6.92zm24.659 0h7.983V31.92h-7.983V25H128v78.77h-17.031v-6.92z\"/></svg>"
},
"$:/core/images/list-bullet": {
"title": "$:/core/images/list-bullet",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-list-bullet tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M11.636 40.273c6.427 0 11.637-5.21 11.637-11.637C23.273 22.21 18.063 17 11.636 17 5.21 17 0 22.21 0 28.636c0 6.427 5.21 11.637 11.636 11.637zm0 34.909c6.427 0 11.637-5.21 11.637-11.637 0-6.426-5.21-11.636-11.637-11.636C5.21 51.91 0 57.12 0 63.545c0 6.427 5.21 11.637 11.636 11.637zm0 34.909c6.427 0 11.637-5.21 11.637-11.636 0-6.427-5.21-11.637-11.637-11.637C5.21 86.818 0 92.028 0 98.455c0 6.426 5.21 11.636 11.636 11.636zM34.91 22.818H128v11.637H34.91V22.818zm0 34.91H128v11.636H34.91V57.727zm0 34.908H128v11.637H34.91V92.636z\"/></svg>"
},
"$:/core/images/list-number": {
"title": "$:/core/images/list-number",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-list-number tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M33.84 22.356H128v11.77H33.84v-11.77zm0 35.31H128v11.77H33.84v-11.77zm0 35.311H128v11.77H33.84v-11.77zM.38 42.631v-2.223h.998c.826 0 1.445-.14 1.858-.42.413-.28.619-.948.619-2.002V22.769c0-1.442-.193-2.336-.58-2.683-.385-.347-1.477-.52-3.275-.52v-2.143c3.502-.147 6.252-.955 8.25-2.423h2.117v22.865c0 .921.15 1.575.449 1.963.3.387.949.58 1.948.58h.998v2.223H.38zm-.3 35.356v-1.902c7.19-6.554 10.786-12.58 10.786-18.08 0-1.562-.326-2.81-.979-3.744-.652-.934-1.524-1.402-2.616-1.402-.893 0-1.655.317-2.287.952-.633.634-.95 1.364-.95 2.192 0 .974.247 1.829.74 2.563.106.16.16.28.16.36 0 .147-.16.28-.48.4-.213.08-.752.308-1.618.681-.839.374-1.358.561-1.558.561-.24 0-.512-.37-.819-1.111A6.2 6.2 0 010 57.064c0-1.949.849-3.544 2.547-4.785 1.698-1.242 3.798-1.862 6.302-1.862 2.463 0 4.53.67 6.202 2.012 1.67 1.341 2.506 3.093 2.506 5.256a8.644 8.644 0 01-.849 3.724c-.566 1.201-1.92 3.053-4.064 5.556a165.471 165.471 0 01-6.272 6.938h11.445l-1.019 5.726h-2.117c.08-.28.12-.534.12-.76 0-.388-.1-.631-.3-.731-.2-.1-.599-.15-1.198-.15H.08zm12.124 19.207c1.745.04 3.236.637 4.474 1.792 1.239 1.154 1.858 2.773 1.858 4.855 0 2.99-1.132 5.393-3.396 7.208-2.263 1.815-5 2.723-8.209 2.723-2.01 0-3.669-.384-4.974-1.151C.652 111.853 0 110.849 0 109.607c0-.774.27-1.398.809-1.872.54-.474 1.128-.71 1.768-.71.639 0 1.162.2 1.568.6.406.4.782 1.055 1.128 1.962.466 1.268 1.239 1.902 2.317 1.902 1.265 0 2.287-.477 3.066-1.431.78-.955 1.169-2.686 1.169-5.196 0-1.709-.12-3.023-.36-3.944-.24-.921-.792-1.382-1.658-1.382-.586 0-1.185.307-1.797.921-.493.494-.932.741-1.319.741-.333 0-.602-.147-.809-.44-.206-.294-.31-.574-.31-.841 0-.32.104-.594.31-.821.207-.227.69-.594 1.449-1.102 2.876-1.922 4.314-4.017 4.314-6.287 0-1.188-.306-2.092-.919-2.713a3.001 3.001 0 00-2.217-.93c-.799 0-1.525.263-2.177.79-.653.528-.979 1.158-.979 1.892 0 .641.253 1.235.76 1.782.172.2.259.367.259.5 0 .121-.57.428-1.708.922-1.139.494-1.854.74-2.147.74-.413 0-.75-.333-1.009-1-.26-.668-.39-1.282-.39-1.842 0-1.749.93-3.224 2.787-4.425 1.858-1.202 3.965-1.802 6.322-1.802 2.064 0 3.851.447 5.363 1.341 1.511.895 2.267 2.116 2.267 3.664 0 1.362-.57 2.623-1.708 3.784a13.387 13.387 0 01-3.945 2.784z\"/></svg>"
},
"$:/core/images/list": {
"title": "$:/core/images/list",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-list tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M87.748 128H23.999c-4.418 0-7.999-3.59-7.999-8.007V8.007C16 3.585 19.588 0 24 0h80c4.419 0 8 3.59 8 8.007V104H91.25c-.965 0-1.84.392-2.473 1.025a3.476 3.476 0 00-1.029 2.476V128zm8-.12l15.88-15.88h-15.88v15.88zM40 15.508A3.502 3.502 0 0143.5 12h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 20h-55a3.498 3.498 0 01-3.5-3.509v-.982zM32 22a6 6 0 100-12 6 6 0 000 12zm8 9.509A3.502 3.502 0 0143.5 28h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 36h-55a3.498 3.498 0 01-3.5-3.509v-.982zm0 16A3.502 3.502 0 0143.5 44h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 52h-55a3.498 3.498 0 01-3.5-3.509v-.982zm0 16A3.502 3.502 0 0143.5 60h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 68h-55a3.498 3.498 0 01-3.5-3.509v-.982zm0 16A3.502 3.502 0 0143.5 76h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 84h-55a3.498 3.498 0 01-3.5-3.509v-.982zm0 16A3.502 3.502 0 0143.5 92h55c1.933 0 3.5 1.561 3.5 3.509v.982A3.502 3.502 0 0198.5 100h-55a3.498 3.498 0 01-3.5-3.509v-.982zm0 16A3.505 3.505 0 0143.497 108h33.006A3.497 3.497 0 0180 111.509v.982A3.505 3.505 0 0176.503 116H43.497A3.497 3.497 0 0140 112.491v-.982zM32 38a6 6 0 100-12 6 6 0 000 12zm0 16a6 6 0 100-12 6 6 0 000 12zm0 16a6 6 0 100-12 6 6 0 000 12zm0 16a6 6 0 100-12 6 6 0 000 12zm0 16a6 6 0 100-12 6 6 0 000 12zm0 16a6 6 0 100-12 6 6 0 000 12z\"/></svg>"
},
"$:/core/images/locked-padlock": {
"title": "$:/core/images/locked-padlock",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-locked-padlock tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M96.472 64H105v32.01C105 113.674 90.674 128 73.001 128H56C38.318 128 24 113.677 24 96.01V64h8c.003-15.723.303-47.731 32.16-47.731 31.794 0 32.305 32.057 32.312 47.731zm-15.897 0H48.44c.002-16.287.142-32 15.719-32 15.684 0 16.977 16.136 16.415 32zM67.732 92.364A8.503 8.503 0 0064.5 76a8.5 8.5 0 00-3.498 16.25l-5.095 22.77H72.8l-5.07-22.656z\"/></svg>"
},
"$:/core/images/mail": {
"title": "$:/core/images/mail",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-mail tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M122.827 104.894a7.986 7.986 0 01-2.834.516H8.007c-.812 0-1.597-.12-2.335-.345l34.163-34.163 20.842 20.842a3.998 3.998 0 003.418 1.134 4.003 4.003 0 003.395-1.134L88.594 70.64c.075.09.155.176.24.26l33.993 33.994zm5.076-6.237c.064-.406.097-.823.097-1.247v-64c0-.669-.082-1.318-.237-1.94L94.23 65.006c.09.075.177.154.261.239l33.413 33.413zm-127.698.56A8.023 8.023 0 010 97.41v-64c0-.716.094-1.41.271-2.071l33.907 33.906L.205 99.218zM5.93 25.684a8.012 8.012 0 012.078-.273h111.986c.766 0 1.507.108 2.209.308L64.083 83.837 5.93 25.683z\"/></svg>"
},
"$:/core/images/menu-button": {
"title": "$:/core/images/menu-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-menu-button tc-image-button\" viewBox=\"0 0 128 128\"><rect width=\"128\" height=\"16\" y=\"16\" rx=\"8\"/><rect width=\"128\" height=\"16\" y=\"56\" rx=\"8\"/><rect width=\"128\" height=\"16\" y=\"96\" rx=\"8\"/></svg>"
},
"$:/core/images/minus-button": {
"title": "$:/core/images/minus-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-minus-button tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M64 0c35.346 0 64 28.654 64 64 0 35.346-28.654 64-64 64-35.346 0-64-28.654-64-64C0 28.654 28.654 0 64 0zm.332 16c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48z\"/><rect width=\"80\" height=\"16\" x=\"24\" y=\"56\" rx=\"8\"/></svg>"
},
"$:/core/images/mono-block": {
"title": "$:/core/images/mono-block",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-mono-block tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M23.965 32.967h.357c.755 0 1.328.192 1.72.577.39.384.586.947.586 1.688 0 .824-.206 1.418-.618 1.782-.413.363-1.094.545-2.045.545h-6.31c-.965 0-1.65-.178-2.056-.535-.405-.356-.608-.954-.608-1.792 0-.811.203-1.391.608-1.74.406-.35 1.09-.525 2.055-.525h.734l-.86-2.453H8.471l-.902 2.453h.734c.95 0 1.632.178 2.044.535.413.356.619.933.619 1.73 0 .824-.206 1.418-.619 1.782-.412.363-1.094.545-2.044.545h-5.41c-.964 0-1.649-.182-2.054-.545-.406-.364-.608-.958-.608-1.782 0-.741.195-1.304.587-1.688.391-.385.964-.577 1.719-.577h.356l5.62-15.641H6.835c-.95 0-1.632-.182-2.044-.546-.412-.363-.619-.95-.619-1.76 0-.825.207-1.42.619-1.783.412-.363 1.094-.545 2.044-.545h7.863c1.244 0 2.118.67 2.62 2.013v.063l6.647 18.2zM12.98 17.326l-3.04 8.848h6.08l-3.04-8.848zm22.402 9.372v6.395h3.145c2.223 0 3.788-.245 4.697-.734.908-.49 1.362-1.307 1.362-2.453 0-1.16-.433-1.985-1.3-2.474-.866-.49-2.383-.734-4.55-.734h-3.354zm10.693-2.327c1.524.559 2.642 1.324 3.355 2.295.713.972 1.07 2.212 1.07 3.722 0 1.272-.308 2.432-.923 3.48-.615 1.049-1.496 1.909-2.642 2.58a7.499 7.499 0 01-2.254.849c-.832.174-2.01.262-3.533.262H30.202c-.922 0-1.583-.182-1.981-.545-.399-.364-.598-.958-.598-1.782 0-.741.189-1.304.566-1.688.378-.385.93-.577 1.657-.577h.356V17.326h-.356c-.727 0-1.28-.196-1.657-.587-.377-.392-.566-.965-.566-1.72 0-.81.203-1.401.608-1.771.406-.37 1.062-.556 1.971-.556h9.645c2.95 0 5.19.573 6.72 1.72 1.53 1.145 2.296 2.823 2.296 5.031 0 1.09-.234 2.052-.703 2.883-.468.832-1.163 1.513-2.086 2.045zM35.381 17.2v5.284h2.83c1.72 0 2.932-.203 3.638-.609.706-.405 1.06-1.09 1.06-2.054 0-.909-.319-1.573-.955-1.992-.636-.42-1.667-.63-3.093-.63h-3.48zm35.863-3.816c.28-.503.566-.86.86-1.07.293-.21.664-.314 1.111-.314.685 0 1.17.182 1.457.545.287.364.43.986.43 1.866l.042 5.452c0 .964-.157 1.614-.472 1.95-.314.335-.884.503-1.709.503-.587 0-1.037-.14-1.352-.42-.314-.28-.584-.796-.807-1.551-.364-1.328-.944-2.282-1.74-2.862-.797-.58-1.901-.87-3.313-.87-2.153 0-3.802.727-4.948 2.18-1.147 1.454-1.72 3.558-1.72 6.311 0 2.74.58 4.844 1.74 6.311 1.16 1.468 2.817 2.202 4.97 2.202 1.467 0 3.085-.49 4.854-1.468 1.768-.978 2.883-1.467 3.344-1.467.545 0 1.003.23 1.373.692.37.46.556 1.034.556 1.719 0 1.23-1.084 2.39-3.25 3.48-2.167 1.09-4.606 1.636-7.318 1.636-3.662 0-6.625-1.21-8.89-3.627-2.264-2.419-3.396-5.578-3.396-9.478 0-3.76 1.146-6.884 3.438-9.372 2.293-2.488 5.2-3.732 8.723-3.732.992 0 1.97.112 2.935.335.964.224 1.992.574 3.082 1.049zm10.22 19.583V17.326h-.356c-.755 0-1.328-.196-1.72-.587-.39-.392-.586-.965-.586-1.72 0-.81.21-1.401.629-1.771.42-.37 1.097-.556 2.034-.556h5.178c2.922 0 5.06.126 6.416.377 1.356.252 2.51.671 3.46 1.258 1.691 1.007 2.988 2.443 3.89 4.31.9 1.865 1.352 4.021 1.352 6.467 0 2.586-.514 4.847-1.541 6.783-1.028 1.936-2.485 3.4-4.372 4.393-.853.447-1.852.772-2.998.975-1.147.203-2.852.304-5.116.304h-6.269c-.965 0-1.65-.178-2.055-.535-.406-.356-.608-.954-.608-1.792 0-.741.195-1.304.587-1.688.391-.385.964-.577 1.72-.577h.356zm5.41-15.725v15.725h1.195c2.642 0 4.592-.646 5.85-1.94 1.258-1.292 1.887-3.28 1.887-5.965 0-2.641-.64-4.612-1.918-5.912-1.28-1.3-3.205-1.95-5.777-1.95-.335 0-.59.003-.765.01a7.992 7.992 0 00-.472.032zm35.067-.126h-9.75v5.368h3.69v-.252c0-.797.175-1.39.524-1.782.35-.392.88-.587 1.594-.587.629 0 1.142.178 1.54.534.4.357.598.808.598 1.353 0 .028.007.118.021.272.014.154.021.308.021.462v4.34c0 .936-.167 1.607-.503 2.013-.335.405-.88.608-1.635.608-.713 0-1.251-.19-1.615-.567-.363-.377-.545-.936-.545-1.677v-.377h-3.69v6.269h9.75v-2.495c0-.937.178-1.608.534-2.013.357-.405.94-.608 1.75-.608.798 0 1.367.2 1.71.597.342.399.513 1.073.513 2.024v5.074c0 .755-.146 1.258-.44 1.51-.293.251-.873.377-1.74.377h-17.172c-.923 0-1.583-.182-1.982-.545-.398-.364-.597-.958-.597-1.782 0-.741.189-1.304.566-1.688.377-.385.93-.577 1.656-.577h.357V17.326h-.357c-.712 0-1.261-.2-1.646-.598-.384-.398-.576-.968-.576-1.709 0-.81.203-1.401.608-1.771.405-.37 1.062-.556 1.97-.556h17.173c.853 0 1.43.13 1.73.388.3.258.45.772.45 1.54v4.698c0 .95-.174 1.631-.524 2.044-.35.412-.915.618-1.698.618-.81 0-1.394-.21-1.75-.629-.357-.419-.535-1.097-.535-2.033v-2.202zM19.77 47.641c.267-.504.55-.86.85-1.07.3-.21.675-.314 1.122-.314.685 0 1.17.181 1.457.545.287.363.43.985.43 1.866l.042 5.451c0 .965-.157 1.615-.472 1.95-.314.336-.891.504-1.73.504-.587 0-1.045-.144-1.373-.43-.329-.287-.598-.8-.807-1.541-.378-1.342-.958-2.3-1.74-2.873-.783-.573-1.88-.86-3.292-.86-2.153 0-3.799.727-4.938 2.181-1.14 1.454-1.709 3.557-1.709 6.311s.598 4.882 1.793 6.385C10.599 67.248 12.294 68 14.488 68c.503 0 1.077-.06 1.72-.179a23.809 23.809 0 002.264-.555v-3.313h-2.37c-.95 0-1.624-.175-2.023-.524-.398-.35-.597-.93-.597-1.74 0-.84.199-1.437.597-1.793.399-.357 1.073-.535 2.024-.535h7.569c.978 0 1.667.175 2.065.524.398.35.598.937.598 1.762 0 .74-.2 1.31-.598 1.708-.398.399-.975.598-1.73.598h-.335v5.242c0 .447-.05.758-.147.933-.098.174-.293.353-.587.534-.797.476-2.062.895-3.795 1.258a25.576 25.576 0 01-5.263.546c-3.662 0-6.625-1.21-8.89-3.628-2.264-2.418-3.397-5.577-3.397-9.477 0-3.76 1.147-6.884 3.44-9.372 2.292-2.488 5.199-3.732 8.721-3.732.979 0 1.954.112 2.925.335.972.224 2.003.573 3.093 1.049zm15.84 3.941v4.823h6.857v-4.823h-.336c-.754 0-1.331-.195-1.73-.587-.398-.391-.597-.964-.597-1.719 0-.825.206-1.419.619-1.782.412-.364 1.093-.545 2.044-.545h5.41c.95 0 1.624.181 2.023.545.398.363.597.957.597 1.782 0 .755-.192 1.328-.576 1.72-.385.39-.947.586-1.688.586h-.357v15.642h.357c.755 0 1.328.192 1.719.576.391.385.587.947.587 1.688 0 .825-.203 1.419-.608 1.782-.405.364-1.09.546-2.055.546h-5.41c-.964 0-1.649-.179-2.054-.535-.405-.357-.608-.954-.608-1.793 0-.74.2-1.303.598-1.688.398-.384.975-.576 1.73-.576h.335v-6.186h-6.856v6.186h.335c.755 0 1.331.192 1.73.576.398.385.597.947.597 1.688 0 .825-.206 1.419-.618 1.782-.412.364-1.094.546-2.044.546h-5.41c-.964 0-1.65-.179-2.055-.535-.405-.357-.608-.954-.608-1.793 0-.74.196-1.303.587-1.688.392-.384.965-.576 1.72-.576h.356V51.582h-.356c-.741 0-1.304-.195-1.688-.587-.385-.391-.577-.964-.577-1.719 0-.825.2-1.419.598-1.782.398-.364 1.073-.545 2.023-.545h5.41c.936 0 1.614.181 2.033.545.42.363.63.957.63 1.782 0 .755-.2 1.328-.598 1.72-.399.39-.975.586-1.73.586h-.335zm31.754 0v15.642h3.523c.95 0 1.632.178 2.044.534.412.357.618.933.618 1.73 0 .811-.21 1.402-.629 1.772-.419.37-1.097.556-2.033.556H58.433c-.95 0-1.632-.182-2.044-.546-.412-.363-.619-.957-.619-1.782 0-.81.203-1.39.608-1.74.406-.35 1.09-.524 2.055-.524h3.523V51.582h-3.523c-.95 0-1.632-.181-2.044-.545-.412-.363-.619-.95-.619-1.761 0-.825.203-1.412.608-1.761.406-.35 1.09-.524 2.055-.524h12.455c.992 0 1.684.174 2.075.524.392.35.587.936.587 1.761 0 .81-.202 1.398-.608 1.761-.405.364-1.09.545-2.054.545h-3.523zm30.496 0v11.994c0 1.873-.122 3.228-.367 4.067a5.876 5.876 0 01-1.227 2.244c-.74.852-1.768 1.495-3.082 1.929-1.314.433-2.893.65-4.738.65-1.3 0-2.555-.126-3.764-.378a16.843 16.843 0 01-3.491-1.132c-.615-.28-1.017-.643-1.206-1.09-.188-.448-.283-1.175-.283-2.18v-4.32c0-1.202.175-2.04.525-2.516.349-.475.957-.713 1.824-.713 1.244 0 1.929.915 2.054 2.747.014.321.035.566.063.733.168 1.622.545 2.73 1.133 3.324.587.594 1.523.89 2.81.89 1.593 0 2.714-.422 3.364-1.268.65-.845.975-2.386.975-4.623V51.582H88.93c-.95 0-1.632-.181-2.044-.545-.413-.363-.619-.95-.619-1.761 0-.825.2-1.412.598-1.761.398-.35 1.086-.524 2.065-.524h10.693c.979 0 1.667.174 2.065.524.399.35.598.936.598 1.761 0 .81-.206 1.398-.619 1.761-.412.364-1.093.545-2.044.545h-1.761zm14.644 0v6.353l6.48-6.478c-.728-.084-1.238-.29-1.531-.619-.294-.328-.44-.85-.44-1.562 0-.825.198-1.419.597-1.782.398-.364 1.073-.545 2.023-.545h5.137c.95 0 1.625.181 2.023.545.399.363.598.957.598 1.782 0 .769-.2 1.345-.598 1.73-.398.384-.982.576-1.75.576h-.483l-6.101 6.06c1.132.839 2.167 1.94 3.103 3.302.937 1.363 2.034 3.456 3.292 6.28h.692c.825 0 1.44.188 1.845.566.405.377.608.943.608 1.698 0 .825-.206 1.419-.619 1.782-.412.364-1.093.546-2.044.546h-2.579c-1.132 0-2.048-.762-2.746-2.286-.126-.28-.224-.503-.294-.67-.923-1.958-1.768-3.467-2.537-4.53a16.616 16.616 0 00-2.705-2.914l-1.97 1.887v3.92h.335c.755 0 1.331.193 1.73.577.398.385.597.947.597 1.688 0 .825-.206 1.419-.618 1.782-.413.364-1.094.546-2.045.546h-5.41c-.964 0-1.649-.179-2.054-.535-.405-.357-.608-.954-.608-1.793 0-.74.196-1.303.587-1.688.391-.384.965-.576 1.72-.576h.356V51.582h-.357c-.74 0-1.303-.195-1.687-.587-.385-.391-.577-.964-.577-1.719 0-.825.2-1.419.598-1.782.398-.364 1.072-.545 2.023-.545h5.41c.936 0 1.614.181 2.033.545.42.363.63.957.63 1.782 0 .755-.2 1.328-.598 1.72-.399.39-.975.586-1.73.586h-.336zM13.44 96.326l4.005-11.889c.251-.782.6-1.352 1.048-1.709.447-.356 1.041-.534 1.782-.534h3.271c.95 0 1.632.182 2.044.545.413.363.619.957.619 1.782 0 .755-.2 1.328-.598 1.72-.398.39-.975.587-1.73.587h-.335l.587 15.641h.357c.754 0 1.32.192 1.698.577.377.384.566.947.566 1.687 0 .825-.2 1.42-.598 1.783-.398.363-1.072.545-2.023.545h-4.718c-.95 0-1.624-.178-2.023-.535-.398-.356-.597-.954-.597-1.793 0-.74.192-1.303.576-1.687.385-.385.954-.577 1.709-.577h.335l-.293-12.79-3.061 9.52c-.224.712-.542 1.226-.954 1.54-.413.315-.982.472-1.709.472-.727 0-1.303-.157-1.73-.472-.426-.314-.751-.828-.975-1.54l-3.04-9.52-.294 12.79h.336c.755 0 1.324.192 1.709.577.384.384.576.947.576 1.687 0 .825-.202 1.42-.608 1.783-.405.363-1.076.545-2.013.545H2.621c-.937 0-1.608-.182-2.013-.545-.405-.364-.608-.958-.608-1.783 0-.74.192-1.303.577-1.687.384-.385.954-.577 1.708-.577h.336l.608-15.641h-.336c-.754 0-1.331-.196-1.73-.588-.398-.39-.597-.964-.597-1.719 0-.825.206-1.419.619-1.782.412-.363 1.093-.545 2.044-.545h3.27c.728 0 1.311.175 1.752.524.44.35.8.923 1.08 1.72l4.109 11.888zm30.454 2.054V86.828H42.74c-.922 0-1.583-.182-1.981-.546-.398-.363-.598-.95-.598-1.76 0-.812.2-1.402.598-1.773.398-.37 1.059-.555 1.981-.555h5.955c.909 0 1.566.185 1.97.555.406.37.609.961.609 1.772 0 .741-.192 1.31-.577 1.709-.384.398-.933.598-1.646.598h-.356v19.038c0 .657-.07 1.069-.21 1.237-.14.167-.454.251-.943.251h-2.097c-.67 0-1.143-.07-1.415-.21-.273-.14-.507-.384-.703-.733l-8.722-15.327v11.385h1.216c.909 0 1.559.175 1.95.524.392.35.587.93.587 1.74 0 .825-.199 1.42-.597 1.783-.399.363-1.045.545-1.94.545h-6.017c-.909 0-1.566-.182-1.971-.545-.406-.364-.608-.958-.608-1.783 0-.74.188-1.303.566-1.687.377-.385.936-.577 1.677-.577h.336V86.828h-.336c-.713 0-1.265-.2-1.656-.598-.392-.398-.587-.968-.587-1.709 0-.81.206-1.401.618-1.772.413-.37 1.066-.555 1.96-.555h3.44c.824 0 1.383.108 1.677.325.293.216.622.653.985 1.31l7.989 14.551zM64.66 86.366c-1.803 0-3.218.727-4.245 2.18-1.028 1.455-1.541 3.474-1.541 6.06 0 2.586.517 4.613 1.551 6.08 1.034 1.468 2.446 2.202 4.235 2.202 1.804 0 3.222-.73 4.257-2.19 1.034-1.461 1.551-3.492 1.551-6.092 0-2.586-.513-4.605-1.54-6.06-1.028-1.453-2.45-2.18-4.268-2.18zm0-4.864c3.44 0 6.27 1.23 8.492 3.69 2.223 2.46 3.334 5.598 3.334 9.414 0 3.844-1.104 6.99-3.313 9.436-2.208 2.446-5.046 3.669-8.513 3.669-3.424 0-6.255-1.234-8.491-3.701-2.237-2.467-3.355-5.602-3.355-9.404 0-3.83 1.108-6.971 3.323-9.424 2.216-2.454 5.057-3.68 8.523-3.68zM87.461 98.17v4.298h2.16c.908 0 1.555.175 1.94.524.384.35.576.93.576 1.74 0 .825-.196 1.42-.587 1.783-.392.363-1.035.545-1.93.545h-7.254c-.922 0-1.583-.182-1.981-.545-.399-.364-.598-.958-.598-1.783 0-.74.189-1.303.566-1.687.378-.385.93-.577 1.657-.577h.356V86.828h-.356c-.713 0-1.262-.2-1.646-.598-.385-.398-.577-.968-.577-1.709 0-.81.203-1.401.608-1.772.406-.37 1.063-.555 1.971-.555h8.66c3.424 0 6.014.657 7.768 1.97 1.754 1.315 2.631 3.25 2.631 5.809 0 2.697-.873 4.738-2.62 6.122-1.748 1.384-4.34 2.076-7.78 2.076h-3.564zm0-11.343v6.625h2.977c1.65 0 2.89-.28 3.722-.839.832-.559 1.248-1.397 1.248-2.516 0-1.048-.43-1.855-1.29-2.421-.86-.566-2.086-.85-3.68-.85h-2.977zm27.267 20.568l-1.636 1.636a12.37 12.37 0 011.772-.44c.58-.098 1.15-.147 1.709-.147 1.104 0 2.268.164 3.491.492 1.223.329 1.967.493 2.233.493.447 0 1.03-.15 1.75-.45.72-.301 1.206-.452 1.458-.452.517 0 .947.2 1.29.598.342.398.513.898.513 1.5 0 .796-.472 1.474-1.415 2.033-.944.56-2.1.839-3.47.839-.937 0-2.139-.22-3.607-.66-1.467-.441-2.53-.661-3.187-.661-.992 0-2.11.272-3.354.817-1.244.546-2.013.818-2.307.818a2.14 2.14 0 01-1.53-.597c-.42-.399-.63-.878-.63-1.437 0-.391.134-.807.4-1.247.265-.44.733-1.01 1.404-1.709l2.118-2.139c-2.335-.852-4.194-2.386-5.578-4.602-1.384-2.215-2.075-4.763-2.075-7.642 0-3.802 1.104-6.909 3.312-9.32 2.209-2.411 5.053-3.617 8.534-3.617 3.467 0 6.304 1.209 8.513 3.627 2.208 2.418 3.312 5.522 3.312 9.31 0 3.774-1.097 6.884-3.291 9.33-2.195 2.446-4.977 3.67-8.345 3.67a22.5 22.5 0 01-1.384-.043zm1.195-21.03c-1.803 0-3.218.727-4.246 2.18-1.027 1.455-1.54 3.474-1.54 6.06 0 2.586.516 4.613 1.55 6.08 1.035 1.468 2.447 2.202 4.236 2.202 1.803 0 3.222-.73 4.256-2.19 1.035-1.461 1.552-3.492 1.552-6.092 0-2.586-.514-4.605-1.541-6.06-1.028-1.453-2.45-2.18-4.267-2.18z\"/></svg>"
},
"$:/core/images/mono-line": {
"title": "$:/core/images/mono-line",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-mono-line tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M60.437 84.523h.908c1.922 0 3.381.489 4.378 1.468.997.979 1.495 2.411 1.495 4.298 0 2.1-.525 3.612-1.575 4.538-1.05.925-2.785 1.388-5.206 1.388h-16.07c-2.456 0-4.2-.454-5.232-1.361-1.032-.908-1.548-2.43-1.548-4.565 0-2.065.516-3.542 1.548-4.432 1.032-.89 2.776-1.334 5.232-1.334h1.869l-2.19-6.247H20.983l-2.296 6.247h1.87c2.42 0 4.155.453 5.205 1.361 1.05.908 1.575 2.376 1.575 4.405 0 2.1-.525 3.612-1.575 4.538-1.05.925-2.785 1.388-5.206 1.388H6.781c-2.456 0-4.2-.463-5.233-1.388C.516 93.9 0 92.389 0 90.289c0-1.887.498-3.32 1.495-4.298.997-.979 2.456-1.468 4.378-1.468h.908l14.308-39.83h-4.271c-2.42 0-4.156-.462-5.206-1.387-1.05-.926-1.575-2.42-1.575-4.485 0-2.1.525-3.613 1.575-4.538 1.05-.926 2.785-1.388 5.206-1.388h20.021c3.168 0 5.392 1.708 6.674 5.125v.16l16.924 46.343zm-27.976-39.83L24.72 67.225h15.483l-7.742-22.53zM89.506 68.56v16.284h8.008c5.66 0 9.646-.623 11.96-1.869 2.313-1.245 3.47-3.328 3.47-6.246 0-2.955-1.103-5.055-3.31-6.3-2.207-1.246-6.069-1.869-11.586-1.869h-8.542zm27.229-5.926c3.88 1.423 6.727 3.372 8.542 5.846 1.815 2.474 2.723 5.633 2.723 9.477 0 3.239-.783 6.193-2.35 8.862-1.565 2.67-3.808 4.859-6.726 6.567-1.709.997-3.622 1.718-5.74 2.163-2.118.445-5.116.667-8.996.667h-27.87c-2.349 0-4.03-.463-5.045-1.388-1.014-.926-1.521-2.438-1.521-4.538 0-1.887.48-3.32 1.441-4.298.961-.979 2.367-1.468 4.218-1.468h.907v-39.83h-.907c-1.851 0-3.257-.498-4.218-1.494-.961-.997-1.441-2.456-1.441-4.378 0-2.065.516-3.568 1.548-4.512 1.032-.943 2.705-1.414 5.018-1.414h24.56c7.51 0 13.214 1.459 17.111 4.377 3.898 2.92 5.847 7.19 5.847 12.814 0 2.776-.597 5.223-1.789 7.341-1.192 2.118-2.963 3.853-5.312 5.206zm-27.23-18.26v13.455h7.208c4.378 0 7.466-.516 9.264-1.549 1.797-1.032 2.696-2.776 2.696-5.232 0-2.313-.81-4.004-2.43-5.072-1.619-1.068-4.244-1.602-7.874-1.602h-8.863z\"/></svg>"
},
"$:/core/images/new-button": {
"title": "$:/core/images/new-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-new-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M56 72H8.007C3.591 72 0 68.418 0 64c0-4.41 3.585-8 8.007-8H56V8.007C56 3.591 59.582 0 64 0c4.41 0 8 3.585 8 8.007V56h47.993c4.416 0 8.007 3.582 8.007 8 0 4.41-3.585 8-8.007 8H72v47.993c0 4.416-3.582 8.007-8 8.007-4.41 0-8-3.585-8-8.007V72z\"/></svg>"
},
"$:/core/images/new-here-button": {
"title": "$:/core/images/new-here-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-new-here-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M55.838 20.935l-3.572.938c-3.688.968-8.23 4.43-10.136 7.731L3.37 96.738c-1.905 3.3-.771 7.524 2.534 9.432l33.717 19.466c3.297 1.904 7.53.78 9.435-2.521l38.76-67.134c1.905-3.3 2.632-8.963 1.623-12.646L83.285 20.88c-1.009-3.68-4.821-5.884-8.513-4.915l-7.603 1.995.043.287c.524 3.394 2.053 7.498 4.18 11.55.418.163.829.36 1.23.59a8.864 8.864 0 014.438 8.169c.104.132.21.264.316.395l-.386.318a8.663 8.663 0 01-1.082 3.137c-2.42 4.192-7.816 5.608-12.051 3.163-4.12-2.379-5.624-7.534-3.476-11.671-2.177-4.394-3.788-8.874-4.543-12.964z\"/><path d=\"M69.554 44.76c-5.944-7.476-10.74-17.196-11.955-25.059-1.68-10.875 3.503-18.216 15.082-18.04 10.407.158 19.975 5.851 24.728 13.785 5.208 8.695 2.95 17.868-6.855 20.496l-2.037-7.601c4.232-1.134 4.999-4.248 2.24-8.853-3.37-5.626-10.465-9.848-18.146-9.965-6.392-.097-8.31 2.62-7.323 9.01.999 6.465 5.318 15.138 10.582 21.65l-.072.06c.559 1.553-4.17 6.44-5.938 4.888l-.005.004-.028-.034a1.323 1.323 0 01-.124-.135 2.618 2.618 0 01-.149-.205z\"/><rect width=\"16\" height=\"48\" x=\"96\" y=\"80\" rx=\"8\"/><rect width=\"48\" height=\"16\" x=\"80\" y=\"96\" rx=\"8\"/></g></svg>"
},
"$:/core/images/new-image-button": {
"title": "$:/core/images/new-image-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-new-image-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M81.362 73.627l15.826-27.41a2.626 2.626 0 00-.962-3.59l-50.01-28.872a2.626 2.626 0 00-3.588.961L30.058 36.49l10.04-5.261c3.042-1.595 6.771.114 7.55 3.46l3.607 17.702 9.88.85a5.25 5.25 0 014.571 3.77c.034.115.1.344.199.671.165.553.353 1.172.562 1.843.595 1.914 1.23 3.85 1.872 5.678.207.588.412 1.156.614 1.701.625 1.685 1.209 3.114 1.725 4.207.255.54.485.977.726 1.427.214.212.547.425 1.011.622 1.141.482 2.784.74 4.657.758.864.008 1.71-.034 2.492-.11.448-.043.753-.085.871-.104.315-.053.625-.077.927-.076zM37.47 2.649A5.257 5.257 0 0144.649.725l63.645 36.746a5.257 5.257 0 011.923 7.178L73.47 108.294a5.257 5.257 0 01-7.177 1.923L2.649 73.47a5.257 5.257 0 01-1.924-7.177L37.471 2.649zm42.837 50.49a5.25 5.25 0 105.25-9.092 5.25 5.25 0 00-5.25 9.093zM96 112h-7.993c-4.419 0-8.007-3.582-8.007-8 0-4.41 3.585-8 8.007-8H96v-7.993C96 83.588 99.582 80 104 80c4.41 0 8 3.585 8 8.007V96h7.993c4.419 0 8.007 3.582 8.007 8 0 4.41-3.585 8-8.007 8H112v7.993c0 4.419-3.582 8.007-8 8.007-4.41 0-8-3.585-8-8.007V112zM33.347 51.791c7.428 7.948 9.01 10.69 7.449 13.394-1.56 2.703-13.838-2.328-16.094 1.58-2.256 3.908-.907 3.258-2.437 5.908l19.73 11.39s-5.605-8.255-4.235-10.628c2.515-4.356 8.77-1.256 10.365-4.019 2.414-4.181-5.103-9.639-14.778-17.625z\"/></svg>"
},
"$:/core/images/new-journal-button": {
"title": "$:/core/images/new-journal-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-new-journal-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M102.545 112.818v11.818c0 1.306 1.086 2.364 2.425 2.364h6.06c1.34 0 2.425-1.058 2.425-2.364v-11.818h12.12c1.34 0 2.425-1.058 2.425-2.363v-5.91c0-1.305-1.085-2.363-2.424-2.363h-12.121V90.364c0-1.306-1.086-2.364-2.425-2.364h-6.06c-1.34 0-2.425 1.058-2.425 2.364v11.818h-12.12c-1.34 0-2.425 1.058-2.425 2.363v5.91c0 1.305 1.085 2.363 2.424 2.363h12.121zM60.016 4.965c-4.781-2.76-10.897-1.118-13.656 3.66L5.553 79.305A9.993 9.993 0 009.21 92.963l51.04 29.468c4.78 2.76 10.897 1.118 13.655-3.66l40.808-70.681a9.993 9.993 0 00-3.658-13.656L60.016 4.965zm-3.567 27.963a6 6 0 106-10.393 6 6 0 00-6 10.393zm31.697 17.928a6 6 0 106-10.392 6 6 0 00-6 10.392z\"/><text class=\"tc-fill-background\" font-family=\"Helvetica\" font-size=\"47.172\" font-weight=\"bold\" transform=\"rotate(30 25.742 95.82)\"><tspan x=\"42\" y=\"77.485\" text-anchor=\"middle\"><<now \"DD\">></tspan></text></g></svg>"
},
"$:/core/images/opacity": {
"title": "$:/core/images/opacity",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-opacity tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M102.362 65a51.595 51.595 0 01-1.942 6H82.584a35.867 35.867 0 002.997-6h16.78zm.472-2c.423-1.961.734-3.963.929-6H87.656a35.78 35.78 0 01-1.368 6h16.546zm-3.249 10a51.847 51.847 0 01-3.135 6H75.812a36.205 36.205 0 005.432-6h18.341zm-4.416 8c-1.424 2.116-3 4.12-4.71 6H60.46a35.843 35.843 0 0012.874-6h21.834zm-7.513-34h16.107C101.247 20.627 79.033 0 52 0 23.281 0 0 23.281 0 52c0 25.228 17.965 46.26 41.8 51h20.4a51.66 51.66 0 0015.875-6H39v-2h42.25a52.257 52.257 0 007.288-6H39v-2h4.539C27.739 83.194 16 68.968 16 52c0-19.882 16.118-36 36-36 18.186 0 33.222 13.484 35.656 31zm.22 2h16.039a52.823 52.823 0 010 6H87.877a36.483 36.483 0 000-6z\"/><path d=\"M76 128c28.719 0 52-23.281 52-52s-23.281-52-52-52-52 23.281-52 52 23.281 52 52 52zm0-16c19.882 0 36-16.118 36-36S95.882 40 76 40 40 56.118 40 76s16.118 36 36 36z\"/><path d=\"M37 58h53v4H37v-4zm3-8h53v4H40v-4zm0-8h53v4H40v-4zm-8 24h53v4H32v-4zm-2 8h53v4H30v-4zm-3 8h53v4H27v-4z\"/></g></svg>"
},
"$:/core/images/open-window": {
"title": "$:/core/images/open-window",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-open-window tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M16 112h88.994c3.87 0 7.006 3.59 7.006 8 0 4.418-3.142 8-7.006 8H7.006C3.136 128 0 124.41 0 120a9.321 9.321 0 010-.01V24.01C0 19.586 3.59 16 8 16c4.418 0 8 3.584 8 8.01V112z\"/><path d=\"M96 43.196V56a8 8 0 1016 0V24c0-4.41-3.585-8-8.007-8H72.007C67.588 16 64 19.582 64 24c0 4.41 3.585 8 8.007 8H84.57l-36.3 36.299a8 8 0 00-.001 11.316c3.117 3.117 8.19 3.123 11.316-.003L96 43.196zM32 7.999C32 3.581 35.588 0 40 0h80c4.419 0 8 3.588 8 8v80c0 4.419-3.588 8-8 8H40c-4.419 0-8-3.588-8-8V8z\"/></g></svg>"
},
"$:/core/images/options-button": {
"title": "$:/core/images/options-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-options-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M110.488 76a47.712 47.712 0 01-5.134 12.384l6.724 6.724c3.123 3.123 3.132 8.192.011 11.313l-5.668 5.668c-3.12 3.12-8.186 3.117-11.313-.01l-6.724-6.725c-3.82 2.258-7.98 4-12.384 5.134v9.505c0 4.417-3.578 8.007-7.992 8.007h-8.016C55.58 128 52 124.415 52 119.993v-9.505a47.712 47.712 0 01-12.384-5.134l-6.724 6.725c-3.123 3.122-8.192 3.131-11.313.01l-5.668-5.668c-3.12-3.12-3.116-8.186.01-11.313l6.725-6.724c-2.257-3.82-4-7.98-5.134-12.384H8.007C3.591 76 0 72.422 0 68.01v-8.017C0 55.58 3.585 52 8.007 52h9.505a47.712 47.712 0 015.134-12.383l-6.724-6.725c-3.123-3.122-3.132-8.191-.011-11.312l5.668-5.669c3.12-3.12 8.186-3.116 11.313.01l6.724 6.725c3.82-2.257 7.98-4 12.384-5.134V8.007C52 3.591 55.578 0 59.992 0h8.016C72.42 0 76 3.585 76 8.007v9.505a47.712 47.712 0 0112.384 5.134l6.724-6.724c3.123-3.123 8.192-3.132 11.313-.01l5.668 5.668c3.12 3.12 3.116 8.186-.01 11.312l-6.725 6.725c2.257 3.82 4 7.979 5.134 12.383h9.505c4.416 0 8.007 3.578 8.007 7.992v8.017c0 4.411-3.585 7.991-8.007 7.991h-9.505zM64 96c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32-17.673 0-32 14.327-32 32 0 17.673 14.327 32 32 32z\"/></svg>"
},
"$:/core/images/paint": {
"title": "$:/core/images/paint",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-paint tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M83.527 76.19C90.43 69.287 91.892 59 87.91 50.665l37.903-37.902c2.919-2.92 2.913-7.659 0-10.572a7.474 7.474 0 00-10.572 0L77.338 40.093c-8.335-3.982-18.622-2.521-25.526 4.383l31.715 31.715zm-2.643 2.644L49.169 47.119S8.506 81.243 0 80.282c0 0 3.782 5.592 6.827 8.039 14.024-5.69 37.326-24.6 37.326-24.6l.661.66S19.45 90.222 9.18 92.047c1.222 1.44 4.354 4.053 6.247 5.776 5.417-1.488 34.733-28.57 34.733-28.57l.661.66-32.407 31.022 5.285 5.286L56.106 75.2l.662.66s-27.864 30.536-28.684 32.432c0 0 6.032 6.853 7.569 7.824.702-2.836 27.884-33.485 27.884-33.485l.661.66s-20.597 23.755-24.964 36.732c3.21 3.549 7.5 5.137 10.926 6.298-2.19-11.817 30.724-47.487 30.724-47.487z\"/></svg>"
},
"$:/core/images/palette": {
"title": "$:/core/images/palette",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-palette tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M80.247 39.182a93.52 93.52 0 00-16.228-1.4C28.662 37.781 0 57.131 0 81.002c0 9.642 4.676 18.546 12.58 25.735C23.504 91.19 26.34 72.395 36.89 63.562c15.183-12.713 26.538-7.828 26.538-7.828l16.82-16.552zm26.535 9.655c13.049 7.913 21.257 19.392 21.257 32.166 0 9.35.519 17.411-11.874 25.08-10.797 6.681-3.824-6.536-11.844-10.898s-19.946 1.308-18.213 7.906c3.2 12.181 19.422 11.455 6.314 16.658-13.107 5.202-18.202 4.476-28.403 4.476-7.821 0-15.315-.947-22.243-2.68 9.844-4.197 27.88-12.539 33.354-19.456C82.788 92.409 87.37 80 83.324 72.484c-.194-.359 11.215-11.668 23.458-23.647zM1.134 123.867l-.66.002c33.479-14.94 22.161-64.226 58.818-64.226.317 1.418.644 2.944 1.062 4.494-25.907-4.166-23.567 48.031-59.22 59.73zm.713-.007c38.872-.506 78.152-22.347 78.152-44.813-9.27 0-14.073-3.48-16.816-7.942-16.597-7.003-30.365 45.715-61.336 52.755zm65.351-64.008c-4.45 4.115 4.886 16.433 11.318 11.318l45.27-45.27c11.317-11.318 0-22.635-11.318-11.318-11.317 11.318-33.518 34.405-45.27 45.27z\"/></svg>"
},
"$:/core/images/permalink-button": {
"title": "$:/core/images/permalink-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-permalink-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M80.483 48l-7.387 32h-25.58l7.388-32h25.58zm3.694-16l5.624-24.358c.993-4.303 5.29-6.996 9.596-6.002 4.296.992 6.988 5.293 5.994 9.602L100.598 32h3.403c4.41 0 7.999 3.582 7.999 8 0 4.41-3.581 8-8 8h-7.096l-7.387 32H104c4.41 0 7.999 3.582 7.999 8 0 4.41-3.581 8-8 8H85.824l-5.624 24.358c-.993 4.303-5.29 6.996-9.596 6.002-4.296-.992-6.988-5.293-5.994-9.602L69.402 96h-25.58L38.2 120.358c-.993 4.303-5.29 6.996-9.596 6.002-4.296-.992-6.988-5.293-5.994-9.602L27.402 96h-3.403C19.59 96 16 92.418 16 88c0-4.41 3.581-8 8-8h7.096l7.387-32H24C19.59 48 16 44.418 16 40c0-4.41 3.581-8 8-8h18.177l5.624-24.358c.993-4.303 5.29-6.996 9.596-6.002 4.296.992 6.988 5.293 5.994 9.602L58.598 32h25.58z\"/></svg>"
},
"$:/core/images/permaview-button": {
"title": "$:/core/images/permaview-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-permaview-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M81.483 48l-1.846 8h-5.58l1.847-8h5.58zm3.694-16l5.624-24.358c.993-4.303 5.29-6.996 9.596-6.002 4.296.992 6.988 5.293 5.994 9.602L101.598 32h2.403c4.41 0 7.999 3.582 7.999 8 0 4.41-3.581 8-8 8h-6.096l-1.847 8h7.944c4.41 0 7.999 3.582 7.999 8 0 4.41-3.581 8-8 8H92.364l-1.846 8H104c4.41 0 7.999 3.582 7.999 8 0 4.41-3.581 8-8 8H86.824l-5.624 24.358c-.993 4.303-5.29 6.996-9.596 6.002-4.296-.992-6.988-5.293-5.994-9.602L70.402 96h-5.58L59.2 120.358c-.993 4.303-5.29 6.996-9.596 6.002-4.296-.992-6.988-5.293-5.994-9.602L48.402 96h-5.58L37.2 120.358c-.993 4.303-5.29 6.996-9.596 6.002-4.296-.992-6.988-5.293-5.994-9.602L26.402 96h-2.403C19.59 96 16 92.418 16 88c0-4.41 3.581-8 8-8h6.096l1.847-8h-7.944C19.59 72 16 68.418 16 64c0-4.41 3.581-8 8-8h11.637l1.846-8H24C19.59 48 16 44.418 16 40c0-4.41 3.581-8 8-8h17.177l5.624-24.358c.993-4.303 5.29-6.996 9.596-6.002 4.296.992 6.988 5.293 5.994 9.602L57.598 32h5.58L68.8 7.642c.993-4.303 5.29-6.996 9.596-6.002 4.296.992 6.988 5.293 5.994 9.602L79.598 32h5.58zM53.904 48l-1.847 8h5.58l1.846-8h-5.579zm22.039 24l-1.847 8h-5.58l1.847-8h5.58zm-27.58 0l-1.846 8h5.579l1.847-8h-5.58z\"/></svg>"
},
"$:/core/images/picture": {
"title": "$:/core/images/picture",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-picture tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M112 68.233v-48.23A4.001 4.001 0 00107.997 16H20.003A4.001 4.001 0 0016 20.003v38.31l9.241-14.593c2.8-4.422 9.023-5.008 12.6-1.186l18.247 20.613 13.687-6.407a8 8 0 018.903 1.492 264.97 264.97 0 002.92 2.739 249.44 249.44 0 006.798 6.066 166.5 166.5 0 002.106 1.778c2.108 1.747 3.967 3.188 5.482 4.237.748.518 1.383.92 2.044 1.33.444.117 1.046.144 1.809.05 1.873-.233 4.238-1.144 6.723-2.547a36.016 36.016 0 003.205-2.044c.558-.4.93-.686 1.07-.802.376-.31.765-.577 1.165-.806zM0 8.007A8.01 8.01 0 018.007 0h111.986A8.01 8.01 0 01128 8.007v111.986a8.01 8.01 0 01-8.007 8.007H8.007A8.01 8.01 0 010 119.993V8.007zM95 42a8 8 0 100-16 8 8 0 000 16zM32 76c15.859 4.83 20.035 7.244 20.035 12S32 95.471 32 102.347c0 6.876 1.285 4.99 1.285 9.653H68s-13.685-6.625-13.685-10.8c0-7.665 10.615-8.34 10.615-13.2 0-7.357-14.078-8.833-32.93-12z\"/></svg>"
},
"$:/core/images/plugin-generic-language": {
"title": "$:/core/images/plugin-generic-language",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\" class=\"tc-image-plugin-generic-language tc-image-button\"><path fill-rule=\"evenodd\" d=\"M61.207 68.137c-4.324 2.795-6.999 6.656-6.999 10.921 0 7.906 9.19 14.424 21.042 15.336 2.162 3.902 8.598 6.785 16.318 7.01-5.126-1.125-9.117-3.742-10.62-7.01C92.805 93.487 102 86.967 102 79.059c0-8.53-10.699-15.445-23.896-15.445-6.599 0-12.572 1.729-16.897 4.524zm12.794-14.158c-4.324 2.795-10.298 4.524-16.897 4.524-2.619 0-5.14-.272-7.497-.775-3.312 2.25-8.383 3.69-14.067 3.69l-.255-.002c4.119-.892 7.511-2.747 9.478-5.13-6.925-2.704-11.555-7.617-11.555-13.228 0-8.53 10.699-15.445 23.896-15.445C70.301 27.613 81 34.528 81 43.058c0 4.265-2.675 8.126-6.999 10.921zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z\"/></svg>"
},
"$:/core/images/plugin-generic-plugin": {
"title": "$:/core/images/plugin-generic-plugin",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\" class=\"tc-image-plugin-generic-plugin tc-image-button\"><path fill-rule=\"evenodd\" d=\"M40.397 76.446V95.34h14.12l-.001-.005a6.912 6.912 0 005.364-11.593l.046-.023a6.912 6.912 0 119.979.526l.086.055a6.914 6.914 0 004.408 10.948l-.023.092h21.32V75.568l-.15.038a6.912 6.912 0 00-11.593-5.364l-.022-.046a6.912 6.912 0 11.526-9.979l.055-.086a6.914 6.914 0 0010.948-4.408c.079.018.158.038.236.059v-15.74h-21.32l.023-.094a6.914 6.914 0 01-4.408-10.947 10.23 10.23 0 00-.086-.055 6.912 6.912 0 10-9.979-.526l-.046.023a6.912 6.912 0 01-5.364 11.593l.001.005h-14.12v12.847A6.912 6.912 0 0129.5 59.843l-.054.086a6.912 6.912 0 10-.526 9.979l.023.046a6.912 6.912 0 0111.455 6.492zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z\"/></svg>"
},
"$:/core/images/plugin-generic-theme": {
"title": "$:/core/images/plugin-generic-theme",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" viewBox=\"0 0 128 128\" class=\"tc-image-plugin-generic-theme tc-image-button\"><path fill-rule=\"evenodd\" d=\"M29.408 91.472L51.469 69.41l-.004-.005a2.22 2.22 0 01.004-3.146c.87-.87 2.281-.872 3.147-.005l9.465 9.464a2.22 2.22 0 01-.005 3.147c-.87.87-2.28.871-3.147.005l-.005-.005-22.061 22.062a6.686 6.686 0 11-9.455-9.455zM60.802 66.38c-2.436-2.704-4.465-5.091-5.817-6.869-6.855-9.014-10.313-4.268-14.226 0-3.913 4.268 1.03 7.726-2.683 10.741-3.713 3.015-3.484 4.06-9.752-1.455-6.267-5.516-6.7-7.034-3.823-10.181 2.877-3.147 5.281 1.808 11.159-3.785 5.877-5.593.94-10.55.94-10.55s12.237-25.014 28.588-23.167c16.351 1.848-6.186-2.392-11.792 17.226-2.4 8.4.447 6.42 4.998 9.968 1.394 1.086 6.03 4.401 11.794 8.685l20.677-20.676 1.615-4.766 7.84-4.689 3.151 3.152-4.688 7.84-4.766 1.615-20.224 20.223c12.663 9.547 28.312 22.146 28.312 26.709 0 7.217-3.071 11.526-9.535 9.164-4.693-1.715-18.768-15.192-28.753-25.897l-2.893 2.893-3.151-3.152 3.029-3.029zM63.953 0l54.56 32v64l-54.56 32-54.56-32V32l54.56-32z\"/></svg>"
},
"$:/core/images/plus-button": {
"title": "$:/core/images/plus-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-plus-button tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M64-.333c35.346 0 64 28.654 64 64 0 35.346-28.654 64-64 64-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64zM64 16c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48z\"/><rect width=\"80\" height=\"16\" x=\"24\" y=\"56\" rx=\"8\"/><rect width=\"16\" height=\"80\" x=\"56\" y=\"24\" rx=\"8\"/></svg>"
},
"$:/core/images/preview-closed": {
"title": "$:/core/images/preview-closed",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-preview-closed tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M.088 64a7.144 7.144 0 001.378 5.458C16.246 88.818 39.17 100.414 64 100.414c24.83 0 47.753-11.596 62.534-30.956A7.144 7.144 0 00127.912 64C110.582 78.416 88.304 87.086 64 87.086 39.696 87.086 17.418 78.416.088 64z\"/><rect width=\"4\" height=\"16\" x=\"62\" y=\"96\" rx=\"4\"/><rect width=\"4\" height=\"16\" x=\"78\" y=\"93\" rx=\"4\" transform=\"rotate(-5 80 101)\"/><rect width=\"4\" height=\"16\" x=\"46\" y=\"93\" rx=\"4\" transform=\"rotate(5 48 101)\"/><rect width=\"4\" height=\"16\" x=\"30\" y=\"88\" rx=\"4\" transform=\"rotate(10 32 96)\"/><rect width=\"4\" height=\"16\" x=\"94\" y=\"88\" rx=\"4\" transform=\"rotate(-10 96 96)\"/><rect width=\"4\" height=\"16\" x=\"110\" y=\"80\" rx=\"4\" transform=\"rotate(-20 112 88)\"/><rect width=\"4\" height=\"16\" x=\"14\" y=\"80\" rx=\"4\" transform=\"rotate(20 16 88)\"/></g></svg>"
},
"$:/core/images/preview-open": {
"title": "$:/core/images/preview-open",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-preview-open tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M64.11 99.588c-24.83 0-47.754-11.596-62.534-30.957a7.148 7.148 0 010-8.675C16.356 40.596 39.28 29 64.11 29c24.83 0 47.753 11.596 62.534 30.956a7.148 7.148 0 010 8.675c-14.78 19.36-37.703 30.957-62.534 30.957zm46.104-32.007c1.44-1.524 1.44-3.638 0-5.162C99.326 50.9 82.439 44 64.147 44S28.968 50.9 18.08 62.42c-1.44 1.523-1.44 3.637 0 5.16C28.968 79.1 45.855 86 64.147 86s35.179-6.9 46.067-18.42z\"/><path d=\"M63.5 88C76.479 88 87 77.479 87 64.5S76.479 41 63.5 41 40 51.521 40 64.5 50.521 88 63.5 88z\"/></g></svg>"
},
"$:/core/images/print-button": {
"title": "$:/core/images/print-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-print-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M112 71V30.5h-.032c-.035-2-.816-3.99-2.343-5.516L86.998 2.357A7.978 7.978 0 0081 .02V0H24a8 8 0 00-8 8v63h8V8h57v14.5c0 4.422 3.582 8 8 8h15V71h8z\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"36\" rx=\"4\"/><rect width=\"64\" height=\"8\" x=\"32\" y=\"52\" rx=\"4\"/><rect width=\"40\" height=\"8\" x=\"32\" y=\"20\" rx=\"4\"/><path d=\"M0 80.005C0 71.165 7.156 64 16 64h96c8.836 0 16 7.155 16 16.005v31.99c0 8.84-7.156 16.005-16 16.005H16c-8.836 0-16-7.155-16-16.005v-31.99zM104 96a8 8 0 100-16 8 8 0 000 16z\"/></g></svg>"
},
"$:/core/images/publish": {
"title": "$:/core/images/publish",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-publish tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\">\n <path d=\"M64.0434107,46.2358498 C65.8048912,45.8955184 67.6195684,46.7809274 68.4102078,48.4458716 L68.4937877,48.6340507 L98.8972485,122.034498 C99.7426494,124.075476 98.7734424,126.415349 96.7324641,127.26075 C94.7552664,128.079732 92.4975633,127.195747 91.5897922,125.284145 L91.5062123,125.095966 L88.403,117.605598 L79.5048497,126.50485 C78.775871,127.233828 77.8355254,127.622617 76.8810886,127.671216 L76.6764226,127.676423 C75.6527333,127.676423 74.6290441,127.285898 73.8479955,126.50485 L63.999,116.656598 L54.1520045,126.50485 C53.4230259,127.233828 52.4826802,127.622617 51.5282434,127.671216 L51.3235774,127.676423 C50.2998881,127.676423 49.2761989,127.285898 48.4951503,126.50485 L39.596,117.605598 L36.4937877,125.095966 C35.6483868,127.136944 33.3085142,128.106151 31.2675359,127.26075 C29.2265576,126.415349 28.2573506,124.075476 29.1027515,122.034498 L59.5062123,48.6340507 C60.2518688,46.8338766 62.1601511,45.867488 64.0005148,46.2445933 L64.0434107,46.2358498 Z M77.679,102.976598 L69.656,110.999598 L76.676,118.018598 L84.699,109.996598 L77.679,102.976598 Z M50.326,102.983598 L43.307,110.002598 L51.323,118.018598 L58.342,110.999598 L50.326,102.983598 Z M64.006,89.3035977 L55.983,97.3265977 L63.999,105.342598 L72.022,97.3195977 L64.006,89.3035977 Z M55.035,80.3325977 L50.348,91.6475977 L58.349,83.6465977 L55.035,80.3325977 Z M72.968,80.3415977 L69.663,83.6465977 L77.642,91.6255977 L72.968,80.3415977 Z M64,58.6895977 L58.3344072,72.3699713 C58.4295481,72.4423583 58.5221874,72.5195778 58.6119911,72.6016299 L58.7445283,72.7283325 L64.006,77.9895977 L69.2684411,72.7283325 C69.3957231,72.6010505 69.5294489,72.4841397 69.6685683,72.3775999 L64,58.6895977 Z M38.5026635,2.59571369 C40.7118025,2.59571369 42.5026635,4.38657469 42.5026635,6.59571369 C42.5026635,7.7643162 42.0015346,8.8158738 41.2024517,9.54721162 L41.372583,9.372583 C35.581722,15.163444 32,23.163444 32,32 C32,40.8370609 35.5821314,48.8374703 41.3735757,54.6284097 C42.0884306,55.3520538 42.531226,56.3471171 42.531226,57.4456008 C42.531226,59.6547398 40.740365,61.4456008 38.531226,61.4456008 C37.4327422,61.4456008 36.4376789,61.0028055 35.7147885,60.2859673 L35.7048234,60.2963403 C28.472656,53.0586276 24,43.0631255 24,32.0229786 C24,21.1046577 28.3744907,11.2080539 35.4664167,3.99022262 C36.2004724,3.13678606 37.2883808,2.59571369 38.5026635,2.59571369 Z M89.3688013,2.48959773 C90.5097745,2.48959773 91.5391719,2.96731026 92.2678917,3.73363348 L92.2733617,3.72780197 C99.5183488,10.9672382 104,20.9717355 104,32.0229786 C104,42.8488024 99.6993143,52.6701472 92.7132398,59.8717162 C91.9816831,60.8152368 90.8371876,61.4223982 89.5508819,61.4223982 C87.3417429,61.4223982 85.5508819,59.6315372 85.5508819,57.4223982 C85.5508819,56.3502862 85.9726717,55.3766885 86.6593633,54.6584932 L86.627417,54.627417 C92.418278,48.836556 96,40.836556 96,32 C96,23.2702193 92.5043135,15.3568999 86.8363661,9.5834674 C85.9399594,8.85136737 85.3688013,7.73718311 85.3688013,6.48959773 C85.3688013,4.28045873 87.1596623,2.48959773 89.3688013,2.48959773 Z M50.0871028,13.6297119 C52.2962418,13.6297119 54.0871028,15.4205729 54.0871028,17.6297119 C54.0871028,18.8506134 53.5401157,19.9437593 52.6778337,20.6774573 L52.6862915,20.6862915 C49.790861,23.581722 48,27.581722 48,32 C48,36.4187838 49.791271,40.4191937 52.6872859,43.3147028 L52.6777105,43.3251493 C53.4423082,44.0537041 53.918794,45.0819221 53.918794,46.2214294 C53.918794,48.4305684 52.127933,50.2214294 49.918794,50.2214294 C48.6900999,50.2214294 47.5907975,49.6674376 46.8570439,48.7956109 L47.0304281,48.9715536 C42.6867001,44.6283295 40,38.627921 40,32 C40,25.372583 42.6862915,19.372583 47.0294373,15.0294373 L47.0395567,15.0387468 C47.7732533,14.1766 48.8663118,13.6297119 50.0871028,13.6297119 Z M77.9823819,13.700452 C79.1679628,13.700452 80.2330731,14.2162483 80.9655529,15.0356811 L80.9715536,15.0304281 C85.314117,19.3734956 88,25.373087 88,32 C88,38.4619387 85.4461804,44.3274009 81.2927766,48.6421512 L80.9933974,48.9476975 C80.2638884,49.7186971 79.2309977,50.2000547 78.08568,50.2000547 C75.876541,50.2000547 74.08568,48.4091937 74.08568,46.2000547 C74.08568,45.0665777 74.557136,44.0432152 75.314649,43.3153662 L75.3137085,43.3137085 C78.209139,40.418278 80,36.418278 80,32 C80,27.5822253 78.209547,23.5826334 75.314698,20.6872811 C74.4981782,19.9511432 73.9823819,18.8860329 73.9823819,17.700452 C73.9823819,15.491313 75.7732429,13.700452 77.9823819,13.700452 Z M64,24 C68.418278,24 72,27.581722 72,32 C72,36.418278 68.418278,40 64,40 C59.581722,40 56,36.418278 56,32 C56,27.581722 59.581722,24 64,24 Z\"></path>\n </g>\n</svg>"
},
"$:/core/images/quote": {
"title": "$:/core/images/quote",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-quote tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M51.219 117.713V62.199H27.427c0-8.891 1.683-16.401 5.047-22.53 3.365-6.127 9.613-10.754 18.745-13.878V2c-7.45.961-14.36 3.184-20.728 6.669-6.368 3.484-11.835 7.87-16.401 13.157C9.524 27.113 5.98 33.241 3.456 40.21.933 47.18-.21 54.63.03 62.56v55.153H51.22zm76.781 0V62.199h-23.791c0-8.891 1.682-16.401 5.046-22.53 3.365-6.127 9.613-10.754 18.745-13.878V2c-7.45.961-14.359 3.184-20.727 6.669-6.369 3.484-11.836 7.87-16.402 13.157-4.566 5.287-8.11 11.415-10.634 18.384-2.523 6.97-3.665 14.42-3.424 22.35v55.153H128z\"/></svg>"
},
"$:/core/images/refresh-button": {
"title": "$:/core/images/refresh-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-refresh-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M106.369 39.433c10.16 20.879 6.57 46.764-10.771 64.106-21.87 21.87-57.327 21.87-79.196 0-21.87-21.87-21.87-57.326 0-79.196a8 8 0 1111.314 11.314c-15.621 15.62-15.621 40.947 0 56.568 15.62 15.621 40.947 15.621 56.568 0C97.72 78.79 99.6 58.175 89.924 42.73l-6.44 12.264a8 8 0 11-14.166-7.437L84.435 18.76a8 8 0 0110.838-3.345l28.873 15.345a8 8 0 11-7.51 14.129l-10.267-5.457zm-8.222-12.368c-.167-.19-.336-.38-.506-.57l.96-.296-.454.866z\"/></svg>"
},
"$:/core/images/right-arrow": {
"title": "$:/core/images/right-arrow",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-right-arrow tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M99.069 64.173c0 2.027-.77 4.054-2.316 5.6l-55.98 55.98a7.92 7.92 0 01-11.196 0c-3.085-3.086-3.092-8.105 0-11.196l50.382-50.382-50.382-50.382a7.92 7.92 0 010-11.195c3.086-3.085 8.104-3.092 11.196 0l55.98 55.98a7.892 7.892 0 012.316 5.595z\"/></svg>"
},
"$:/core/images/rotate-left": {
"title": "$:/core/images/rotate-left",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-rotate-left tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"32\" height=\"80\" rx=\"8\"/><rect width=\"80\" height=\"32\" x=\"48\" y=\"96\" rx=\"8\"/><path d=\"M61.32 36.65c19.743 2.45 35.023 19.287 35.023 39.693a4 4 0 01-8 0c0-15.663-11.254-28.698-26.117-31.46l3.916 3.916a4 4 0 11-5.657 5.657L49.172 43.142a4 4 0 010-5.657l11.313-11.313a4 4 0 115.657 5.656l-4.821 4.822z\"/></g></svg>"
},
"$:/core/images/save-button": {
"title": "$:/core/images/save-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-save-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M120.783 34.33c4.641 8.862 7.266 18.948 7.266 29.646 0 35.347-28.653 64-64 64-35.346 0-64-28.653-64-64 0-35.346 28.654-64 64-64 18.808 0 35.72 8.113 47.43 21.03l2.68-2.68c3.13-3.13 8.197-3.132 11.321-.008 3.118 3.118 3.121 8.193-.007 11.32l-4.69 4.691zm-12.058 12.058a47.876 47.876 0 013.324 17.588c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48c14.39 0 27.3 6.332 36.098 16.362L58.941 73.544 41.976 56.578c-3.127-3.127-8.201-3.123-11.32-.005-3.123 3.124-3.119 8.194.006 11.319l22.617 22.617a7.992 7.992 0 005.659 2.347c2.05 0 4.101-.783 5.667-2.349l44.12-44.12z\"/></svg>"
},
"$:/core/images/size": {
"title": "$:/core/images/size",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-size tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M92.343 26l-9.171 9.172a4 4 0 105.656 5.656l16-16a4 4 0 000-5.656l-16-16a4 4 0 10-5.656 5.656L92.343 18H22a4 4 0 00-4 4v70.343l-9.172-9.171a4 4 0 10-5.656 5.656l16 16a4 4 0 005.656 0l16-16a4 4 0 10-5.656-5.656L26 92.343V22l-4 4h70.343zM112 52v64l4-4H52a4 4 0 100 8h64a4 4 0 004-4V52a4 4 0 10-8 0z\"/></svg>"
},
"$:/core/images/spiral": {
"title": "$:/core/images/spiral",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-spiral tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M64.534 68.348c3.39 0 6.097-2.62 6.476-5.968l-4.755-.538 4.75.583c.377-3.07-1.194-6.054-3.89-7.78-2.757-1.773-6.34-2.01-9.566-.7-3.46 1.403-6.14 4.392-7.35 8.148l-.01.026c-1.3 4.08-.72 8.64 1.58 12.52 2.5 4.2 6.77 7.2 11.76 8.27 5.37 1.15 11.11-.05 15.83-3.31 5.04-3.51 8.46-9.02 9.45-15.3 1.05-6.7-.72-13.63-4.92-19.19l.02.02c-4.42-5.93-11.2-9.82-18.78-10.78-7.96-1.01-16.13 1.31-22.59 6.43-6.81 5.39-11.18 13.41-12.11 22.26-.98 9.27 1.87 18.65 7.93 26.02 6.32 7.69 15.6 12.56 25.74 13.48 10.54.96 21.15-2.42 29.45-9.4l.01-.01c8.58-7.25 13.94-17.78 14.86-29.21.94-11.84-2.96-23.69-10.86-32.9-8.19-9.5-19.95-15.36-32.69-16.27-13.16-.94-26.24 3.49-36.34 12.34l.01-.01c-10.41 9.08-16.78 22.1-17.68 36.15-.93 14.44 4.03 28.77 13.79 39.78 10.03 11.32 24.28 18.2 39.6 19.09 15.73.92 31.31-4.56 43.24-15.234 12.23-10.954 19.61-26.44 20.5-43.074a4.785 4.785 0 00-4.52-5.03 4.778 4.778 0 00-5.03 4.52c-.75 14.1-7 27.2-17.33 36.45-10.03 8.98-23.11 13.58-36.3 12.81-12.79-.75-24.67-6.48-33-15.89-8.07-9.11-12.17-20.94-11.41-32.827.74-11.52 5.942-22.15 14.43-29.54l.01-.01c8.18-7.17 18.74-10.75 29.35-9.998 10.21.726 19.6 5.41 26.11 12.96 6.24 7.273 9.32 16.61 8.573 25.894-.718 8.9-4.88 17.064-11.504 22.66l.01-.007c-6.36 5.342-14.44 7.92-22.425 7.19-7.604-.68-14.52-4.314-19.21-10.027-4.44-5.4-6.517-12.23-5.806-18.94.67-6.3 3.76-11.977 8.54-15.766 4.46-3.54 10.05-5.128 15.44-4.44 5.03.63 9.46 3.18 12.32 7.01l.02.024c2.65 3.5 3.75 7.814 3.1 11.92-.59 3.71-2.58 6.925-5.45 8.924-2.56 1.767-5.61 2.403-8.38 1.81-2.42-.516-4.42-1.92-5.53-3.79-.93-1.56-1.15-3.3-.69-4.75l-4.56-1.446L59.325 65c.36-1.12 1.068-1.905 1.84-2.22.25-.103.48-.14.668-.13.06.006.11.015.14.025.01 0 .01 0-.01-.01a1.047 1.047 0 01-.264-.332c-.15-.29-.23-.678-.18-1.11l-.005.04c.15-1.332 1.38-2.523 3.035-2.523-2.65 0-4.79 2.144-4.79 4.787s2.14 4.785 4.78 4.785z\"/></svg>"
},
"$:/core/images/stamp": {
"title": "$:/core/images/stamp",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-stamp tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M49.733 64H16.01C11.584 64 8 67.583 8 72.003V97h112V72.003A8 8 0 00111.99 64H78.267A22.813 22.813 0 0175.5 53.077c0-6.475 2.687-12.324 7.009-16.497A22.818 22.818 0 0087 22.952C87 10.276 76.703 0 64 0S41 10.276 41 22.952c0 5.103 1.669 9.817 4.491 13.628 4.322 4.173 7.009 10.022 7.009 16.497 0 3.954-1.002 7.675-2.767 10.923zM8 104h112v8H8v-8z\"/></svg>"
},
"$:/core/images/star-filled": {
"title": "$:/core/images/star-filled",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-star-filled tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M61.836 96.823l37.327 27.287c2.72 1.99 6.379-.69 5.343-3.912L90.29 75.988l-1.26 3.91 37.285-27.345c2.718-1.993 1.32-6.327-2.041-6.33l-46.113-.036 3.3 2.416L67.176 4.416c-1.04-3.221-5.563-3.221-6.604 0L46.29 48.603l3.3-2.416-46.113.036c-3.362.003-4.759 4.337-2.04 6.33L38.72 79.898l-1.26-3.91-14.216 44.21c-1.036 3.223 2.622 5.901 5.343 3.912l37.326-27.287h-4.078z\"/></svg>"
},
"$:/core/images/storyview-classic": {
"title": "$:/core/images/storyview-classic",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-storyview-classic tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M8.007 0A8.01 8.01 0 000 8.007v111.986A8.01 8.01 0 008.007 128h111.986a8.01 8.01 0 008.007-8.007V8.007A8.01 8.01 0 00119.993 0H8.007zm15.992 16C19.581 16 16 19.578 16 23.992v16.016C16 44.422 19.588 48 24 48h80c4.419 0 8-3.578 8-7.992V23.992c0-4.414-3.588-7.992-8-7.992H24zm0 48C19.581 64 16 67.59 16 72c0 4.418 3.588 8 8 8h80c4.419 0 8-3.59 8-8 0-4.418-3.588-8-8-8H24zm0 32C19.581 96 16 99.59 16 104c0 4.418 3.588 8 8 8h80c4.419 0 8-3.59 8-8 0-4.418-3.588-8-8-8H24z\"/></svg>"
},
"$:/core/images/storyview-pop": {
"title": "$:/core/images/storyview-pop",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-storyview-pop tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M8.007 0A8.01 8.01 0 000 8.007v111.986A8.01 8.01 0 008.007 128h111.986a8.01 8.01 0 008.007-8.007V8.007A8.01 8.01 0 00119.993 0H8.007zm15.992 16C19.581 16 16 19.578 16 23.992v16.016C16 44.422 19.588 48 24 48h80c4.419 0 8-3.578 8-7.992V23.992c0-4.414-3.588-7.992-8-7.992H24zm-7.99 40C11.587 56 8 59.578 8 63.992v16.016C8 84.422 11.584 88 16.01 88h95.98c4.424 0 8.01-3.578 8.01-7.992V63.992c0-4.414-3.584-7.992-8.01-7.992H16.01zM24 96C19.581 96 16 99.59 16 104c0 4.418 3.588 8 8 8h80c4.419 0 8-3.59 8-8 0-4.418-3.588-8-8-8H24zm0-32C19.581 64 16 67.59 16 72c0 4.418 3.588 8 8 8h80c4.419 0 8-3.59 8-8 0-4.418-3.588-8-8-8H24z\"/></svg>"
},
"$:/core/images/storyview-zoomin": {
"title": "$:/core/images/storyview-zoomin",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-storyview-zoomin tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M8.007 0A8.01 8.01 0 000 8.007v111.986A8.01 8.01 0 008.007 128h111.986a8.01 8.01 0 008.007-8.007V8.007A8.01 8.01 0 00119.993 0H8.007zm15.992 16A8 8 0 0016 24.009V71.99C16 76.414 19.588 80 24 80h80a8 8 0 008-8.009V24.01c0-4.423-3.588-8.009-8-8.009H24z\"/></svg>"
},
"$:/core/images/strikethrough": {
"title": "$:/core/images/strikethrough",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-strikethrough tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M92.794 38.726h15.422c-.229-6.74-1.514-12.538-3.856-17.393-2.342-4.855-5.54-8.881-9.596-12.08-4.055-3.199-8.767-5.54-14.136-7.025C75.258.743 69.433 0 63.15 0a62.76 62.76 0 00-16.364 2.142C41.474 3.57 36.733 5.74 32.564 8.653c-4.17 2.913-7.511 6.626-10.025 11.138-2.513 4.512-3.77 9.853-3.77 16.022 0 5.597 1.115 10.252 3.342 13.965 2.228 3.712 5.198 6.74 8.91 9.081 3.713 2.342 7.911 4.227 12.595 5.655a194.641 194.641 0 0014.308 3.77c4.855 1.085 9.624 2.142 14.308 3.17 4.683 1.028 8.881 2.37 12.594 4.027 3.713 1.656 6.683 3.798 8.91 6.425 2.228 2.628 3.342 6.055 3.342 10.281 0 4.456-.914 8.111-2.742 10.967a19.953 19.953 0 01-7.197 6.768c-2.97 1.657-6.311 2.828-10.024 3.513a60.771 60.771 0 01-11.052 1.028c-4.57 0-9.025-.571-13.366-1.713-4.34-1.143-8.139-2.913-11.394-5.312-3.256-2.4-5.884-5.455-7.883-9.168-1.999-3.712-2.998-8.139-2.998-13.28H15c0 7.426 1.342 13.852 4.027 19.278 2.684 5.426 6.34 9.881 10.966 13.365 4.627 3.484 9.996 6.083 16.107 7.797 6.112 1.713 12.595 2.57 19.449 2.57 5.597 0 11.223-.657 16.878-1.97 5.655-1.314 10.767-3.428 15.336-6.34 4.57-2.914 8.31-6.683 11.224-11.31 2.913-4.626 4.37-10.195 4.37-16.707 0-6.054-1.115-11.08-3.342-15.079-2.228-3.998-5.198-7.31-8.91-9.938-3.713-2.627-7.911-4.712-12.595-6.254a170.83 170.83 0 00-14.308-4.027 549.669 549.669 0 00-14.308-3.17c-4.683-.971-8.881-2.2-12.594-3.684-3.713-1.485-6.683-3.399-8.91-5.74-2.228-2.342-3.342-5.398-3.342-9.168 0-3.998.771-7.34 2.313-10.024 1.543-2.685 3.599-4.826 6.17-6.426 2.57-1.599 5.51-2.741 8.824-3.427a49.767 49.767 0 0110.11-1.028c8.453 0 15.393 1.97 20.819 5.912 5.426 3.94 8.596 10.31 9.51 19.106z\"/><path d=\"M5 54h118v16H5z\"/></g></svg>"
},
"$:/core/images/subscript": {
"title": "$:/core/images/subscript",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-subscript tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M2.272 16h19.91l21.649 33.675L66.414 16h18.708L53.585 61.969l33.809 49.443H67.082L43.296 74.93l-24.187 36.48H0L33.808 61.97 2.272 16zM127.91 128.412H85.328c.059-5.168 1.306-9.681 3.741-13.542 2.435-3.86 5.761-7.216 9.978-10.066a112.388 112.388 0 016.325-4.321 50.09 50.09 0 006.058-4.499c1.841-1.603 3.356-3.34 4.543-5.211 1.188-1.871 1.812-4.024 1.871-6.46 0-1.128-.133-2.33-.4-3.607a9.545 9.545 0 00-1.56-3.564c-.772-1.098-1.84-2.019-3.207-2.761-1.366-.743-3.148-1.114-5.345-1.114-2.02 0-3.697.4-5.033 1.203-1.337.801-2.406 1.9-3.208 3.296-.801 1.396-1.395 3.044-1.781 4.944-.386 1.9-.609 3.95-.668 6.147H86.486c0-3.445.46-6.637 1.38-9.577.921-2.94 2.302-5.478 4.143-7.617 1.841-2.138 4.083-3.815 6.726-5.033 2.643-1.217 5.716-1.826 9.22-1.826 3.802 0 6.979.623 9.533 1.87 2.554 1.248 4.617 2.822 6.191 4.722 1.574 1.9 2.688 3.965 3.341 6.192.653 2.227.98 4.35.98 6.37 0 2.494-.386 4.75-1.158 6.77a21.803 21.803 0 01-3.118 5.568 31.516 31.516 0 01-4.454 4.677 66.788 66.788 0 01-5.167 4.009 139.198 139.198 0 01-5.346 3.563 79.237 79.237 0 00-4.944 3.386c-1.514 1.128-2.836 2.3-3.964 3.518-1.129 1.218-1.9 2.51-2.317 3.876h30.379v9.087z\"/></svg>"
},
"$:/core/images/superscript": {
"title": "$:/core/images/superscript",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-superscript tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M2.272 16h19.91l21.649 33.675L66.414 16h18.708L53.585 61.969l33.809 49.443H67.082L43.296 74.93l-24.187 36.48H0L33.808 61.97 2.272 16zM127.91 63.412H85.328c.059-5.168 1.306-9.681 3.741-13.542 2.435-3.86 5.761-7.216 9.978-10.066a112.388 112.388 0 016.325-4.321 50.09 50.09 0 006.058-4.499c1.841-1.603 3.356-3.34 4.543-5.211 1.188-1.871 1.812-4.024 1.871-6.46 0-1.128-.133-2.33-.4-3.607a9.545 9.545 0 00-1.56-3.564c-.772-1.098-1.84-2.019-3.207-2.761-1.366-.743-3.148-1.114-5.345-1.114-2.02 0-3.697.4-5.033 1.203-1.337.801-2.406 1.9-3.208 3.296-.801 1.396-1.395 3.044-1.781 4.944-.386 1.9-.609 3.95-.668 6.147H86.486c0-3.445.46-6.637 1.38-9.577.921-2.94 2.302-5.478 4.143-7.617 1.841-2.138 4.083-3.815 6.726-5.033 2.643-1.217 5.716-1.826 9.22-1.826 3.802 0 6.979.623 9.533 1.87 2.554 1.248 4.617 2.822 6.191 4.722 1.574 1.9 2.688 3.965 3.341 6.192.653 2.227.98 4.35.98 6.37 0 2.494-.386 4.75-1.158 6.77a21.803 21.803 0 01-3.118 5.568 31.516 31.516 0 01-4.454 4.677 66.788 66.788 0 01-5.167 4.009 139.198 139.198 0 01-5.346 3.563 79.237 79.237 0 00-4.944 3.386c-1.514 1.128-2.836 2.3-3.964 3.518-1.129 1.218-1.9 2.51-2.317 3.876h30.379v9.087z\"/></svg>"
},
"$:/core/images/tag-button": {
"title": "$:/core/images/tag-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-tag-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M18.164 47.66l.004 4.105c.003 3.823 2.19 9.097 4.885 11.792l61.85 61.85c2.697 2.697 7.068 2.69 9.769-.01L125.767 94.3a6.903 6.903 0 00.01-9.77L63.928 22.683c-2.697-2.697-7.976-4.88-11.796-4.881l-27.076-.007a6.902 6.902 0 00-6.91 6.91l.008 9.96.287.033c3.73.411 8.489-.044 13.365-1.153a9.702 9.702 0 0111.14-3.662l.291-.13.128.285a9.7 9.7 0 013.3 2.17c3.796 3.796 3.801 9.945.012 13.734-3.618 3.618-9.386 3.777-13.204.482-5.365 1.122-10.674 1.596-15.309 1.237z\"/><path d=\"M47.633 39.532l.023.051c-9.689 4.356-21.584 6.799-30.396 5.828C5.273 44.089-1.028 36.43 2.443 24.078 5.562 12.976 14.3 4.361 24.047 1.548c10.68-3.083 19.749 1.968 19.749 13.225h-8.623c0-4.859-3.078-6.573-8.735-4.94-6.91 1.995-13.392 8.383-15.694 16.577-1.915 6.818.417 9.653 7.46 10.43 7.126.785 17.531-1.352 25.917-5.121l.027.06.036-.017c1.76-.758 6.266 6.549 3.524 7.74a2.8 2.8 0 01-.075.03z\"/></g></svg>"
},
"$:/core/images/theme-button": {
"title": "$:/core/images/theme-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-theme-button tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M55.854 66.945a122.626 122.626 0 01-3.9-4.819c-11.064-14.548-16.645-6.888-22.96 0-6.315 6.888 1.664 12.47-4.33 17.335-5.993 4.866-5.623 6.552-15.737-2.35-10.115-8.9-10.815-11.351-6.172-16.43 4.644-5.08 8.524 2.918 18.01-6.108 9.485-9.026 1.517-17.026 1.517-17.026S42.03-2.824 68.42.157c26.39 2.982-9.984-3.86-19.031 27.801-3.874 13.556.72 10.362 8.066 16.087 1.707 1.33 6.428 4.732 12.671 9.318-6.129 5.879-11.157 10.669-14.273 13.582zm11.641 12.947c16.013 17.036 37.742 37.726 45.117 40.42 10.432 3.813 15.388-3.141 15.388-14.79 0-7.151-23.83-26.542-43.924-41.769-7.408 7.156-13.376 12.953-16.58 16.139z\"/><path d=\"M11.069 109.828L46.31 74.587a3.56 3.56 0 115.037-5.032l15.098 15.098a3.56 3.56 0 11-5.032 5.037l-35.24 35.241c-4.171 4.17-10.933 4.17-15.104 0-4.17-4.17-4.17-10.933 0-15.103zM124.344 6.622l5.034 5.034-7.49 12.524-7.613 2.58L61.413 79.62l-5.034-5.034 52.861-52.862 2.58-7.614 12.524-7.49z\"/></g></svg>"
},
"$:/core/images/timestamp-off": {
"title": "$:/core/images/timestamp-off",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-timestamp-off tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M58.25 11C26.08 11 0 37.082 0 69.25s26.08 58.25 58.25 58.25c32.175 0 58.25-26.082 58.25-58.25S90.425 11 58.25 11zm0 100.5C34.914 111.5 16 92.586 16 69.25 16 45.92 34.914 27 58.25 27s42.25 18.92 42.25 42.25c0 23.336-18.914 42.25-42.25 42.25zM49.704 10a5 5 0 010-10H66.69a5 5 0 015 5c.006 2.757-2.238 5-5 5H49.705z\"/><path d=\"M58.25 35.88c-18.777 0-33.998 15.224-33.998 33.998 0 18.773 15.22 34.002 33.998 34.002 18.784 0 34.002-15.23 34.002-34.002 0-18.774-15.218-33.998-34.002-33.998zm-3.03 50.123H44.196v-34H55.22v34zm16.976 0H61.17v-34h11.025v34z\"/></g></svg>"
},
"$:/core/images/timestamp-on": {
"title": "$:/core/images/timestamp-on",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-timestamp-on tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><path d=\"M58.25 11C26.08 11 0 37.082 0 69.25s26.08 58.25 58.25 58.25c32.175 0 58.25-26.082 58.25-58.25S90.425 11 58.25 11zm0 100.5C34.914 111.5 16 92.586 16 69.25 16 45.92 34.914 27 58.25 27s42.25 18.92 42.25 42.25c0 23.336-18.914 42.25-42.25 42.25zM49.704 10a5 5 0 010-10H66.69a5 5 0 015 5c.006 2.757-2.238 5-5 5H49.705z\"/><path d=\"M13.41 27.178a5.005 5.005 0 01-7.045-.613 5.008 5.008 0 01.616-7.047l9.95-8.348a5 5 0 016.429 7.661l-9.95 8.348zm89.573 0a5.005 5.005 0 007.045-.613 5.008 5.008 0 00-.616-7.047l-9.95-8.348a5 5 0 00-6.428 7.661l9.95 8.348zM65.097 71.072c0 3.826-3.09 6.928-6.897 6.928-3.804.006-6.9-3.102-6.903-6.928 0 0 4.76-39.072 6.903-39.072s6.897 39.072 6.897 39.072z\"/></g></svg>"
},
"$:/core/images/tip": {
"title": "$:/core/images/tip",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-tip tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M64 128.242c35.346 0 64-28.654 64-64 0-35.346-28.654-64-64-64-35.346 0-64 28.654-64 64 0 35.346 28.654 64 64 64zm11.936-36.789c-.624 4.129-5.73 7.349-11.936 7.349-6.206 0-11.312-3.22-11.936-7.349C54.33 94.05 58.824 95.82 64 95.82c5.175 0 9.67-1.769 11.936-4.366zm0 4.492c-.624 4.13-5.73 7.349-11.936 7.349-6.206 0-11.312-3.22-11.936-7.349 2.266 2.597 6.76 4.366 11.936 4.366 5.175 0 9.67-1.769 11.936-4.366zm0 4.456c-.624 4.129-5.73 7.349-11.936 7.349-6.206 0-11.312-3.22-11.936-7.349 2.266 2.597 6.76 4.366 11.936 4.366 5.175 0 9.67-1.769 11.936-4.366zm0 4.492c-.624 4.13-5.73 7.349-11.936 7.349-6.206 0-11.312-3.22-11.936-7.349 2.266 2.597 6.76 4.366 11.936 4.366 5.175 0 9.67-1.769 11.936-4.366zM64.3 24.242c11.618 0 23.699 7.82 23.699 24.2S75.92 71.754 75.92 83.576c0 5.873-5.868 9.26-11.92 9.26s-12.027-3.006-12.027-9.26C51.973 71.147 40 65.47 40 48.442s12.683-24.2 24.301-24.2z\"/></svg>"
},
"$:/core/images/transcludify": {
"title": "$:/core/images/transcludify",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-transcludify-button tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M0 59.482c.591 0 1.36-.089 2.306-.266a10.417 10.417 0 002.75-.932 6.762 6.762 0 002.306-1.907c.651-.828.976-1.863.976-3.104V35.709c0-2.01.414-3.74 1.242-5.19.828-1.448 1.833-2.66 3.016-3.636s2.425-1.7 3.726-2.173c1.3-.473 2.424-.71 3.37-.71h8.073v7.451h-4.88c-1.241 0-2.232.207-2.97.621-.74.414-1.302.932-1.686 1.552a4.909 4.909 0 00-.71 1.996c-.089.71-.133 1.39-.133 2.04v16.677c0 1.715-.325 3.134-.976 4.258-.65 1.123-1.434 2.025-2.35 2.705-.917.68-1.863 1.168-2.839 1.464-.976.296-1.818.473-2.528.532v.178c.71.059 1.552.207 2.528.443.976.237 1.922.68 2.839 1.33.916.651 1.7 1.583 2.35 2.795.65 1.212.976 2.853.976 4.923v16.144c0 .65.044 1.33.133 2.04.089.71.325 1.375.71 1.996.384.621.946 1.139 1.685 1.553.74.414 1.73.62 2.972.62h4.879v7.452h-8.073c-.946 0-2.07-.237-3.37-.71-1.301-.473-2.543-1.197-3.726-2.173-1.183-.976-2.188-2.188-3.016-3.637-.828-1.449-1.242-3.179-1.242-5.19V74.119c0-1.42-.325-2.572-.976-3.46-.65-.886-1.419-1.581-2.306-2.084a8.868 8.868 0 00-2.75-1.02C1.36 67.377.591 67.288 0 67.288v-7.806zm24.66 0c.591 0 1.36-.089 2.306-.266a10.417 10.417 0 002.75-.932 6.762 6.762 0 002.306-1.907c.65-.828.976-1.863.976-3.104V35.709c0-2.01.414-3.74 1.242-5.19.828-1.448 1.833-2.66 3.016-3.636s2.425-1.7 3.726-2.173c1.3-.473 2.424-.71 3.37-.71h8.073v7.451h-4.88c-1.241 0-2.232.207-2.97.621-.74.414-1.302.932-1.686 1.552a4.909 4.909 0 00-.71 1.996c-.089.71-.133 1.39-.133 2.04v16.677c0 1.715-.325 3.134-.976 4.258-.65 1.123-1.434 2.025-2.35 2.705-.917.68-1.863 1.168-2.839 1.464-.976.296-1.818.473-2.528.532v.178c.71.059 1.552.207 2.528.443.976.237 1.922.68 2.839 1.33.916.651 1.7 1.583 2.35 2.795.65 1.212.976 2.853.976 4.923v16.144c0 .65.044 1.33.133 2.04.089.71.325 1.375.71 1.996.384.621.946 1.139 1.685 1.553.74.414 1.73.62 2.972.62h4.879v7.452h-8.073c-.946 0-2.07-.237-3.37-.71-1.301-.473-2.543-1.197-3.726-2.173-1.183-.976-2.188-2.188-3.016-3.637-.828-1.449-1.242-3.179-1.242-5.19V74.119c0-1.42-.325-2.572-.976-3.46-.65-.886-1.419-1.581-2.306-2.084a8.868 8.868 0 00-2.75-1.02c-.946-.177-1.715-.266-2.306-.266v-7.806zm43.965-3.538L80.6 52.041l2.306 7.097-12.063 3.903 7.628 10.378-6.12 4.435-7.63-10.467-7.45 10.201-5.943-4.524 7.628-10.023-12.152-4.17 2.306-7.096 12.064 4.17V43.347h7.451v12.596zm34.425 11.344c-.65 0-1.449.089-2.395.266-.946.177-1.863.488-2.75.931a6.356 6.356 0 00-2.262 1.908c-.62.828-.931 1.862-.931 3.104v17.564c0 2.01-.414 3.74-1.242 5.189-.828 1.449-1.833 2.661-3.016 3.637s-2.425 1.7-3.726 2.173c-1.3.473-2.424.71-3.37.71h-8.073v-7.451h4.88c1.241 0 2.232-.207 2.97-.621.74-.414 1.302-.932 1.686-1.553a4.9 4.9 0 00.71-1.995c.089-.71.133-1.39.133-2.04V72.432c0-1.715.325-3.134.976-4.258.65-1.124 1.434-2.01 2.35-2.661.917-.65 1.863-1.124 2.839-1.42.976-.295 1.818-.502 2.528-.62v-.178c-.71-.059-1.552-.207-2.528-.443-.976-.237-1.922-.68-2.839-1.33-.916-.651-1.7-1.583-2.35-2.795-.65-1.212-.976-2.853-.976-4.923V37.66c0-.651-.044-1.331-.133-2.04a4.909 4.909 0 00-.71-1.997c-.384-.62-.946-1.138-1.685-1.552-.74-.414-1.73-.62-2.972-.62h-4.879V24h8.073c.946 0 2.07.237 3.37.71 1.301.473 2.543 1.197 3.726 2.173 1.183.976 2.188 2.188 3.016 3.637.828 1.449 1.242 3.178 1.242 5.189v16.943c0 1.419.31 2.572.931 3.46a6.897 6.897 0 002.262 2.084 8.868 8.868 0 002.75 1.02c.946.177 1.745.266 2.395.266v7.806zm24.66 0c-.65 0-1.449.089-2.395.266-.946.177-1.863.488-2.75.931a6.356 6.356 0 00-2.262 1.908c-.62.828-.931 1.862-.931 3.104v17.564c0 2.01-.414 3.74-1.242 5.189-.828 1.449-1.833 2.661-3.016 3.637s-2.425 1.7-3.726 2.173c-1.3.473-2.424.71-3.37.71h-8.073v-7.451h4.88c1.241 0 2.232-.207 2.97-.621.74-.414 1.302-.932 1.686-1.553a4.9 4.9 0 00.71-1.995c.089-.71.133-1.39.133-2.04V72.432c0-1.715.325-3.134.976-4.258.65-1.124 1.434-2.01 2.35-2.661.917-.65 1.863-1.124 2.839-1.42.976-.295 1.818-.502 2.528-.62v-.178c-.71-.059-1.552-.207-2.528-.443-.976-.237-1.922-.68-2.839-1.33-.916-.651-1.7-1.583-2.35-2.795-.65-1.212-.976-2.853-.976-4.923V37.66c0-.651-.044-1.331-.133-2.04a4.909 4.909 0 00-.71-1.997c-.384-.62-.946-1.138-1.685-1.552-.74-.414-1.73-.62-2.972-.62h-4.879V24h8.073c.946 0 2.07.237 3.37.71 1.301.473 2.543 1.197 3.726 2.173 1.183.976 2.188 2.188 3.016 3.637.828 1.449 1.242 3.178 1.242 5.189v16.943c0 1.419.31 2.572.931 3.46a6.897 6.897 0 002.262 2.084 8.868 8.868 0 002.75 1.02c.946.177 1.745.266 2.395.266v7.806z\"/></svg>"
},
"$:/core/images/twitter": {
"title": "$:/core/images/twitter",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-twitter tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M41.626 115.803A73.376 73.376 0 012 104.235c2.022.238 4.08.36 6.166.36 12.111 0 23.258-4.117 32.105-11.023-11.312-.208-20.859-7.653-24.148-17.883a25.98 25.98 0 0011.674-.441C15.971 72.881 7.061 62.474 7.061 49.997c0-.108 0-.216.002-.323a25.824 25.824 0 0011.709 3.22c-6.936-4.617-11.5-12.5-11.5-21.433 0-4.719 1.274-9.142 3.5-12.945 12.75 15.579 31.797 25.83 53.281 26.904-.44-1.884-.67-3.85-.67-5.868 0-14.22 11.575-25.75 25.852-25.75a25.865 25.865 0 0118.869 8.132 51.892 51.892 0 0016.415-6.248c-1.93 6.012-6.029 11.059-11.366 14.246A51.844 51.844 0 00128 25.878a52.428 52.428 0 01-12.9 13.33c.05 1.104.075 2.214.075 3.33 0 34.028-26 73.265-73.549 73.265\"/></svg>"
},
"$:/core/images/underline": {
"title": "$:/core/images/underline",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-underline tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M7 117.421h114.248V128H7v-10.579zm97.871-18.525V0h-16.26v55.856c0 4.463-.605 8.576-1.816 12.338-1.212 3.762-3.03 7.046-5.452 9.851-2.423 2.806-5.452 4.974-9.086 6.504-3.635 1.53-7.939 2.296-12.912 2.296-6.25 0-11.159-1.786-14.73-5.356-3.57-3.571-5.356-8.417-5.356-14.538V0H23v65.038c0 5.356.542 10.234 1.626 14.633 1.084 4.4 2.965 8.194 5.643 11.382 2.678 3.188 6.185 5.643 10.52 7.365 4.337 1.721 9.756 2.582 16.26 2.582 7.27 0 13.582-1.435 18.938-4.304 5.356-2.87 9.755-7.365 13.199-13.486h.382v15.686h15.303z\"/></svg>"
},
"$:/core/images/unfold-all-button": {
"title": "$:/core/images/unfold-all-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-unfold-all tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"128\" height=\"16\" rx=\"8\"/><rect width=\"128\" height=\"16\" y=\"64\" rx=\"8\"/><path d=\"M63.945 60.624c-2.05 0-4.101-.78-5.666-2.345L35.662 35.662c-3.125-3.125-3.13-8.195-.005-11.319 3.118-3.118 8.192-3.122 11.319.005L63.94 41.314l16.966-16.966c3.124-3.124 8.194-3.129 11.318-.005 3.118 3.118 3.122 8.192-.005 11.319L69.603 58.279a7.986 7.986 0 01-5.663 2.346zM64.004 124.565c-2.05 0-4.102-.78-5.666-2.345L35.721 99.603c-3.125-3.125-3.13-8.195-.005-11.319 3.118-3.118 8.191-3.122 11.318.005L64 105.255l16.966-16.966c3.124-3.124 8.194-3.129 11.318-.005 3.118 3.118 3.122 8.192-.005 11.319L69.662 122.22a7.986 7.986 0 01-5.663 2.346z\"/></g></svg>"
},
"$:/core/images/unfold-button": {
"title": "$:/core/images/unfold-button",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-unfold tc-image-button\" viewBox=\"0 0 128 128\"><g fill-rule=\"evenodd\"><rect width=\"128\" height=\"16\" rx=\"8\"/><path d=\"M63.945 63.624c-2.05 0-4.101-.78-5.666-2.345L35.662 38.662c-3.125-3.125-3.13-8.195-.005-11.319 3.118-3.118 8.192-3.122 11.319.005L63.94 44.314l16.966-16.966c3.124-3.124 8.194-3.129 11.318-.005 3.118 3.118 3.122 8.192-.005 11.319L69.603 61.279a7.986 7.986 0 01-5.663 2.346zM64.004 105.682c-2.05.001-4.102-.78-5.666-2.344L35.721 80.721c-3.125-3.125-3.13-8.195-.005-11.319 3.118-3.118 8.191-3.122 11.318.005L64 86.373l16.966-16.966c3.124-3.125 8.194-3.13 11.318-.005 3.118 3.118 3.122 8.192-.005 11.319l-22.617 22.617a7.986 7.986 0 01-5.663 2.346z\"/></g></svg>"
},
"$:/core/images/unlocked-padlock": {
"title": "$:/core/images/unlocked-padlock",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-unlocked-padlock tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M48.627 64H105v32.01C105 113.674 90.674 128 73.001 128H56C38.318 128 24 113.677 24 96.01V64h6.136c-10.455-12.651-27.364-35.788-4.3-55.142 24.636-20.672 45.835 4.353 55.777 16.201 9.943 11.85-2.676 22.437-12.457 9.892-9.78-12.545-21.167-24.146-33.207-14.043-12.041 10.104-1.757 22.36 8.813 34.958 2.467 2.94 3.641 5.732 3.865 8.134zm19.105 28.364A8.503 8.503 0 0064.5 76a8.5 8.5 0 00-3.498 16.25l-5.095 22.77H72.8l-5.07-22.656z\"/></svg>"
},
"$:/core/images/up-arrow": {
"title": "$:/core/images/up-arrow",
"created": "20150316000544368",
"modified": "20150316000831867",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-up-arrow tc-image-button\" viewBox=\"0 0 128 128\"><path d=\"M63.892.281c2.027 0 4.054.77 5.6 2.316l55.98 55.98a7.92 7.92 0 010 11.196c-3.086 3.085-8.104 3.092-11.196 0L63.894 19.393 13.513 69.774a7.92 7.92 0 01-11.196 0c-3.085-3.086-3.092-8.105 0-11.196l55.98-55.98A7.892 7.892 0 0163.893.28z\"/></svg>"
},
"$:/core/images/video": {
"title": "$:/core/images/video",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-video tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M64 12c-34.91 0-55.273 2.917-58.182 5.833C2.91 20.75 0 41.167 0 64.5c0 23.333 2.91 43.75 5.818 46.667C8.728 114.083 29.091 117 64 117c34.91 0 55.273-2.917 58.182-5.833C125.09 108.25 128 87.833 128 64.5c0-23.333-2.91-43.75-5.818-46.667C119.272 14.917 98.909 12 64 12zm-9.084 32.618c-3.813-2.542-6.905-.879-6.905 3.698v31.368c0 4.585 3.099 6.235 6.905 3.698l22.168-14.779c3.813-2.542 3.806-6.669 0-9.206L54.916 44.618z\"/></svg>"
},
"$:/core/images/warning": {
"title": "$:/core/images/warning",
"tags": "$:/tags/Image",
"text": "<svg width=\"22pt\" height=\"22pt\" class=\"tc-image-warning tc-image-button\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M57.072 11c3.079-5.333 10.777-5.333 13.856 0l55.426 96c3.079 5.333-.77 12-6.928 12H8.574c-6.158 0-10.007-6.667-6.928-12l55.426-96zM64 37c-4.418 0-8 3.582-8 7.994v28.012C56 77.421 59.59 81 64 81c4.418 0 8-3.582 8-7.994V44.994C72 40.579 68.41 37 64 37zm0 67a8 8 0 100-16 8 8 0 000 16z\"/></svg>"
},
"$:/language/Buttons/AdvancedSearch/Caption": {
"title": "$:/language/Buttons/AdvancedSearch/Caption",
"text": "advanced search"
},
"$:/language/Buttons/AdvancedSearch/Hint": {
"title": "$:/language/Buttons/AdvancedSearch/Hint",
"text": "Advanced search"
},
"$:/language/Buttons/Cancel/Caption": {
"title": "$:/language/Buttons/Cancel/Caption",
"text": "cancel"
},
"$:/language/Buttons/Cancel/Hint": {
"title": "$:/language/Buttons/Cancel/Hint",
"text": "Discard changes to this tiddler"
},
"$:/language/Buttons/Clone/Caption": {
"title": "$:/language/Buttons/Clone/Caption",
"text": "clone"
},
"$:/language/Buttons/Clone/Hint": {
"title": "$:/language/Buttons/Clone/Hint",
"text": "Clone this tiddler"
},
"$:/language/Buttons/Close/Caption": {
"title": "$:/language/Buttons/Close/Caption",
"text": "close"
},
"$:/language/Buttons/Close/Hint": {
"title": "$:/language/Buttons/Close/Hint",
"text": "Close this tiddler"
},
"$:/language/Buttons/CloseAll/Caption": {
"title": "$:/language/Buttons/CloseAll/Caption",
"text": "close all"
},
"$:/language/Buttons/CloseAll/Hint": {
"title": "$:/language/Buttons/CloseAll/Hint",
"text": "Close all tiddlers"
},
"$:/language/Buttons/CloseOthers/Caption": {
"title": "$:/language/Buttons/CloseOthers/Caption",
"text": "close others"
},
"$:/language/Buttons/CloseOthers/Hint": {
"title": "$:/language/Buttons/CloseOthers/Hint",
"text": "Close other tiddlers"
},
"$:/language/Buttons/ControlPanel/Caption": {
"title": "$:/language/Buttons/ControlPanel/Caption",
"text": "control panel"
},
"$:/language/Buttons/ControlPanel/Hint": {
"title": "$:/language/Buttons/ControlPanel/Hint",
"text": "Open control panel"
},
"$:/language/Buttons/CopyToClipboard/Caption": {
"title": "$:/language/Buttons/CopyToClipboard/Caption",
"text": "copy to clipboard"
},
"$:/language/Buttons/CopyToClipboard/Hint": {
"title": "$:/language/Buttons/CopyToClipboard/Hint",
"text": "Copy this text to the clipboard"
},
"$:/language/Buttons/Delete/Caption": {
"title": "$:/language/Buttons/Delete/Caption",
"text": "delete"
},
"$:/language/Buttons/Delete/Hint": {
"title": "$:/language/Buttons/Delete/Hint",
"text": "Delete this tiddler"
},
"$:/language/Buttons/Edit/Caption": {
"title": "$:/language/Buttons/Edit/Caption",
"text": "edit"
},
"$:/language/Buttons/Edit/Hint": {
"title": "$:/language/Buttons/Edit/Hint",
"text": "Edit this tiddler"
},
"$:/language/Buttons/Encryption/Caption": {
"title": "$:/language/Buttons/Encryption/Caption",
"text": "encryption"
},
"$:/language/Buttons/Encryption/Hint": {
"title": "$:/language/Buttons/Encryption/Hint",
"text": "Set or clear a password for saving this wiki"
},
"$:/language/Buttons/Encryption/ClearPassword/Caption": {
"title": "$:/language/Buttons/Encryption/ClearPassword/Caption",
"text": "clear password"
},
"$:/language/Buttons/Encryption/ClearPassword/Hint": {
"title": "$:/language/Buttons/Encryption/ClearPassword/Hint",
"text": "Clear the password and save this wiki without encryption"
},
"$:/language/Buttons/Encryption/SetPassword/Caption": {
"title": "$:/language/Buttons/Encryption/SetPassword/Caption",
"text": "set password"
},
"$:/language/Buttons/Encryption/SetPassword/Hint": {
"title": "$:/language/Buttons/Encryption/SetPassword/Hint",
"text": "Set a password for saving this wiki with encryption"
},
"$:/language/Buttons/ExportPage/Caption": {
"title": "$:/language/Buttons/ExportPage/Caption",
"text": "export all"
},
"$:/language/Buttons/ExportPage/Hint": {
"title": "$:/language/Buttons/ExportPage/Hint",
"text": "Export all tiddlers"
},
"$:/language/Buttons/ExportTiddler/Caption": {
"title": "$:/language/Buttons/ExportTiddler/Caption",
"text": "export tiddler"
},
"$:/language/Buttons/ExportTiddler/Hint": {
"title": "$:/language/Buttons/ExportTiddler/Hint",
"text": "Export tiddler"
},
"$:/language/Buttons/ExportTiddlers/Caption": {
"title": "$:/language/Buttons/ExportTiddlers/Caption",
"text": "export tiddlers"
},
"$:/language/Buttons/ExportTiddlers/Hint": {
"title": "$:/language/Buttons/ExportTiddlers/Hint",
"text": "Export tiddlers"
},
"$:/language/Buttons/SidebarSearch/Hint": {
"title": "$:/language/Buttons/SidebarSearch/Hint",
"text": "Select the sidebar search field"
},
"$:/language/Buttons/Fold/Caption": {
"title": "$:/language/Buttons/Fold/Caption",
"text": "fold tiddler"
},
"$:/language/Buttons/Fold/Hint": {
"title": "$:/language/Buttons/Fold/Hint",
"text": "Fold the body of this tiddler"
},
"$:/language/Buttons/Fold/FoldBar/Caption": {
"title": "$:/language/Buttons/Fold/FoldBar/Caption",
"text": "fold-bar"
},
"$:/language/Buttons/Fold/FoldBar/Hint": {
"title": "$:/language/Buttons/Fold/FoldBar/Hint",
"text": "Optional bars to fold and unfold tiddlers"
},
"$:/language/Buttons/Unfold/Caption": {
"title": "$:/language/Buttons/Unfold/Caption",
"text": "unfold tiddler"
},
"$:/language/Buttons/Unfold/Hint": {
"title": "$:/language/Buttons/Unfold/Hint",
"text": "Unfold the body of this tiddler"
},
"$:/language/Buttons/FoldOthers/Caption": {
"title": "$:/language/Buttons/FoldOthers/Caption",
"text": "fold other tiddlers"
},
"$:/language/Buttons/FoldOthers/Hint": {
"title": "$:/language/Buttons/FoldOthers/Hint",
"text": "Fold the bodies of other opened tiddlers"
},
"$:/language/Buttons/FoldAll/Caption": {
"title": "$:/language/Buttons/FoldAll/Caption",
"text": "fold all tiddlers"
},
"$:/language/Buttons/FoldAll/Hint": {
"title": "$:/language/Buttons/FoldAll/Hint",
"text": "Fold the bodies of all opened tiddlers"
},
"$:/language/Buttons/UnfoldAll/Caption": {
"title": "$:/language/Buttons/UnfoldAll/Caption",
"text": "unfold all tiddlers"
},
"$:/language/Buttons/UnfoldAll/Hint": {
"title": "$:/language/Buttons/UnfoldAll/Hint",
"text": "Unfold the bodies of all opened tiddlers"
},
"$:/language/Buttons/FullScreen/Caption": {
"title": "$:/language/Buttons/FullScreen/Caption",
"text": "full-screen"
},
"$:/language/Buttons/FullScreen/Hint": {
"title": "$:/language/Buttons/FullScreen/Hint",
"text": "Enter or leave full-screen mode"
},
"$:/language/Buttons/Help/Caption": {
"title": "$:/language/Buttons/Help/Caption",
"text": "help"
},
"$:/language/Buttons/Help/Hint": {
"title": "$:/language/Buttons/Help/Hint",
"text": "Show help panel"
},
"$:/language/Buttons/Import/Caption": {
"title": "$:/language/Buttons/Import/Caption",
"text": "import"
},
"$:/language/Buttons/Import/Hint": {
"title": "$:/language/Buttons/Import/Hint",
"text": "Import many types of file including text, image, TiddlyWiki or JSON"
},
"$:/language/Buttons/Info/Caption": {
"title": "$:/language/Buttons/Info/Caption",
"text": "info"
},
"$:/language/Buttons/Info/Hint": {
"title": "$:/language/Buttons/Info/Hint",
"text": "Show information for this tiddler"
},
"$:/language/Buttons/Home/Caption": {
"title": "$:/language/Buttons/Home/Caption",
"text": "home"
},
"$:/language/Buttons/Home/Hint": {
"title": "$:/language/Buttons/Home/Hint",
"text": "Open the default tiddlers"
},
"$:/language/Buttons/Language/Caption": {
"title": "$:/language/Buttons/Language/Caption",
"text": "language"
},
"$:/language/Buttons/Language/Hint": {
"title": "$:/language/Buttons/Language/Hint",
"text": "Choose the user interface language"
},
"$:/language/Buttons/Manager/Caption": {
"title": "$:/language/Buttons/Manager/Caption",
"text": "tiddler manager"
},
"$:/language/Buttons/Manager/Hint": {
"title": "$:/language/Buttons/Manager/Hint",
"text": "Open tiddler manager"
},
"$:/language/Buttons/More/Caption": {
"title": "$:/language/Buttons/More/Caption",
"text": "more"
},
"$:/language/Buttons/More/Hint": {
"title": "$:/language/Buttons/More/Hint",
"text": "More actions"
},
"$:/language/Buttons/NewHere/Caption": {
"title": "$:/language/Buttons/NewHere/Caption",
"text": "new here"
},
"$:/language/Buttons/NewHere/Hint": {
"title": "$:/language/Buttons/NewHere/Hint",
"text": "Create a new tiddler tagged with this one"
},
"$:/language/Buttons/NewJournal/Caption": {
"title": "$:/language/Buttons/NewJournal/Caption",
"text": "new journal"
},
"$:/language/Buttons/NewJournal/Hint": {
"title": "$:/language/Buttons/NewJournal/Hint",
"text": "Create a new journal tiddler"
},
"$:/language/Buttons/NewJournalHere/Caption": {
"title": "$:/language/Buttons/NewJournalHere/Caption",
"text": "new journal here"
},
"$:/language/Buttons/NewJournalHere/Hint": {
"title": "$:/language/Buttons/NewJournalHere/Hint",
"text": "Create a new journal tiddler tagged with this one"
},
"$:/language/Buttons/NewImage/Caption": {
"title": "$:/language/Buttons/NewImage/Caption",
"text": "new image"
},
"$:/language/Buttons/NewImage/Hint": {
"title": "$:/language/Buttons/NewImage/Hint",
"text": "Create a new image tiddler"
},
"$:/language/Buttons/NewMarkdown/Caption": {
"title": "$:/language/Buttons/NewMarkdown/Caption",
"text": "new Markdown tiddler"
},
"$:/language/Buttons/NewMarkdown/Hint": {
"title": "$:/language/Buttons/NewMarkdown/Hint",
"text": "Create a new Markdown tiddler"
},
"$:/language/Buttons/NewTiddler/Caption": {
"title": "$:/language/Buttons/NewTiddler/Caption",
"text": "new tiddler"
},
"$:/language/Buttons/NewTiddler/Hint": {
"title": "$:/language/Buttons/NewTiddler/Hint",
"text": "Create a new tiddler"
},
"$:/language/Buttons/OpenWindow/Caption": {
"title": "$:/language/Buttons/OpenWindow/Caption",
"text": "open in new window"
},
"$:/language/Buttons/OpenWindow/Hint": {
"title": "$:/language/Buttons/OpenWindow/Hint",
"text": "Open tiddler in new window"
},
"$:/language/Buttons/Palette/Caption": {
"title": "$:/language/Buttons/Palette/Caption",
"text": "palette"
},
"$:/language/Buttons/Palette/Hint": {
"title": "$:/language/Buttons/Palette/Hint",
"text": "Choose the colour palette"
},
"$:/language/Buttons/Permalink/Caption": {
"title": "$:/language/Buttons/Permalink/Caption",
"text": "permalink"
},
"$:/language/Buttons/Permalink/Hint": {
"title": "$:/language/Buttons/Permalink/Hint",
"text": "Set browser address bar to a direct link to this tiddler"
},
"$:/language/Buttons/Permaview/Caption": {
"title": "$:/language/Buttons/Permaview/Caption",
"text": "permaview"
},
"$:/language/Buttons/Permaview/Hint": {
"title": "$:/language/Buttons/Permaview/Hint",
"text": "Set browser address bar to a direct link to all the tiddlers in this story"
},
"$:/language/Buttons/Print/Caption": {
"title": "$:/language/Buttons/Print/Caption",
"text": "print page"
},
"$:/language/Buttons/Print/Hint": {
"title": "$:/language/Buttons/Print/Hint",
"text": "Print the current page"
},
"$:/language/Buttons/Publish/Caption": {
"title": "$:/language/Buttons/Publish/Caption",
"text": "publish"
},
"$:/language/Buttons/Publish/Hint": {
"title": "$:/language/Buttons/Publish/Hint",
"text": "Publish from the wiki"
},
"$:/language/Buttons/Refresh/Caption": {
"title": "$:/language/Buttons/Refresh/Caption",
"text": "refresh"
},
"$:/language/Buttons/Refresh/Hint": {
"title": "$:/language/Buttons/Refresh/Hint",
"text": "Perform a full refresh of the wiki"
},
"$:/language/Buttons/Save/Caption": {
"title": "$:/language/Buttons/Save/Caption",
"text": "ok"
},
"$:/language/Buttons/Save/Hint": {
"title": "$:/language/Buttons/Save/Hint",
"text": "Confirm changes to this tiddler"
},
"$:/language/Buttons/SaveWiki/Caption": {
"title": "$:/language/Buttons/SaveWiki/Caption",
"text": "save changes"
},
"$:/language/Buttons/SaveWiki/Hint": {
"title": "$:/language/Buttons/SaveWiki/Hint",
"text": "Save changes"
},
"$:/language/Buttons/StoryView/Caption": {
"title": "$:/language/Buttons/StoryView/Caption",
"text": "storyview"
},
"$:/language/Buttons/StoryView/Hint": {
"title": "$:/language/Buttons/StoryView/Hint",
"text": "Choose the story visualisation"
},
"$:/language/Buttons/HideSideBar/Caption": {
"title": "$:/language/Buttons/HideSideBar/Caption",
"text": "hide sidebar"
},
"$:/language/Buttons/HideSideBar/Hint": {
"title": "$:/language/Buttons/HideSideBar/Hint",
"text": "Hide sidebar"
},
"$:/language/Buttons/ShowSideBar/Caption": {
"title": "$:/language/Buttons/ShowSideBar/Caption",
"text": "show sidebar"
},
"$:/language/Buttons/ShowSideBar/Hint": {
"title": "$:/language/Buttons/ShowSideBar/Hint",
"text": "Show sidebar"
},
"$:/language/Buttons/TagManager/Caption": {
"title": "$:/language/Buttons/TagManager/Caption",
"text": "tag manager"
},
"$:/language/Buttons/TagManager/Hint": {
"title": "$:/language/Buttons/TagManager/Hint",
"text": "Open tag manager"
},
"$:/language/Buttons/Timestamp/Caption": {
"title": "$:/language/Buttons/Timestamp/Caption",
"text": "timestamps"
},
"$:/language/Buttons/Timestamp/Hint": {
"title": "$:/language/Buttons/Timestamp/Hint",
"text": "Choose whether modifications update timestamps"
},
"$:/language/Buttons/Timestamp/On/Caption": {
"title": "$:/language/Buttons/Timestamp/On/Caption",
"text": "timestamps are on"
},
"$:/language/Buttons/Timestamp/On/Hint": {
"title": "$:/language/Buttons/Timestamp/On/Hint",
"text": "Update timestamps when tiddlers are modified"
},
"$:/language/Buttons/Timestamp/Off/Caption": {
"title": "$:/language/Buttons/Timestamp/Off/Caption",
"text": "timestamps are off"
},
"$:/language/Buttons/Timestamp/Off/Hint": {
"title": "$:/language/Buttons/Timestamp/Off/Hint",
"text": "Don't update timestamps when tiddlers are modified"
},
"$:/language/Buttons/Theme/Caption": {
"title": "$:/language/Buttons/Theme/Caption",
"text": "theme"
},
"$:/language/Buttons/Theme/Hint": {
"title": "$:/language/Buttons/Theme/Hint",
"text": "Choose the display theme"
},
"$:/language/Buttons/Bold/Caption": {
"title": "$:/language/Buttons/Bold/Caption",
"text": "bold"
},
"$:/language/Buttons/Bold/Hint": {
"title": "$:/language/Buttons/Bold/Hint",
"text": "Apply bold formatting to selection"
},
"$:/language/Buttons/Clear/Caption": {
"title": "$:/language/Buttons/Clear/Caption",
"text": "clear"
},
"$:/language/Buttons/Clear/Hint": {
"title": "$:/language/Buttons/Clear/Hint",
"text": "Clear image to solid colour"
},
"$:/language/Buttons/EditorHeight/Caption": {
"title": "$:/language/Buttons/EditorHeight/Caption",
"text": "editor height"
},
"$:/language/Buttons/EditorHeight/Caption/Auto": {
"title": "$:/language/Buttons/EditorHeight/Caption/Auto",
"text": "Automatically adjust height to fit content"
},
"$:/language/Buttons/EditorHeight/Caption/Fixed": {
"title": "$:/language/Buttons/EditorHeight/Caption/Fixed",
"text": "Fixed height:"
},
"$:/language/Buttons/EditorHeight/Hint": {
"title": "$:/language/Buttons/EditorHeight/Hint",
"text": "Choose the height of the text editor"
},
"$:/language/Buttons/Excise/Caption": {
"title": "$:/language/Buttons/Excise/Caption",
"text": "excise"
},
"$:/language/Buttons/Excise/Caption/Excise": {
"title": "$:/language/Buttons/Excise/Caption/Excise",
"text": "Perform excision"
},
"$:/language/Buttons/Excise/Caption/MacroName": {
"title": "$:/language/Buttons/Excise/Caption/MacroName",
"text": "Macro name:"
},
"$:/language/Buttons/Excise/Caption/NewTitle": {
"title": "$:/language/Buttons/Excise/Caption/NewTitle",
"text": "Title of new tiddler:"
},
"$:/language/Buttons/Excise/Caption/Replace": {
"title": "$:/language/Buttons/Excise/Caption/Replace",
"text": "Replace excised text with:"
},
"$:/language/Buttons/Excise/Caption/Replace/Macro": {
"title": "$:/language/Buttons/Excise/Caption/Replace/Macro",
"text": "macro"
},
"$:/language/Buttons/Excise/Caption/Replace/Link": {
"title": "$:/language/Buttons/Excise/Caption/Replace/Link",
"text": "link"
},
"$:/language/Buttons/Excise/Caption/Replace/Transclusion": {
"title": "$:/language/Buttons/Excise/Caption/Replace/Transclusion",
"text": "transclusion"
},
"$:/language/Buttons/Excise/Caption/Tag": {
"title": "$:/language/Buttons/Excise/Caption/Tag",
"text": "Tag new tiddler with the title of this tiddler"
},
"$:/language/Buttons/Excise/Caption/TiddlerExists": {
"title": "$:/language/Buttons/Excise/Caption/TiddlerExists",
"text": "Warning: tiddler already exists"
},
"$:/language/Buttons/Excise/Hint": {
"title": "$:/language/Buttons/Excise/Hint",
"text": "Excise the selected text into a new tiddler"
},
"$:/language/Buttons/Heading1/Caption": {
"title": "$:/language/Buttons/Heading1/Caption",
"text": "heading 1"
},
"$:/language/Buttons/Heading1/Hint": {
"title": "$:/language/Buttons/Heading1/Hint",
"text": "Apply heading level 1 formatting to lines containing selection"
},
"$:/language/Buttons/Heading2/Caption": {
"title": "$:/language/Buttons/Heading2/Caption",
"text": "heading 2"
},
"$:/language/Buttons/Heading2/Hint": {
"title": "$:/language/Buttons/Heading2/Hint",
"text": "Apply heading level 2 formatting to lines containing selection"
},
"$:/language/Buttons/Heading3/Caption": {
"title": "$:/language/Buttons/Heading3/Caption",
"text": "heading 3"
},
"$:/language/Buttons/Heading3/Hint": {
"title": "$:/language/Buttons/Heading3/Hint",
"text": "Apply heading level 3 formatting to lines containing selection"
},
"$:/language/Buttons/Heading4/Caption": {
"title": "$:/language/Buttons/Heading4/Caption",
"text": "heading 4"
},
"$:/language/Buttons/Heading4/Hint": {
"title": "$:/language/Buttons/Heading4/Hint",
"text": "Apply heading level 4 formatting to lines containing selection"
},
"$:/language/Buttons/Heading5/Caption": {
"title": "$:/language/Buttons/Heading5/Caption",
"text": "heading 5"
},
"$:/language/Buttons/Heading5/Hint": {
"title": "$:/language/Buttons/Heading5/Hint",
"text": "Apply heading level 5 formatting to lines containing selection"
},
"$:/language/Buttons/Heading6/Caption": {
"title": "$:/language/Buttons/Heading6/Caption",
"text": "heading 6"
},
"$:/language/Buttons/Heading6/Hint": {
"title": "$:/language/Buttons/Heading6/Hint",
"text": "Apply heading level 6 formatting to lines containing selection"
},
"$:/language/Buttons/Italic/Caption": {
"title": "$:/language/Buttons/Italic/Caption",
"text": "italic"
},
"$:/language/Buttons/Italic/Hint": {
"title": "$:/language/Buttons/Italic/Hint",
"text": "Apply italic formatting to selection"
},
"$:/language/Buttons/LineWidth/Caption": {
"title": "$:/language/Buttons/LineWidth/Caption",
"text": "line width"
},
"$:/language/Buttons/LineWidth/Hint": {
"title": "$:/language/Buttons/LineWidth/Hint",
"text": "Set line width for painting"
},
"$:/language/Buttons/Link/Caption": {
"title": "$:/language/Buttons/Link/Caption",
"text": "link"
},
"$:/language/Buttons/Link/Hint": {
"title": "$:/language/Buttons/Link/Hint",
"text": "Create wikitext link"
},
"$:/language/Buttons/Linkify/Caption": {
"title": "$:/language/Buttons/Linkify/Caption",
"text": "wikilink"
},
"$:/language/Buttons/Linkify/Hint": {
"title": "$:/language/Buttons/Linkify/Hint",
"text": "Wrap selection in square brackets"
},
"$:/language/Buttons/ListBullet/Caption": {
"title": "$:/language/Buttons/ListBullet/Caption",
"text": "bulleted list"
},
"$:/language/Buttons/ListBullet/Hint": {
"title": "$:/language/Buttons/ListBullet/Hint",
"text": "Apply bulleted list formatting to lines containing selection"
},
"$:/language/Buttons/ListNumber/Caption": {
"title": "$:/language/Buttons/ListNumber/Caption",
"text": "numbered list"
},
"$:/language/Buttons/ListNumber/Hint": {
"title": "$:/language/Buttons/ListNumber/Hint",
"text": "Apply numbered list formatting to lines containing selection"
},
"$:/language/Buttons/MonoBlock/Caption": {
"title": "$:/language/Buttons/MonoBlock/Caption",
"text": "monospaced block"
},
"$:/language/Buttons/MonoBlock/Hint": {
"title": "$:/language/Buttons/MonoBlock/Hint",
"text": "Apply monospaced block formatting to lines containing selection"
},
"$:/language/Buttons/MonoLine/Caption": {
"title": "$:/language/Buttons/MonoLine/Caption",
"text": "monospaced"
},
"$:/language/Buttons/MonoLine/Hint": {
"title": "$:/language/Buttons/MonoLine/Hint",
"text": "Apply monospaced character formatting to selection"
},
"$:/language/Buttons/Opacity/Caption": {
"title": "$:/language/Buttons/Opacity/Caption",
"text": "opacity"
},
"$:/language/Buttons/Opacity/Hint": {
"title": "$:/language/Buttons/Opacity/Hint",
"text": "Set painting opacity"
},
"$:/language/Buttons/Paint/Caption": {
"title": "$:/language/Buttons/Paint/Caption",
"text": "paint colour"
},
"$:/language/Buttons/Paint/Hint": {
"title": "$:/language/Buttons/Paint/Hint",
"text": "Set painting colour"
},
"$:/language/Buttons/Picture/Caption": {
"title": "$:/language/Buttons/Picture/Caption",
"text": "picture"
},
"$:/language/Buttons/Picture/Hint": {
"title": "$:/language/Buttons/Picture/Hint",
"text": "Insert picture"
},
"$:/language/Buttons/Preview/Caption": {
"title": "$:/language/Buttons/Preview/Caption",
"text": "preview"
},
"$:/language/Buttons/Preview/Hint": {
"title": "$:/language/Buttons/Preview/Hint",
"text": "Show preview pane"
},
"$:/language/Buttons/PreviewType/Caption": {
"title": "$:/language/Buttons/PreviewType/Caption",
"text": "preview type"
},
"$:/language/Buttons/PreviewType/Hint": {
"title": "$:/language/Buttons/PreviewType/Hint",
"text": "Choose preview type"
},
"$:/language/Buttons/Quote/Caption": {
"title": "$:/language/Buttons/Quote/Caption",
"text": "quote"
},
"$:/language/Buttons/Quote/Hint": {
"title": "$:/language/Buttons/Quote/Hint",
"text": "Apply quoted text formatting to lines containing selection"
},
"$:/language/Buttons/RotateLeft/Caption": {
"title": "$:/language/Buttons/RotateLeft/Caption",
"text": "rotate left"
},
"$:/language/Buttons/RotateLeft/Hint": {
"title": "$:/language/Buttons/RotateLeft/Hint",
"text": "Rotate image left by 90 degrees"
},
"$:/language/Buttons/Size/Caption": {
"title": "$:/language/Buttons/Size/Caption",
"text": "image size"
},
"$:/language/Buttons/Size/Caption/Height": {
"title": "$:/language/Buttons/Size/Caption/Height",
"text": "Height:"
},
"$:/language/Buttons/Size/Caption/Resize": {
"title": "$:/language/Buttons/Size/Caption/Resize",
"text": "Resize image"
},
"$:/language/Buttons/Size/Caption/Width": {
"title": "$:/language/Buttons/Size/Caption/Width",
"text": "Width:"
},
"$:/language/Buttons/Size/Hint": {
"title": "$:/language/Buttons/Size/Hint",
"text": "Set image size"
},
"$:/language/Buttons/Stamp/Caption": {
"title": "$:/language/Buttons/Stamp/Caption",
"text": "stamp"
},
"$:/language/Buttons/Stamp/Caption/New": {
"title": "$:/language/Buttons/Stamp/Caption/New",
"text": "Add your own"
},
"$:/language/Buttons/Stamp/Hint": {
"title": "$:/language/Buttons/Stamp/Hint",
"text": "Insert a preconfigured snippet of text"
},
"$:/language/Buttons/Stamp/New/Title": {
"title": "$:/language/Buttons/Stamp/New/Title",
"text": "Name as shown in menu"
},
"$:/language/Buttons/Stamp/New/Text": {
"title": "$:/language/Buttons/Stamp/New/Text",
"text": "Text of snippet. (Remember to add a descriptive title in the caption field)."
},
"$:/language/Buttons/Strikethrough/Caption": {
"title": "$:/language/Buttons/Strikethrough/Caption",
"text": "strikethrough"
},
"$:/language/Buttons/Strikethrough/Hint": {
"title": "$:/language/Buttons/Strikethrough/Hint",
"text": "Apply strikethrough formatting to selection"
},
"$:/language/Buttons/Subscript/Caption": {
"title": "$:/language/Buttons/Subscript/Caption",
"text": "subscript"
},
"$:/language/Buttons/Subscript/Hint": {
"title": "$:/language/Buttons/Subscript/Hint",
"text": "Apply subscript formatting to selection"
},
"$:/language/Buttons/Superscript/Caption": {
"title": "$:/language/Buttons/Superscript/Caption",
"text": "superscript"
},
"$:/language/Buttons/Superscript/Hint": {
"title": "$:/language/Buttons/Superscript/Hint",
"text": "Apply superscript formatting to selection"
},
"$:/language/Buttons/ToggleSidebar/Hint": {
"title": "$:/language/Buttons/ToggleSidebar/Hint",
"text": "Toggle the sidebar visibility"
},
"$:/language/Buttons/Transcludify/Caption": {
"title": "$:/language/Buttons/Transcludify/Caption",
"text": "transclusion"
},
"$:/language/Buttons/Transcludify/Hint": {
"title": "$:/language/Buttons/Transcludify/Hint",
"text": "Wrap selection in curly brackets"
},
"$:/language/Buttons/Underline/Caption": {
"title": "$:/language/Buttons/Underline/Caption",
"text": "underline"
},
"$:/language/Buttons/Underline/Hint": {
"title": "$:/language/Buttons/Underline/Hint",
"text": "Apply underline formatting to selection"
},
"$:/language/ControlPanel/Advanced/Caption": {
"title": "$:/language/ControlPanel/Advanced/Caption",
"text": "Advanced"
},
"$:/language/ControlPanel/Advanced/Hint": {
"title": "$:/language/ControlPanel/Advanced/Hint",
"text": "Internal information about this TiddlyWiki"
},
"$:/language/ControlPanel/Appearance/Caption": {
"title": "$:/language/ControlPanel/Appearance/Caption",
"text": "Appearance"
},
"$:/language/ControlPanel/Appearance/Hint": {
"title": "$:/language/ControlPanel/Appearance/Hint",
"text": "Ways to customise the appearance of your TiddlyWiki."
},
"$:/language/ControlPanel/Basics/AnimDuration/Prompt": {
"title": "$:/language/ControlPanel/Basics/AnimDuration/Prompt",
"text": "Animation duration"
},
"$:/language/ControlPanel/Basics/AutoFocus/Prompt": {
"title": "$:/language/ControlPanel/Basics/AutoFocus/Prompt",
"text": "Default focus field for new tiddlers"
},
"$:/language/ControlPanel/Basics/Caption": {
"title": "$:/language/ControlPanel/Basics/Caption",
"text": "Basics"
},
"$:/language/ControlPanel/Basics/DefaultTiddlers/BottomHint": {
"title": "$:/language/ControlPanel/Basics/DefaultTiddlers/BottomHint",
"text": "Use [[double square brackets]] for titles with spaces. Or you can choose to <$button set=\"$:/DefaultTiddlers\" setTo=\"[list[$:/StoryList]]\">retain story ordering</$button>"
},
"$:/language/ControlPanel/Basics/DefaultTiddlers/Prompt": {
"title": "$:/language/ControlPanel/Basics/DefaultTiddlers/Prompt",
"text": "Default tiddlers"
},
"$:/language/ControlPanel/Basics/DefaultTiddlers/TopHint": {
"title": "$:/language/ControlPanel/Basics/DefaultTiddlers/TopHint",
"text": "Choose which tiddlers are displayed at startup"
},
"$:/language/ControlPanel/Basics/Language/Prompt": {
"title": "$:/language/ControlPanel/Basics/Language/Prompt",
"text": "Hello! Current language:"
},
"$:/language/ControlPanel/Basics/NewJournal/Title/Prompt": {
"title": "$:/language/ControlPanel/Basics/NewJournal/Title/Prompt",
"text": "Title of new journal tiddlers"
},
"$:/language/ControlPanel/Basics/NewJournal/Text/Prompt": {
"title": "$:/language/ControlPanel/Basics/NewJournal/Text/Prompt",
"text": "Text for new journal tiddlers"
},
"$:/language/ControlPanel/Basics/NewJournal/Tags/Prompt": {
"title": "$:/language/ControlPanel/Basics/NewJournal/Tags/Prompt",
"text": "Tags for new journal tiddlers"
},
"$:/language/ControlPanel/Basics/NewTiddler/Title/Prompt": {
"title": "$:/language/ControlPanel/Basics/NewTiddler/Title/Prompt",
"text": "Title of new tiddlers"
},
"$:/language/ControlPanel/Basics/NewTiddler/Tags/Prompt": {
"title": "$:/language/ControlPanel/Basics/NewTiddler/Tags/Prompt",
"text": "Tags for new tiddlers"
},
"$:/language/ControlPanel/Basics/OverriddenShadowTiddlers/Prompt": {
"title": "$:/language/ControlPanel/Basics/OverriddenShadowTiddlers/Prompt",
"text": "Number of overridden shadow tiddlers"
},
"$:/language/ControlPanel/Basics/RemoveTags": {
"title": "$:/language/ControlPanel/Basics/RemoveTags",
"text": "Update to current format"
},
"$:/language/ControlPanel/Basics/RemoveTags/Hint": {
"title": "$:/language/ControlPanel/Basics/RemoveTags/Hint",
"text": "Update the tags configuration to the latest format"
},
"$:/language/ControlPanel/Basics/ShadowTiddlers/Prompt": {
"title": "$:/language/ControlPanel/Basics/ShadowTiddlers/Prompt",
"text": "Number of shadow tiddlers"
},
"$:/language/ControlPanel/Basics/Subtitle/Prompt": {
"title": "$:/language/ControlPanel/Basics/Subtitle/Prompt",
"text": "Subtitle"
},
"$:/language/ControlPanel/Basics/SystemTiddlers/Prompt": {
"title": "$:/language/ControlPanel/Basics/SystemTiddlers/Prompt",
"text": "Number of system tiddlers"
},
"$:/language/ControlPanel/Basics/Tags/Prompt": {
"title": "$:/language/ControlPanel/Basics/Tags/Prompt",
"text": "Number of tags"
},
"$:/language/ControlPanel/Basics/Tiddlers/Prompt": {
"title": "$:/language/ControlPanel/Basics/Tiddlers/Prompt",
"text": "Number of tiddlers"
},
"$:/language/ControlPanel/Basics/Title/Prompt": {
"title": "$:/language/ControlPanel/Basics/Title/Prompt",
"text": "Title of this ~TiddlyWiki"
},
"$:/language/ControlPanel/Basics/Username/Prompt": {
"title": "$:/language/ControlPanel/Basics/Username/Prompt",
"text": "Username for signing edits"
},
"$:/language/ControlPanel/Basics/Version/Prompt": {
"title": "$:/language/ControlPanel/Basics/Version/Prompt",
"text": "~TiddlyWiki version"
},
"$:/language/ControlPanel/EditorTypes/Caption": {
"title": "$:/language/ControlPanel/EditorTypes/Caption",
"text": "Editor Types"
},
"$:/language/ControlPanel/EditorTypes/Editor/Caption": {
"title": "$:/language/ControlPanel/EditorTypes/Editor/Caption",
"text": "Editor"
},
"$:/language/ControlPanel/EditorTypes/Hint": {
"title": "$:/language/ControlPanel/EditorTypes/Hint",
"text": "These tiddlers determine which editor is used to edit specific tiddler types."
},
"$:/language/ControlPanel/EditorTypes/Type/Caption": {
"title": "$:/language/ControlPanel/EditorTypes/Type/Caption",
"text": "Type"
},
"$:/language/ControlPanel/Info/Caption": {
"title": "$:/language/ControlPanel/Info/Caption",
"text": "Info"
},
"$:/language/ControlPanel/Info/Hint": {
"title": "$:/language/ControlPanel/Info/Hint",
"text": "Information about this TiddlyWiki"
},
"$:/language/ControlPanel/KeyboardShortcuts/Add/Prompt": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Add/Prompt",
"text": "Type shortcut here"
},
"$:/language/ControlPanel/KeyboardShortcuts/Add/Caption": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Add/Caption",
"text": "add shortcut"
},
"$:/language/ControlPanel/KeyboardShortcuts/Caption": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Caption",
"text": "Keyboard Shortcuts"
},
"$:/language/ControlPanel/KeyboardShortcuts/Hint": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Hint",
"text": "Manage keyboard shortcut assignments"
},
"$:/language/ControlPanel/KeyboardShortcuts/NoShortcuts/Caption": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/NoShortcuts/Caption",
"text": "No keyboard shortcuts assigned"
},
"$:/language/ControlPanel/KeyboardShortcuts/Remove/Hint": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Remove/Hint",
"text": "remove keyboard shortcut"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/All": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/All",
"text": "All platforms"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/Mac": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/Mac",
"text": "Macintosh platform only"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonMac": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/NonMac",
"text": "Non-Macintosh platforms only"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/Linux": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/Linux",
"text": "Linux platform only"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonLinux": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/NonLinux",
"text": "Non-Linux platforms only"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/Windows": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/Windows",
"text": "Windows platform only"
},
"$:/language/ControlPanel/KeyboardShortcuts/Platform/NonWindows": {
"title": "$:/language/ControlPanel/KeyboardShortcuts/Platform/NonWindows",
"text": "Non-Windows platforms only"
},
"$:/language/ControlPanel/LayoutSwitcher/Caption": {
"title": "$:/language/ControlPanel/LayoutSwitcher/Caption",
"text": "Layout"
},
"$:/language/ControlPanel/LoadedModules/Caption": {
"title": "$:/language/ControlPanel/LoadedModules/Caption",
"text": "Loaded Modules"
},
"$:/language/ControlPanel/LoadedModules/Hint": {
"title": "$:/language/ControlPanel/LoadedModules/Hint",
"text": "These are the currently loaded tiddler modules linked to their source tiddlers. Any italicised modules lack a source tiddler, typically because they were setup during the boot process."
},
"$:/language/ControlPanel/Palette/Caption": {
"title": "$:/language/ControlPanel/Palette/Caption",
"text": "Palette"
},
"$:/language/ControlPanel/Palette/Editor/Clone/Caption": {
"title": "$:/language/ControlPanel/Palette/Editor/Clone/Caption",
"text": "clone"
},
"$:/language/ControlPanel/Palette/Editor/Clone/Prompt": {
"title": "$:/language/ControlPanel/Palette/Editor/Clone/Prompt",
"text": "It is recommended that you clone this shadow palette before editing it"
},
"$:/language/ControlPanel/Palette/Editor/Delete/Hint": {
"title": "$:/language/ControlPanel/Palette/Editor/Delete/Hint",
"text": "delete this entry from the current palette"
},
"$:/language/ControlPanel/Palette/Editor/Names/External/Show": {
"title": "$:/language/ControlPanel/Palette/Editor/Names/External/Show",
"text": "Show color names that are not part of the current palette"
},
"$:/language/ControlPanel/Palette/Editor/Prompt/Modified": {
"title": "$:/language/ControlPanel/Palette/Editor/Prompt/Modified",
"text": "This shadow palette has been modified"
},
"$:/language/ControlPanel/Palette/Editor/Prompt": {
"title": "$:/language/ControlPanel/Palette/Editor/Prompt",
"text": "Editing"
},
"$:/language/ControlPanel/Palette/Editor/Reset/Caption": {
"title": "$:/language/ControlPanel/Palette/Editor/Reset/Caption",
"text": "reset"
},
"$:/language/ControlPanel/Palette/HideEditor/Caption": {
"title": "$:/language/ControlPanel/Palette/HideEditor/Caption",
"text": "hide editor"
},
"$:/language/ControlPanel/Palette/Prompt": {
"title": "$:/language/ControlPanel/Palette/Prompt",
"text": "Current palette:"
},
"$:/language/ControlPanel/Palette/ShowEditor/Caption": {
"title": "$:/language/ControlPanel/Palette/ShowEditor/Caption",
"text": "show editor"
},
"$:/language/ControlPanel/Parsing/Caption": {
"title": "$:/language/ControlPanel/Parsing/Caption",
"text": "Parsing"
},
"$:/language/ControlPanel/Parsing/Hint": {
"title": "$:/language/ControlPanel/Parsing/Hint",
"text": "Here you can globally disable/enable wiki parser rules. For changes to take effect, save and reload your wiki. Disabling certain parser rules can prevent <$text text=\"TiddlyWiki\"/> from functioning correctly. Use [[safe mode|https://tiddlywiki.com/#SafeMode]] to restore normal operation."
},
"$:/language/ControlPanel/Parsing/Block/Caption": {
"title": "$:/language/ControlPanel/Parsing/Block/Caption",
"text": "Block Parse Rules"
},
"$:/language/ControlPanel/Parsing/Inline/Caption": {
"title": "$:/language/ControlPanel/Parsing/Inline/Caption",
"text": "Inline Parse Rules"
},
"$:/language/ControlPanel/Parsing/Pragma/Caption": {
"title": "$:/language/ControlPanel/Parsing/Pragma/Caption",
"text": "Pragma Parse Rules"
},
"$:/language/ControlPanel/Plugins/Add/Caption": {
"title": "$:/language/ControlPanel/Plugins/Add/Caption",
"text": "Get more plugins"
},
"$:/language/ControlPanel/Plugins/Add/Hint": {
"title": "$:/language/ControlPanel/Plugins/Add/Hint",
"text": "Install plugins from the official library"
},
"$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint": {
"title": "$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint",
"text": "This plugin is already installed at version <$text text=<<installedVersion>>/>"
},
"$:/language/ControlPanel/Plugins/AlsoRequires": {
"title": "$:/language/ControlPanel/Plugins/AlsoRequires",
"text": "Also requires:"
},
"$:/language/ControlPanel/Plugins/Caption": {
"title": "$:/language/ControlPanel/Plugins/Caption",
"text": "Plugins"
},
"$:/language/ControlPanel/Plugins/Disable/Caption": {
"title": "$:/language/ControlPanel/Plugins/Disable/Caption",
"text": "disable"
},
"$:/language/ControlPanel/Plugins/Disable/Hint": {
"title": "$:/language/ControlPanel/Plugins/Disable/Hint",
"text": "Disable this plugin when reloading page"
},
"$:/language/ControlPanel/Plugins/Disabled/Status": {
"title": "$:/language/ControlPanel/Plugins/Disabled/Status",
"text": "(disabled)"
},
"$:/language/ControlPanel/Plugins/Downgrade/Caption": {
"title": "$:/language/ControlPanel/Plugins/Downgrade/Caption",
"text": "downgrade"
},
"$:/language/ControlPanel/Plugins/Empty/Hint": {
"title": "$:/language/ControlPanel/Plugins/Empty/Hint",
"text": "None"
},
"$:/language/ControlPanel/Plugins/Enable/Caption": {
"title": "$:/language/ControlPanel/Plugins/Enable/Caption",
"text": "enable"
},
"$:/language/ControlPanel/Plugins/Enable/Hint": {
"title": "$:/language/ControlPanel/Plugins/Enable/Hint",
"text": "Enable this plugin when reloading page"
},
"$:/language/ControlPanel/Plugins/Install/Caption": {
"title": "$:/language/ControlPanel/Plugins/Install/Caption",
"text": "install"
},
"$:/language/ControlPanel/Plugins/Installed/Hint": {
"title": "$:/language/ControlPanel/Plugins/Installed/Hint",
"text": "Currently installed plugins:"
},
"$:/language/ControlPanel/Plugins/Languages/Caption": {
"title": "$:/language/ControlPanel/Plugins/Languages/Caption",
"text": "Languages"
},
"$:/language/ControlPanel/Plugins/Languages/Hint": {
"title": "$:/language/ControlPanel/Plugins/Languages/Hint",
"text": "Language pack plugins"
},
"$:/language/ControlPanel/Plugins/NoInfoFound/Hint": {
"title": "$:/language/ControlPanel/Plugins/NoInfoFound/Hint",
"text": "No ''\"<$text text=<<currentTab>>/>\"'' found"
},
"$:/language/ControlPanel/Plugins/NotInstalled/Hint": {
"title": "$:/language/ControlPanel/Plugins/NotInstalled/Hint",
"text": "This plugin is not currently installed"
},
"$:/language/ControlPanel/Plugins/OpenPluginLibrary": {
"title": "$:/language/ControlPanel/Plugins/OpenPluginLibrary",
"text": "open plugin library"
},
"$:/language/ControlPanel/Plugins/ClosePluginLibrary": {
"title": "$:/language/ControlPanel/Plugins/ClosePluginLibrary",
"text": "close plugin library"
},
"$:/language/ControlPanel/Plugins/PluginWillRequireReload": {
"title": "$:/language/ControlPanel/Plugins/PluginWillRequireReload",
"text": "(requires reload)"
},
"$:/language/ControlPanel/Plugins/Plugins/Caption": {
"title": "$:/language/ControlPanel/Plugins/Plugins/Caption",
"text": "Plugins"
},
"$:/language/ControlPanel/Plugins/Plugins/Hint": {
"title": "$:/language/ControlPanel/Plugins/Plugins/Hint",
"text": "Plugins"
},
"$:/language/ControlPanel/Plugins/Reinstall/Caption": {
"title": "$:/language/ControlPanel/Plugins/Reinstall/Caption",
"text": "reinstall"
},
"$:/language/ControlPanel/Plugins/Themes/Caption": {
"title": "$:/language/ControlPanel/Plugins/Themes/Caption",
"text": "Themes"
},
"$:/language/ControlPanel/Plugins/Themes/Hint": {
"title": "$:/language/ControlPanel/Plugins/Themes/Hint",
"text": "Theme plugins"
},
"$:/language/ControlPanel/Plugins/Update/Caption": {
"title": "$:/language/ControlPanel/Plugins/Update/Caption",
"text": "update"
},
"$:/language/ControlPanel/Plugins/Updates/Caption": {
"title": "$:/language/ControlPanel/Plugins/Updates/Caption",
"text": "Updates"
},
"$:/language/ControlPanel/Plugins/Updates/Hint": {
"title": "$:/language/ControlPanel/Plugins/Updates/Hint",
"text": "Available updates to installed plugins"
},
"$:/language/ControlPanel/Plugins/Updates/UpdateAll/Caption": {
"title": "$:/language/ControlPanel/Plugins/Updates/UpdateAll/Caption",
"text": "Update <<update-count>> plugins"
},
"$:/language/ControlPanel/Plugins/SubPluginPrompt": {
"title": "$:/language/ControlPanel/Plugins/SubPluginPrompt",
"text": "With <<count>> sub-plugins available"
},
"$:/language/ControlPanel/Publishing/Caption": {
"title": "$:/language/ControlPanel/Publishing/Caption",
"text": "Publishing"
},
"$:/language/ControlPanel/Publishing/Hint": {
"title": "$:/language/ControlPanel/Publishing/Hint",
"text": "Settings used for publishing extracts from this TiddlyWiki as separate files through a \"publisher\" module"
},
"$:/language/ControlPanel/Saving/Caption": {
"title": "$:/language/ControlPanel/Saving/Caption",
"text": "Saving"
},
"$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Description": {
"title": "$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Description",
"text": "Permit automatic saving for the download saver"
},
"$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Hint": {
"title": "$:/language/ControlPanel/Saving/DownloadSaver/AutoSave/Hint",
"text": "Enable Autosave for Download Saver"
},
"$:/language/ControlPanel/Saving/DownloadSaver/Caption": {
"title": "$:/language/ControlPanel/Saving/DownloadSaver/Caption",
"text": "Download Saver"
},
"$:/language/ControlPanel/Saving/DownloadSaver/Hint": {
"title": "$:/language/ControlPanel/Saving/DownloadSaver/Hint",
"text": "These settings apply to the HTML5-compatible download saver"
},
"$:/language/ControlPanel/Saving/General/Caption": {
"title": "$:/language/ControlPanel/Saving/General/Caption",
"text": "General"
},
"$:/language/ControlPanel/Saving/General/Hint": {
"title": "$:/language/ControlPanel/Saving/General/Hint",
"text": "These settings apply to all the loaded savers"
},
"$:/language/ControlPanel/Saving/Hint": {
"title": "$:/language/ControlPanel/Saving/Hint",
"text": "Settings used for saving the entire TiddlyWiki as a single file via a saver module"
},
"$:/language/ControlPanel/Saving/GitService/Branch": {
"title": "$:/language/ControlPanel/Saving/GitService/Branch",
"text": "Target branch for saving"
},
"$:/language/ControlPanel/Saving/GitService/CommitMessage": {
"title": "$:/language/ControlPanel/Saving/GitService/CommitMessage",
"text": "Saved by TiddlyWiki"
},
"$:/language/ControlPanel/Saving/GitService/Description": {
"title": "$:/language/ControlPanel/Saving/GitService/Description",
"text": "These settings are only used when saving to <<service-name>>"
},
"$:/language/ControlPanel/Saving/GitService/Filename": {
"title": "$:/language/ControlPanel/Saving/GitService/Filename",
"text": "Filename of target file (e.g. `index.html`)"
},
"$:/language/ControlPanel/Saving/GitService/Path": {
"title": "$:/language/ControlPanel/Saving/GitService/Path",
"text": "Path to target file (e.g. `/wiki/`)"
},
"$:/language/ControlPanel/Saving/GitService/Repo": {
"title": "$:/language/ControlPanel/Saving/GitService/Repo",
"text": "Target repository (e.g. `Jermolene/TiddlyWiki5`)"
},
"$:/language/ControlPanel/Saving/GitService/ServerURL": {
"title": "$:/language/ControlPanel/Saving/GitService/ServerURL",
"text": "Server API URL"
},
"$:/language/ControlPanel/Saving/GitService/UserName": {
"title": "$:/language/ControlPanel/Saving/GitService/UserName",
"text": "Username"
},
"$:/language/ControlPanel/Saving/GitService/GitHub/Caption": {
"title": "$:/language/ControlPanel/Saving/GitService/GitHub/Caption",
"text": "~GitHub Saver"
},
"$:/language/ControlPanel/Saving/GitService/GitHub/Password": {
"title": "$:/language/ControlPanel/Saving/GitService/GitHub/Password",
"text": "Password, OAUTH token, or personal access token (see [[GitHub help page|https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line]] for details)"
},
"$:/language/ControlPanel/Saving/GitService/GitLab/Caption": {
"title": "$:/language/ControlPanel/Saving/GitService/GitLab/Caption",
"text": "~GitLab Saver"
},
"$:/language/ControlPanel/Saving/GitService/GitLab/Password": {
"title": "$:/language/ControlPanel/Saving/GitService/GitLab/Password",
"text": "Personal access token for API (see [[GitLab help page|https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html]] for details)"
},
"$:/language/ControlPanel/Saving/GitService/Gitea/Caption": {
"title": "$:/language/ControlPanel/Saving/GitService/Gitea/Caption",
"text": "Gitea Saver"
},
"$:/language/ControlPanel/Saving/GitService/Gitea/Password": {
"title": "$:/language/ControlPanel/Saving/GitService/Gitea/Password",
"text": "Personal access token for API (via Gitea’s web interface: `Settings | Applications | Generate New Token`)"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Advanced/Heading": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Advanced/Heading",
"text": "Advanced Settings"
},
"$:/language/ControlPanel/Saving/TiddlySpot/BackupDir": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/BackupDir",
"text": "Backup Directory"
},
"$:/language/ControlPanel/Saving/TiddlySpot/ControlPanel": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/ControlPanel",
"text": "~TiddlySpot Control Panel"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Backups": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Backups",
"text": "Backups"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Caption": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Caption",
"text": "~TiddlySpot Saver"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Description": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Description",
"text": "These settings are only used when saving to [[TiddlySpot|http://tiddlyspot.com]], [[TiddlyHost|https://tiddlyhost.com]], or a compatible remote server. See [[here|https://github.com/simonbaird/tiddlyhost/wiki/TiddlySpot-Saver-configuration-for-Tiddlyhost-and-Tiddlyspot]] for information on ~TiddlySpot and ~TiddlyHost saving configuration."
},
"$:/language/ControlPanel/Saving/TiddlySpot/Filename": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Filename",
"text": "Upload Filename"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Heading": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Heading",
"text": "~TiddlySpot"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Hint": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Hint",
"text": "//The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address, e.g. `http://example.com/store.php`.//"
},
"$:/language/ControlPanel/Saving/TiddlySpot/Password": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/Password",
"text": "Password"
},
"$:/language/ControlPanel/Saving/TiddlySpot/ReadOnly": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/ReadOnly",
"text": "Note that [[TiddlySpot|http://tiddlyspot.com]] no longer allows the creation of new sites. For new sites, you can use [[TiddlyHost|https://tiddlyhost.com]], a new hosting service that replaces ~TiddlySpot."
},
"$:/language/ControlPanel/Saving/TiddlySpot/ServerURL": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/ServerURL",
"text": "Server URL"
},
"$:/language/ControlPanel/Saving/TiddlySpot/UploadDir": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/UploadDir",
"text": "Upload Directory"
},
"$:/language/ControlPanel/Saving/TiddlySpot/UserName": {
"title": "$:/language/ControlPanel/Saving/TiddlySpot/UserName",
"text": "Wiki Name"
},
"$:/language/ControlPanel/Settings/AutoSave/Caption": {
"title": "$:/language/ControlPanel/Settings/AutoSave/Caption",
"text": "Autosave"
},
"$:/language/ControlPanel/Settings/AutoSave/Disabled/Description": {
"title": "$:/language/ControlPanel/Settings/AutoSave/Disabled/Description",
"text": "Do not save changes automatically"
},
"$:/language/ControlPanel/Settings/AutoSave/Enabled/Description": {
"title": "$:/language/ControlPanel/Settings/AutoSave/Enabled/Description",
"text": "Save changes automatically"
},
"$:/language/ControlPanel/Settings/AutoSave/Hint": {
"title": "$:/language/ControlPanel/Settings/AutoSave/Hint",
"text": "Attempt to automatically save changes during editing when using a supporting saver"
},
"$:/language/ControlPanel/Settings/CamelCase/Caption": {
"title": "$:/language/ControlPanel/Settings/CamelCase/Caption",
"text": "Camel Case Wiki Links"
},
"$:/language/ControlPanel/Settings/CamelCase/Hint": {
"title": "$:/language/ControlPanel/Settings/CamelCase/Hint",
"text": "You can globally disable automatic linking of ~CamelCase phrases. Requires reload to take effect"
},
"$:/language/ControlPanel/Settings/CamelCase/Description": {
"title": "$:/language/ControlPanel/Settings/CamelCase/Description",
"text": "Enable automatic ~CamelCase linking"
},
"$:/language/ControlPanel/Settings/Caption": {
"title": "$:/language/ControlPanel/Settings/Caption",
"text": "Settings"
},
"$:/language/ControlPanel/Settings/EditorToolbar/Caption": {
"title": "$:/language/ControlPanel/Settings/EditorToolbar/Caption",
"text": "Editor Toolbar"
},
"$:/language/ControlPanel/Settings/EditorToolbar/Hint": {
"title": "$:/language/ControlPanel/Settings/EditorToolbar/Hint",
"text": "Enable or disable the editor toolbar:"
},
"$:/language/ControlPanel/Settings/EditorToolbar/Description": {
"title": "$:/language/ControlPanel/Settings/EditorToolbar/Description",
"text": "Show editor toolbar"
},
"$:/language/ControlPanel/Settings/InfoPanelMode/Caption": {
"title": "$:/language/ControlPanel/Settings/InfoPanelMode/Caption",
"text": "Tiddler Info Panel Mode"
},
"$:/language/ControlPanel/Settings/InfoPanelMode/Hint": {
"title": "$:/language/ControlPanel/Settings/InfoPanelMode/Hint",
"text": "Control when the tiddler info panel closes:"
},
"$:/language/ControlPanel/Settings/InfoPanelMode/Popup/Description": {
"title": "$:/language/ControlPanel/Settings/InfoPanelMode/Popup/Description",
"text": "Tiddler info panel closes automatically"
},
"$:/language/ControlPanel/Settings/InfoPanelMode/Sticky/Description": {
"title": "$:/language/ControlPanel/Settings/InfoPanelMode/Sticky/Description",
"text": "Tiddler info panel stays open until explicitly closed"
},
"$:/language/ControlPanel/Settings/Hint": {
"title": "$:/language/ControlPanel/Settings/Hint",
"text": "These settings let you customise the behaviour of TiddlyWiki."
},
"$:/language/ControlPanel/Settings/NavigationAddressBar/Caption": {
"title": "$:/language/ControlPanel/Settings/NavigationAddressBar/Caption",
"text": "Navigation Address Bar"
},
"$:/language/ControlPanel/Settings/NavigationAddressBar/Hint": {
"title": "$:/language/ControlPanel/Settings/NavigationAddressBar/Hint",
"text": "Behaviour of the browser address bar when navigating to a tiddler:"
},
"$:/language/ControlPanel/Settings/NavigationAddressBar/No/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationAddressBar/No/Description",
"text": "Do not update the address bar"
},
"$:/language/ControlPanel/Settings/NavigationAddressBar/Permalink/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationAddressBar/Permalink/Description",
"text": "Include the target tiddler"
},
"$:/language/ControlPanel/Settings/NavigationAddressBar/Permaview/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationAddressBar/Permaview/Description",
"text": "Include the target tiddler and the current story sequence"
},
"$:/language/ControlPanel/Settings/NavigationHistory/Caption": {
"title": "$:/language/ControlPanel/Settings/NavigationHistory/Caption",
"text": "Navigation History"
},
"$:/language/ControlPanel/Settings/NavigationHistory/Hint": {
"title": "$:/language/ControlPanel/Settings/NavigationHistory/Hint",
"text": "Update browser history when navigating to a tiddler:"
},
"$:/language/ControlPanel/Settings/NavigationHistory/No/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationHistory/No/Description",
"text": "Do not update history"
},
"$:/language/ControlPanel/Settings/NavigationHistory/Yes/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationHistory/Yes/Description",
"text": "Update history"
},
"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/Caption": {
"title": "$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/Caption",
"text": "Permalink/permaview Mode"
},
"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/Hint": {
"title": "$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/Hint",
"text": "Choose how permalink/permaview is handled:"
},
"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/CopyToClipboard/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/CopyToClipboard/Description",
"text": "Copy permalink/permaview URL to clipboard"
},
"$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/UpdateAddressBar/Description": {
"title": "$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/UpdateAddressBar/Description",
"text": "Update address bar with permalink/permaview URL"
},
"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Caption": {
"title": "$:/language/ControlPanel/Settings/PerformanceInstrumentation/Caption",
"text": "Performance Instrumentation"
},
"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Hint": {
"title": "$:/language/ControlPanel/Settings/PerformanceInstrumentation/Hint",
"text": "Displays performance statistics in the browser developer console. Requires reload to take effect"
},
"$:/language/ControlPanel/Settings/PerformanceInstrumentation/Description": {
"title": "$:/language/ControlPanel/Settings/PerformanceInstrumentation/Description",
"text": "Enable performance instrumentation"
},
"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Caption": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtonStyle/Caption",
"text": "Toolbar Button Style"
},
"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Hint": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtonStyle/Hint",
"text": "Choose the style for toolbar buttons:"
},
"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Borderless": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Borderless",
"text": "Borderless"
},
"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Boxed": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Boxed",
"text": "Boxed"
},
"$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Rounded": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Rounded",
"text": "Rounded"
},
"$:/language/ControlPanel/Settings/ToolbarButtons/Caption": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtons/Caption",
"text": "Toolbar Buttons"
},
"$:/language/ControlPanel/Settings/ToolbarButtons/Hint": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtons/Hint",
"text": "Default toolbar button appearance:"
},
"$:/language/ControlPanel/Settings/ToolbarButtons/Icons/Description": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtons/Icons/Description",
"text": "Include icon"
},
"$:/language/ControlPanel/Settings/ToolbarButtons/Text/Description": {
"title": "$:/language/ControlPanel/Settings/ToolbarButtons/Text/Description",
"text": "Include text"
},
"$:/language/ControlPanel/Settings/DefaultSidebarTab/Caption": {
"title": "$:/language/ControlPanel/Settings/DefaultSidebarTab/Caption",
"text": "Default Sidebar Tab"
},
"$:/language/ControlPanel/Settings/DefaultSidebarTab/Hint": {
"title": "$:/language/ControlPanel/Settings/DefaultSidebarTab/Hint",
"text": "Specify which sidebar tab is displayed by default"
},
"$:/language/ControlPanel/Settings/DefaultMoreSidebarTab/Caption": {
"title": "$:/language/ControlPanel/Settings/DefaultMoreSidebarTab/Caption",
"text": "Default More Sidebar Tab"
},
"$:/language/ControlPanel/Settings/DefaultMoreSidebarTab/Hint": {
"title": "$:/language/ControlPanel/Settings/DefaultMoreSidebarTab/Hint",
"text": "Specify which More sidebar tab is displayed by default"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/Caption": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/Caption",
"text": "Tiddler Opening Behaviour"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/InsideRiver/Hint": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/InsideRiver/Hint",
"text": "Navigation from //within// the story river"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/OutsideRiver/Hint": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/OutsideRiver/Hint",
"text": "Navigation from //outside// the story river"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAbove": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAbove",
"text": "Open above the current tiddler"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenBelow": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/OpenBelow",
"text": "Open below the current tiddler"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtTop": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtTop",
"text": "Open at the top of the story river"
},
"$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtBottom": {
"title": "$:/language/ControlPanel/Settings/LinkToBehaviour/OpenAtBottom",
"text": "Open at the bottom of the story river"
},
"$:/language/ControlPanel/Settings/TitleLinks/Caption": {
"title": "$:/language/ControlPanel/Settings/TitleLinks/Caption",
"text": "Tiddler Titles"
},
"$:/language/ControlPanel/Settings/TitleLinks/Hint": {
"title": "$:/language/ControlPanel/Settings/TitleLinks/Hint",
"text": "Optionally display tiddler titles as links"
},
"$:/language/ControlPanel/Settings/TitleLinks/No/Description": {
"title": "$:/language/ControlPanel/Settings/TitleLinks/No/Description",
"text": "Do not display tiddler titles as links"
},
"$:/language/ControlPanel/Settings/TitleLinks/Yes/Description": {
"title": "$:/language/ControlPanel/Settings/TitleLinks/Yes/Description",
"text": "Display tiddler titles as links"
},
"$:/language/ControlPanel/Settings/MissingLinks/Caption": {
"title": "$:/language/ControlPanel/Settings/MissingLinks/Caption",
"text": "Wiki Links"
},
"$:/language/ControlPanel/Settings/MissingLinks/Hint": {
"title": "$:/language/ControlPanel/Settings/MissingLinks/Hint",
"text": "Choose whether to link to tiddlers that do not exist yet"
},
"$:/language/ControlPanel/Settings/MissingLinks/Description": {
"title": "$:/language/ControlPanel/Settings/MissingLinks/Description",
"text": "Enable links to missing tiddlers"
},
"$:/language/ControlPanel/StoryView/Caption": {
"title": "$:/language/ControlPanel/StoryView/Caption",
"text": "Story View"
},
"$:/language/ControlPanel/StoryView/Prompt": {
"title": "$:/language/ControlPanel/StoryView/Prompt",
"text": "Current view:"
},
"$:/language/ControlPanel/Stylesheets/Caption": {
"title": "$:/language/ControlPanel/Stylesheets/Caption",
"text": "Stylesheets"
},
"$:/language/ControlPanel/Stylesheets/Expand/Caption": {
"title": "$:/language/ControlPanel/Stylesheets/Expand/Caption",
"text": "Expand All"
},
"$:/language/ControlPanel/Stylesheets/Hint": {
"title": "$:/language/ControlPanel/Stylesheets/Hint",
"text": "This is the rendered CSS of the current stylesheet tiddlers tagged with <<tag \"$:/tags/Stylesheet\">>"
},
"$:/language/ControlPanel/Stylesheets/Restore/Caption": {
"title": "$:/language/ControlPanel/Stylesheets/Restore/Caption",
"text": "Restore"
},
"$:/language/ControlPanel/Theme/Caption": {
"title": "$:/language/ControlPanel/Theme/Caption",
"text": "Theme"
},
"$:/language/ControlPanel/Theme/Prompt": {
"title": "$:/language/ControlPanel/Theme/Prompt",
"text": "Current theme:"
},
"$:/language/ControlPanel/TiddlerFields/Caption": {
"title": "$:/language/ControlPanel/TiddlerFields/Caption",
"text": "Tiddler Fields"
},
"$:/language/ControlPanel/TiddlerFields/Hint": {
"title": "$:/language/ControlPanel/TiddlerFields/Hint",
"text": "This is the full set of TiddlerFields in use in this wiki (including system tiddlers but excluding shadow tiddlers)."
},
"$:/language/ControlPanel/Toolbars/Caption": {
"title": "$:/language/ControlPanel/Toolbars/Caption",
"text": "Toolbars"
},
"$:/language/ControlPanel/Toolbars/EditToolbar/Caption": {
"title": "$:/language/ControlPanel/Toolbars/EditToolbar/Caption",
"text": "Edit Toolbar"
},
"$:/language/ControlPanel/Toolbars/EditToolbar/Hint": {
"title": "$:/language/ControlPanel/Toolbars/EditToolbar/Hint",
"text": "Choose which buttons are displayed for tiddlers in edit mode. Drag and drop to change the ordering"
},
"$:/language/ControlPanel/Toolbars/Hint": {
"title": "$:/language/ControlPanel/Toolbars/Hint",
"text": "Select which toolbar buttons are displayed"
},
"$:/language/ControlPanel/Toolbars/PageControls/Caption": {
"title": "$:/language/ControlPanel/Toolbars/PageControls/Caption",
"text": "Page Toolbar"
},
"$:/language/ControlPanel/Toolbars/PageControls/Hint": {
"title": "$:/language/ControlPanel/Toolbars/PageControls/Hint",
"text": "Choose which buttons are displayed on the main page toolbar. Drag and drop to change the ordering"
},
"$:/language/ControlPanel/Toolbars/EditorToolbar/Caption": {
"title": "$:/language/ControlPanel/Toolbars/EditorToolbar/Caption",
"text": "Editor Toolbar"
},
"$:/language/ControlPanel/Toolbars/EditorToolbar/Hint": {
"title": "$:/language/ControlPanel/Toolbars/EditorToolbar/Hint",
"text": "Choose which buttons are displayed in the editor toolbar. Note that some buttons will only appear when editing tiddlers of a certain type. Drag and drop to change the ordering"
},
"$:/language/ControlPanel/Toolbars/ViewToolbar/Caption": {
"title": "$:/language/ControlPanel/Toolbars/ViewToolbar/Caption",
"text": "View Toolbar"
},
"$:/language/ControlPanel/Toolbars/ViewToolbar/Hint": {
"title": "$:/language/ControlPanel/Toolbars/ViewToolbar/Hint",
"text": "Choose which buttons are displayed for tiddlers in view mode. Drag and drop to change the ordering"
},
"$:/language/ControlPanel/Tools/Download/Full/Caption": {
"title": "$:/language/ControlPanel/Tools/Download/Full/Caption",
"text": "Download full wiki"
},
"$:/language/Date/DaySuffix/1": {
"title": "$:/language/Date/DaySuffix/1",
"text": "st"
},
"$:/language/Date/DaySuffix/2": {
"title": "$:/language/Date/DaySuffix/2",
"text": "nd"
},
"$:/language/Date/DaySuffix/3": {
"title": "$:/language/Date/DaySuffix/3",
"text": "rd"
},
"$:/language/Date/DaySuffix/4": {
"title": "$:/language/Date/DaySuffix/4",
"text": "th"
},
"$:/language/Date/DaySuffix/5": {
"title": "$:/language/Date/DaySuffix/5",
"text": "th"
},
"$:/language/Date/DaySuffix/6": {
"title": "$:/language/Date/DaySuffix/6",
"text": "th"
},
"$:/language/Date/DaySuffix/7": {
"title": "$:/language/Date/DaySuffix/7",
"text": "th"
},
"$:/language/Date/DaySuffix/8": {
"title": "$:/language/Date/DaySuffix/8",
"text": "th"
},
"$:/language/Date/DaySuffix/9": {
"title": "$:/language/Date/DaySuffix/9",
"text": "th"
},
"$:/language/Date/DaySuffix/10": {
"title": "$:/language/Date/DaySuffix/10",
"text": "th"
},
"$:/language/Date/DaySuffix/11": {
"title": "$:/language/Date/DaySuffix/11",
"text": "th"
},
"$:/language/Date/DaySuffix/12": {
"title": "$:/language/Date/DaySuffix/12",
"text": "th"
},
"$:/language/Date/DaySuffix/13": {
"title": "$:/language/Date/DaySuffix/13",
"text": "th"
},
"$:/language/Date/DaySuffix/14": {
"title": "$:/language/Date/DaySuffix/14",
"text": "th"
},
"$:/language/Date/DaySuffix/15": {
"title": "$:/language/Date/DaySuffix/15",
"text": "th"
},
"$:/language/Date/DaySuffix/16": {
"title": "$:/language/Date/DaySuffix/16",
"text": "th"
},
"$:/language/Date/DaySuffix/17": {
"title": "$:/language/Date/DaySuffix/17",
"text": "th"
},
"$:/language/Date/DaySuffix/18": {
"title": "$:/language/Date/DaySuffix/18",
"text": "th"
},
"$:/language/Date/DaySuffix/19": {
"title": "$:/language/Date/DaySuffix/19",
"text": "th"
},
"$:/language/Date/DaySuffix/20": {
"title": "$:/language/Date/DaySuffix/20",
"text": "th"
},
"$:/language/Date/DaySuffix/21": {
"title": "$:/language/Date/DaySuffix/21",
"text": "st"
},
"$:/language/Date/DaySuffix/22": {
"title": "$:/language/Date/DaySuffix/22",
"text": "nd"
},
"$:/language/Date/DaySuffix/23": {
"title": "$:/language/Date/DaySuffix/23",
"text": "rd"
},
"$:/language/Date/DaySuffix/24": {
"title": "$:/language/Date/DaySuffix/24",
"text": "th"
},
"$:/language/Date/DaySuffix/25": {
"title": "$:/language/Date/DaySuffix/25",
"text": "th"
},
"$:/language/Date/DaySuffix/26": {
"title": "$:/language/Date/DaySuffix/26",
"text": "th"
},
"$:/language/Date/DaySuffix/27": {
"title": "$:/language/Date/DaySuffix/27",
"text": "th"
},
"$:/language/Date/DaySuffix/28": {
"title": "$:/language/Date/DaySuffix/28",
"text": "th"
},
"$:/language/Date/DaySuffix/29": {
"title": "$:/language/Date/DaySuffix/29",
"text": "th"
},
"$:/language/Date/DaySuffix/30": {
"title": "$:/language/Date/DaySuffix/30",
"text": "th"
},
"$:/language/Date/DaySuffix/31": {
"title": "$:/language/Date/DaySuffix/31",
"text": "st"
},
"$:/language/Date/Long/Day/0": {
"title": "$:/language/Date/Long/Day/0",
"text": "Sunday"
},
"$:/language/Date/Long/Day/1": {
"title": "$:/language/Date/Long/Day/1",
"text": "Monday"
},
"$:/language/Date/Long/Day/2": {
"title": "$:/language/Date/Long/Day/2",
"text": "Tuesday"
},
"$:/language/Date/Long/Day/3": {
"title": "$:/language/Date/Long/Day/3",
"text": "Wednesday"
},
"$:/language/Date/Long/Day/4": {
"title": "$:/language/Date/Long/Day/4",
"text": "Thursday"
},
"$:/language/Date/Long/Day/5": {
"title": "$:/language/Date/Long/Day/5",
"text": "Friday"
},
"$:/language/Date/Long/Day/6": {
"title": "$:/language/Date/Long/Day/6",
"text": "Saturday"
},
"$:/language/Date/Long/Month/1": {
"title": "$:/language/Date/Long/Month/1",
"text": "January"
},
"$:/language/Date/Long/Month/2": {
"title": "$:/language/Date/Long/Month/2",
"text": "February"
},
"$:/language/Date/Long/Month/3": {
"title": "$:/language/Date/Long/Month/3",
"text": "March"
},
"$:/language/Date/Long/Month/4": {
"title": "$:/language/Date/Long/Month/4",
"text": "April"
},
"$:/language/Date/Long/Month/5": {
"title": "$:/language/Date/Long/Month/5",
"text": "May"
},
"$:/language/Date/Long/Month/6": {
"title": "$:/language/Date/Long/Month/6",
"text": "June"
},
"$:/language/Date/Long/Month/7": {
"title": "$:/language/Date/Long/Month/7",
"text": "July"
},
"$:/language/Date/Long/Month/8": {
"title": "$:/language/Date/Long/Month/8",
"text": "August"
},
"$:/language/Date/Long/Month/9": {
"title": "$:/language/Date/Long/Month/9",
"text": "September"
},
"$:/language/Date/Long/Month/10": {
"title": "$:/language/Date/Long/Month/10",
"text": "October"
},
"$:/language/Date/Long/Month/11": {
"title": "$:/language/Date/Long/Month/11",
"text": "November"
},
"$:/language/Date/Long/Month/12": {
"title": "$:/language/Date/Long/Month/12",
"text": "December"
},
"$:/language/Date/Period/am": {
"title": "$:/language/Date/Period/am",
"text": "am"
},
"$:/language/Date/Period/pm": {
"title": "$:/language/Date/Period/pm",
"text": "pm"
},
"$:/language/Date/Short/Day/0": {
"title": "$:/language/Date/Short/Day/0",
"text": "Sun"
},
"$:/language/Date/Short/Day/1": {
"title": "$:/language/Date/Short/Day/1",
"text": "Mon"
},
"$:/language/Date/Short/Day/2": {
"title": "$:/language/Date/Short/Day/2",
"text": "Tue"
},
"$:/language/Date/Short/Day/3": {
"title": "$:/language/Date/Short/Day/3",
"text": "Wed"
},
"$:/language/Date/Short/Day/4": {
"title": "$:/language/Date/Short/Day/4",
"text": "Thu"
},
"$:/language/Date/Short/Day/5": {
"title": "$:/language/Date/Short/Day/5",
"text": "Fri"
},
"$:/language/Date/Short/Day/6": {
"title": "$:/language/Date/Short/Day/6",
"text": "Sat"
},
"$:/language/Date/Short/Month/1": {
"title": "$:/language/Date/Short/Month/1",
"text": "Jan"
},
"$:/language/Date/Short/Month/2": {
"title": "$:/language/Date/Short/Month/2",
"text": "Feb"
},
"$:/language/Date/Short/Month/3": {
"title": "$:/language/Date/Short/Month/3",
"text": "Mar"
},
"$:/language/Date/Short/Month/4": {
"title": "$:/language/Date/Short/Month/4",
"text": "Apr"
},
"$:/language/Date/Short/Month/5": {
"title": "$:/language/Date/Short/Month/5",
"text": "May"
},
"$:/language/Date/Short/Month/6": {
"title": "$:/language/Date/Short/Month/6",
"text": "Jun"
},
"$:/language/Date/Short/Month/7": {
"title": "$:/language/Date/Short/Month/7",
"text": "Jul"
},
"$:/language/Date/Short/Month/8": {
"title": "$:/language/Date/Short/Month/8",
"text": "Aug"
},
"$:/language/Date/Short/Month/9": {
"title": "$:/language/Date/Short/Month/9",
"text": "Sep"
},
"$:/language/Date/Short/Month/10": {
"title": "$:/language/Date/Short/Month/10",
"text": "Oct"
},
"$:/language/Date/Short/Month/11": {
"title": "$:/language/Date/Short/Month/11",
"text": "Nov"
},
"$:/language/Date/Short/Month/12": {
"title": "$:/language/Date/Short/Month/12",
"text": "Dec"
},
"$:/language/RelativeDate/Future/Days": {
"title": "$:/language/RelativeDate/Future/Days",
"text": "<<period>> days from now"
},
"$:/language/RelativeDate/Future/Hours": {
"title": "$:/language/RelativeDate/Future/Hours",
"text": "<<period>> hours from now"
},
"$:/language/RelativeDate/Future/Minutes": {
"title": "$:/language/RelativeDate/Future/Minutes",
"text": "<<period>> minutes from now"
},
"$:/language/RelativeDate/Future/Months": {
"title": "$:/language/RelativeDate/Future/Months",
"text": "<<period>> months from now"
},
"$:/language/RelativeDate/Future/Second": {
"title": "$:/language/RelativeDate/Future/Second",
"text": "1 second from now"
},
"$:/language/RelativeDate/Future/Seconds": {
"title": "$:/language/RelativeDate/Future/Seconds",
"text": "<<period>> seconds from now"
},
"$:/language/RelativeDate/Future/Years": {
"title": "$:/language/RelativeDate/Future/Years",
"text": "<<period>> years from now"
},
"$:/language/RelativeDate/Past/Days": {
"title": "$:/language/RelativeDate/Past/Days",
"text": "<<period>> days ago"
},
"$:/language/RelativeDate/Past/Hours": {
"title": "$:/language/RelativeDate/Past/Hours",
"text": "<<period>> hours ago"
},
"$:/language/RelativeDate/Past/Minutes": {
"title": "$:/language/RelativeDate/Past/Minutes",
"text": "<<period>> minutes ago"
},
"$:/language/RelativeDate/Past/Months": {
"title": "$:/language/RelativeDate/Past/Months",
"text": "<<period>> months ago"
},
"$:/language/RelativeDate/Past/Second": {
"title": "$:/language/RelativeDate/Past/Second",
"text": "1 second ago"
},
"$:/language/RelativeDate/Past/Seconds": {
"title": "$:/language/RelativeDate/Past/Seconds",
"text": "<<period>> seconds ago"
},
"$:/language/RelativeDate/Past/Years": {
"title": "$:/language/RelativeDate/Past/Years",
"text": "<<period>> years ago"
},
"$:/language/Docs/ModuleTypes/allfilteroperator": {
"title": "$:/language/Docs/ModuleTypes/allfilteroperator",
"text": "A sub-operator for the ''all'' filter operator."
},
"$:/language/Docs/ModuleTypes/animation": {
"title": "$:/language/Docs/ModuleTypes/animation",
"text": "Animations that may be used with the RevealWidget."
},
"$:/language/Docs/ModuleTypes/authenticator": {
"title": "$:/language/Docs/ModuleTypes/authenticator",
"text": "Defines how requests are authenticated by the built-in HTTP server."
},
"$:/language/Docs/ModuleTypes/bitmapeditoroperation": {
"title": "$:/language/Docs/ModuleTypes/bitmapeditoroperation",
"text": "A bitmap editor toolbar operation."
},
"$:/language/Docs/ModuleTypes/command": {
"title": "$:/language/Docs/ModuleTypes/command",
"text": "Commands that can be executed under Node.js."
},
"$:/language/Docs/ModuleTypes/config": {
"title": "$:/language/Docs/ModuleTypes/config",
"text": "Data to be inserted into `$tw.config`."
},
"$:/language/Docs/ModuleTypes/filteroperator": {
"title": "$:/language/Docs/ModuleTypes/filteroperator",
"text": "Individual filter operator methods."
},
"$:/language/Docs/ModuleTypes/global": {
"title": "$:/language/Docs/ModuleTypes/global",
"text": "Global data to be inserted into `$tw`."
},
"$:/language/Docs/ModuleTypes/info": {
"title": "$:/language/Docs/ModuleTypes/info",
"text": "Publishes system information via the [[$:/temp/info-plugin]] pseudo-plugin."
},
"$:/language/Docs/ModuleTypes/isfilteroperator": {
"title": "$:/language/Docs/ModuleTypes/isfilteroperator",
"text": "Operands for the ''is'' filter operator."
},
"$:/language/Docs/ModuleTypes/library": {
"title": "$:/language/Docs/ModuleTypes/library",
"text": "Generic module type for general purpose JavaScript modules."
},
"$:/language/Docs/ModuleTypes/macro": {
"title": "$:/language/Docs/ModuleTypes/macro",
"text": "JavaScript macro definitions."
},
"$:/language/Docs/ModuleTypes/parser": {
"title": "$:/language/Docs/ModuleTypes/parser",
"text": "Parsers for different content types."
},
"$:/language/Docs/ModuleTypes/route": {
"title": "$:/language/Docs/ModuleTypes/route",
"text": "Defines how individual URL patterns are handled by the built-in HTTP server."
},
"$:/language/Docs/ModuleTypes/saver": {
"title": "$:/language/Docs/ModuleTypes/saver",
"text": "Savers handle different methods for saving files from the browser."
},
"$:/language/Docs/ModuleTypes/startup": {
"title": "$:/language/Docs/ModuleTypes/startup",
"text": "Startup functions."
},
"$:/language/Docs/ModuleTypes/storyview": {
"title": "$:/language/Docs/ModuleTypes/storyview",
"text": "Story views customise the animation and behaviour of list widgets."
},
"$:/language/Docs/ModuleTypes/texteditoroperation": {
"title": "$:/language/Docs/ModuleTypes/texteditoroperation",
"text": "A text editor toolbar operation."
},
"$:/language/Docs/ModuleTypes/tiddlerdeserializer": {
"title": "$:/language/Docs/ModuleTypes/tiddlerdeserializer",
"text": "Converts different content types into tiddlers."
},
"$:/language/Docs/ModuleTypes/tiddlerfield": {
"title": "$:/language/Docs/ModuleTypes/tiddlerfield",
"text": "Defines the behaviour of an individual tiddler field."
},
"$:/language/Docs/ModuleTypes/tiddlermethod": {
"title": "$:/language/Docs/ModuleTypes/tiddlermethod",
"text": "Adds methods to the `$tw.Tiddler` prototype."
},
"$:/language/Docs/ModuleTypes/upgrader": {
"title": "$:/language/Docs/ModuleTypes/upgrader",
"text": "Applies upgrade processing to tiddlers during an upgrade/import."
},
"$:/language/Docs/ModuleTypes/utils": {
"title": "$:/language/Docs/ModuleTypes/utils",
"text": "Adds methods to `$tw.utils`."
},
"$:/language/Docs/ModuleTypes/utils-browser": {
"title": "$:/language/Docs/ModuleTypes/utils-browser",
"text": "Adds browser-specific methods to `$tw.utils`."
},
"$:/language/Docs/ModuleTypes/utils-node": {
"title": "$:/language/Docs/ModuleTypes/utils-node",
"text": "Adds Node.js-specific methods to `$tw.utils`."
},
"$:/language/Docs/ModuleTypes/widget": {
"title": "$:/language/Docs/ModuleTypes/widget",
"text": "Widgets encapsulate DOM rendering and refreshing."
},
"$:/language/Docs/ModuleTypes/wikimethod": {
"title": "$:/language/Docs/ModuleTypes/wikimethod",
"text": "Adds methods to `$tw.Wiki`."
},
"$:/language/Docs/ModuleTypes/wikirule": {
"title": "$:/language/Docs/ModuleTypes/wikirule",
"text": "Individual parser rules for the main WikiText parser."
},
"$:/language/Docs/PaletteColours/alert-background": {
"title": "$:/language/Docs/PaletteColours/alert-background",
"text": "Alert background"
},
"$:/language/Docs/PaletteColours/alert-border": {
"title": "$:/language/Docs/PaletteColours/alert-border",
"text": "Alert border"
},
"$:/language/Docs/PaletteColours/alert-highlight": {
"title": "$:/language/Docs/PaletteColours/alert-highlight",
"text": "Alert highlight"
},
"$:/language/Docs/PaletteColours/alert-muted-foreground": {
"title": "$:/language/Docs/PaletteColours/alert-muted-foreground",
"text": "Alert muted foreground"
},
"$:/language/Docs/PaletteColours/background": {
"title": "$:/language/Docs/PaletteColours/background",
"text": "General background"
},
"$:/language/Docs/PaletteColours/blockquote-bar": {
"title": "$:/language/Docs/PaletteColours/blockquote-bar",
"text": "Blockquote bar"
},
"$:/language/Docs/PaletteColours/button-background": {
"title": "$:/language/Docs/PaletteColours/button-background",
"text": "Default button background"
},
"$:/language/Docs/PaletteColours/button-border": {
"title": "$:/language/Docs/PaletteColours/button-border",
"text": "Default button border"
},
"$:/language/Docs/PaletteColours/button-foreground": {
"title": "$:/language/Docs/PaletteColours/button-foreground",
"text": "Default button foreground"
},
"$:/language/Docs/PaletteColours/dirty-indicator": {
"title": "$:/language/Docs/PaletteColours/dirty-indicator",
"text": "Unsaved changes indicator"
},
"$:/language/Docs/PaletteColours/code-background": {
"title": "$:/language/Docs/PaletteColours/code-background",
"text": "Code background"
},
"$:/language/Docs/PaletteColours/code-border": {
"title": "$:/language/Docs/PaletteColours/code-border",
"text": "Code border"
},
"$:/language/Docs/PaletteColours/code-foreground": {
"title": "$:/language/Docs/PaletteColours/code-foreground",
"text": "Code foreground"
},
"$:/language/Docs/PaletteColours/download-background": {
"title": "$:/language/Docs/PaletteColours/download-background",
"text": "Download button background"
},
"$:/language/Docs/PaletteColours/download-foreground": {
"title": "$:/language/Docs/PaletteColours/download-foreground",
"text": "Download button foreground"
},
"$:/language/Docs/PaletteColours/dragger-background": {
"title": "$:/language/Docs/PaletteColours/dragger-background",
"text": "Dragger background"
},
"$:/language/Docs/PaletteColours/dragger-foreground": {
"title": "$:/language/Docs/PaletteColours/dragger-foreground",
"text": "Dragger foreground"
},
"$:/language/Docs/PaletteColours/dropdown-background": {
"title": "$:/language/Docs/PaletteColours/dropdown-background",
"text": "Dropdown background"
},
"$:/language/Docs/PaletteColours/dropdown-border": {
"title": "$:/language/Docs/PaletteColours/dropdown-border",
"text": "Dropdown border"
},
"$:/language/Docs/PaletteColours/dropdown-tab-background-selected": {
"title": "$:/language/Docs/PaletteColours/dropdown-tab-background-selected",
"text": "Dropdown tab background for selected tabs"
},
"$:/language/Docs/PaletteColours/dropdown-tab-background": {
"title": "$:/language/Docs/PaletteColours/dropdown-tab-background",
"text": "Dropdown tab background"
},
"$:/language/Docs/PaletteColours/dropzone-background": {
"title": "$:/language/Docs/PaletteColours/dropzone-background",
"text": "Dropzone background"
},
"$:/language/Docs/PaletteColours/external-link-background-hover": {
"title": "$:/language/Docs/PaletteColours/external-link-background-hover",
"text": "External link background hover"
},
"$:/language/Docs/PaletteColours/external-link-background-visited": {
"title": "$:/language/Docs/PaletteColours/external-link-background-visited",
"text": "External link background visited"
},
"$:/language/Docs/PaletteColours/external-link-background": {
"title": "$:/language/Docs/PaletteColours/external-link-background",
"text": "External link background"
},
"$:/language/Docs/PaletteColours/external-link-foreground-hover": {
"title": "$:/language/Docs/PaletteColours/external-link-foreground-hover",
"text": "External link foreground hover"
},
"$:/language/Docs/PaletteColours/external-link-foreground-visited": {
"title": "$:/language/Docs/PaletteColours/external-link-foreground-visited",
"text": "External link foreground visited"
},
"$:/language/Docs/PaletteColours/external-link-foreground": {
"title": "$:/language/Docs/PaletteColours/external-link-foreground",
"text": "External link foreground"
},
"$:/language/Docs/PaletteColours/foreground": {
"title": "$:/language/Docs/PaletteColours/foreground",
"text": "General foreground"
},
"$:/language/Docs/PaletteColours/menubar-background": {
"title": "$:/language/Docs/PaletteColours/menubar-background",
"text": "Menu bar background"
},
"$:/language/Docs/PaletteColours/menubar-foreground": {
"title": "$:/language/Docs/PaletteColours/menubar-foreground",
"text": "Menu bar foreground"
},
"$:/language/Docs/PaletteColours/message-background": {
"title": "$:/language/Docs/PaletteColours/message-background",
"text": "Message box background"
},
"$:/language/Docs/PaletteColours/message-border": {
"title": "$:/language/Docs/PaletteColours/message-border",
"text": "Message box border"
},
"$:/language/Docs/PaletteColours/message-foreground": {
"title": "$:/language/Docs/PaletteColours/message-foreground",
"text": "Message box foreground"
},
"$:/language/Docs/PaletteColours/modal-backdrop": {
"title": "$:/language/Docs/PaletteColours/modal-backdrop",
"text": "Modal backdrop"
},
"$:/language/Docs/PaletteColours/modal-background": {
"title": "$:/language/Docs/PaletteColours/modal-background",
"text": "Modal background"
},
"$:/language/Docs/PaletteColours/modal-border": {
"title": "$:/language/Docs/PaletteColours/modal-border",
"text": "Modal border"
},
"$:/language/Docs/PaletteColours/modal-footer-background": {
"title": "$:/language/Docs/PaletteColours/modal-footer-background",
"text": "Modal footer background"
},
"$:/language/Docs/PaletteColours/modal-footer-border": {
"title": "$:/language/Docs/PaletteColours/modal-footer-border",
"text": "Modal footer border"
},
"$:/language/Docs/PaletteColours/modal-header-border": {
"title": "$:/language/Docs/PaletteColours/modal-header-border",
"text": "Modal header border"
},
"$:/language/Docs/PaletteColours/muted-foreground": {
"title": "$:/language/Docs/PaletteColours/muted-foreground",
"text": "General muted foreground"
},
"$:/language/Docs/PaletteColours/notification-background": {
"title": "$:/language/Docs/PaletteColours/notification-background",
"text": "Notification background"
},
"$:/language/Docs/PaletteColours/notification-border": {
"title": "$:/language/Docs/PaletteColours/notification-border",
"text": "Notification border"
},
"$:/language/Docs/PaletteColours/page-background": {
"title": "$:/language/Docs/PaletteColours/page-background",
"text": "Page background"
},
"$:/language/Docs/PaletteColours/pre-background": {
"title": "$:/language/Docs/PaletteColours/pre-background",
"text": "Preformatted code background"
},
"$:/language/Docs/PaletteColours/pre-border": {
"title": "$:/language/Docs/PaletteColours/pre-border",
"text": "Preformatted code border"
},
"$:/language/Docs/PaletteColours/primary": {
"title": "$:/language/Docs/PaletteColours/primary",
"text": "General primary"
},
"$:/language/Docs/PaletteColours/select-tag-background": {
"title": "$:/language/Docs/PaletteColours/select-tag-background",
"text": "`<select>` element background"
},
"$:/language/Docs/PaletteColours/select-tag-foreground": {
"title": "$:/language/Docs/PaletteColours/select-tag-foreground",
"text": "`<select>` element text"
},
"$:/language/Docs/PaletteColours/sidebar-button-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-button-foreground",
"text": "Sidebar button foreground"
},
"$:/language/Docs/PaletteColours/sidebar-controls-foreground-hover": {
"title": "$:/language/Docs/PaletteColours/sidebar-controls-foreground-hover",
"text": "Sidebar controls foreground hover"
},
"$:/language/Docs/PaletteColours/sidebar-controls-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-controls-foreground",
"text": "Sidebar controls foreground"
},
"$:/language/Docs/PaletteColours/sidebar-foreground-shadow": {
"title": "$:/language/Docs/PaletteColours/sidebar-foreground-shadow",
"text": "Sidebar foreground shadow"
},
"$:/language/Docs/PaletteColours/sidebar-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-foreground",
"text": "Sidebar foreground"
},
"$:/language/Docs/PaletteColours/sidebar-muted-foreground-hover": {
"title": "$:/language/Docs/PaletteColours/sidebar-muted-foreground-hover",
"text": "Sidebar muted foreground hover"
},
"$:/language/Docs/PaletteColours/sidebar-muted-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-muted-foreground",
"text": "Sidebar muted foreground"
},
"$:/language/Docs/PaletteColours/sidebar-tab-background-selected": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-background-selected",
"text": "Sidebar tab background for selected tabs"
},
"$:/language/Docs/PaletteColours/sidebar-tab-background": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-background",
"text": "Sidebar tab background"
},
"$:/language/Docs/PaletteColours/sidebar-tab-border-selected": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-border-selected",
"text": "Sidebar tab border for selected tabs"
},
"$:/language/Docs/PaletteColours/sidebar-tab-border": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-border",
"text": "Sidebar tab border"
},
"$:/language/Docs/PaletteColours/sidebar-tab-divider": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-divider",
"text": "Sidebar tab divider"
},
"$:/language/Docs/PaletteColours/sidebar-tab-foreground-selected": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-foreground-selected",
"text": "Sidebar tab foreground for selected tabs"
},
"$:/language/Docs/PaletteColours/sidebar-tab-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-tab-foreground",
"text": "Sidebar tab foreground"
},
"$:/language/Docs/PaletteColours/sidebar-tiddler-link-foreground-hover": {
"title": "$:/language/Docs/PaletteColours/sidebar-tiddler-link-foreground-hover",
"text": "Sidebar tiddler link foreground hover"
},
"$:/language/Docs/PaletteColours/sidebar-tiddler-link-foreground": {
"title": "$:/language/Docs/PaletteColours/sidebar-tiddler-link-foreground",
"text": "Sidebar tiddler link foreground"
},
"$:/language/Docs/PaletteColours/site-title-foreground": {
"title": "$:/language/Docs/PaletteColours/site-title-foreground",
"text": "Site title foreground"
},
"$:/language/Docs/PaletteColours/static-alert-foreground": {
"title": "$:/language/Docs/PaletteColours/static-alert-foreground",
"text": "Static alert foreground"
},
"$:/language/Docs/PaletteColours/tab-background-selected": {
"title": "$:/language/Docs/PaletteColours/tab-background-selected",
"text": "Tab background for selected tabs"
},
"$:/language/Docs/PaletteColours/tab-background": {
"title": "$:/language/Docs/PaletteColours/tab-background",
"text": "Tab background"
},
"$:/language/Docs/PaletteColours/tab-border-selected": {
"title": "$:/language/Docs/PaletteColours/tab-border-selected",
"text": "Tab border for selected tabs"
},
"$:/language/Docs/PaletteColours/tab-border": {
"title": "$:/language/Docs/PaletteColours/tab-border",
"text": "Tab border"
},
"$:/language/Docs/PaletteColours/tab-divider": {
"title": "$:/language/Docs/PaletteColours/tab-divider",
"text": "Tab divider"
},
"$:/language/Docs/PaletteColours/tab-foreground-selected": {
"title": "$:/language/Docs/PaletteColours/tab-foreground-selected",
"text": "Tab foreground for selected tabs"
},
"$:/language/Docs/PaletteColours/tab-foreground": {
"title": "$:/language/Docs/PaletteColours/tab-foreground",
"text": "Tab foreground"
},
"$:/language/Docs/PaletteColours/table-border": {
"title": "$:/language/Docs/PaletteColours/table-border",
"text": "Table border"
},
"$:/language/Docs/PaletteColours/table-footer-background": {
"title": "$:/language/Docs/PaletteColours/table-footer-background",
"text": "Table footer background"
},
"$:/language/Docs/PaletteColours/table-header-background": {
"title": "$:/language/Docs/PaletteColours/table-header-background",
"text": "Table header background"
},
"$:/language/Docs/PaletteColours/tag-background": {
"title": "$:/language/Docs/PaletteColours/tag-background",
"text": "Tag background"
},
"$:/language/Docs/PaletteColours/tag-foreground": {
"title": "$:/language/Docs/PaletteColours/tag-foreground",
"text": "Tag foreground"
},
"$:/language/Docs/PaletteColours/tiddler-background": {
"title": "$:/language/Docs/PaletteColours/tiddler-background",
"text": "Tiddler background"
},
"$:/language/Docs/PaletteColours/tiddler-border": {
"title": "$:/language/Docs/PaletteColours/tiddler-border",
"text": "Tiddler border"
},
"$:/language/Docs/PaletteColours/tiddler-controls-foreground-hover": {
"title": "$:/language/Docs/PaletteColours/tiddler-controls-foreground-hover",
"text": "Tiddler controls foreground hover"
},
"$:/language/Docs/PaletteColours/tiddler-controls-foreground-selected": {
"title": "$:/language/Docs/PaletteColours/tiddler-controls-foreground-selected",
"text": "Tiddler controls foreground for selected controls"
},
"$:/language/Docs/PaletteColours/tiddler-controls-foreground": {
"title": "$:/language/Docs/PaletteColours/tiddler-controls-foreground",
"text": "Tiddler controls foreground"
},
"$:/language/Docs/PaletteColours/tiddler-editor-background": {
"title": "$:/language/Docs/PaletteColours/tiddler-editor-background",
"text": "Tiddler editor background"
},
"$:/language/Docs/PaletteColours/tiddler-editor-border-image": {
"title": "$:/language/Docs/PaletteColours/tiddler-editor-border-image",
"text": "Tiddler editor border image"
},
"$:/language/Docs/PaletteColours/tiddler-editor-border": {
"title": "$:/language/Docs/PaletteColours/tiddler-editor-border",
"text": "Tiddler editor border"
},
"$:/language/Docs/PaletteColours/tiddler-editor-fields-even": {
"title": "$:/language/Docs/PaletteColours/tiddler-editor-fields-even",
"text": "Tiddler editor background for even fields"
},
"$:/language/Docs/PaletteColours/tiddler-editor-fields-odd": {
"title": "$:/language/Docs/PaletteColours/tiddler-editor-fields-odd",
"text": "Tiddler editor background for odd fields"
},
"$:/language/Docs/PaletteColours/tiddler-info-background": {
"title": "$:/language/Docs/PaletteColours/tiddler-info-background",
"text": "Tiddler info panel background"
},
"$:/language/Docs/PaletteColours/tiddler-info-border": {
"title": "$:/language/Docs/PaletteColours/tiddler-info-border",
"text": "Tiddler info panel border"
},
"$:/language/Docs/PaletteColours/tiddler-info-tab-background": {
"title": "$:/language/Docs/PaletteColours/tiddler-info-tab-background",
"text": "Tiddler info panel tab background"
},
"$:/language/Docs/PaletteColours/tiddler-link-background": {
"title": "$:/language/Docs/PaletteColours/tiddler-link-background",
"text": "Tiddler link background"
},
"$:/language/Docs/PaletteColours/tiddler-link-foreground": {
"title": "$:/language/Docs/PaletteColours/tiddler-link-foreground",
"text": "Tiddler link foreground"
},
"$:/language/Docs/PaletteColours/tiddler-subtitle-foreground": {
"title": "$:/language/Docs/PaletteColours/tiddler-subtitle-foreground",
"text": "Tiddler subtitle foreground"
},
"$:/language/Docs/PaletteColours/tiddler-title-foreground": {
"title": "$:/language/Docs/PaletteColours/tiddler-title-foreground",
"text": "Tiddler title foreground"
},
"$:/language/Docs/PaletteColours/toolbar-new-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-new-button",
"text": "Toolbar 'new tiddler' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-options-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-options-button",
"text": "Toolbar 'options' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-save-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-save-button",
"text": "Toolbar 'save' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-info-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-info-button",
"text": "Toolbar 'info' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-edit-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-edit-button",
"text": "Toolbar 'edit' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-close-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-close-button",
"text": "Toolbar 'close' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-delete-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-delete-button",
"text": "Toolbar 'delete' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-cancel-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-cancel-button",
"text": "Toolbar 'cancel' button foreground"
},
"$:/language/Docs/PaletteColours/toolbar-done-button": {
"title": "$:/language/Docs/PaletteColours/toolbar-done-button",
"text": "Toolbar 'done' button foreground"
},
"$:/language/Docs/PaletteColours/untagged-background": {
"title": "$:/language/Docs/PaletteColours/untagged-background",
"text": "Untagged pill background"
},
"$:/language/Docs/PaletteColours/very-muted-foreground": {
"title": "$:/language/Docs/PaletteColours/very-muted-foreground",
"text": "Very muted foreground"
},
"$:/language/EditTemplate/Body/External/Hint": {
"title": "$:/language/EditTemplate/Body/External/Hint",
"text": "This tiddler shows content stored outside of the main TiddlyWiki file. You can edit the tags and fields but cannot directly edit the content itself"
},
"$:/language/EditTemplate/Body/Placeholder": {
"title": "$:/language/EditTemplate/Body/Placeholder",
"text": "Type the text for this tiddler"
},
"$:/language/EditTemplate/Body/Preview/Type/Output": {
"title": "$:/language/EditTemplate/Body/Preview/Type/Output",
"text": "output"
},
"$:/language/EditTemplate/Body/Preview/Type/DiffShadow": {
"title": "$:/language/EditTemplate/Body/Preview/Type/DiffShadow",
"text": "differences from shadow (if any)"
},
"$:/language/EditTemplate/Body/Preview/Type/DiffCurrent": {
"title": "$:/language/EditTemplate/Body/Preview/Type/DiffCurrent",
"text": "differences from current"
},
"$:/language/EditTemplate/Field/Remove/Caption": {
"title": "$:/language/EditTemplate/Field/Remove/Caption",
"text": "remove field"
},
"$:/language/EditTemplate/Field/Remove/Hint": {
"title": "$:/language/EditTemplate/Field/Remove/Hint",
"text": "Remove field"
},
"$:/language/EditTemplate/Field/Dropdown/Caption": {
"title": "$:/language/EditTemplate/Field/Dropdown/Caption",
"text": "field list"
},
"$:/language/EditTemplate/Field/Dropdown/Hint": {
"title": "$:/language/EditTemplate/Field/Dropdown/Hint",
"text": "Show field list"
},
"$:/language/EditTemplate/Fields/Add/Button": {
"title": "$:/language/EditTemplate/Fields/Add/Button",
"text": "add"
},
"$:/language/EditTemplate/Fields/Add/Button/Hint": {
"title": "$:/language/EditTemplate/Fields/Add/Button/Hint",
"text": "Add the new field to the tiddler"
},
"$:/language/EditTemplate/Fields/Add/Name/Placeholder": {
"title": "$:/language/EditTemplate/Fields/Add/Name/Placeholder",
"text": "field name"
},
"$:/language/EditTemplate/Fields/Add/Prompt": {
"title": "$:/language/EditTemplate/Fields/Add/Prompt",
"text": "Add a new field:"
},
"$:/language/EditTemplate/Fields/Add/Value/Placeholder": {
"title": "$:/language/EditTemplate/Fields/Add/Value/Placeholder",
"text": "field value"
},
"$:/language/EditTemplate/Fields/Add/Dropdown/System": {
"title": "$:/language/EditTemplate/Fields/Add/Dropdown/System",
"text": "System fields"
},
"$:/language/EditTemplate/Fields/Add/Dropdown/User": {
"title": "$:/language/EditTemplate/Fields/Add/Dropdown/User",
"text": "User fields"
},
"$:/language/EditTemplate/Shadow/Warning": {
"title": "$:/language/EditTemplate/Shadow/Warning",
"text": "This is a shadow tiddler. Any changes you make will override the default version from the plugin <<pluginLink>>"
},
"$:/language/EditTemplate/Shadow/OverriddenWarning": {
"title": "$:/language/EditTemplate/Shadow/OverriddenWarning",
"text": "This is a modified shadow tiddler. You can revert to the default version in the plugin <<pluginLink>> by deleting this tiddler"
},
"$:/language/EditTemplate/Tags/Add/Button": {
"title": "$:/language/EditTemplate/Tags/Add/Button",
"text": "add"
},
"$:/language/EditTemplate/Tags/Add/Button/Hint": {
"title": "$:/language/EditTemplate/Tags/Add/Button/Hint",
"text": "add tag"
},
"$:/language/EditTemplate/Tags/Add/Placeholder": {
"title": "$:/language/EditTemplate/Tags/Add/Placeholder",
"text": "tag name"
},
"$:/language/EditTemplate/Tags/ClearInput/Caption": {
"title": "$:/language/EditTemplate/Tags/ClearInput/Caption",
"text": "clear input"
},
"$:/language/EditTemplate/Tags/ClearInput/Hint": {
"title": "$:/language/EditTemplate/Tags/ClearInput/Hint",
"text": "Clear tag input"
},
"$:/language/EditTemplate/Tags/Dropdown/Caption": {
"title": "$:/language/EditTemplate/Tags/Dropdown/Caption",
"text": "tag list"
},
"$:/language/EditTemplate/Tags/Dropdown/Hint": {
"title": "$:/language/EditTemplate/Tags/Dropdown/Hint",
"text": "Show tag list"
},
"$:/language/EditTemplate/Title/BadCharacterWarning": {
"title": "$:/language/EditTemplate/Title/BadCharacterWarning",
"text": "Warning: avoid using any of the characters <<bad-chars>> in tiddler titles"
},
"$:/language/EditTemplate/Title/Exists/Prompt": {
"title": "$:/language/EditTemplate/Title/Exists/Prompt",
"text": "Target tiddler already exists"
},
"$:/language/EditTemplate/Title/Relink/Prompt": {
"title": "$:/language/EditTemplate/Title/Relink/Prompt",
"text": "Update ''<$text text=<<fromTitle>>/>'' to ''<$text text=<<toTitle>>/>'' in the //tags// and //list// fields of other tiddlers"
},
"$:/language/EditTemplate/Title/References/Prompt": {
"title": "$:/language/EditTemplate/Title/References/Prompt",
"text": "The following references to this tiddler will not be automatically updated:"
},
"$:/language/EditTemplate/Type/Dropdown/Caption": {
"title": "$:/language/EditTemplate/Type/Dropdown/Caption",
"text": "content type list"
},
"$:/language/EditTemplate/Type/Dropdown/Hint": {
"title": "$:/language/EditTemplate/Type/Dropdown/Hint",
"text": "Show content type list"
},
"$:/language/EditTemplate/Type/Delete/Caption": {
"title": "$:/language/EditTemplate/Type/Delete/Caption",
"text": "delete content type"
},
"$:/language/EditTemplate/Type/Delete/Hint": {
"title": "$:/language/EditTemplate/Type/Delete/Hint",
"text": "Delete content type"
},
"$:/language/EditTemplate/Type/Placeholder": {
"title": "$:/language/EditTemplate/Type/Placeholder",
"text": "content type"
},
"$:/language/EditTemplate/Type/Prompt": {
"title": "$:/language/EditTemplate/Type/Prompt",
"text": "Type:"
},
"$:/language/Exporters/StaticRiver": {
"title": "$:/language/Exporters/StaticRiver",
"text": "Static HTML"
},
"$:/language/Exporters/JsonFile": {
"title": "$:/language/Exporters/JsonFile",
"text": "JSON file"
},
"$:/language/Exporters/CsvFile": {
"title": "$:/language/Exporters/CsvFile",
"text": "CSV file"
},
"$:/language/Exporters/TidFile": {
"title": "$:/language/Exporters/TidFile",
"text": "\".tid\" file"
},
"$:/language/Docs/Fields/_canonical_uri": {
"title": "$:/language/Docs/Fields/_canonical_uri",
"text": "The full URI of an external image tiddler"
},
"$:/language/Docs/Fields/bag": {
"title": "$:/language/Docs/Fields/bag",
"text": "The name of the bag from which a tiddler came"
},
"$:/language/Docs/Fields/caption": {
"title": "$:/language/Docs/Fields/caption",
"text": "The text to be displayed on a tab or button"
},
"$:/language/Docs/Fields/color": {
"title": "$:/language/Docs/Fields/color",
"text": "The CSS color value associated with a tiddler"
},
"$:/language/Docs/Fields/component": {
"title": "$:/language/Docs/Fields/component",
"text": "The name of the component responsible for an [[alert tiddler|AlertMechanism]]"
},
"$:/language/Docs/Fields/current-tiddler": {
"title": "$:/language/Docs/Fields/current-tiddler",
"text": "Used to cache the top tiddler in a [[history list|HistoryMechanism]]"
},
"$:/language/Docs/Fields/created": {
"title": "$:/language/Docs/Fields/created",
"text": "The date a tiddler was created"
},
"$:/language/Docs/Fields/creator": {
"title": "$:/language/Docs/Fields/creator",
"text": "The name of the person who created a tiddler"
},
"$:/language/Docs/Fields/dependents": {
"title": "$:/language/Docs/Fields/dependents",
"text": "For a plugin, lists the dependent plugin titles"
},
"$:/language/Docs/Fields/description": {
"title": "$:/language/Docs/Fields/description",
"text": "The descriptive text for a plugin, or a modal dialogue"
},
"$:/language/Docs/Fields/draft.of": {
"title": "$:/language/Docs/Fields/draft.of",
"text": "For draft tiddlers, contains the title of the tiddler of which this is a draft"
},
"$:/language/Docs/Fields/draft.title": {
"title": "$:/language/Docs/Fields/draft.title",
"text": "For draft tiddlers, contains the proposed new title of the tiddler"
},
"$:/language/Docs/Fields/footer": {
"title": "$:/language/Docs/Fields/footer",
"text": "The footer text for a wizard"
},
"$:/language/Docs/Fields/hide-body": {
"title": "$:/language/Docs/Fields/hide-body",
"text": "The view template will hide bodies of tiddlers if set to: ''yes''"
},
"$:/language/Docs/Fields/icon": {
"title": "$:/language/Docs/Fields/icon",
"text": "The title of the tiddler containing the icon associated with a tiddler"
},
"$:/language/Docs/Fields/library": {
"title": "$:/language/Docs/Fields/library",
"text": "Indicates that a tiddler should be saved as a JavaScript library if set to: ''yes''"
},
"$:/language/Docs/Fields/list": {
"title": "$:/language/Docs/Fields/list",
"text": "An ordered list of tiddler titles associated with a tiddler"
},
"$:/language/Docs/Fields/list-before": {
"title": "$:/language/Docs/Fields/list-before",
"text": "If set, the title of a tiddler before which this tiddler should be added to the ordered list of tiddler titles, or at the start of the list if this field is present but empty"
},
"$:/language/Docs/Fields/list-after": {
"title": "$:/language/Docs/Fields/list-after",
"text": "If set, the title of the tiddler after which this tiddler should be added to the ordered list of tiddler titles, or at the end of the list if this field is present but empty"
},
"$:/language/Docs/Fields/modified": {
"title": "$:/language/Docs/Fields/modified",
"text": "The date and time at which a tiddler was last modified"
},
"$:/language/Docs/Fields/modifier": {
"title": "$:/language/Docs/Fields/modifier",
"text": "The tiddler title associated with the person who last modified a tiddler"
},
"$:/language/Docs/Fields/name": {
"title": "$:/language/Docs/Fields/name",
"text": "The human readable name associated with a plugin tiddler"
},
"$:/language/Docs/Fields/plugin-priority": {
"title": "$:/language/Docs/Fields/plugin-priority",
"text": "A numerical value indicating the priority of a plugin tiddler"
},
"$:/language/Docs/Fields/plugin-type": {
"title": "$:/language/Docs/Fields/plugin-type",
"text": "The type of plugin in a plugin tiddler"
},
"$:/language/Docs/Fields/revision": {
"title": "$:/language/Docs/Fields/revision",
"text": "The revision of the tiddler held at the server"
},
"$:/language/Docs/Fields/released": {
"title": "$:/language/Docs/Fields/released",
"text": "Date of a TiddlyWiki release"
},
"$:/language/Docs/Fields/source": {
"title": "$:/language/Docs/Fields/source",
"text": "The source URL associated with a tiddler"
},
"$:/language/Docs/Fields/subtitle": {
"title": "$:/language/Docs/Fields/subtitle",
"text": "The subtitle text for a wizard"
},
"$:/language/Docs/Fields/tags": {
"title": "$:/language/Docs/Fields/tags",
"text": "A list of tags associated with a tiddler"
},
"$:/language/Docs/Fields/text": {
"title": "$:/language/Docs/Fields/text",
"text": "The body text of a tiddler"
},
"$:/language/Docs/Fields/throttle.refresh": {
"title": "$:/language/Docs/Fields/throttle.refresh",
"text": "If present, throttles refreshes of this tiddler"
},
"$:/language/Docs/Fields/title": {
"title": "$:/language/Docs/Fields/title",
"text": "The unique name of a tiddler"
},
"$:/language/Docs/Fields/toc-link": {
"title": "$:/language/Docs/Fields/toc-link",
"text": "Suppresses the tiddler's link in a Table of Contents tree if set to: ''no''"
},
"$:/language/Docs/Fields/type": {
"title": "$:/language/Docs/Fields/type",
"text": "The content type of a tiddler"
},
"$:/language/Docs/Fields/version": {
"title": "$:/language/Docs/Fields/version",
"text": "Version information for a plugin"
},
"$:/language/Docs/Fields/_is_skinny": {
"title": "$:/language/Docs/Fields/_is_skinny",
"text": "If present, indicates that the tiddler text field must be loaded from the server"
},
"$:/language/Filters/AllTiddlers": {
"title": "$:/language/Filters/AllTiddlers",
"text": "All tiddlers except system tiddlers"
},
"$:/language/Filters/RecentSystemTiddlers": {
"title": "$:/language/Filters/RecentSystemTiddlers",
"text": "Recently modified tiddlers, including system tiddlers"
},
"$:/language/Filters/RecentTiddlers": {
"title": "$:/language/Filters/RecentTiddlers",
"text": "Recently modified tiddlers"
},
"$:/language/Filters/AllTags": {
"title": "$:/language/Filters/AllTags",
"text": "All tags except system tags"
},
"$:/language/Filters/Missing": {
"title": "$:/language/Filters/Missing",
"text": "Missing tiddlers"
},
"$:/language/Filters/Drafts": {
"title": "$:/language/Filters/Drafts",
"text": "Draft tiddlers"
},
"$:/language/Filters/Orphans": {
"title": "$:/language/Filters/Orphans",
"text": "Orphan tiddlers"
},
"$:/language/Filters/SystemTiddlers": {
"title": "$:/language/Filters/SystemTiddlers",
"text": "System tiddlers"
},
"$:/language/Filters/ShadowTiddlers": {
"title": "$:/language/Filters/ShadowTiddlers",
"text": "Shadow tiddlers"
},
"$:/language/Filters/OverriddenShadowTiddlers": {
"title": "$:/language/Filters/OverriddenShadowTiddlers",
"text": "Overridden shadow tiddlers"
},
"$:/language/Filters/SessionTiddlers": {
"title": "$:/language/Filters/SessionTiddlers",
"text": "Tiddlers modified since the wiki was loaded"
},
"$:/language/Filters/SystemTags": {
"title": "$:/language/Filters/SystemTags",
"text": "System tags"
},
"$:/language/Filters/StoryList": {
"title": "$:/language/Filters/StoryList",
"text": "Tiddlers in the story river, excluding <$text text=\"$:/AdvancedSearch\"/>"
},
"$:/language/Filters/TypedTiddlers": {
"title": "$:/language/Filters/TypedTiddlers",
"text": "Non wiki-text tiddlers"
},
"GettingStarted": {
"title": "GettingStarted",
"text": "\\define lingo-base() $:/language/ControlPanel/Basics/\nWelcome to ~TiddlyWiki and the ~TiddlyWiki community\n\nBefore you start storing important information in ~TiddlyWiki it is vital to make sure that you can reliably save changes. See https://tiddlywiki.com/#GettingStarted for details\n\n!! Set up this ~TiddlyWiki\n\n<div class=\"tc-control-panel\">\n\n|<$link to=\"$:/SiteTitle\"><<lingo Title/Prompt>></$link> |<$edit-text tiddler=\"$:/SiteTitle\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/SiteSubtitle\"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler=\"$:/SiteSubtitle\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/DefaultTiddlers\"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag=\"textarea\" tiddler=\"$:/DefaultTiddlers\"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |\n</div>\n\nSee the [[control panel|$:/ControlPanel]] for more options.\n"
},
"$:/language/Help/build": {
"title": "$:/language/Help/build",
"description": "Automatically run configured commands",
"text": "Build the specified build targets for the current wiki. If no build targets are specified then all available targets will be built.\n\n```\n--build <target> [<target> ...]\n```\n\nBuild targets are defined in the `tiddlywiki.info` file of a wiki folder.\n\n"
},
"$:/language/Help/clearpassword": {
"title": "$:/language/Help/clearpassword",
"description": "Clear a password for subsequent crypto operations",
"text": "Clear the password for subsequent crypto operations\n\n```\n--clearpassword\n```\n"
},
"$:/language/Help/default": {
"title": "$:/language/Help/default",
"text": "\\define commandTitle()\n$:/language/Help/$(command)$\n\\end\n```\nusage: tiddlywiki [<wikifolder>] [--<command> [<args>...]...]\n```\n\nAvailable commands:\n\n<ul>\n<$list filter=\"[commands[]sort[title]]\" variable=\"command\">\n<li><$link to=<<commandTitle>>><$macrocall $name=\"command\" $type=\"text/plain\" $output=\"text/plain\"/></$link>: <$transclude tiddler=<<commandTitle>> field=\"description\"/></li>\n</$list>\n</ul>\n\nTo get detailed help on a command:\n\n```\ntiddlywiki --help <command>\n```\n"
},
"$:/language/Help/deletetiddlers": {
"title": "$:/language/Help/deletetiddlers",
"description": "Deletes a group of tiddlers",
"text": "<<.from-version \"5.1.20\">> Deletes a group of tiddlers identified by a filter.\n\n```\n--deletetiddlers <filter>\n```\n"
},
"$:/language/Help/editions": {
"title": "$:/language/Help/editions",
"description": "Lists the available editions of TiddlyWiki",
"text": "Lists the names and descriptions of the available editions. You can create a new wiki of a specified edition with the `--init` command.\n\n```\n--editions\n```\n"
},
"$:/language/Help/fetch": {
"title": "$:/language/Help/fetch",
"description": "Fetch tiddlers from wiki by URL",
"text": "Fetch one or more files over HTTP/HTTPS, and import the tiddlers matching a filter, optionally transforming the incoming titles.\n\n```\n--fetch file <url> <import-filter> <transform-filter>\n--fetch files <url-filter> <import-filter> <transform-filter>\n--fetch raw-file <url> <transform-filter>\n--fetch raw-files <url-filter> <transform-filter>\n```\n\nThe \"file\" and \"files\" variants fetch the specified files and attempt to import the tiddlers within them (the same processing as if the files were dragged into the browser window). The \"raw-file\" and \"raw-files\" variants fetch the specified files and then store the raw file data in tiddlers, without applying the import logic.\n\nWith the \"file\" and \"raw-file\" variants only a single file is fetched and the first parameter is the URL of the file to read.\n\nWith the \"files\" and \"raw-files\" variants, multiple files are fetched and the first parameter is a filter yielding a list of URLs of the files to read. For example, given a set of tiddlers tagged \"remote-server\" that have a field \"url\" the filter `[tag[remote-server]get[url]]` will retrieve all the available URLs.\n\nFor the \"file\" and \"files\" variants, the `<import-filter>` parameter specifies a filter determining which tiddlers are imported. It defaults to `[all[tiddlers]]` if not provided.\n\nFor all variants, the `<transform-filter>` parameter specifies an optional filter that transforms the titles of the imported tiddlers. For example, `[addprefix[$:/myimports/]]` would add the prefix `$:/myimports/` to each title.\n\nPreceding the `--fetch` command with `--verbose` will output progress information during the import.\n\nNote that TiddlyWiki will not fetch an older version of an already loaded plugin.\n\nThe following example retrieves all the non-system tiddlers from https://tiddlywiki.com and saves them to a JSON file:\n\n```\ntiddlywiki --verbose --fetch file \"https://tiddlywiki.com/\" \"[!is[system]]\" \"\" --rendertiddler \"$:/core/templates/exporters/JsonFile\" output.json text/plain \"\" exportFilter \"[!is[system]]\"\n```\n\nThe following example retrieves the \"favicon\" file from tiddlywiki.com and saves it in a file called \"output.ico\". Note that the intermediate tiddler \"Icon Tiddler\" is quoted in the \"--fetch\" command because it is being used as a transformation filter to replace the default title, while there are no quotes for the \"--savetiddler\" command because it is being used directly as a title.\n\n```\ntiddlywiki --verbose --fetch raw-file \"https://tiddlywiki.com/favicon.ico\" \"[[Icon Tiddler]]\" --savetiddler \"Icon Tiddler\" output.ico\n```\n\n"
},
"$:/language/Help/help": {
"title": "$:/language/Help/help",
"description": "Display help for TiddlyWiki commands",
"text": "Displays help text for a command:\n\n```\n--help [<command>]\n```\n\nIf the command name is omitted then a list of available commands is displayed.\n"
},
"$:/language/Help/import": {
"title": "$:/language/Help/import",
"description": "Import tiddlers from a file",
"text": "Import tiddlers from TiddlyWiki (`.html`), `.tiddler`, `.tid`, `.json` or other local files. The deserializer must be explicitly specified, unlike the `load` command which infers the deserializer from the file extension.\n\n```\n--import <filepath> <deserializer> [<title>] [<encoding>]\n```\n\nThe deserializers in the core include:\n\n* application/javascript\n* application/json\n* application/x-tiddler\n* application/x-tiddler-html-div\n* application/x-tiddlers\n* text/html\n* text/plain\n\nThe title of the imported tiddler defaults to the filename.\n\nThe encoding defaults to \"utf8\", but can be \"base64\" for importing binary files.\n\nNote that TiddlyWiki will not import an older version of an already loaded plugin.\n"
},
"$:/language/Help/init": {
"title": "$:/language/Help/init",
"description": "Initialise a new wiki folder",
"text": "Initialise an empty [[WikiFolder|WikiFolders]] with a copy of the specified edition.\n\n```\n--init <edition> [<edition> ...]\n```\n\nFor example:\n\n```\ntiddlywiki ./MyWikiFolder --init empty\n```\n\nNote:\n\n* The wiki folder directory will be created if necessary\n* The \"edition\" defaults to ''empty''\n* The init command will fail if the wiki folder is not empty\n* The init command removes any `includeWikis` definitions in the edition's `tiddlywiki.info` file\n* When multiple editions are specified, editions initialised later will overwrite any files shared with earlier editions (so, the final `tiddlywiki.info` file will be copied from the last edition)\n* `--editions` returns a list of available editions\n"
},
"$:/language/Help/listen": {
"title": "$:/language/Help/listen",
"description": "Provides an HTTP server interface to TiddlyWiki",
"text": "Serves a wiki over HTTP.\n\nThe listen command uses NamedCommandParameters:\n\n```\n--listen [<name>=<value>]...\n```\n\nAll parameters are optional with safe defaults, and can be specified in any order. The recognised parameters are:\n\n* ''host'' - optional hostname to serve from (defaults to \"127.0.0.1\" aka \"localhost\")\n* ''path-prefix'' - optional prefix for paths\n* ''port'' - port number on which to listen; non-numeric values are interpreted as a system environment variable from which the port number is extracted (defaults to \"8080\")\n* ''credentials'' - pathname of credentials CSV file (relative to wiki folder)\n* ''anon-username'' - the username for signing edits for anonymous users\n* ''username'' - optional username for basic authentication\n* ''password'' - optional password for basic authentication\n* ''authenticated-user-header'' - optional name of header to be used for trusted authentication\n* ''readers'' - comma-separated list of principals allowed to read from this wiki\n* ''writers'' - comma-separated list of principals allowed to write to this wiki\n* ''csrf-disable'' - set to \"yes\" to disable CSRF checks (defaults to \"no\")\n* ''sse-enabled'' - set to \"yes\" to enable Server-sent events (defaults to \"no\")\n* ''sitemap'' - optional sitemap describing how the tiddlers will be served. See [[Publishing]] for more details\n* ''root-tiddler'' - the tiddler to serve at the root (defaults to \"$:/core/save/all\")\n* ''root-render-type'' - the content type to which the root tiddler should be rendered (defaults to \"text/plain\")\n* ''root-serve-type'' - the content type with which the root tiddler should be served (defaults to \"text/html\")\n* ''tls-cert'' - pathname of TLS certificate file (relative to wiki folder)\n* ''tls-key'' - pathname of TLS key file (relative to wiki folder)\n* ''debug-level'' - optional debug level; set to \"debug\" to view request details (defaults to \"none\")\n* ''gzip'' - set to \"yes\" to enable gzip compression for some http endpoints (defaults to \"no\")\n* ''use-browser-cache'' - set to \"yes\" to allow the browser to cache responses to save bandwidth (defaults to \"no\")\n\nFor information on opening up your instance to the entire local network, and possible security concerns, see the WebServer tiddler at TiddlyWiki.com.\n\n"
},
"$:/language/Help/load": {
"title": "$:/language/Help/load",
"description": "Load tiddlers from a file",
"text": "Load tiddlers from TiddlyWiki (`.html`), `.tiddler`, `.tid`, `.json` or other local files. The processing applied to incoming files is determined by the file extension. Use the alternative `import` command if you need to specify the deserializer and encoding explicitly.\n\n```\n--load <filepath> [noerror]\n--load <dirpath> [noerror]\n```\n\nBy default, the load command raises an error if no tiddlers are found. The error can be suppressed by providing the optional \"noerror\" parameter.\n\nTo load tiddlers from an encrypted TiddlyWiki file you should first specify the password with the PasswordCommand. For example:\n\n```\ntiddlywiki ./MyWiki --password pa55w0rd --load my_encrypted_wiki.html\n```\n\nNote that TiddlyWiki will not load an older version of an already loaded plugin.\n"
},
"$:/language/Help/makelibrary": {
"title": "$:/language/Help/makelibrary",
"description": "Construct library plugin required by upgrade process",
"text": "Constructs the `$:/UpgradeLibrary` tiddler for the upgrade process.\n\nThe upgrade library is formatted as an ordinary plugin tiddler with the plugin type `library`. It contains a copy of each of the plugins, themes and language packs available within the TiddlyWiki5 repository.\n\nThis command is intended for internal use; it is only relevant to users constructing a custom upgrade procedure.\n\n```\n--makelibrary <title>\n```\n\nThe title argument defaults to `$:/UpgradeLibrary`.\n"
},
"$:/language/Help/notfound": {
"title": "$:/language/Help/notfound",
"text": "No such help item"
},
"$:/language/Help/output": {
"title": "$:/language/Help/output",
"description": "Set the base output directory for subsequent commands",
"text": "Sets the base output directory for subsequent commands. The default output directory is the `output` subdirectory of the edition directory.\n\n```\n--output <pathname>\n```\n\nIf the specified pathname is relative then it is resolved relative to the current working directory. For example `--output .` sets the output directory to the current working directory.\n\n"
},
"$:/language/Help/password": {
"title": "$:/language/Help/password",
"description": "Set a password for subsequent crypto operations",
"text": "Set a password for subsequent crypto operations\n\n```\n--password <password>\n```\n\n''Note'': This should not be used for serving TiddlyWiki with password protection. Instead, see the password option under the [[ServerCommand]].\n"
},
"$:/language/Help/render": {
"title": "$:/language/Help/render",
"description": "Renders individual tiddlers to files",
"text": "Render individual tiddlers identified by a filter and save the results to the specified files.\n\nOptionally, the title of a template tiddler can be specified. In this case, instead of directly rendering each tiddler, the template tiddler is rendered with the \"currentTiddler\" variable set to the title of the tiddler that is being rendered.\n\nA name and value for an additional variable may optionally also be specified.\n\n```\n--render <tiddler-filter> [<filename-filter>] [<render-type>] [<template>] [ [<name>] [<value>] ]*\n```\n\n* ''tiddler-filter'': A filter identifying the tiddler(s) to be rendered\n* ''filename-filter'': Optional filter transforming tiddler titles into pathnames. If omitted, defaults to `[is[tiddler]addsuffix[.html]]`, which uses the unchanged tiddler title as the filename\n* ''render-type'': Optional render type: `text/html` (the default) returns the full HTML text and `text/plain` just returns the text content (ie it ignores HTML tags and other unprintable material)\n* ''template'': Optional template through which each tiddler is rendered\n* ''name'': Name of optional variables\n* ''value'': Value of optional variables\n\nBy default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.\n\nNotes:\n\n* The output directory is not cleared of any existing files\n* Any missing directories in the path to the filename are automatically created.\n* When referring to a tiddler with spaces in its title, take care to use both the quotes required by your shell and also TiddlyWiki's double square brackets: `--render \"[[Motovun Jack.jpg]]\"`\n* The filename filter is evaluated with the selected items being set to the title of the tiddler currently being rendered, allowing the title to be used as the basis for computing the filename. For example `[encodeuricomponent[]addprefix[static/]]` applies URI encoding to each title, and then adds the prefix `static/`\n* Multiple ''name''/''value'' pairs can be used to pass more than one variable\n* The `--render` command is a more flexible replacement for both the `--rendertiddler` and `--rendertiddlers` commands, which are deprecated\n\nExamples:\n\n* `--render \"[!is[system]]\" \"[encodeuricomponent[]addprefix[tiddlers/]addsuffix[.html]]\"` -- renders all non-system tiddlers as files in the subdirectory \"tiddlers\" with URL-encoded titles and the extension HTML\n\n"
},
"$:/language/Help/rendertiddler": {
"title": "$:/language/Help/rendertiddler",
"description": "Render an individual tiddler as a specified ContentType",
"text": "(Note: The `--rendertiddler` command is deprecated in favour of the new, more flexible `--render` command)\n\nRender an individual tiddler as a specified ContentType, defaulting to `text/html` and save it to the specified filename.\n\nOptionally the title of a template tiddler can be specified, in which case the template tiddler is rendered with the \"currentTiddler\" variable set to the tiddler that is being rendered (the first parameter value).\n\nA name and value for an additional variable may optionally also be specified.\n\n```\n--rendertiddler <title> <filename> [<type>] [<template>] [<name>] [<value>]\n```\n\nBy default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.\n\nAny missing directories in the path to the filename are automatically created.\n\nFor example, the following command saves all tiddlers matching the filter `[tag[done]]` to a JSON file titled `output.json` by employing the core template `$:/core/templates/exporters/JsonFile`.\n\n```\n--rendertiddler \"$:/core/templates/exporters/JsonFile\" output.json text/plain \"\" exportFilter \"[tag[done]]\"\n```\n"
},
"$:/language/Help/rendertiddlers": {
"title": "$:/language/Help/rendertiddlers",
"description": "Render tiddlers matching a filter to a specified ContentType",
"text": "(Note: The `--rendertiddlers` command is deprecated in favour of the new, more flexible `--render` command)\n\nRender a set of tiddlers matching a filter to separate files of a specified ContentType (defaults to `text/html`) and extension (defaults to `.html`).\n\n```\n--rendertiddlers '<filter>' <template> <pathname> [<type>] [<extension>] [\"noclean\"]\n```\n\nFor example:\n\n```\n--rendertiddlers '[!is[system]]' $:/core/templates/static.tiddler.html ./static text/plain\n```\n\nBy default, the pathname is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.\n\nAny files in the target directory are deleted unless the ''noclean'' flag is specified. The target directory is recursively created if it is missing.\n"
},
"$:/language/Help/save": {
"title": "$:/language/Help/save",
"description": "Saves individual raw tiddlers to files",
"text": "Saves individual tiddlers identified by a filter in their raw text or binary format to the specified files.\n\n```\n--save <tiddler-filter> <filename-filter>\n```\n\n* ''tiddler-filter'': A filter identifying the tiddler(s) to be saved\n* ''filename-filter'': Optional filter transforming tiddler titles into pathnames. If omitted, defaults to `[is[tiddler]]`, which uses the unchanged tiddler title as the filename\n\nBy default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.\n\nNotes:\n\n* The output directory is not cleared of any existing files\n* Any missing directories in the path to the filename are automatically created.\n* When saving a tiddler with spaces in its title, take care to use both the quotes required by your shell and also TiddlyWiki's double square brackets: `--save \"[[Motovun Jack.jpg]]\"`\n* The filename filter is evaluated with the selected items being set to the title of the tiddler currently being saved, allowing the title to be used as the basis for computing the filename. For example `[encodeuricomponent[]addprefix[static/]]` applies URI encoding to each title, and then adds the prefix `static/`\n* The `--save` command is a more flexible replacement for both the `--savetiddler` and `--savetiddlers` commands, which are deprecated\n\nExamples:\n\n* `--save \"[!is[system]is[image]]\" \"[encodeuricomponent[]addprefix[tiddlers/]]\"` -- saves all non-system image tiddlers as files in the subdirectory \"tiddlers\" with URL-encoded titles\n"
},
"$:/language/Help/savetiddler": {
"title": "$:/language/Help/savetiddler",
"description": "Saves a raw tiddler to a file",
"text": "(Note: The `--savetiddler` command is deprecated in favour of the new, more flexible `--save` command)\n\nSaves an individual tiddler in its raw text or binary format to the specified filename.\n\n```\n--savetiddler <title> <filename>\n```\n\nBy default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.\n\nAny missing directories in the path to the filename are automatically created.\n"
},
"$:/language/Help/savetiddlers": {
"title": "$:/language/Help/savetiddlers",
"description": "Saves a group of raw tiddlers to a directory",
"text": "(Note: The `--savetiddlers` command is deprecated in favour of the new, more flexible `--save` command)\n\nSaves a group of tiddlers in their raw text or binary format to the specified directory.\n\n```\n--savetiddlers <filter> <pathname> [\"noclean\"]\n```\n\nBy default, the pathname is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.\n\nThe output directory is cleared of existing files before saving the specified files. The deletion can be disabled by specifying the ''noclean'' flag.\n\nAny missing directories in the pathname are automatically created.\n"
},
"$:/language/Help/savewikifolder": {
"title": "$:/language/Help/savewikifolder",
"description": "Saves a wiki to a new wiki folder",
"text": "<<.from-version \"5.1.20\">> Saves the current wiki as a wiki folder, including tiddlers, plugins and configuration:\n\n```\n--savewikifolder <wikifolderpath> [<filter>]\n```\n\n* The target wiki folder must be empty or non-existent\n* The filter specifies which tiddlers should be included. It is optional, defaulting to `[all[tiddlers]]`\n* Plugins from the official plugin library are replaced with references to those plugins in the `tiddlywiki.info` file\n* Custom plugins are unpacked into their own folder\n\nA common usage is to convert a TiddlyWiki HTML file into a wiki folder:\n\n```\ntiddlywiki --load ./mywiki.html --savewikifolder ./mywikifolder\n```\n"
},
"$:/language/Help/server": {
"title": "$:/language/Help/server",
"description": "Provides an HTTP server interface to TiddlyWiki (deprecated in favour of the new listen command)",
"text": "Legacy command to serve a wiki over HTTP.\n\n```\n--server <port> <root-tiddler> <root-render-type> <root-serve-type> <username> <password> <host> <path-prefix> <debug-level>\n```\n\nThe parameters are:\n\n* ''port'' - port number on which to listen; non-numeric values are interpreted as a system environment variable from which the port number is extracted (defaults to \"8080\")\n* ''root-tiddler'' - the tiddler to serve at the root (defaults to \"$:/core/save/all\")\n* ''root-render-type'' - the content type to which the root tiddler should be rendered (defaults to \"text/plain\")\n* ''root-serve-type'' - the content type with which the root tiddler should be served (defaults to \"text/html\")\n* ''username'' - the default username for signing edits\n* ''password'' - optional password for basic authentication\n* ''host'' - optional hostname to serve from (defaults to \"127.0.0.1\" aka \"localhost\")\n* ''path-prefix'' - optional prefix for paths\n* ''debug-level'' - optional debug level; set to \"debug\" to view request details (defaults to \"none\")\n\nIf the password parameter is specified then the browser will prompt the user for the username and password. Note that the password is transmitted in plain text so this implementation should only be used on a trusted network or over HTTPS.\n\nFor example:\n\n```\n--server 8080 $:/core/save/all text/plain text/html MyUserName passw0rd\n```\n\nThe username and password can be specified as empty strings if you need to set the hostname or pathprefix and don't want to require a password.\n\n\n```\n--server 8080 $:/core/save/all text/plain text/html \"\" \"\" 192.168.0.245\n```\n\nUsing an address like this exposes your system to the local network. For information on opening up your instance to the entire local network, and possible security concerns, see the WebServer tiddler at TiddlyWiki.com.\n\nTo run multiple TiddlyWiki servers at the same time you'll need to put each one on a different port. It can be useful to use an environment variable to pass the port number to the Node.js process. This example references an environment variable called \"MY_PORT_NUMBER\":\n\n```\n--server MY_PORT_NUMBER $:/core/save/all text/plain text/html MyUserName passw0rd\n```\n"
},
"$:/language/Help/setfield": {
"title": "$:/language/Help/setfield",
"description": "Prepares external tiddlers for use",
"text": "//Note that this command is experimental and may change or be replaced before being finalised//\n\nSets the specified field of a group of tiddlers to the result of wikifying a template tiddler with the `currentTiddler` variable set to the tiddler.\n\n```\n--setfield <filter> <fieldname> <templatetitle> <rendertype>\n```\n\nThe parameters are:\n\n* ''filter'' - filter identifying the tiddlers to be affected\n* ''fieldname'' - the field to modify (defaults to \"text\")\n* ''templatetitle'' - the tiddler to wikify into the specified field. If blank or missing then the specified field is deleted\n* ''rendertype'' - the text type to render (defaults to \"text/plain\"; \"text/html\" can be used to include HTML tags)\n"
},
"$:/language/Help/unpackplugin": {
"title": "$:/language/Help/unpackplugin",
"description": "Unpack the payload tiddlers from a plugin",
"text": "Extract the payload tiddlers from a plugin, creating them as ordinary tiddlers:\n\n```\n--unpackplugin <title>\n```\n"
},
"$:/language/Help/verbose": {
"title": "$:/language/Help/verbose",
"description": "Triggers verbose output mode",
"text": "Triggers verbose output, useful for debugging\n\n```\n--verbose\n```\n"
},
"$:/language/Help/version": {
"title": "$:/language/Help/version",
"description": "Displays the version number of TiddlyWiki",
"text": "Displays the version number of TiddlyWiki.\n\n```\n--version\n```\n"
},
"$:/language/Import/Editor/Import/Heading": {
"title": "$:/language/Import/Editor/Import/Heading",
"text": "Import images and insert them into the editor."
},
"$:/language/Import/Imported/Hint": {
"title": "$:/language/Import/Imported/Hint",
"text": "The following tiddlers were imported:"
},
"$:/language/Import/Listing/Cancel/Caption": {
"title": "$:/language/Import/Listing/Cancel/Caption",
"text": "Cancel"
},
"$:/language/Import/Listing/Hint": {
"title": "$:/language/Import/Listing/Hint",
"text": "These tiddlers are ready to import:"
},
"$:/language/Import/Listing/Import/Caption": {
"title": "$:/language/Import/Listing/Import/Caption",
"text": "Import"
},
"$:/language/Import/Listing/Select/Caption": {
"title": "$:/language/Import/Listing/Select/Caption",
"text": "Select"
},
"$:/language/Import/Listing/Status/Caption": {
"title": "$:/language/Import/Listing/Status/Caption",
"text": "Status"
},
"$:/language/Import/Listing/Title/Caption": {
"title": "$:/language/Import/Listing/Title/Caption",
"text": "Title"
},
"$:/language/Import/Listing/Preview": {
"title": "$:/language/Import/Listing/Preview",
"text": "Preview:"
},
"$:/language/Import/Listing/Preview/Text": {
"title": "$:/language/Import/Listing/Preview/Text",
"text": "Text"
},
"$:/language/Import/Listing/Preview/TextRaw": {
"title": "$:/language/Import/Listing/Preview/TextRaw",
"text": "Text (Raw)"
},
"$:/language/Import/Listing/Preview/Fields": {
"title": "$:/language/Import/Listing/Preview/Fields",
"text": "Fields"
},
"$:/language/Import/Listing/Preview/Diff": {
"title": "$:/language/Import/Listing/Preview/Diff",
"text": "Diff"
},
"$:/language/Import/Listing/Preview/DiffFields": {
"title": "$:/language/Import/Listing/Preview/DiffFields",
"text": "Diff (Fields)"
},
"$:/language/Import/Listing/Rename/Tooltip": {
"title": "$:/language/Import/Listing/Rename/Tooltip",
"text": "Rename tiddler before importing"
},
"$:/language/Import/Listing/Rename/Prompt": {
"title": "$:/language/Import/Listing/Rename/Prompt",
"text": "Rename to:"
},
"$:/language/Import/Listing/Rename/ConfirmRename": {
"title": "$:/language/Import/Listing/Rename/ConfirmRename",
"text": "Rename tiddler"
},
"$:/language/Import/Listing/Rename/CancelRename": {
"title": "$:/language/Import/Listing/Rename/CancelRename",
"text": "Cancel"
},
"$:/language/Import/Listing/Rename/OverwriteWarning": {
"title": "$:/language/Import/Listing/Rename/OverwriteWarning",
"text": "A tiddler with this title already exists."
},
"$:/language/Import/Upgrader/Plugins/Suppressed/Incompatible": {
"title": "$:/language/Import/Upgrader/Plugins/Suppressed/Incompatible",
"text": "Blocked incompatible or obsolete plugin."
},
"$:/language/Import/Upgrader/Plugins/Suppressed/Version": {
"title": "$:/language/Import/Upgrader/Plugins/Suppressed/Version",
"text": "Blocked plugin (due to incoming <<incoming>> not being newer than existing <<existing>>)."
},
"$:/language/Import/Upgrader/Plugins/Upgraded": {
"title": "$:/language/Import/Upgrader/Plugins/Upgraded",
"text": "Upgraded plugin from <<incoming>> to <<upgraded>>."
},
"$:/language/Import/Upgrader/State/Suppressed": {
"title": "$:/language/Import/Upgrader/State/Suppressed",
"text": "Blocked temporary state tiddler."
},
"$:/language/Import/Upgrader/System/Disabled": {
"title": "$:/language/Import/Upgrader/System/Disabled",
"text": "Disabled system tiddler."
},
"$:/language/Import/Upgrader/System/Suppressed": {
"title": "$:/language/Import/Upgrader/System/Suppressed",
"text": "Blocked system tiddler."
},
"$:/language/Import/Upgrader/System/Warning": {
"title": "$:/language/Import/Upgrader/System/Warning",
"text": "Core module tiddler."
},
"$:/language/Import/Upgrader/System/Alert": {
"title": "$:/language/Import/Upgrader/System/Alert",
"text": "You are about to import a tiddler that will overwrite a core module tiddler. This is not recommended as it may make the system unstable."
},
"$:/language/Import/Upgrader/ThemeTweaks/Created": {
"title": "$:/language/Import/Upgrader/ThemeTweaks/Created",
"text": "Migrated theme tweak from <$text text=<<from>>/>."
},
"$:/language/Import/Upgrader/Tiddler/Disabled": {
"title": "$:/language/Import/Upgrader/Tiddler/Disabled",
"text": "Disabled tiddler."
},
"$:/language/Import/Upgrader/Tiddler/Selected": {
"title": "$:/language/Import/Upgrader/Tiddler/Selected",
"text": "User selected."
},
"$:/language/Import/Upgrader/Tiddler/Unselected": {
"title": "$:/language/Import/Upgrader/Tiddler/Unselected",
"text": "Unselected tiddler."
},
"$:/language/AboveStory/ClassicPlugin/Warning": {
"title": "$:/language/AboveStory/ClassicPlugin/Warning",
"text": "It looks like you are trying to load a plugin designed for ~TiddlyWiki Classic. Please note that [[these plugins do not work with TiddlyWiki version 5.x.x|https://tiddlywiki.com/#TiddlyWikiClassic]]. ~TiddlyWiki Classic plugins detected:"
},
"$:/language/BinaryWarning/Prompt": {
"title": "$:/language/BinaryWarning/Prompt",
"text": "This tiddler contains binary data"
},
"$:/language/ClassicWarning/Hint": {
"title": "$:/language/ClassicWarning/Hint",
"text": "This tiddler is written in TiddlyWiki Classic wiki text format, which is not fully compatible with TiddlyWiki version 5. See https://tiddlywiki.com/static/Upgrading.html for more details."
},
"$:/language/ClassicWarning/Upgrade/Caption": {
"title": "$:/language/ClassicWarning/Upgrade/Caption",
"text": "upgrade"
},
"$:/language/CloseAll/Button": {
"title": "$:/language/CloseAll/Button",
"text": "close all"
},
"$:/language/ColourPicker/Recent": {
"title": "$:/language/ColourPicker/Recent",
"text": "Recent:"
},
"$:/language/ConfirmCancelTiddler": {
"title": "$:/language/ConfirmCancelTiddler",
"text": "Do you wish to discard changes to the tiddler \"<$text text=<<title>>/>\"?"
},
"$:/language/ConfirmDeleteTiddler": {
"title": "$:/language/ConfirmDeleteTiddler",
"text": "Do you wish to delete the tiddler \"<$text text=<<title>>/>\"?"
},
"$:/language/ConfirmOverwriteTiddler": {
"title": "$:/language/ConfirmOverwriteTiddler",
"text": "Do you wish to overwrite the tiddler \"<$text text=<<title>>/>\"?"
},
"$:/language/ConfirmEditShadowTiddler": {
"title": "$:/language/ConfirmEditShadowTiddler",
"text": "You are about to edit a ShadowTiddler. Any changes will override the default system making future upgrades non-trivial. Are you sure you want to edit \"<$text text=<<title>>/>\"?"
},
"$:/language/ConfirmAction": {
"title": "$:/language/ConfirmAction",
"text": "Do you wish to proceed?"
},
"$:/language/Count": {
"title": "$:/language/Count",
"text": "count"
},
"$:/language/DefaultNewTiddlerTitle": {
"title": "$:/language/DefaultNewTiddlerTitle",
"text": "New Tiddler"
},
"$:/language/Diffs/CountMessage": {
"title": "$:/language/Diffs/CountMessage",
"text": "<<diff-count>> differences"
},
"$:/language/DropMessage": {
"title": "$:/language/DropMessage",
"text": "Drop here (or use the 'Escape' key to cancel)"
},
"$:/language/Encryption/Cancel": {
"title": "$:/language/Encryption/Cancel",
"text": "Cancel"
},
"$:/language/Encryption/ConfirmClearPassword": {
"title": "$:/language/Encryption/ConfirmClearPassword",
"text": "Do you wish to clear the password? This will remove the encryption applied when saving this wiki"
},
"$:/language/Encryption/PromptSetPassword": {
"title": "$:/language/Encryption/PromptSetPassword",
"text": "Set a new password for this TiddlyWiki"
},
"$:/language/Encryption/Username": {
"title": "$:/language/Encryption/Username",
"text": "Username"
},
"$:/language/Encryption/Password": {
"title": "$:/language/Encryption/Password",
"text": "Password"
},
"$:/language/Encryption/RepeatPassword": {
"title": "$:/language/Encryption/RepeatPassword",
"text": "Repeat password"
},
"$:/language/Encryption/PasswordNoMatch": {
"title": "$:/language/Encryption/PasswordNoMatch",
"text": "Passwords do not match"
},
"$:/language/Encryption/SetPassword": {
"title": "$:/language/Encryption/SetPassword",
"text": "Set password"
},
"$:/language/Error/Caption": {
"title": "$:/language/Error/Caption",
"text": "Error"
},
"$:/language/Error/Filter": {
"title": "$:/language/Error/Filter",
"text": "Filter error"
},
"$:/language/Error/FilterSyntax": {
"title": "$:/language/Error/FilterSyntax",
"text": "Syntax error in filter expression"
},
"$:/language/Error/FilterRunPrefix": {
"title": "$:/language/Error/FilterRunPrefix",
"text": "Filter Error: Unknown prefix for filter run"
},
"$:/language/Error/IsFilterOperator": {
"title": "$:/language/Error/IsFilterOperator",
"text": "Filter Error: Unknown operand for the 'is' filter operator"
},
"$:/language/Error/FormatFilterOperator": {
"title": "$:/language/Error/FormatFilterOperator",
"text": "Filter Error: Unknown suffix for the 'format' filter operator"
},
"$:/language/Error/LoadingPluginLibrary": {
"title": "$:/language/Error/LoadingPluginLibrary",
"text": "Error loading plugin library"
},
"$:/language/Error/NetworkErrorAlert": {
"title": "$:/language/Error/NetworkErrorAlert",
"text": "`<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.`"
},
"$:/language/Error/PutEditConflict": {
"title": "$:/language/Error/PutEditConflict",
"text": "File changed on server"
},
"$:/language/Error/PutForbidden": {
"title": "$:/language/Error/PutForbidden",
"text": "Permission denied"
},
"$:/language/Error/PutUnauthorized": {
"title": "$:/language/Error/PutUnauthorized",
"text": "Authentication required"
},
"$:/language/Error/RecursiveTransclusion": {
"title": "$:/language/Error/RecursiveTransclusion",
"text": "Recursive transclusion error in transclude widget"
},
"$:/language/Error/RetrievingSkinny": {
"title": "$:/language/Error/RetrievingSkinny",
"text": "Error retrieving skinny tiddler list"
},
"$:/language/Error/SavingToTWEdit": {
"title": "$:/language/Error/SavingToTWEdit",
"text": "Error saving to TWEdit"
},
"$:/language/Error/WhileSaving": {
"title": "$:/language/Error/WhileSaving",
"text": "Error while saving"
},
"$:/language/Error/XMLHttpRequest": {
"title": "$:/language/Error/XMLHttpRequest",
"text": "XMLHttpRequest error code"
},
"$:/language/InternalJavaScriptError/Title": {
"title": "$:/language/InternalJavaScriptError/Title",
"text": "Internal JavaScript Error"
},
"$:/language/InternalJavaScriptError/Hint": {
"title": "$:/language/InternalJavaScriptError/Hint",
"text": "Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser"
},
"$:/language/InvalidFieldName": {
"title": "$:/language/InvalidFieldName",
"text": "Illegal characters in field name \"<$text text=<<fieldName>>/>\". Fields can only contain lowercase letters, digits and the characters underscore (`_`), hyphen (`-`) and period (`.`)"
},
"$:/language/LayoutSwitcher/Description": {
"title": "$:/language/LayoutSwitcher/Description",
"text": "Open the layout switcher"
},
"$:/language/LazyLoadingWarning": {
"title": "$:/language/LazyLoadingWarning",
"text": "<p>Trying to load external content from ''<$text text={{!!_canonical_uri}}/>''</p><p>If this message doesn't disappear, either the tiddler content type doesn't match the type of the external content, or you may be using a browser that doesn't support external content for wikis loaded as standalone files. See https://tiddlywiki.com/#ExternalText</p>"
},
"$:/language/LoginToTiddlySpace": {
"title": "$:/language/LoginToTiddlySpace",
"text": "Login to TiddlySpace"
},
"$:/language/Manager/Controls/FilterByTag/None": {
"title": "$:/language/Manager/Controls/FilterByTag/None",
"text": "(none)"
},
"$:/language/Manager/Controls/FilterByTag/Prompt": {
"title": "$:/language/Manager/Controls/FilterByTag/Prompt",
"text": "Filter by tag:"
},
"$:/language/Manager/Controls/Order/Prompt": {
"title": "$:/language/Manager/Controls/Order/Prompt",
"text": "Reverse order"
},
"$:/language/Manager/Controls/Search/Placeholder": {
"title": "$:/language/Manager/Controls/Search/Placeholder",
"text": "Search"
},
"$:/language/Manager/Controls/Search/Prompt": {
"title": "$:/language/Manager/Controls/Search/Prompt",
"text": "Search:"
},
"$:/language/Manager/Controls/Show/Option/Tags": {
"title": "$:/language/Manager/Controls/Show/Option/Tags",
"text": "tags"
},
"$:/language/Manager/Controls/Show/Option/Tiddlers": {
"title": "$:/language/Manager/Controls/Show/Option/Tiddlers",
"text": "tiddlers"
},
"$:/language/Manager/Controls/Show/Prompt": {
"title": "$:/language/Manager/Controls/Show/Prompt",
"text": "Show:"
},
"$:/language/Manager/Controls/Sort/Prompt": {
"title": "$:/language/Manager/Controls/Sort/Prompt",
"text": "Sort by:"
},
"$:/language/Manager/Item/Colour": {
"title": "$:/language/Manager/Item/Colour",
"text": "Colour"
},
"$:/language/Manager/Item/Fields": {
"title": "$:/language/Manager/Item/Fields",
"text": "Fields"
},
"$:/language/Manager/Item/Icon/None": {
"title": "$:/language/Manager/Item/Icon/None",
"text": "(none)"
},
"$:/language/Manager/Item/Icon": {
"title": "$:/language/Manager/Item/Icon",
"text": "Icon"
},
"$:/language/Manager/Item/RawText": {
"title": "$:/language/Manager/Item/RawText",
"text": "Raw text"
},
"$:/language/Manager/Item/Tags": {
"title": "$:/language/Manager/Item/Tags",
"text": "Tags"
},
"$:/language/Manager/Item/Tools": {
"title": "$:/language/Manager/Item/Tools",
"text": "Tools"
},
"$:/language/Manager/Item/WikifiedText": {
"title": "$:/language/Manager/Item/WikifiedText",
"text": "Wikified text"
},
"$:/language/MissingTiddler/Hint": {
"title": "$:/language/MissingTiddler/Hint",
"text": "Missing tiddler \"<$text text=<<currentTiddler>>/>\" -- click {{||$:/core/ui/Buttons/edit}} to create"
},
"$:/language/No": {
"title": "$:/language/No",
"text": "No"
},
"$:/language/OfficialPluginLibrary": {
"title": "$:/language/OfficialPluginLibrary",
"text": "Official ~TiddlyWiki Plugin Library"
},
"$:/language/OfficialPluginLibrary/Hint": {
"title": "$:/language/OfficialPluginLibrary/Hint",
"text": "The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team."
},
"$:/language/PageTemplate/Description": {
"title": "$:/language/PageTemplate/Description",
"text": "the default ~TiddlyWiki layout"
},
"$:/language/PageTemplate/Name": {
"title": "$:/language/PageTemplate/Name",
"text": "Default ~PageTemplate"
},
"$:/language/PluginReloadWarning": {
"title": "$:/language/PluginReloadWarning",
"text": "Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect"
},
"$:/language/RecentChanges/DateFormat": {
"title": "$:/language/RecentChanges/DateFormat",
"text": "DDth MMM YYYY"
},
"$:/language/Shortcuts/Input/AdvancedSearch/Hint": {
"title": "$:/language/Shortcuts/Input/AdvancedSearch/Hint",
"text": "Open the ~AdvancedSearch panel from within the sidebar search field"
},
"$:/language/Shortcuts/Input/Accept/Hint": {
"title": "$:/language/Shortcuts/Input/Accept/Hint",
"text": "Accept the selected item"
},
"$:/language/Shortcuts/Input/AcceptVariant/Hint": {
"title": "$:/language/Shortcuts/Input/AcceptVariant/Hint",
"text": "Accept the selected item (variant)"
},
"$:/language/Shortcuts/Input/Cancel/Hint": {
"title": "$:/language/Shortcuts/Input/Cancel/Hint",
"text": "Clear the input field"
},
"$:/language/Shortcuts/Input/Down/Hint": {
"title": "$:/language/Shortcuts/Input/Down/Hint",
"text": "Select the next item"
},
"$:/language/Shortcuts/Input/Tab-Left/Hint": {
"title": "$:/language/Shortcuts/Input/Tab-Left/Hint",
"text": "Select the previous Tab"
},
"$:/language/Shortcuts/Input/Tab-Right/Hint": {
"title": "$:/language/Shortcuts/Input/Tab-Right/Hint",
"text": "Select the next Tab"
},
"$:/language/Shortcuts/Input/Up/Hint": {
"title": "$:/language/Shortcuts/Input/Up/Hint",
"text": "Select the previous item"
},
"$:/language/Shortcuts/SidebarLayout/Hint": {
"title": "$:/language/Shortcuts/SidebarLayout/Hint",
"text": "Change the sidebar layout"
},
"$:/language/Switcher/Subtitle/theme": {
"title": "$:/language/Switcher/Subtitle/theme",
"text": "Switch Theme"
},
"$:/language/Switcher/Subtitle/layout": {
"title": "$:/language/Switcher/Subtitle/layout",
"text": "Switch Layout"
},
"$:/language/Switcher/Subtitle/language": {
"title": "$:/language/Switcher/Subtitle/language",
"text": "Switch Language"
},
"$:/language/Switcher/Subtitle/palette": {
"title": "$:/language/Switcher/Subtitle/palette",
"text": "Switch Palette"
},
"$:/language/SystemTiddler/Tooltip": {
"title": "$:/language/SystemTiddler/Tooltip",
"text": "This is a system tiddler"
},
"$:/language/SystemTiddlers/Include/Prompt": {
"title": "$:/language/SystemTiddlers/Include/Prompt",
"text": "Include system tiddlers"
},
"$:/language/TagManager/Colour/Heading": {
"title": "$:/language/TagManager/Colour/Heading",
"text": "Colour"
},
"$:/language/TagManager/Count/Heading": {
"title": "$:/language/TagManager/Count/Heading",
"text": "Count"
},
"$:/language/TagManager/Icon/Heading": {
"title": "$:/language/TagManager/Icon/Heading",
"text": "Icon"
},
"$:/language/TagManager/Icons/None": {
"title": "$:/language/TagManager/Icons/None",
"text": "None"
},
"$:/language/TagManager/Info/Heading": {
"title": "$:/language/TagManager/Info/Heading",
"text": "Info"
},
"$:/language/TagManager/Tag/Heading": {
"title": "$:/language/TagManager/Tag/Heading",
"text": "Tag"
},
"$:/language/Tiddler/DateFormat": {
"title": "$:/language/Tiddler/DateFormat",
"text": "DDth MMM YYYY at hh12:0mmam"
},
"$:/language/UnsavedChangesWarning": {
"title": "$:/language/UnsavedChangesWarning",
"text": "You have unsaved changes in TiddlyWiki"
},
"$:/language/Yes": {
"title": "$:/language/Yes",
"text": "Yes"
},
"$:/language/Modals/Download": {
"title": "$:/language/Modals/Download",
"subtitle": "Download changes",
"footer": "<$button message=\"tm-close-tiddler\">Close</$button>",
"help": "https://tiddlywiki.com/static/DownloadingChanges.html",
"text": "Your browser only supports manual saving.\n\nTo save your modified wiki, right click on the download link below and select \"Download file\" or \"Save file\", and then choose the folder and filename.\n\n//You can marginally speed things up by clicking the link with the control key (Windows) or the options/alt key (Mac OS X). You will not be prompted for the folder or filename, but your browser is likely to give it an unrecognisable name -- you may need to rename the file to include an `.html` extension before you can do anything useful with it.//\n\nOn smartphones that do not allow files to be downloaded you can instead bookmark the link, and then sync your bookmarks to a desktop computer from where the wiki can be saved normally.\n"
},
"$:/language/Modals/SaveInstructions": {
"title": "$:/language/Modals/SaveInstructions",
"subtitle": "Save your work",
"footer": "<$button message=\"tm-close-tiddler\">Close</$button>",
"help": "https://tiddlywiki.com/static/SavingChanges.html",
"text": "Your changes to this wiki need to be saved as a ~TiddlyWiki HTML file.\n\n!!! Desktop browsers\n\n# Select ''Save As'' from the ''File'' menu\n# Choose a filename and location\n#* Some browsers also require you to explicitly specify the file saving format as ''Webpage, HTML only'' or similar\n# Close this tab\n\n!!! Smartphone browsers\n\n# Create a bookmark to this page\n#* If you've got iCloud or Google Sync set up then the bookmark will automatically sync to your desktop where you can open it and save it as above\n# Close this tab\n\n//If you open the bookmark again in Mobile Safari you will see this message again. If you want to go ahead and use the file, just click the ''close'' button below//\n"
},
"$:/config/NewJournal/Title": {
"title": "$:/config/NewJournal/Title",
"text": "DDth MMM YYYY"
},
"$:/config/NewJournal/Text": {
"title": "$:/config/NewJournal/Text",
"text": ""
},
"$:/config/NewJournal/Tags": {
"title": "$:/config/NewJournal/Tags",
"text": "Journal\n"
},
"$:/language/Notifications/Save/Done": {
"title": "$:/language/Notifications/Save/Done",
"text": "Saved wiki"
},
"$:/language/Notifications/Save/Starting": {
"title": "$:/language/Notifications/Save/Starting",
"text": "Starting to save wiki"
},
"$:/language/Notifications/CopiedToClipboard/Succeeded": {
"title": "$:/language/Notifications/CopiedToClipboard/Succeeded",
"text": "Copied to clipboard!"
},
"$:/language/Notifications/CopiedToClipboard/Failed": {
"title": "$:/language/Notifications/CopiedToClipboard/Failed",
"text": "Failed to copy to clipboard!"
},
"$:/language/Publishing/Modal": {
"title": "$:/language/Publishing/Modal",
"subtitle": "Publishing: ''<$transclude field=\"caption\"><$view field=\"title\"/></$transclude>''",
"footer": "<$button message=\"tm-close-tiddler\">Cancel</$button>",
"text": "Publishing <$text text=<<totalFiles>>/> files via the \"{{!!publisher}}\" publisher.\n"
},
"$:/language/Search/DefaultResults/Caption": {
"title": "$:/language/Search/DefaultResults/Caption",
"text": "List"
},
"$:/language/Search/Filter/Caption": {
"title": "$:/language/Search/Filter/Caption",
"text": "Filter"
},
"$:/language/Search/Filter/Hint": {
"title": "$:/language/Search/Filter/Hint",
"text": "Search via a [[filter expression|https://tiddlywiki.com/static/Filters.html]]"
},
"$:/language/Search/Filter/Matches": {
"title": "$:/language/Search/Filter/Matches",
"text": "//<small><<resultCount>> matches</small>//"
},
"$:/language/Search/Matches": {
"title": "$:/language/Search/Matches",
"text": "//<small><<resultCount>> matches</small>//"
},
"$:/language/Search/Matches/All": {
"title": "$:/language/Search/Matches/All",
"text": "All matches:"
},
"$:/language/Search/Matches/Title": {
"title": "$:/language/Search/Matches/Title",
"text": "Title matches:"
},
"$:/language/Search/Search": {
"title": "$:/language/Search/Search",
"text": "Search"
},
"$:/language/Search/Search/TooShort": {
"title": "$:/language/Search/Search/TooShort",
"text": "Search text too short"
},
"$:/language/Search/Shadows/Caption": {
"title": "$:/language/Search/Shadows/Caption",
"text": "Shadows"
},
"$:/language/Search/Shadows/Hint": {
"title": "$:/language/Search/Shadows/Hint",
"text": "Search for shadow tiddlers"
},
"$:/language/Search/Shadows/Matches": {
"title": "$:/language/Search/Shadows/Matches",
"text": "//<small><<resultCount>> matches</small>//"
},
"$:/language/Search/Standard/Caption": {
"title": "$:/language/Search/Standard/Caption",
"text": "Standard"
},
"$:/language/Search/Standard/Hint": {
"title": "$:/language/Search/Standard/Hint",
"text": "Search for standard tiddlers"
},
"$:/language/Search/Standard/Matches": {
"title": "$:/language/Search/Standard/Matches",
"text": "//<small><<resultCount>> matches</small>//"
},
"$:/language/Search/System/Caption": {
"title": "$:/language/Search/System/Caption",
"text": "System"
},
"$:/language/Search/System/Hint": {
"title": "$:/language/Search/System/Hint",
"text": "Search for system tiddlers"
},
"$:/language/Search/System/Matches": {
"title": "$:/language/Search/System/Matches",
"text": "//<small><<resultCount>> matches</small>//"
},
"$:/language/SideBar/All/Caption": {
"title": "$:/language/SideBar/All/Caption",
"text": "All"
},
"$:/language/SideBar/Contents/Caption": {
"title": "$:/language/SideBar/Contents/Caption",
"text": "Contents"
},
"$:/language/SideBar/Drafts/Caption": {
"title": "$:/language/SideBar/Drafts/Caption",
"text": "Drafts"
},
"$:/language/SideBar/Explorer/Caption": {
"title": "$:/language/SideBar/Explorer/Caption",
"text": "Explorer"
},
"$:/language/SideBar/Missing/Caption": {
"title": "$:/language/SideBar/Missing/Caption",
"text": "Missing"
},
"$:/language/SideBar/More/Caption": {
"title": "$:/language/SideBar/More/Caption",
"text": "More"
},
"$:/language/SideBar/Open/Caption": {
"title": "$:/language/SideBar/Open/Caption",
"text": "Open"
},
"$:/language/SideBar/Orphans/Caption": {
"title": "$:/language/SideBar/Orphans/Caption",
"text": "Orphans"
},
"$:/language/SideBar/Recent/Caption": {
"title": "$:/language/SideBar/Recent/Caption",
"text": "Recent"
},
"$:/language/SideBar/Shadows/Caption": {
"title": "$:/language/SideBar/Shadows/Caption",
"text": "Shadows"
},
"$:/language/SideBar/System/Caption": {
"title": "$:/language/SideBar/System/Caption",
"text": "System"
},
"$:/language/SideBar/Tags/Caption": {
"title": "$:/language/SideBar/Tags/Caption",
"text": "Tags"
},
"$:/language/SideBar/Tags/Untagged/Caption": {
"title": "$:/language/SideBar/Tags/Untagged/Caption",
"text": "untagged"
},
"$:/language/SideBar/Tools/Caption": {
"title": "$:/language/SideBar/Tools/Caption",
"text": "Tools"
},
"$:/language/SideBar/Types/Caption": {
"title": "$:/language/SideBar/Types/Caption",
"text": "Types"
},
"$:/SiteSubtitle": {
"title": "$:/SiteSubtitle",
"text": "a non-linear personal web notebook"
},
"$:/SiteTitle": {
"title": "$:/SiteTitle",
"text": "My ~TiddlyWiki"
},
"$:/language/Snippets/ListByTag": {
"title": "$:/language/Snippets/ListByTag",
"tags": "$:/tags/TextEditor/Snippet",
"caption": "List of tiddlers by tag",
"text": "<<list-links \"[tag[task]sort[title]]\">>\n"
},
"$:/language/Snippets/MacroDefinition": {
"title": "$:/language/Snippets/MacroDefinition",
"tags": "$:/tags/TextEditor/Snippet",
"caption": "Macro definition",
"text": "\\define macroName(param1:\"default value\",param2)\nText of the macro\n\\end\n"
},
"$:/language/Snippets/Table4x3": {
"title": "$:/language/Snippets/Table4x3",
"tags": "$:/tags/TextEditor/Snippet",
"caption": "Table with 4 columns by 3 rows",
"text": "|! |!Alpha |!Beta |!Gamma |!Delta |\n|!One | | | | |\n|!Two | | | | |\n|!Three | | | | |\n"
},
"$:/language/Snippets/TableOfContents": {
"title": "$:/language/Snippets/TableOfContents",
"tags": "$:/tags/TextEditor/Snippet",
"caption": "Table of Contents",
"text": "<div class=\"tc-table-of-contents\">\n\n<<toc-selective-expandable 'TableOfContents'>>\n\n</div>"
},
"$:/language/ThemeTweaks/ThemeTweaks": {
"title": "$:/language/ThemeTweaks/ThemeTweaks",
"text": "Theme Tweaks"
},
"$:/language/ThemeTweaks/ThemeTweaks/Hint": {
"title": "$:/language/ThemeTweaks/ThemeTweaks/Hint",
"text": "You can tweak certain aspects of the ''Vanilla'' theme."
},
"$:/language/ThemeTweaks/Options": {
"title": "$:/language/ThemeTweaks/Options",
"text": "Options"
},
"$:/language/ThemeTweaks/Options/SidebarLayout": {
"title": "$:/language/ThemeTweaks/Options/SidebarLayout",
"text": "Sidebar layout"
},
"$:/language/ThemeTweaks/Options/SidebarLayout/Fixed-Fluid": {
"title": "$:/language/ThemeTweaks/Options/SidebarLayout/Fixed-Fluid",
"text": "Fixed story, fluid sidebar"
},
"$:/language/ThemeTweaks/Options/SidebarLayout/Fluid-Fixed": {
"title": "$:/language/ThemeTweaks/Options/SidebarLayout/Fluid-Fixed",
"text": "Fluid story, fixed sidebar"
},
"$:/language/ThemeTweaks/Options/StickyTitles": {
"title": "$:/language/ThemeTweaks/Options/StickyTitles",
"text": "Sticky titles"
},
"$:/language/ThemeTweaks/Options/StickyTitles/Hint": {
"title": "$:/language/ThemeTweaks/Options/StickyTitles/Hint",
"text": "Causes tiddler titles to \"stick\" to the top of the browser window"
},
"$:/language/ThemeTweaks/Options/CodeWrapping": {
"title": "$:/language/ThemeTweaks/Options/CodeWrapping",
"text": "Wrap long lines in code blocks"
},
"$:/language/ThemeTweaks/Settings": {
"title": "$:/language/ThemeTweaks/Settings",
"text": "Settings"
},
"$:/language/ThemeTweaks/Settings/FontFamily": {
"title": "$:/language/ThemeTweaks/Settings/FontFamily",
"text": "Font family"
},
"$:/language/ThemeTweaks/Settings/CodeFontFamily": {
"title": "$:/language/ThemeTweaks/Settings/CodeFontFamily",
"text": "Code font family"
},
"$:/language/ThemeTweaks/Settings/EditorFontFamily": {
"title": "$:/language/ThemeTweaks/Settings/EditorFontFamily",
"text": "Editor font family"
},
"$:/language/ThemeTweaks/Settings/BackgroundImage": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImage",
"text": "Page background image"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageAttachment": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageAttachment",
"text": "Page background image attachment"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageAttachment/Scroll": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageAttachment/Scroll",
"text": "Scroll with tiddlers"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageAttachment/Fixed": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageAttachment/Fixed",
"text": "Fixed to window"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageSize": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageSize",
"text": "Page background image size"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageSize/Auto": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageSize/Auto",
"text": "Auto"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageSize/Cover": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageSize/Cover",
"text": "Cover"
},
"$:/language/ThemeTweaks/Settings/BackgroundImageSize/Contain": {
"title": "$:/language/ThemeTweaks/Settings/BackgroundImageSize/Contain",
"text": "Contain"
},
"$:/language/ThemeTweaks/Metrics": {
"title": "$:/language/ThemeTweaks/Metrics",
"text": "Sizes"
},
"$:/language/ThemeTweaks/Metrics/FontSize": {
"title": "$:/language/ThemeTweaks/Metrics/FontSize",
"text": "Font size"
},
"$:/language/ThemeTweaks/Metrics/LineHeight": {
"title": "$:/language/ThemeTweaks/Metrics/LineHeight",
"text": "Line height"
},
"$:/language/ThemeTweaks/Metrics/BodyFontSize": {
"title": "$:/language/ThemeTweaks/Metrics/BodyFontSize",
"text": "Font size for tiddler body"
},
"$:/language/ThemeTweaks/Metrics/BodyLineHeight": {
"title": "$:/language/ThemeTweaks/Metrics/BodyLineHeight",
"text": "Line height for tiddler body"
},
"$:/language/ThemeTweaks/Metrics/StoryLeft": {
"title": "$:/language/ThemeTweaks/Metrics/StoryLeft",
"text": "Story left position"
},
"$:/language/ThemeTweaks/Metrics/StoryLeft/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/StoryLeft/Hint",
"text": "how far the left margin of the story river<br>(tiddler area) is from the left of the page"
},
"$:/language/ThemeTweaks/Metrics/StoryTop": {
"title": "$:/language/ThemeTweaks/Metrics/StoryTop",
"text": "Story top position"
},
"$:/language/ThemeTweaks/Metrics/StoryTop/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/StoryTop/Hint",
"text": "how far the top margin of the story river<br>is from the top of the page"
},
"$:/language/ThemeTweaks/Metrics/StoryRight": {
"title": "$:/language/ThemeTweaks/Metrics/StoryRight",
"text": "Story right"
},
"$:/language/ThemeTweaks/Metrics/StoryRight/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/StoryRight/Hint",
"text": "how far the left margin of the sidebar <br>is from the left of the page"
},
"$:/language/ThemeTweaks/Metrics/StoryWidth": {
"title": "$:/language/ThemeTweaks/Metrics/StoryWidth",
"text": "Story width"
},
"$:/language/ThemeTweaks/Metrics/StoryWidth/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/StoryWidth/Hint",
"text": "the overall width of the story river"
},
"$:/language/ThemeTweaks/Metrics/TiddlerWidth": {
"title": "$:/language/ThemeTweaks/Metrics/TiddlerWidth",
"text": "Tiddler width"
},
"$:/language/ThemeTweaks/Metrics/TiddlerWidth/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/TiddlerWidth/Hint",
"text": "within the story river"
},
"$:/language/ThemeTweaks/Metrics/SidebarBreakpoint": {
"title": "$:/language/ThemeTweaks/Metrics/SidebarBreakpoint",
"text": "Sidebar breakpoint"
},
"$:/language/ThemeTweaks/Metrics/SidebarBreakpoint/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/SidebarBreakpoint/Hint",
"text": "the minimum page width at which the story<br>river and sidebar will appear side by side"
},
"$:/language/ThemeTweaks/Metrics/SidebarWidth": {
"title": "$:/language/ThemeTweaks/Metrics/SidebarWidth",
"text": "Sidebar width"
},
"$:/language/ThemeTweaks/Metrics/SidebarWidth/Hint": {
"title": "$:/language/ThemeTweaks/Metrics/SidebarWidth/Hint",
"text": "the width of the sidebar in fluid-fixed layout"
},
"$:/language/TiddlerInfo/Advanced/Caption": {
"title": "$:/language/TiddlerInfo/Advanced/Caption",
"text": "Advanced"
},
"$:/language/TiddlerInfo/Advanced/PluginInfo/Empty/Hint": {
"title": "$:/language/TiddlerInfo/Advanced/PluginInfo/Empty/Hint",
"text": "none"
},
"$:/language/TiddlerInfo/Advanced/PluginInfo/Heading": {
"title": "$:/language/TiddlerInfo/Advanced/PluginInfo/Heading",
"text": "Plugin Details"
},
"$:/language/TiddlerInfo/Advanced/PluginInfo/Hint": {
"title": "$:/language/TiddlerInfo/Advanced/PluginInfo/Hint",
"text": "This plugin contains the following shadow tiddlers:"
},
"$:/language/TiddlerInfo/Advanced/ShadowInfo/Heading": {
"title": "$:/language/TiddlerInfo/Advanced/ShadowInfo/Heading",
"text": "Shadow Status"
},
"$:/language/TiddlerInfo/Advanced/ShadowInfo/NotShadow/Hint": {
"title": "$:/language/TiddlerInfo/Advanced/ShadowInfo/NotShadow/Hint",
"text": "The tiddler <$link to=<<infoTiddler>>><$text text=<<infoTiddler>>/></$link> is not a shadow tiddler"
},
"$:/language/TiddlerInfo/Advanced/ShadowInfo/Shadow/Hint": {
"title": "$:/language/TiddlerInfo/Advanced/ShadowInfo/Shadow/Hint",
"text": "The tiddler <$link to=<<infoTiddler>>><$text text=<<infoTiddler>>/></$link> is a shadow tiddler"
},
"$:/language/TiddlerInfo/Advanced/ShadowInfo/Shadow/Source": {
"title": "$:/language/TiddlerInfo/Advanced/ShadowInfo/Shadow/Source",
"text": "It is defined in the plugin <$link to=<<pluginTiddler>>><$text text=<<pluginTiddler>>/></$link>"
},
"$:/language/TiddlerInfo/Advanced/ShadowInfo/OverriddenShadow/Hint": {
"title": "$:/language/TiddlerInfo/Advanced/ShadowInfo/OverriddenShadow/Hint",
"text": "It is overridden by an ordinary tiddler"
},
"$:/language/TiddlerInfo/Fields/Caption": {
"title": "$:/language/TiddlerInfo/Fields/Caption",
"text": "Fields"
},
"$:/language/TiddlerInfo/List/Caption": {
"title": "$:/language/TiddlerInfo/List/Caption",
"text": "List"
},
"$:/language/TiddlerInfo/List/Empty": {
"title": "$:/language/TiddlerInfo/List/Empty",
"text": "This tiddler does not have a list"
},
"$:/language/TiddlerInfo/Listed/Caption": {
"title": "$:/language/TiddlerInfo/Listed/Caption",
"text": "Listed"
},
"$:/language/TiddlerInfo/Listed/Empty": {
"title": "$:/language/TiddlerInfo/Listed/Empty",
"text": "This tiddler is not listed by any others"
},
"$:/language/TiddlerInfo/References/Caption": {
"title": "$:/language/TiddlerInfo/References/Caption",
"text": "Backlinks"
},
"$:/language/TiddlerInfo/References/Empty": {
"title": "$:/language/TiddlerInfo/References/Empty",
"text": "No tiddlers link to this one"
},
"$:/language/TiddlerInfo/Tagging/Caption": {
"title": "$:/language/TiddlerInfo/Tagging/Caption",
"text": "Tagging"
},
"$:/language/TiddlerInfo/Tagging/Empty": {
"title": "$:/language/TiddlerInfo/Tagging/Empty",
"text": "No tiddlers are tagged with this one"
},
"$:/language/TiddlerInfo/Tools/Caption": {
"title": "$:/language/TiddlerInfo/Tools/Caption",
"text": "Tools"
},
"$:/language/Docs/Types/application/javascript": {
"title": "$:/language/Docs/Types/application/javascript",
"description": "JavaScript code",
"name": "application/javascript",
"group": "Developer",
"group-sort": "2"
},
"$:/language/Docs/Types/application/json": {
"title": "$:/language/Docs/Types/application/json",
"description": "JSON data",
"name": "application/json",
"group": "Developer",
"group-sort": "2"
},
"$:/language/Docs/Types/application/x-tiddler-dictionary": {
"title": "$:/language/Docs/Types/application/x-tiddler-dictionary",
"description": "Data dictionary",
"name": "application/x-tiddler-dictionary",
"group": "Developer",
"group-sort": "2"
},
"$:/language/Docs/Types/image/gif": {
"title": "$:/language/Docs/Types/image/gif",
"description": "GIF image",
"name": "image/gif",
"group": "Image",
"group-sort": "1"
},
"$:/language/Docs/Types/image/jpeg": {
"title": "$:/language/Docs/Types/image/jpeg",
"description": "JPEG image",
"name": "image/jpeg",
"group": "Image",
"group-sort": "1"
},
"$:/language/Docs/Types/image/png": {
"title": "$:/language/Docs/Types/image/png",
"description": "PNG image",
"name": "image/png",
"group": "Image",
"group-sort": "1"
},
"$:/language/Docs/Types/image/svg+xml": {
"title": "$:/language/Docs/Types/image/svg+xml",
"description": "Structured Vector Graphics image",
"name": "image/svg+xml",
"group": "Image",
"group-sort": "1"
},
"$:/language/Docs/Types/image/x-icon": {
"title": "$:/language/Docs/Types/image/x-icon",
"description": "ICO format icon file",
"name": "image/x-icon",
"group": "Image",
"group-sort": "1"
},
"$:/language/Docs/Types/text/css": {
"title": "$:/language/Docs/Types/text/css",
"description": "Static stylesheet",
"name": "text/css",
"group": "Developer",
"group-sort": "2"
},
"$:/language/Docs/Types/text/html": {
"title": "$:/language/Docs/Types/text/html",
"description": "HTML markup",
"name": "text/html",
"group": "Text",
"group-sort": "0"
},
"$:/language/Docs/Types/text/plain": {
"title": "$:/language/Docs/Types/text/plain",
"description": "Plain text",
"name": "text/plain",
"group": "Text",
"group-sort": "0"
},
"$:/language/Docs/Types/text/vnd.tiddlywiki": {
"title": "$:/language/Docs/Types/text/vnd.tiddlywiki",
"description": "TiddlyWiki 5",
"name": "text/vnd.tiddlywiki",
"group": "Text",
"group-sort": "0"
},
"$:/language/Docs/Types/text/x-tiddlywiki": {
"title": "$:/language/Docs/Types/text/x-tiddlywiki",
"description": "TiddlyWiki Classic",
"name": "text/x-tiddlywiki",
"group": "Text",
"group-sort": "0"
},
"$:/languages/en-GB/icon": {
"title": "$:/languages/en-GB/icon",
"type": "image/svg+xml",
"text": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 60 30\" width=\"1200\" height=\"600\">\n<clipPath id=\"t\">\n\t<path d=\"M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z\"/>\n</clipPath>\n<path d=\"M0,0 v30 h60 v-30 z\" fill=\"#00247d\"/>\n<path d=\"M0,0 L60,30 M60,0 L0,30\" stroke=\"#fff\" stroke-width=\"6\"/>\n<path d=\"M0,0 L60,30 M60,0 L0,30\" clip-path=\"url(#t)\" stroke=\"#cf142b\" stroke-width=\"4\"/>\n<path d=\"M30,0 v30 M0,15 h60\" stroke=\"#fff\" stroke-width=\"10\"/>\n<path d=\"M30,0 v30 M0,15 h60\" stroke=\"#cf142b\" stroke-width=\"6\"/>\n</svg>\n"
},
"$:/languages/en-GB": {
"title": "$:/languages/en-GB",
"name": "en-GB",
"description": "English (British)",
"author": "JeremyRuston",
"core-version": ">=5.0.0\"",
"text": "Stub pseudo-plugin for the default language"
},
"$:/core/modules/commander.js": {
"title": "$:/core/modules/commander.js",
"text": "/*\\\ntitle: $:/core/modules/commander.js\ntype: application/javascript\nmodule-type: global\n\nThe $tw.Commander class is a command interpreter\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nParse a sequence of commands\n\tcommandTokens: an array of command string tokens\n\twiki: reference to the wiki store object\n\tstreams: {output:, error:}, each of which has a write(string) method\n\tcallback: a callback invoked as callback(err) where err is null if there was no error\n*/\nvar Commander = function(commandTokens,callback,wiki,streams) {\n\tvar path = require(\"path\");\n\tthis.commandTokens = commandTokens;\n\tthis.nextToken = 0;\n\tthis.callback = callback;\n\tthis.wiki = wiki;\n\tthis.streams = streams;\n\tthis.outputPath = path.resolve($tw.boot.wikiPath,$tw.config.wikiOutputSubDir);\n};\n\n/*\nLog a string if verbose flag is set\n*/\nCommander.prototype.log = function(str) {\n\tif(this.verbose) {\n\t\tthis.streams.output.write(str + \"\\n\");\n\t}\n};\n\n/*\nWrite a string if verbose flag is set\n*/\nCommander.prototype.write = function(str) {\n\tif(this.verbose) {\n\t\tthis.streams.output.write(str);\n\t}\n};\n\n/*\nAdd a string of tokens to the command queue\n*/\nCommander.prototype.addCommandTokens = function(commandTokens) {\n\tvar params = commandTokens.slice(0);\n\tparams.unshift(0);\n\tparams.unshift(this.nextToken);\n\tArray.prototype.splice.apply(this.commandTokens,params);\n};\n\n/*\nExecute the sequence of commands and invoke a callback on completion\n*/\nCommander.prototype.execute = function() {\n\tthis.executeNextCommand();\n};\n\n/*\nExecute the next command in the sequence\n*/\nCommander.prototype.executeNextCommand = function() {\n\tvar self = this;\n\t// Invoke the callback if there are no more commands\n\tif(this.nextToken >= this.commandTokens.length) {\n\t\tthis.callback(null);\n\t} else {\n\t\t// Get and check the command token\n\t\tvar commandName = this.commandTokens[this.nextToken++];\n\t\tif(commandName.substr(0,2) !== \"--\") {\n\t\t\tthis.callback(\"Missing command: \" + commandName);\n\t\t} else {\n\t\t\tcommandName = commandName.substr(2); // Trim off the --\n\t\t\t// Accumulate the parameters to the command\n\t\t\tvar params = [];\n\t\t\twhile(this.nextToken < this.commandTokens.length && \n\t\t\t\tthis.commandTokens[this.nextToken].substr(0,2) !== \"--\") {\n\t\t\t\tparams.push(this.commandTokens[this.nextToken++]);\n\t\t\t}\n\t\t\t// Get the command info\n\t\t\tvar command = $tw.commands[commandName],\n\t\t\t\tc,err;\n\t\t\tif(!command) {\n\t\t\t\tthis.callback(\"Unknown command: \" + commandName);\n\t\t\t} else {\n\t\t\t\tif(this.verbose) {\n\t\t\t\t\tthis.streams.output.write(\"Executing command: \" + commandName + \" \" + params.join(\" \") + \"\\n\");\n\t\t\t\t}\n\t\t\t\t// Parse named parameters if required\n\t\t\t\tif(command.info.namedParameterMode) {\n\t\t\t\t\tparams = this.extractNamedParameters(params,command.info.mandatoryParameters);\n\t\t\t\t\tif(typeof params === \"string\") {\n\t\t\t\t\t\treturn this.callback(params);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(command.info.synchronous) {\n\t\t\t\t\t// Synchronous command\n\t\t\t\t\tc = new command.Command(params,this);\n\t\t\t\t\terr = c.execute();\n\t\t\t\t\tif(err) {\n\t\t\t\t\t\tthis.callback(err);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.executeNextCommand();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Asynchronous command\n\t\t\t\t\tc = new command.Command(params,this,function(err) {\n\t\t\t\t\t\tif(err) {\n\t\t\t\t\t\t\tself.callback(err);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tself.executeNextCommand();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\terr = c.execute();\n\t\t\t\t\tif(err) {\n\t\t\t\t\t\tthis.callback(err);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\n/*\nGiven an array of parameter strings `params` in name:value format, and an array of mandatory parameter names in `mandatoryParameters`, returns a hashmap of values or a string if error\n*/\nCommander.prototype.extractNamedParameters = function(params,mandatoryParameters) {\n\tmandatoryParameters = mandatoryParameters || [];\n\tvar errors = [],\n\t\tparamsByName = Object.create(null);\n\t// Extract the parameters\n\t$tw.utils.each(params,function(param) {\n\t\tvar index = param.indexOf(\"=\");\n\t\tif(index < 1) {\n\t\t\terrors.push(\"malformed named parameter: '\" + param + \"'\");\n\t\t}\n\t\tparamsByName[param.slice(0,index)] = $tw.utils.trim(param.slice(index+1));\n\t});\n\t// Check the mandatory parameters are present\n\t$tw.utils.each(mandatoryParameters,function(mandatoryParameter) {\n\t\tif(!$tw.utils.hop(paramsByName,mandatoryParameter)) {\n\t\t\terrors.push(\"missing mandatory parameter: '\" + mandatoryParameter + \"'\");\n\t\t}\n\t});\n\t// Return any errors\n\tif(errors.length > 0) {\n\t\treturn errors.join(\" and\\n\");\n\t} else {\n\t\treturn paramsByName;\n\t}\n};\n\nCommander.initCommands = function(moduleType) {\n\tmoduleType = moduleType || \"command\";\n\t$tw.commands = {};\n\t$tw.modules.forEachModuleOfType(moduleType,function(title,module) {\n\t\tvar c = $tw.commands[module.info.name] = {};\n\t\t// Add the methods defined by the module\n\t\tfor(var f in module) {\n\t\t\tif($tw.utils.hop(module,f)) {\n\t\t\t\tc[f] = module[f];\n\t\t\t}\n\t\t}\n\t});\n};\n\nexports.Commander = Commander;\n\n})();\n",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/commands/build.js": {
"title": "$:/core/modules/commands/build.js",
"text": "/*\\\ntitle: $:/core/modules/commands/build.js\ntype: application/javascript\nmodule-type: command\n\nCommand to build a build target\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"build\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\t// Get the build targets defined in the wiki\n\tvar buildTargets = $tw.boot.wikiInfo.build;\n\tif(!buildTargets) {\n\t\treturn \"No build targets defined\";\n\t}\n\t// Loop through each of the specified targets\n\tvar targets;\n\tif(this.params.length > 0) {\n\t\ttargets = this.params;\n\t} else {\n\t\ttargets = Object.keys(buildTargets);\n\t}\n\tfor(var targetIndex=0; targetIndex<targets.length; targetIndex++) {\n\t\tvar target = targets[targetIndex],\n\t\t\tcommands = buildTargets[target];\n\t\tif(!commands) {\n\t\t\treturn \"Build target '\" + target + \"' not found\";\n\t\t}\n\t\t// Add the commands to the queue\n\t\tthis.commander.addCommandTokens(commands);\n\t}\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/clearpassword.js": {
"title": "$:/core/modules/commands/clearpassword.js",
"text": "/*\\\ntitle: $:/core/modules/commands/clearpassword.js\ntype: application/javascript\nmodule-type: command\n\nClear password for crypto operations\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"clearpassword\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\t$tw.crypto.setPassword(null);\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/deletetiddlers.js": {
"title": "$:/core/modules/commands/deletetiddlers.js",
"text": "/*\\\ntitle: $:/core/modules/commands/deletetiddlers.js\ntype: application/javascript\nmodule-type: command\n\nCommand to delete tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"deletetiddlers\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Missing filter\";\n\t}\n\tvar self = this,\n\t\twiki = this.commander.wiki,\n\t\tfilter = this.params[0],\n\t\ttiddlers = wiki.filterTiddlers(filter);\n\t$tw.utils.each(tiddlers,function(title) {\n\t\twiki.deleteTiddler(title);\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/editions.js": {
"title": "$:/core/modules/commands/editions.js",
"text": "/*\\\ntitle: $:/core/modules/commands/editions.js\ntype: application/javascript\nmodule-type: command\n\nCommand to list the available editions\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"editions\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tvar self = this;\n\t// Output the list\n\tthis.commander.streams.output.write(\"Available editions:\\n\\n\");\n\tvar editionInfo = $tw.utils.getEditionInfo();\n\t$tw.utils.each(editionInfo,function(info,name) {\n\t\tself.commander.streams.output.write(\" \" + name + \": \" + info.description + \"\\n\");\n\t});\n\tthis.commander.streams.output.write(\"\\n\");\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/fetch.js": {
"title": "$:/core/modules/commands/fetch.js",
"text": "/*\\\ntitle: $:/core/modules/commands/fetch.js\ntype: application/javascript\nmodule-type: command\n\nCommands to fetch external tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"fetch\",\n\tsynchronous: false\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing subcommand and url\";\n\t}\n\tswitch(this.params[0]) {\n\t\tcase \"raw-file\":\n\t\t\treturn this.fetchFiles({\n\t\t\t\traw: true,\n\t\t\t\turl: this.params[1],\n\t\t\t\ttransformFilter: this.params[2] || \"\",\n\t\t\t\tcallback: this.callback\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"file\":\n\t\t\treturn this.fetchFiles({\n\t\t\t\turl: this.params[1],\n\t\t\t\timportFilter: this.params[2],\n\t\t\t\ttransformFilter: this.params[3] || \"\",\n\t\t\t\tcallback: this.callback\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"raw-files\":\n\t\t\treturn this.fetchFiles({\n\t\t\t\traw: true,\n\t\t\t\turlFilter: this.params[1],\n\t\t\t\ttransformFilter: this.params[2] || \"\",\n\t\t\t\tcallback: this.callback\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"files\":\n\t\t\treturn this.fetchFiles({\n\t\t\t\turlFilter: this.params[1],\n\t\t\t\timportFilter: this.params[2],\n\t\t\t\ttransformFilter: this.params[3] || \"\",\n\t\t\t\tcallback: this.callback\n\t\t\t});\n\t\t\tbreak;\n\t}\n\treturn null;\n};\n\nCommand.prototype.fetchFiles = function(options) {\n\tvar self = this;\n\t// Get the list of URLs\n\tvar urls;\n\tif(options.url) {\n\t\turls = [options.url]\n\t} else if(options.urlFilter) {\n\t\turls = this.commander.wiki.filterTiddlers(options.urlFilter);\n\t} else {\n\t\treturn \"Missing URL\";\n\t}\n\t// Process each URL in turn\n\tvar next = 0;\n\tvar getNextFile = function(err) {\n\t\tif(err) {\n\t\t\treturn options.callback(err);\n\t\t}\n\t\tif(next < urls.length) {\n\t\t\tself.fetchFile(urls[next++],options,getNextFile);\n\t\t} else {\n\t\t\toptions.callback(null);\n\t\t}\n\t};\n\tgetNextFile(null);\n\t// Success\n\treturn null;\n};\n\nCommand.prototype.fetchFile = function(url,options,callback,redirectCount) {\n\tif(redirectCount > 10) {\n\t\treturn callback(\"Error too many redirects retrieving \" + url);\n\t}\n\tvar self = this,\n\t\tlib = url.substr(0,8) === \"https://\" ? require(\"https\") : require(\"http\");\n\tlib.get(url).on(\"response\",function(response) {\n\t var type = (response.headers[\"content-type\"] || \"\").split(\";\")[0],\n\t \tdata = [];\n\t self.commander.write(\"Reading \" + url + \": \");\n\t response.on(\"data\",function(chunk) {\n\t data.push(chunk);\n\t self.commander.write(\".\");\n\t });\n\t response.on(\"end\",function() {\n\t self.commander.write(\"\\n\");\n\t if(response.statusCode === 200) {\n\t\t self.processBody(Buffer.concat(data),type,options,url);\n\t\t callback(null);\n\t } else {\n\t \tif(response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) {\n\t \t\treturn self.fetchFile(response.headers.location,options,callback,redirectCount + 1);\n\t \t} else {\n\t\t \treturn callback(\"Error \" + response.statusCode + \" retrieving \" + url)\n\t \t}\n\t }\n\t \t});\n\t \tresponse.on(\"error\",function(e) {\n\t\t\tconsole.log(\"Error on GET request: \" + e);\n\t\t\tcallback(e);\n\t \t});\n\t});\n\treturn null;\n};\n\nCommand.prototype.processBody = function(body,type,options,url) {\n\tvar self = this;\n\t// Collect the tiddlers in a wiki\n\tvar incomingWiki = new $tw.Wiki();\n\tif(options.raw) {\n\t\tvar typeInfo = type ? $tw.config.contentTypeInfo[type] : null,\n\t\t\tencoding = typeInfo ? typeInfo.encoding : \"utf8\";\n\t\tincomingWiki.addTiddler(new $tw.Tiddler({\n\t\t\ttitle: url,\n\t\t\ttype: type,\n\t\t\ttext: body.toString(encoding)\n\t\t}));\n\t} else {\n\t\t// Deserialise the file to extract the tiddlers\n\t\tvar tiddlers = this.commander.wiki.deserializeTiddlers(type || \"text/html\",body.toString(\"utf8\"),{});\n\t\t$tw.utils.each(tiddlers,function(tiddler) {\n\t\t\tincomingWiki.addTiddler(new $tw.Tiddler(tiddler));\n\t\t});\n\t}\n\t// Filter the tiddlers to select the ones we want\n\tvar filteredTitles = incomingWiki.filterTiddlers(options.importFilter || \"[all[tiddlers]]\");\n\t// Import the selected tiddlers\n\tvar count = 0;\n\tincomingWiki.each(function(tiddler,title) {\n\t\tif(filteredTitles.indexOf(title) !== -1) {\n\t\t\tvar newTiddler;\n\t\t\tif(options.transformFilter) {\n\t\t\t\tvar transformedTitle = (incomingWiki.filterTiddlers(options.transformFilter,null,self.commander.wiki.makeTiddlerIterator([title])) || [\"\"])[0];\n\t\t\t\tif(transformedTitle) {\n\t\t\t\t\tself.commander.log(\"Importing \" + title + \" as \" + transformedTitle)\n\t\t\t\t\tnewTiddler = new $tw.Tiddler(tiddler,{title: transformedTitle});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tself.commander.log(\"Importing \" + title)\n\t\t\t\tnewTiddler = tiddler;\n\t\t\t}\n\t\t\tself.commander.wiki.importTiddler(newTiddler);\n\t\t\tcount++;\n\t\t}\n\t});\n\tself.commander.log(\"Imported \" + count + \" tiddlers\")\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/help.js": {
"title": "$:/core/modules/commands/help.js",
"text": "/*\\\ntitle: $:/core/modules/commands/help.js\ntype: application/javascript\nmodule-type: command\n\nHelp command\n\n\\*/\n(function(){\n\n/*jshint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"help\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tvar subhelp = this.params[0] || \"default\",\n\t\thelpBase = \"$:/language/Help/\",\n\t\ttext;\n\tif(!this.commander.wiki.getTiddler(helpBase + subhelp)) {\n\t\tsubhelp = \"notfound\";\n\t}\n\t// Wikify the help as formatted text (ie block elements generate newlines)\n\ttext = this.commander.wiki.renderTiddler(\"text/plain-formatted\",helpBase + subhelp);\n\t// Remove any leading linebreaks\n\ttext = text.replace(/^(\\r?\\n)*/g,\"\");\n\tthis.commander.streams.output.write(text);\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/import.js": {
"title": "$:/core/modules/commands/import.js",
"text": "/*\\\ntitle: $:/core/modules/commands/import.js\ntype: application/javascript\nmodule-type: command\n\nCommand to import tiddlers from a file\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"import\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\");\n\tif(this.params.length < 2) {\n\t\treturn \"Missing parameters\";\n\t}\n\tvar filename = self.params[0],\n\t\tdeserializer = self.params[1],\n\t\ttitle = self.params[2] || filename,\n\t\tencoding = self.params[3] || \"utf8\",\n\t\ttext = fs.readFileSync(filename,encoding),\n\t\ttiddlers = this.commander.wiki.deserializeTiddlers(null,text,{title: title},{deserializer: deserializer});\n\t$tw.utils.each(tiddlers,function(tiddler) {\n\t\tself.commander.wiki.importTiddler(new $tw.Tiddler(tiddler));\n\t});\n\tthis.commander.log(tiddlers.length + \" tiddler(s) imported\");\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/init.js": {
"title": "$:/core/modules/commands/init.js",
"text": "/*\\\ntitle: $:/core/modules/commands/init.js\ntype: application/javascript\nmodule-type: command\n\nCommand to initialise an empty wiki folder\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"init\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tvar fs = require(\"fs\"),\n\t\tpath = require(\"path\");\n\t// Check that we don't already have a valid wiki folder\n\tif($tw.boot.wikiTiddlersPath || ($tw.utils.isDirectory($tw.boot.wikiPath) && !$tw.utils.isDirectoryEmpty($tw.boot.wikiPath))) {\n\t\treturn \"Wiki folder is not empty\";\n\t}\n\t// Loop through each of the specified editions\n\tvar editions = this.params.length > 0 ? this.params : [\"empty\"];\n\tfor(var editionIndex=0; editionIndex<editions.length; editionIndex++) {\n\t\tvar editionName = editions[editionIndex];\n\t\t// Check the edition exists\n\t\tvar editionPath = $tw.findLibraryItem(editionName,$tw.getLibraryItemSearchPaths($tw.config.editionsPath,$tw.config.editionsEnvVar));\n\t\tif(!$tw.utils.isDirectory(editionPath)) {\n\t\t\treturn \"Edition '\" + editionName + \"' not found\";\n\t\t}\n\t\t// Copy the edition content\n\t\tvar err = $tw.utils.copyDirectory(editionPath,$tw.boot.wikiPath);\n\t\tif(!err) {\n\t\t\tthis.commander.streams.output.write(\"Copied edition '\" + editionName + \"' to \" + $tw.boot.wikiPath + \"\\n\");\n\t\t} else {\n\t\t\treturn err;\n\t\t}\n\t}\n\t// Tweak the tiddlywiki.info to remove any included wikis\n\tvar packagePath = $tw.boot.wikiPath + \"/tiddlywiki.info\",\n\t\tpackageJson = JSON.parse(fs.readFileSync(packagePath));\n\tdelete packageJson.includeWikis;\n\tfs.writeFileSync(packagePath,JSON.stringify(packageJson,null,$tw.config.preferences.jsonSpaces));\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/listen.js": {
"title": "$:/core/modules/commands/listen.js",
"text": "/*\\\ntitle: $:/core/modules/commands/listen.js\ntype: application/javascript\nmodule-type: command\n\nListen for HTTP requests and serve tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Server = require(\"$:/core/modules/server/server.js\").Server;\n\nexports.info = {\n\tname: \"listen\",\n\tsynchronous: true,\n\tnamedParameterMode: true,\n\tmandatoryParameters: [],\n};\n\nvar Command = function(params,commander,callback) {\n\tvar self = this;\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tvar self = this;\n\tif(!$tw.boot.wikiTiddlersPath) {\n\t\t$tw.utils.warning(\"Warning: Wiki folder '\" + $tw.boot.wikiPath + \"' does not exist or is missing a tiddlywiki.info file\");\n\t}\n\t// Set up server\n\tthis.server = new Server({\n\t\twiki: this.commander.wiki,\n\t\tvariables: self.params\n\t});\n\tvar nodeServer = this.server.listen();\n\t$tw.hooks.invokeHook(\"th-server-command-post-start\",this.server,nodeServer,\"tiddlywiki\");\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/load.js": {
"title": "$:/core/modules/commands/load.js",
"text": "/*\\\ntitle: $:/core/modules/commands/load.js\ntype: application/javascript\nmodule-type: command\n\nCommand to load tiddlers from a file or directory\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"load\",\n\tsynchronous: false\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\");\n\tif(this.params.length < 1) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar tiddlers = $tw.loadTiddlersFromPath(self.params[0]),\n\t\tcount = 0;\n\t$tw.utils.each(tiddlers,function(tiddlerInfo) {\n\t\t$tw.utils.each(tiddlerInfo.tiddlers,function(tiddler) {\n\t\t\tself.commander.wiki.importTiddler(new $tw.Tiddler(tiddler));\n\t\t\tcount++;\n\t\t});\n\t});\n\tif(!count && self.params[1] !== \"noerror\") {\n\t\tself.callback(\"No tiddlers found in file \\\"\" + self.params[0] + \"\\\"\");\n\t} else {\n\t\tself.callback(null);\n\t}\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/makelibrary.js": {
"title": "$:/core/modules/commands/makelibrary.js",
"text": "/*\\\ntitle: $:/core/modules/commands/makelibrary.js\ntype: application/javascript\nmodule-type: command\n\nCommand to pack all of the plugins in the library into a plugin tiddler of type \"library\"\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"makelibrary\",\n\tsynchronous: true\n};\n\nvar UPGRADE_LIBRARY_TITLE = \"$:/UpgradeLibrary\";\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tvar wiki = this.commander.wiki,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\tupgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE,\n\t\ttiddlers = {};\n\t// Collect up the library plugins\n\tvar collectPlugins = function(folder) {\n\t\t\tvar pluginFolders = $tw.utils.getSubdirectories(folder) || [];\n\t\t\tfor(var p=0; p<pluginFolders.length; p++) {\n\t\t\t\tif(!$tw.boot.excludeRegExp.test(pluginFolders[p])) {\n\t\t\t\t\tpluginFields = $tw.loadPluginFolder(path.resolve(folder,\"./\" + pluginFolders[p]));\n\t\t\t\t\tif(pluginFields && pluginFields.title) {\n\t\t\t\t\t\ttiddlers[pluginFields.title] = pluginFields;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tcollectPublisherPlugins = function(folder) {\n\t\t\tvar publisherFolders = $tw.utils.getSubdirectories(folder) || [];\n\t\t\tfor(var t=0; t<publisherFolders.length; t++) {\n\t\t\t\tif(!$tw.boot.excludeRegExp.test(publisherFolders[t])) {\n\t\t\t\t\tcollectPlugins(path.resolve(folder,\"./\" + publisherFolders[t]));\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.pluginsPath,$tw.config.pluginsEnvVar),collectPublisherPlugins);\n\t$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.themesPath,$tw.config.themesEnvVar),collectPublisherPlugins);\n\t$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,$tw.config.languagesEnvVar),collectPlugins);\n\t// Save the upgrade library tiddler\n\tvar pluginFields = {\n\t\ttitle: upgradeLibraryTitle,\n\t\ttype: \"application/json\",\n\t\t\"plugin-type\": \"library\",\n\t\t\"text\": JSON.stringify({tiddlers: tiddlers})\n\t};\n\twiki.addTiddler(new $tw.Tiddler(pluginFields));\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/output.js": {
"title": "$:/core/modules/commands/output.js",
"text": "/*\\\ntitle: $:/core/modules/commands/output.js\ntype: application/javascript\nmodule-type: command\n\nCommand to set the default output location (defaults to current working directory)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"output\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tvar fs = require(\"fs\"),\n\t\tpath = require(\"path\");\n\tif(this.params.length < 1) {\n\t\treturn \"Missing output path\";\n\t}\n\tthis.commander.outputPath = path.resolve(process.cwd(),this.params[0]);\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/password.js": {
"title": "$:/core/modules/commands/password.js",
"text": "/*\\\ntitle: $:/core/modules/commands/password.js\ntype: application/javascript\nmodule-type: command\n\nSave password for crypto operations\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"password\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Missing password\";\n\t}\n\t$tw.crypto.setPassword(this.params[0]);\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/publish.js": {
"title": "$:/core/modules/commands/publish.js",
"text": "/*\\\ntitle: $:/core/modules/commands/publish.js\ntype: application/javascript\nmodule-type: command\n\nPublish static files\n\n\\*/\n(function(){\n\n /*jslint node: true, browser: true */\n /*global $tw: false */\n \"use strict\";\n \n exports.info = {\n name: \"publish\",\n synchronous: false\n };\n \n var Command = function(params,commander,callback) {\n this.params = params;\n this.commander = commander;\n this.callback = callback;\n };\n \n Command.prototype.execute = function() {\n if(this.params.length < 1) {\n return \"Missing filename filter\";\n }\n var self = this,\n wiki = this.commander.wiki,\n jobTiddler = this.params[0],\n variableList = this.params.slice(1),\n variables = Object.create(null);\n while(variableList.length >= 2) {\n variables[variableList[0]] = variableList[1];\n variableList = variableList.slice(2);\n }\n $tw.publisherHandler.publish(jobTiddler,this.callback,{commander: this.commander,variables: variables});\n return null;\n };\n \n exports.Command = Command;\n \n })();\n ",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/render.js": {
"title": "$:/core/modules/commands/render.js",
"text": "/*\\\ntitle: $:/core/modules/commands/render.js\ntype: application/javascript\nmodule-type: command\n\nRender individual tiddlers and save the results to the specified files\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.info = {\n\tname: \"render\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Missing tiddler filter\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\twiki = this.commander.wiki,\n\t\ttiddlerFilter = this.params[0],\n\t\tfilenameFilter = this.params[1] || \"[is[tiddler]addsuffix[.html]]\",\n\t\ttype = this.params[2] || \"text/html\",\n\t\ttemplate = this.params[3],\n\t\tvariableList = this.params.slice(4),\n\t\ttiddlers = wiki.filterTiddlers(tiddlerFilter),\n\t\tvariables = Object.create(null);\n\twhile(variableList.length >= 2) {\n\t\tvariables[variableList[0]] = variableList[1];\n\t\tvariableList = variableList.slice(2);\n\t}\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar parser = wiki.parseTiddler(template || title);\n\t\tvar widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title})}),\n\t\t\tcontainer = $tw.fakeDocument.createElement(\"div\");\n\t\twidgetNode.render(container,null);\n\t\tvar text = type === \"text/html\" ? container.innerHTML : container.textContent,\n\t\t\tfilepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);\n\t\tif(self.commander.verbose) {\n\t\t\tconsole.log(\"Rendering \\\"\" + title + \"\\\" to \\\"\" + filepath + \"\\\"\");\n\t\t}\n\t\t$tw.utils.createFileDirectories(filepath);\n\t\tfs.writeFileSync(filepath,text,\"utf8\");\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/rendertiddler.js": {
"title": "$:/core/modules/commands/rendertiddler.js",
"text": "/*\\\ntitle: $:/core/modules/commands/rendertiddler.js\ntype: application/javascript\nmodule-type: command\n\nCommand to render a tiddler and save it to a file\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"rendertiddler\",\n\tsynchronous: false\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\ttitle = this.params[0],\n\t\tfilename = path.resolve(this.commander.outputPath,this.params[1]),\n\t\ttype = this.params[2] || \"text/html\",\n\t\ttemplate = this.params[3],\n\t\tname = this.params[4],\n\t\tvalue = this.params[5],\n\t\tvariables = {};\n\t$tw.utils.createFileDirectories(filename);\n\tif(template) {\n\t\tvariables.currentTiddler = title;\n\t\ttitle = template;\n\t}\n\tif(name && value) {\n\t\tvariables[name] = value;\n\t}\n\tfs.writeFile(filename,this.commander.wiki.renderTiddler(type,title,{variables: variables}),\"utf8\",function(err) {\n\t\tself.callback(err);\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/rendertiddlers.js": {
"title": "$:/core/modules/commands/rendertiddlers.js",
"text": "/*\\\ntitle: $:/core/modules/commands/rendertiddlers.js\ntype: application/javascript\nmodule-type: command\n\nCommand to render several tiddlers to a folder of files\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.info = {\n\tname: \"rendertiddlers\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\twiki = this.commander.wiki,\n\t\tfilter = this.params[0],\n\t\ttemplate = this.params[1],\n\t\toutputPath = this.commander.outputPath,\n\t\tpathname = path.resolve(outputPath,this.params[2]),\n\t\ttype = this.params[3] || \"text/html\",\n\t\textension = this.params[4] || \".html\",\n\t\tdeleteDirectory = (this.params[5] || \"\").toLowerCase() !== \"noclean\",\n\t\ttiddlers = wiki.filterTiddlers(filter);\n\tif(deleteDirectory) {\n\t\t$tw.utils.deleteDirectory(pathname);\n\t}\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar parser = wiki.parseTiddler(template),\n\t\t\twidgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}}),\n\t\t\tcontainer = $tw.fakeDocument.createElement(\"div\");\n\t\twidgetNode.render(container,null);\n\t\tvar text = type === \"text/html\" ? container.innerHTML : container.textContent,\n\t\t\texportPath = null;\n\t\tif($tw.utils.hop($tw.macros,\"tv-get-export-path\")) {\n\t\t\tvar macroPath = $tw.macros[\"tv-get-export-path\"].run.apply(self,[title]);\n\t\t\tif(macroPath) {\n\t\t\t\texportPath = path.resolve(outputPath,macroPath + extension);\n\t\t\t}\n\t\t}\n\t\tvar finalPath = exportPath || path.resolve(pathname,encodeURIComponent(title) + extension);\n\t\t$tw.utils.createFileDirectories(finalPath);\n\t\tfs.writeFileSync(finalPath,text,\"utf8\");\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/save.js": {
"title": "$:/core/modules/commands/save.js",
"text": "/*\\\ntitle: $:/core/modules/commands/save.js\ntype: application/javascript\nmodule-type: command\n\nSaves individual tiddlers in their raw text or binary format to the specified files\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"save\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Missing filename filter\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\twiki = this.commander.wiki,\n\t\ttiddlerFilter = this.params[0],\n\t\tfilenameFilter = this.params[1] || \"[is[tiddler]]\",\n\t\ttiddlers = wiki.filterTiddlers(tiddlerFilter);\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar tiddler = self.commander.wiki.getTiddler(title),\n\t\t\ttype = tiddler.fields.type || \"text/vnd.tiddlywiki\",\n\t\t\tcontentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: \"utf8\"},\n\t\t\tfilepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);\n\t\tif(self.commander.verbose) {\n\t\t\tconsole.log(\"Saving \\\"\" + title + \"\\\" to \\\"\" + filepath + \"\\\"\");\n\t\t}\n\t\t$tw.utils.createFileDirectories(filepath);\n\t\tfs.writeFileSync(filepath,tiddler.fields.text,contentTypeInfo.encoding);\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/savelibrarytiddlers.js": {
"title": "$:/core/modules/commands/savelibrarytiddlers.js",
"text": "/*\\\ntitle: $:/core/modules/commands/savelibrarytiddlers.js\ntype: application/javascript\nmodule-type: command\n\nCommand to save the subtiddlers of a bundle tiddler as a series of JSON files\n\n--savelibrarytiddlers <tiddler> <tiddler-filter> <pathname> <skinnylisting>\n\nThe tiddler identifies the bundle tiddler that contains the subtiddlers.\n\nThe tiddler filter specifies the plugins to be included.\n\nThe pathname specifies the pathname to the folder in which the JSON files should be saved. The filename is the URL encoded title of the subtiddler.\n\nThe skinnylisting specifies the title of the tiddler to which a JSON catalogue of the subtiddlers will be saved. The JSON file contains the same data as the bundle tiddler but with the `text` field removed.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"savelibrarytiddlers\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\tcontainerTitle = this.params[0],\n\t\tfilter = this.params[1],\n\t\tbasepath = this.params[2],\n\t\tskinnyListTitle = this.params[3];\n\t// Get the container tiddler as data\n\tvar containerData = self.commander.wiki.getTiddlerDataCached(containerTitle,undefined);\n\tif(!containerData) {\n\t\treturn \"'\" + containerTitle + \"' is not a tiddler bundle\";\n\t}\n\t// Filter the list of plugins\n\tvar pluginList = [];\n\t$tw.utils.each(containerData.tiddlers,function(tiddler,title) {\n\t\tpluginList.push(title);\n\t});\n\tvar filteredPluginList;\n\tif(filter) {\n\t\tfilteredPluginList = self.commander.wiki.filterTiddlers(filter,null,self.commander.wiki.makeTiddlerIterator(pluginList));\n\t} else {\n\t\tfilteredPluginList = pluginList;\n\t}\n\t// Iterate through the plugins\n\tvar skinnyList = [];\n\t$tw.utils.each(filteredPluginList,function(title) {\n\t\tvar tiddler = containerData.tiddlers[title];\n\t\t// Save each JSON file and collect the skinny data\n\t\tvar pathname = path.resolve(self.commander.outputPath,basepath + encodeURIComponent(title) + \".json\");\n\t\t$tw.utils.createFileDirectories(pathname);\n\t\tfs.writeFileSync(pathname,JSON.stringify(tiddler),\"utf8\");\n\t\t// Collect the skinny list data\n\t\tvar pluginTiddlers = JSON.parse(tiddler.text),\n\t\t\treadmeContent = (pluginTiddlers.tiddlers[title + \"/readme\"] || {}).text,\n\t\t\tdoesRequireReload = !!self.commander.wiki.doesPluginInfoRequireReload(pluginTiddlers),\n\t\t\ticonTiddler = pluginTiddlers.tiddlers[title + \"/icon\"] || {},\n\t\t\ticonType = iconTiddler.type,\n\t\t\ticonText = iconTiddler.text,\n\t\t\ticonContent;\n\t\tif(iconType && iconText) {\n\t\t\ticonContent = $tw.utils.makeDataUri(iconText,iconType);\n\t\t}\n\t\tskinnyList.push($tw.utils.extend({},tiddler,{\n\t\t\ttext: undefined,\n\t\t\treadme: readmeContent,\n\t\t\t\"requires-reload\": doesRequireReload ? \"yes\" : \"no\",\n\t\t\ticon: iconContent\n\t\t}));\n\t});\n\t// Save the catalogue tiddler\n\tif(skinnyListTitle) {\n\t\tself.commander.wiki.setTiddlerData(skinnyListTitle,skinnyList);\n\t}\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/savetiddler.js": {
"title": "$:/core/modules/commands/savetiddler.js",
"text": "/*\\\ntitle: $:/core/modules/commands/savetiddler.js\ntype: application/javascript\nmodule-type: command\n\nCommand to save the content of a tiddler to a file\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"savetiddler\",\n\tsynchronous: false\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 2) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\ttitle = this.params[0],\n\t\tfilename = path.resolve(this.commander.outputPath,this.params[1]),\n\t\ttiddler = this.commander.wiki.getTiddler(title);\n\tif(tiddler) {\n\t\tvar type = tiddler.fields.type || \"text/vnd.tiddlywiki\",\n\t\t\tcontentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: \"utf8\"};\n\t\t$tw.utils.createFileDirectories(filename);\n\t\tfs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,function(err) {\n\t\t\tself.callback(err);\n\t\t});\n\t} else {\n\t\treturn \"Missing tiddler: \" + title;\n\t}\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/savetiddlers.js": {
"title": "$:/core/modules/commands/savetiddlers.js",
"text": "/*\\\ntitle: $:/core/modules/commands/savetiddlers.js\ntype: application/javascript\nmodule-type: command\n\nCommand to save several tiddlers to a folder of files\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.info = {\n\tname: \"savetiddlers\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Missing filename\";\n\t}\n\tvar self = this,\n\t\tfs = require(\"fs\"),\n\t\tpath = require(\"path\"),\n\t\twiki = this.commander.wiki,\n\t\tfilter = this.params[0],\n\t\tpathname = path.resolve(this.commander.outputPath,this.params[1]),\n\t\tdeleteDirectory = (this.params[2] || \"\").toLowerCase() !== \"noclean\",\n\t\ttiddlers = wiki.filterTiddlers(filter);\n\tif(deleteDirectory) {\n\t\t$tw.utils.deleteDirectory(pathname);\n\t}\n\t$tw.utils.createDirectory(pathname);\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar tiddler = self.commander.wiki.getTiddler(title),\n\t\t\ttype = tiddler.fields.type || \"text/vnd.tiddlywiki\",\n\t\t\tcontentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: \"utf8\"},\n\t\t\tfilename = path.resolve(pathname,encodeURIComponent(title));\n\t\tfs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/savewikifolder.js": {
"title": "$:/core/modules/commands/savewikifolder.js",
"text": "/*\\\ntitle: $:/core/modules/commands/savewikifolder.js\ntype: application/javascript\nmodule-type: command\n\nCommand to save the current wiki as a wiki folder\n\n--savewikifolder <wikifolderpath> [<filter>]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"savewikifolder\",\n\tsynchronous: true\n};\n\nvar fs,path;\nif($tw.node) {\n\tfs = require(\"fs\");\n\tpath = require(\"path\");\n}\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Missing wiki folder path\";\n\t}\n\tvar wikifoldermaker = new WikiFolderMaker(this.params[0],this.params[1],this.commander);\n\treturn wikifoldermaker.save();\n};\n\nfunction WikiFolderMaker(wikiFolderPath,wikiFilter,commander) {\n\tthis.wikiFolderPath = wikiFolderPath;\n\tthis.wikiFilter = wikiFilter || \"[all[tiddlers]]\";\n\tthis.commander = commander;\n\tthis.wiki = commander.wiki;\n\tthis.savedPaths = []; // So that we can detect filename clashes\n}\n\nWikiFolderMaker.prototype.log = function(str) {\n\tif(this.commander.verbose) {\n\t\tconsole.log(str);\n\t}\n};\n\nWikiFolderMaker.prototype.tiddlersToIgnore = [\n\t\"$:/boot/boot.css\",\n\t\"$:/boot/boot.js\",\n\t\"$:/boot/bootprefix.js\",\n\t\"$:/core\",\n\t\"$:/library/sjcl.js\",\n\t\"$:/temp/info-plugin\"\n];\n\n/*\nReturns null if successful, or an error string if there was an error\n*/\nWikiFolderMaker.prototype.save = function() {\n\tvar self = this;\n\t// Check that the output directory doesn't exist\n\tif(fs.existsSync(this.wikiFolderPath) && !$tw.utils.isDirectoryEmpty(this.wikiFolderPath)) {\n\t\treturn \"The unpackwiki command requires that the output wiki folder be empty\";\n\t}\n\t// Get the tiddlers from the source wiki\n\tvar tiddlerTitles = this.wiki.filterTiddlers(this.wikiFilter);\n\t// Initialise a new tiddlwiki.info file\n\tvar newWikiInfo = {};\n\t// Process each incoming tiddler in turn\n\t$tw.utils.each(tiddlerTitles,function(title) {\n\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tif(self.tiddlersToIgnore.indexOf(title) !== -1) {\n\t\t\t\t// Ignore the core plugin and the ephemeral info plugin\n\t\t\t\tself.log(\"Ignoring tiddler: \" + title);\n\t\t\t} else {\n\t\t\t\tvar type = tiddler.fields.type,\n\t\t\t\t\tpluginType = tiddler.fields[\"plugin-type\"];\n\t\t\t\tif(type === \"application/json\" && pluginType) {\n\t\t\t\t\t// Plugin tiddler\n\t\t\t\t\tvar libraryDetails = self.findPluginInLibrary(title);\n\t\t\t\t\tif(libraryDetails) {\n\t\t\t\t\t\t// A plugin from the core library\n\t\t\t\t\t\tself.log(\"Adding built-in plugin: \" + libraryDetails.name);\n\t\t\t\t\t\tnewWikiInfo[libraryDetails.type] = newWikiInfo[libraryDetails.type] || [];\n\t\t\t\t\t\t$tw.utils.pushTop(newWikiInfo[libraryDetails.type],libraryDetails.name);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// A custom plugin\n\t\t\t\t\t\tself.log(\"Processing custom plugin: \" + title);\n\t\t\t\t\t\tself.saveCustomPlugin(tiddler);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Ordinary tiddler\n\t\t\t\t\tself.saveTiddler(\"tiddlers\",tiddler);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\t// Save the tiddlywiki.info file\n\tthis.saveJSONFile(\"tiddlywiki.info\",newWikiInfo);\n\tself.log(\"Writing tiddlywiki.info: \" + JSON.stringify(newWikiInfo,null,$tw.config.preferences.jsonSpaces));\n\treturn null;\n};\n\n/*\nTest whether the specified tiddler is a plugin in the plugin library\n*/\nWikiFolderMaker.prototype.findPluginInLibrary = function(title) {\n\tvar parts = title.split(\"/\"),\n\t\tpluginPath, type, name;\n\tif(parts[0] === \"$:\") {\n\t\tif(parts[1] === \"languages\" && parts.length === 3) {\n\t\t\tpluginPath = \"languages\" + path.sep + parts[2];\n\t\t\ttype = parts[1];\n\t\t\tname = parts[2];\n\t\t} else if(parts[1] === \"plugins\" || parts[1] === \"themes\" && parts.length === 4) {\n\t\t\tpluginPath = parts[1] + path.sep + parts[2] + path.sep + parts[3];\n\t\t\ttype = parts[1];\n\t\t\tname = parts[2] + \"/\" + parts[3];\n\t\t}\n\t}\n\tif(pluginPath && type && name) {\n\t\tpluginPath = path.resolve($tw.boot.bootPath,\"..\",pluginPath);\n\t\tif(fs.existsSync(pluginPath)) {\n\t\t\treturn {\n\t\t\t\tpluginPath: pluginPath,\n\t\t\t\ttype: type,\n\t\t\t\tname: name\n\t\t\t};\n\t\t}\n\t}\n\treturn false;\n};\n\nWikiFolderMaker.prototype.saveCustomPlugin = function(pluginTiddler) {\n\tvar self = this,\n\t\tpluginTitle = pluginTiddler.fields.title,\n\t\ttitleParts = pluginTitle.split(\"/\"),\n\t\tdirectory = $tw.utils.generateTiddlerFilepath(titleParts[titleParts.length - 1],{\n\t\t\tdirectory: path.resolve(this.wikiFolderPath,pluginTiddler.fields[\"plugin-type\"] + \"s\")\n\t\t}),\n\t\tpluginInfo = pluginTiddler.getFieldStrings({exclude: [\"text\",\"type\"]});\n\tthis.saveJSONFile(directory + path.sep + \"plugin.info\",pluginInfo);\n\tself.log(\"Writing \" + directory + path.sep + \"plugin.info: \" + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces));\n\tvar pluginTiddlers = JSON.parse(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin\n\t$tw.utils.each(pluginTiddlers,function(tiddler) {\n\t\tself.saveTiddler(directory,new $tw.Tiddler(tiddler));\n\t});\n};\n\nWikiFolderMaker.prototype.saveTiddler = function(directory,tiddler) {\n\tvar title = tiddler.fields.title, fileInfo, pathFilters, extFilters;\n\tif(this.wiki.tiddlerExists(\"$:/config/FileSystemPaths\")) {\n\t\tpathFilters = this.wiki.getTiddlerText(\"$:/config/FileSystemPaths\",\"\").split(\"\\n\");\n\t}\n\tif(this.wiki.tiddlerExists(\"$:/config/FileSystemExtensions\")) {\n\t\textFilters = this.wiki.getTiddlerText(\"$:/config/FileSystemExtensions\",\"\").split(\"\\n\");\n\t}\n\tvar fileInfo = $tw.utils.generateTiddlerFileInfo(tiddler,{\n\t\tdirectory: path.resolve(this.wikiFolderPath,directory),\n\t\tpathFilters: pathFilters,\n\t\textFilters: extFilters,\n\t\twiki: this.wiki,\n\t\tfileInfo: {}\n\t});\n\ttry {\n\t\t$tw.utils.saveTiddlerToFileSync(tiddler,fileInfo);\n\t} catch (err) {\n\t\tconsole.log(\"SaveWikiFolder: Error saving file '\" + fileInfo.filepath + \"', tiddler: '\" + tiddler.fields.title);\n\t}\n};\n\nWikiFolderMaker.prototype.saveJSONFile = function(filename,json) {\n\tthis.saveTextFile(filename,JSON.stringify(json,null,$tw.config.preferences.jsonSpaces));\n};\n\nWikiFolderMaker.prototype.saveTextFile = function(filename,data) {\n\tthis.saveFile(filename,\"utf8\",data);\n};\n\nWikiFolderMaker.prototype.saveFile = function(filename,encoding,data) {\n\tvar filepath = path.resolve(this.wikiFolderPath,filename);\n\t$tw.utils.createFileDirectories(filepath);\n\tfs.writeFileSync(filepath,data,encoding);\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/server.js": {
"title": "$:/core/modules/commands/server.js",
"text": "/*\\\ntitle: $:/core/modules/commands/server.js\ntype: application/javascript\nmodule-type: command\n\nDeprecated legacy command for serving tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Server = require(\"$:/core/modules/server/server.js\").Server;\n\nexports.info = {\n\tname: \"server\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tvar self = this;\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(!$tw.boot.wikiTiddlersPath) {\n\t\t$tw.utils.warning(\"Warning: Wiki folder '\" + $tw.boot.wikiPath + \"' does not exist or is missing a tiddlywiki.info file\");\n\t}\n\t// Set up server\n\tthis.server = new Server({\n\t\twiki: this.commander.wiki,\n\t\tvariables: {\n\t\t\tport: this.params[0],\n\t\t\thost: this.params[6],\n\t\t\t\"root-tiddler\": this.params[1],\n\t\t\t\"root-render-type\": this.params[2],\n\t\t\t\"root-serve-type\": this.params[3],\n\t\t\tusername: this.params[4],\n\t\t\tpassword: this.params[5],\n\t\t\t\"path-prefix\": this.params[7],\n\t\t\t\"debug-level\": this.params[8]\n\t\t}\n\t});\n\tvar nodeServer = this.server.listen();\n\t$tw.hooks.invokeHook(\"th-server-command-post-start\",this.server,nodeServer,\"tiddlywiki\");\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/setfield.js": {
"title": "$:/core/modules/commands/setfield.js",
"text": "/*\\\ntitle: $:/core/modules/commands/setfield.js\ntype: application/javascript\nmodule-type: command\n\nCommand to modify selected tiddlers to set a field to the text of a template tiddler that has been wikified with the selected tiddler as the current tiddler.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.info = {\n\tname: \"setfield\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 4) {\n\t\treturn \"Missing parameters\";\n\t}\n\tvar self = this,\n\t\twiki = this.commander.wiki,\n\t\tfilter = this.params[0],\n\t\tfieldname = this.params[1] || \"text\",\n\t\ttemplatetitle = this.params[2],\n\t\trendertype = this.params[3] || \"text/plain\",\n\t\ttiddlers = wiki.filterTiddlers(filter);\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar parser = wiki.parseTiddler(templatetitle),\n\t\t\tnewFields = {},\n\t\t\ttiddler = wiki.getTiddler(title);\n\t\tif(parser) {\n\t\t\tvar widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}});\n\t\t\tvar container = $tw.fakeDocument.createElement(\"div\");\n\t\t\twidgetNode.render(container,null);\n\t\t\tnewFields[fieldname] = rendertype === \"text/html\" ? container.innerHTML : container.textContent;\n\t\t} else {\n\t\t\tnewFields[fieldname] = undefined;\n\t\t}\n\t\twiki.addTiddler(new $tw.Tiddler(tiddler,newFields));\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/unpackplugin.js": {
"title": "$:/core/modules/commands/unpackplugin.js",
"text": "/*\\\ntitle: $:/core/modules/commands/unpackplugin.js\ntype: application/javascript\nmodule-type: command\n\nCommand to extract the shadow tiddlers from within a plugin\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"unpackplugin\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander,callback) {\n\tthis.params = params;\n\tthis.commander = commander;\n\tthis.callback = callback;\n};\n\nCommand.prototype.execute = function() {\n\tif(this.params.length < 1) {\n\t\treturn \"Missing plugin name\";\n\t}\n\tvar self = this,\n\t\ttitle = this.params[0],\n\t\tpluginData = this.commander.wiki.getTiddlerDataCached(title);\n\tif(!pluginData) {\n\t\treturn \"Plugin '\" + title + \"' not found\";\n\t}\n\t$tw.utils.each(pluginData.tiddlers,function(tiddler) {\n\t\tself.commander.wiki.addTiddler(new $tw.Tiddler(tiddler));\n\t});\n\treturn null;\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/verbose.js": {
"title": "$:/core/modules/commands/verbose.js",
"text": "/*\\\ntitle: $:/core/modules/commands/verbose.js\ntype: application/javascript\nmodule-type: command\n\nVerbose command\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"verbose\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tthis.commander.verbose = true;\n\t// Output the boot message log\n\tthis.commander.streams.output.write(\"Boot log:\\n \" + $tw.boot.logMessages.join(\"\\n \") + \"\\n\");\n\treturn null; // No error\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/commands/version.js": {
"title": "$:/core/modules/commands/version.js",
"text": "/*\\\ntitle: $:/core/modules/commands/version.js\ntype: application/javascript\nmodule-type: command\n\nVersion command\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.info = {\n\tname: \"version\",\n\tsynchronous: true\n};\n\nvar Command = function(params,commander) {\n\tthis.params = params;\n\tthis.commander = commander;\n};\n\nCommand.prototype.execute = function() {\n\tthis.commander.streams.output.write($tw.version + \"\\n\");\n\treturn null; // No error\n};\n\nexports.Command = Command;\n\n})();\n",
"type": "application/javascript",
"module-type": "command"
},
"$:/core/modules/config.js": {
"title": "$:/core/modules/config.js",
"text": "/*\\\ntitle: $:/core/modules/config.js\ntype: application/javascript\nmodule-type: config\n\nCore configuration constants\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.preferences = {};\n\nexports.preferences.notificationDuration = 3 * 1000;\nexports.preferences.jsonSpaces = 4;\n\nexports.textPrimitives = {\n\tupperLetter: \"[A-Z\\u00c0-\\u00d6\\u00d8-\\u00de\\u0150\\u0170]\",\n\tlowerLetter: \"[a-z\\u00df-\\u00f6\\u00f8-\\u00ff\\u0151\\u0171]\",\n\tanyLetter: \"[A-Za-z0-9\\u00c0-\\u00d6\\u00d8-\\u00de\\u00df-\\u00f6\\u00f8-\\u00ff\\u0150\\u0170\\u0151\\u0171]\",\n\tblockPrefixLetters:\t\"[A-Za-z0-9-_\\u00c0-\\u00d6\\u00d8-\\u00de\\u00df-\\u00f6\\u00f8-\\u00ff\\u0150\\u0170\\u0151\\u0171]\"\n};\n\nexports.textPrimitives.unWikiLink = \"~\";\nexports.textPrimitives.wikiLink = exports.textPrimitives.upperLetter + \"+\" +\n\texports.textPrimitives.lowerLetter + \"+\" +\n\texports.textPrimitives.upperLetter +\n\texports.textPrimitives.anyLetter + \"*\";\n\nexports.htmlEntities = {quot:34, amp:38, apos:39, lt:60, gt:62, nbsp:160, iexcl:161, cent:162, pound:163, curren:164, yen:165, brvbar:166, sect:167, uml:168, copy:169, ordf:170, laquo:171, not:172, shy:173, reg:174, macr:175, deg:176, plusmn:177, sup2:178, sup3:179, acute:180, micro:181, para:182, middot:183, cedil:184, sup1:185, ordm:186, raquo:187, frac14:188, frac12:189, frac34:190, iquest:191, Agrave:192, Aacute:193, Acirc:194, Atilde:195, Auml:196, Aring:197, AElig:198, Ccedil:199, Egrave:200, Eacute:201, Ecirc:202, Euml:203, Igrave:204, Iacute:205, Icirc:206, Iuml:207, ETH:208, Ntilde:209, Ograve:210, Oacute:211, Ocirc:212, Otilde:213, Ouml:214, times:215, Oslash:216, Ugrave:217, Uacute:218, Ucirc:219, Uuml:220, Yacute:221, THORN:222, szlig:223, agrave:224, aacute:225, acirc:226, atilde:227, auml:228, aring:229, aelig:230, ccedil:231, egrave:232, eacute:233, ecirc:234, euml:235, igrave:236, iacute:237, icirc:238, iuml:239, eth:240, ntilde:241, ograve:242, oacute:243, ocirc:244, otilde:245, ouml:246, divide:247, oslash:248, ugrave:249, uacute:250, ucirc:251, uuml:252, yacute:253, thorn:254, yuml:255, OElig:338, oelig:339, Scaron:352, scaron:353, Yuml:376, fnof:402, circ:710, tilde:732, Alpha:913, Beta:914, Gamma:915, Delta:916, Epsilon:917, Zeta:918, Eta:919, Theta:920, Iota:921, Kappa:922, Lambda:923, Mu:924, Nu:925, Xi:926, Omicron:927, Pi:928, Rho:929, Sigma:931, Tau:932, Upsilon:933, Phi:934, Chi:935, Psi:936, Omega:937, alpha:945, beta:946, gamma:947, delta:948, epsilon:949, zeta:950, eta:951, theta:952, iota:953, kappa:954, lambda:955, mu:956, nu:957, xi:958, omicron:959, pi:960, rho:961, sigmaf:962, sigma:963, tau:964, upsilon:965, phi:966, chi:967, psi:968, omega:969, thetasym:977, upsih:978, piv:982, ensp:8194, emsp:8195, thinsp:8201, zwnj:8204, zwj:8205, lrm:8206, rlm:8207, ndash:8211, mdash:8212, lsquo:8216, rsquo:8217, sbquo:8218, ldquo:8220, rdquo:8221, bdquo:8222, dagger:8224, Dagger:8225, bull:8226, hellip:8230, permil:8240, prime:8242, Prime:8243, lsaquo:8249, rsaquo:8250, oline:8254, frasl:8260, euro:8364, image:8465, weierp:8472, real:8476, trade:8482, alefsym:8501, larr:8592, uarr:8593, rarr:8594, darr:8595, harr:8596, crarr:8629, lArr:8656, uArr:8657, rArr:8658, dArr:8659, hArr:8660, forall:8704, part:8706, exist:8707, empty:8709, nabla:8711, isin:8712, notin:8713, ni:8715, prod:8719, sum:8721, minus:8722, lowast:8727, radic:8730, prop:8733, infin:8734, ang:8736, and:8743, or:8744, cap:8745, cup:8746, int:8747, there4:8756, sim:8764, cong:8773, asymp:8776, ne:8800, equiv:8801, le:8804, ge:8805, sub:8834, sup:8835, nsub:8836, sube:8838, supe:8839, oplus:8853, otimes:8855, perp:8869, sdot:8901, lceil:8968, rceil:8969, lfloor:8970, rfloor:8971, lang:9001, rang:9002, loz:9674, spades:9824, clubs:9827, hearts:9829, diams:9830 };\n\nexports.htmlVoidElements = \"area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr\".split(\",\");\n\nexports.htmlBlockElements = \"address,article,aside,audio,blockquote,canvas,dd,details,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,nav,ol,p,pre,section,summary,table,tfoot,ul,video\".split(\",\");\n\nexports.htmlUnsafeElements = \"script\".split(\",\");\n\n})();\n",
"type": "application/javascript",
"module-type": "config"
},
"$:/core/modules/deserializers.js": {
"title": "$:/core/modules/deserializers.js",
"text": "/*\\\ntitle: $:/core/modules/deserializers.js\ntype: application/javascript\nmodule-type: tiddlerdeserializer\n\nFunctions to deserialise tiddlers from a block of text\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nUtility function to parse an old-style tiddler DIV in a *.tid file. It looks like this:\n\n<div title=\"Title\" creator=\"JoeBloggs\" modifier=\"JoeBloggs\" created=\"201102111106\" modified=\"201102111310\" tags=\"myTag [[my long tag]]\">\n<pre>The text of the tiddler (without the expected HTML encoding).\n</pre>\n</div>\n\nNote that the field attributes are HTML encoded, but that the body of the <PRE> tag is not encoded.\n\nWhen these tiddler DIVs are encountered within a TiddlyWiki HTML file then the body is encoded in the usual way.\n*/\nvar parseTiddlerDiv = function(text /* [,fields] */) {\n\t// Slot together the default results\n\tvar result = {};\n\tif(arguments.length > 1) {\n\t\tfor(var f=1; f<arguments.length; f++) {\n\t\t\tvar fields = arguments[f];\n\t\t\tfor(var t in fields) {\n\t\t\t\tresult[t] = fields[t];\n\t\t\t}\n\t\t}\n\t}\n\t// Parse the DIV body\n\tvar startRegExp = /^\\s*<div\\s+([^>]*)>(\\s*<pre>)?/gi,\n\t\tendRegExp,\n\t\tmatch = startRegExp.exec(text);\n\tif(match) {\n\t\t// Old-style DIVs don't have the <pre> tag\n\t\tif(match[2]) {\n\t\t\tendRegExp = /<\\/pre>\\s*<\\/div>\\s*$/gi;\n\t\t} else {\n\t\t\tendRegExp = /<\\/div>\\s*$/gi;\n\t\t}\n\t\tvar endMatch = endRegExp.exec(text);\n\t\tif(endMatch) {\n\t\t\t// Extract the text\n\t\t\tresult.text = text.substring(match.index + match[0].length,endMatch.index);\n\t\t\t// Process the attributes\n\t\t\tvar attrRegExp = /\\s*([^=\\s]+)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')/gi,\n\t\t\t\tattrMatch;\n\t\t\tdo {\n\t\t\t\tattrMatch = attrRegExp.exec(match[1]);\n\t\t\t\tif(attrMatch) {\n\t\t\t\t\tvar name = attrMatch[1];\n\t\t\t\t\tvar value = attrMatch[2] !== undefined ? attrMatch[2] : attrMatch[3];\n\t\t\t\t\tresult[name] = value;\n\t\t\t\t}\n\t\t\t} while(attrMatch);\n\t\t\treturn result;\n\t\t}\n\t}\n\treturn undefined;\n};\n\nexports[\"application/x-tiddler-html-div\"] = function(text,fields) {\n\treturn [parseTiddlerDiv(text,fields)];\n};\n\nexports[\"application/json\"] = function(text,fields) {\n\tvar incoming,\n\t\tresults = [];\n\ttry {\n\t\tincoming = JSON.parse(text);\n\t} catch(e) {\n\t\tincoming = [{\n\t\t\ttitle: \"JSON error: \" + e,\n\t\t\ttext: \"\"\n\t\t}]\n\t}\n\tif(!$tw.utils.isArray(incoming)) {\n\t\tincoming = [incoming];\n\t}\n\tfor(var t=0; t<incoming.length; t++) {\n\t\tvar incomingFields = incoming[t],\n\t\t\tfields = {};\n\t\tfor(var f in incomingFields) {\n\t\t\tif(typeof incomingFields[f] === \"string\") {\n\t\t\t\tfields[f] = incomingFields[f];\n\t\t\t}\n\t\t}\n\t\tresults.push(fields);\n\t}\n\treturn results;\n};\n\n/*\nParse an HTML file into tiddlers. There are three possibilities:\n# A TiddlyWiki classic HTML file containing `text/x-tiddlywiki` tiddlers\n# A TiddlyWiki5 HTML file containing `text/vnd.tiddlywiki` tiddlers\n# An ordinary HTML file\n*/\nexports[\"text/html\"] = function(text,fields) {\n\t// Check if we've got a store area\n\tvar storeAreaMarkerRegExp = /<div id=[\"']?storeArea['\"]?( style=[\"']?display:none;[\"']?)?>/gi,\n\t\tmatch = storeAreaMarkerRegExp.exec(text);\n\tif(match) {\n\t\t// If so, it's either a classic TiddlyWiki file or an unencrypted TW5 file\n\t\t// First read the normal tiddlers\n\t\tvar results = deserializeTiddlyWikiFile(text,storeAreaMarkerRegExp.lastIndex,!!match[1],fields);\n\t\t// Then any system tiddlers\n\t\tvar systemAreaMarkerRegExp = /<div id=[\"']?systemArea['\"]?( style=[\"']?display:none;[\"']?)?>/gi,\n\t\t\tsysMatch = systemAreaMarkerRegExp.exec(text);\n\t\tif(sysMatch) {\n\t\t\tresults.push.apply(results,deserializeTiddlyWikiFile(text,systemAreaMarkerRegExp.lastIndex,!!sysMatch[1],fields));\n\t\t}\n\t\treturn results;\n\t} else {\n\t\t// Check whether we've got an encrypted file\n\t\tvar encryptedStoreArea = $tw.utils.extractEncryptedStoreArea(text);\n\t\tif(encryptedStoreArea) {\n\t\t\t// If so, attempt to decrypt it using the current password\n\t\t\treturn $tw.utils.decryptStoreArea(encryptedStoreArea);\n\t\t} else {\n\t\t\t// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler\n\t\t\treturn deserializeHtmlFile(text,fields);\n\t\t}\n\t}\n};\n\nfunction deserializeHtmlFile(text,fields) {\n\tvar result = {};\n\t$tw.utils.each(fields,function(value,name) {\n\t\tresult[name] = value;\n\t});\n\tresult.text = text;\n\tresult.type = \"text/html\";\n\treturn [result];\n}\n\nfunction deserializeTiddlyWikiFile(text,storeAreaEnd,isTiddlyWiki5,fields) {\n\tvar results = [],\n\t\tendOfDivRegExp = /(<\\/div>\\s*)/gi,\n\t\tstartPos = storeAreaEnd,\n\t\tdefaultType = isTiddlyWiki5 ? undefined : \"text/x-tiddlywiki\";\n\tendOfDivRegExp.lastIndex = startPos;\n\tvar match = endOfDivRegExp.exec(text);\n\twhile(match) {\n\t\tvar endPos = endOfDivRegExp.lastIndex,\n\t\t\ttiddlerFields = parseTiddlerDiv(text.substring(startPos,endPos),fields,{type: defaultType});\n\t\tif(!tiddlerFields) {\n\t\t\tbreak;\n\t\t}\n\t\t$tw.utils.each(tiddlerFields,function(value,name) {\n\t\t\tif(typeof value === \"string\") {\n\t\t\t\ttiddlerFields[name] = $tw.utils.htmlDecode(value);\n\t\t\t}\n\t\t});\n\t\tif(tiddlerFields.text !== null) {\n\t\t\tresults.push(tiddlerFields);\n\t\t}\n\t\tstartPos = endPos;\n\t\tmatch = endOfDivRegExp.exec(text);\n\t}\n\treturn results;\n}\n\n})();\n",
"type": "application/javascript",
"module-type": "tiddlerdeserializer"
},
"$:/core/modules/editor/engines/framed.js": {
"title": "$:/core/modules/editor/engines/framed.js",
"text": "/*\\\ntitle: $:/core/modules/editor/engines/framed.js\ntype: application/javascript\nmodule-type: library\n\nText editor engine based on a simple input or textarea within an iframe. This is done so that the selection is preserved even when clicking away from the textarea\n\n\\*/\n(function(){\n\n/*jslint node: true,browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar HEIGHT_VALUE_TITLE = \"$:/config/TextEditor/EditorHeight/Height\";\n\nfunction FramedEngine(options) {\n\t// Save our options\n\toptions = options || {};\n\tthis.widget = options.widget;\n\tthis.value = options.value;\n\tthis.parentNode = options.parentNode;\n\tthis.nextSibling = options.nextSibling;\n\t// Create our hidden dummy text area for reading styles\n\tthis.dummyTextArea = this.widget.document.createElement(\"textarea\");\n\tif(this.widget.editClass) {\n\t\tthis.dummyTextArea.className = this.widget.editClass;\n\t}\n\tthis.dummyTextArea.setAttribute(\"hidden\",\"true\");\n\tthis.parentNode.insertBefore(this.dummyTextArea,this.nextSibling);\n\tthis.widget.domNodes.push(this.dummyTextArea);\n\t// Create the iframe\n\tthis.iframeNode = this.widget.document.createElement(\"iframe\");\n\tthis.parentNode.insertBefore(this.iframeNode,this.nextSibling);\n\tthis.iframeDoc = this.iframeNode.contentWindow.document;\n\t// (Firefox requires us to put some empty content in the iframe)\n\tthis.iframeDoc.open();\n\tthis.iframeDoc.write(\"\");\n\tthis.iframeDoc.close();\n\t// Style the iframe\n\tthis.iframeNode.className = this.dummyTextArea.className;\n\tthis.iframeNode.style.border = \"none\";\n\tthis.iframeNode.style.padding = \"0\";\n\tthis.iframeNode.style.resize = \"none\";\n\tthis.iframeDoc.body.style.margin = \"0\";\n\tthis.iframeDoc.body.style.padding = \"0\";\n\tthis.widget.domNodes.push(this.iframeNode);\n\t// Construct the textarea or input node\n\tvar tag = this.widget.editTag;\n\tif($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {\n\t\ttag = \"input\";\n\t}\n\tthis.domNode = this.iframeDoc.createElement(tag);\n\t// Set the text\n\tif(this.widget.editTag === \"textarea\") {\n\t\tthis.domNode.appendChild(this.iframeDoc.createTextNode(this.value));\n\t} else {\n\t\tthis.domNode.value = this.value;\n\t}\n\t// Set the attributes\n\tif(this.widget.editType) {\n\t\tthis.domNode.setAttribute(\"type\",this.widget.editType);\n\t}\n\tif(this.widget.editPlaceholder) {\n\t\tthis.domNode.setAttribute(\"placeholder\",this.widget.editPlaceholder);\n\t}\n\tif(this.widget.editSize) {\n\t\tthis.domNode.setAttribute(\"size\",this.widget.editSize);\n\t}\n\tif(this.widget.editRows) {\n\t\tthis.domNode.setAttribute(\"rows\",this.widget.editRows);\n\t}\n\tif(this.widget.editTabIndex) {\n\t\tthis.iframeNode.setAttribute(\"tabindex\",this.widget.editTabIndex);\n\t}\n\tif(this.widget.editAutoComplete) {\n\t\tthis.domNode.setAttribute(\"autocomplete\",this.widget.editAutoComplete);\n\t}\n\tif(this.widget.isDisabled === \"yes\") {\n\t\tthis.domNode.setAttribute(\"disabled\",true);\n\t}\n\t// Copy the styles from the dummy textarea\n\tthis.copyStyles();\n\t// Add event listeners\n\t$tw.utils.addEventListeners(this.domNode,[\n\t\t{name: \"click\",handlerObject: this,handlerMethod: \"handleClickEvent\"},\n\t\t{name: \"input\",handlerObject: this,handlerMethod: \"handleInputEvent\"},\n\t\t{name: \"keydown\",handlerObject: this.widget,handlerMethod: \"handleKeydownEvent\"},\n\t\t{name: \"focus\",handlerObject: this,handlerMethod: \"handleFocusEvent\"}\n\t]);\n\t// Add drag and drop event listeners if fileDrop is enabled\n\tif(this.widget.isFileDropEnabled) {\n\t\t$tw.utils.addEventListeners(this.domNode,[\n\t\t\t{name: \"dragenter\",handlerObject: this.widget,handlerMethod: \"handleDragEnterEvent\"},\n\t\t\t{name: \"dragover\",handlerObject: this.widget,handlerMethod: \"handleDragOverEvent\"},\n\t\t\t{name: \"dragleave\",handlerObject: this.widget,handlerMethod: \"handleDragLeaveEvent\"},\n\t\t\t{name: \"dragend\",handlerObject: this.widget,handlerMethod: \"handleDragEndEvent\"},\n\t\t\t{name: \"drop\", handlerObject: this.widget,handlerMethod: \"handleDropEvent\"},\n\t\t\t{name: \"paste\", handlerObject: this.widget,handlerMethod: \"handlePasteEvent\"},\n\t\t\t{name: \"click\",handlerObject: this.widget,handlerMethod: \"handleClickEvent\"}\n\t\t]);\n\t}\n\t// Insert the element into the DOM\n\tthis.iframeDoc.body.appendChild(this.domNode);\n}\n\n/*\nCopy styles from the dummy text area to the textarea in the iframe\n*/\nFramedEngine.prototype.copyStyles = function() {\n\t// Copy all styles\n\t$tw.utils.copyStyles(this.dummyTextArea,this.domNode);\n\t// Override the ones that should not be set the same as the dummy textarea\n\tthis.domNode.style.display = \"block\";\n\tthis.domNode.style.width = \"100%\";\n\tthis.domNode.style.margin = \"0\";\n\t// In Chrome setting -webkit-text-fill-color overrides the placeholder text colour\n\tthis.domNode.style[\"-webkit-text-fill-color\"] = \"currentcolor\";\n};\n\n/*\nSet the text of the engine if it doesn't currently have focus\n*/\nFramedEngine.prototype.setText = function(text,type) {\n\tif(!this.domNode.isTiddlyWikiFakeDom) {\n\t\tif(this.domNode.ownerDocument.activeElement !== this.domNode) {\n\t\t\tthis.updateDomNodeText(text);\n\t\t}\n\t\t// Fix the height if needed\n\t\tthis.fixHeight();\n\t}\n};\n\n/*\nUpdate the DomNode with the new text\n*/\nFramedEngine.prototype.updateDomNodeText = function(text) {\n\tthis.domNode.value = text;\n};\n\n/*\nGet the text of the engine\n*/\nFramedEngine.prototype.getText = function() {\n\treturn this.domNode.value;\n};\n\n/*\nFix the height of textarea to fit content\n*/\nFramedEngine.prototype.fixHeight = function() {\n\t// Make sure styles are updated\n\tthis.copyStyles();\n\t// Adjust height\n\tif(this.widget.editTag === \"textarea\") {\n\t\tif(this.widget.editAutoHeight) {\n\t\t\tif(this.domNode && !this.domNode.isTiddlyWikiFakeDom) {\n\t\t\t\tvar newHeight = $tw.utils.resizeTextAreaToFit(this.domNode,this.widget.editMinHeight);\n\t\t\t\tthis.iframeNode.style.height = (newHeight + 14) + \"px\"; // +14 for the border on the textarea\n\t\t\t}\n\t\t} else {\n\t\t\tvar fixedHeight = parseInt(this.widget.wiki.getTiddlerText(HEIGHT_VALUE_TITLE,\"400px\"),10);\n\t\t\tfixedHeight = Math.max(fixedHeight,20);\n\t\t\tthis.domNode.style.height = fixedHeight + \"px\";\n\t\t\tthis.iframeNode.style.height = (fixedHeight + 14) + \"px\";\n\t\t}\n\t}\n};\n\n/*\nFocus the engine node\n*/\nFramedEngine.prototype.focus = function() {\n\tif(this.domNode.focus && this.domNode.select) {\n\t\tthis.domNode.focus();\n\t\tthis.domNode.select();\n\t}\n};\n\n/*\nHandle a focus event\n*/\nFramedEngine.prototype.handleFocusEvent = function(event) {\n\tif(this.widget.editCancelPopups) {\n\t\t$tw.popup.cancel(0);\n\t}\n};\n\n/*\nHandle a click\n*/\nFramedEngine.prototype.handleClickEvent = function(event) {\n\tthis.fixHeight();\n\treturn true;\n};\n\n/*\nHandle a dom \"input\" event which occurs when the text has changed\n*/\nFramedEngine.prototype.handleInputEvent = function(event) {\n\tthis.widget.saveChanges(this.getText());\n\tthis.fixHeight();\n\tif(this.widget.editInputActions) {\n\t\tthis.widget.invokeActionString(this.widget.editInputActions);\n\t}\n\treturn true;\n};\n\n/*\nCreate a blank structure representing a text operation\n*/\nFramedEngine.prototype.createTextOperation = function() {\n\tvar operation = {\n\t\ttext: this.domNode.value,\n\t\tselStart: this.domNode.selectionStart,\n\t\tselEnd: this.domNode.selectionEnd,\n\t\tcutStart: null,\n\t\tcutEnd: null,\n\t\treplacement: null,\n\t\tnewSelStart: null,\n\t\tnewSelEnd: null\n\t};\n\toperation.selection = operation.text.substring(operation.selStart,operation.selEnd);\n\treturn operation;\n};\n\n/*\nExecute a text operation\n*/\nFramedEngine.prototype.executeTextOperation = function(operation) {\n\t// Perform the required changes to the text area and the underlying tiddler\n\tvar newText = operation.text;\n\tif(operation.replacement !== null) {\n\t\tnewText = operation.text.substring(0,operation.cutStart) + operation.replacement + operation.text.substring(operation.cutEnd);\n\t\t// Attempt to use a execCommand to modify the value of the control\n\t\tif(this.iframeDoc.queryCommandSupported(\"insertText\") && this.iframeDoc.queryCommandSupported(\"delete\") && !$tw.browser.isFirefox) {\n\t\t\tthis.domNode.focus();\n\t\t\tthis.domNode.setSelectionRange(operation.cutStart,operation.cutEnd);\n\t\t\tif(operation.replacement === \"\") {\n\t\t\t\tthis.iframeDoc.execCommand(\"delete\",false,\"\");\n\t\t\t} else {\n\t\t\t\tthis.iframeDoc.execCommand(\"insertText\",false,operation.replacement);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.domNode.value = newText;\n\t\t}\n\t\tthis.domNode.focus();\n\t\tthis.domNode.setSelectionRange(operation.newSelStart,operation.newSelEnd);\n\t}\n\tthis.domNode.focus();\n\treturn newText;\n};\n\nexports.FramedEngine = FramedEngine;\n\n})();\n",
"type": "application/javascript",
"module-type": "library"
},
"$:/core/modules/editor/engines/simple.js": {
"title": "$:/core/modules/editor/engines/simple.js",
"text": "/*\\\ntitle: $:/core/modules/editor/engines/simple.js\ntype: application/javascript\nmodule-type: library\n\nText editor engine based on a simple input or textarea tag\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar HEIGHT_VALUE_TITLE = \"$:/config/TextEditor/EditorHeight/Height\";\n\nfunction SimpleEngine(options) {\n\t// Save our options\n\toptions = options || {};\n\tthis.widget = options.widget;\n\tthis.value = options.value;\n\tthis.parentNode = options.parentNode;\n\tthis.nextSibling = options.nextSibling;\n\t// Construct the textarea or input node\n\tvar tag = this.widget.editTag;\n\tif($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {\n\t\ttag = \"input\";\n\t}\n\tthis.domNode = this.widget.document.createElement(tag);\n\t// Set the text\n\tif(this.widget.editTag === \"textarea\") {\n\t\tthis.domNode.appendChild(this.widget.document.createTextNode(this.value));\n\t} else {\n\t\tthis.domNode.value = this.value;\n\t}\n\t// Set the attributes\n\tif(this.widget.editType) {\n\t\tthis.domNode.setAttribute(\"type\",this.widget.editType);\n\t}\n\tif(this.widget.editPlaceholder) {\n\t\tthis.domNode.setAttribute(\"placeholder\",this.widget.editPlaceholder);\n\t}\n\tif(this.widget.editSize) {\n\t\tthis.domNode.setAttribute(\"size\",this.widget.editSize);\n\t}\n\tif(this.widget.editRows) {\n\t\tthis.domNode.setAttribute(\"rows\",this.widget.editRows);\n\t}\n\tif(this.widget.editClass) {\n\t\tthis.domNode.className = this.widget.editClass;\n\t}\n\tif(this.widget.editTabIndex) {\n\t\tthis.domNode.setAttribute(\"tabindex\",this.widget.editTabIndex);\n\t}\n\tif(this.widget.editAutoComplete) {\n\t\tthis.domNode.setAttribute(\"autocomplete\",this.widget.editAutoComplete);\n\t}\n\tif(this.widget.isDisabled === \"yes\") {\n\t\tthis.domNode.setAttribute(\"disabled\",true);\n\t}\n\t// Add an input event handler\n\t$tw.utils.addEventListeners(this.domNode,[\n\t\t{name: \"focus\", handlerObject: this, handlerMethod: \"handleFocusEvent\"},\n\t\t{name: \"input\", handlerObject: this, handlerMethod: \"handleInputEvent\"}\n\t]);\n\t// Insert the element into the DOM\n\tthis.parentNode.insertBefore(this.domNode,this.nextSibling);\n\tthis.widget.domNodes.push(this.domNode);\n}\n\n/*\nSet the text of the engine if it doesn't currently have focus\n*/\nSimpleEngine.prototype.setText = function(text,type) {\n\tif(!this.domNode.isTiddlyWikiFakeDom) {\n\t\tif(this.domNode.ownerDocument.activeElement !== this.domNode || text === \"\") {\n\t\t\tthis.updateDomNodeText(text);\n\t\t}\n\t\t// Fix the height if needed\n\t\tthis.fixHeight();\n\t}\n};\n\n/*\nUpdate the DomNode with the new text\n*/\nSimpleEngine.prototype.updateDomNodeText = function(text) {\n\tthis.domNode.value = text;\n};\n\n/*\nGet the text of the engine\n*/\nSimpleEngine.prototype.getText = function() {\n\treturn this.domNode.value;\n};\n\n/*\nFix the height of textarea to fit content\n*/\nSimpleEngine.prototype.fixHeight = function() {\n\tif(this.widget.editTag === \"textarea\") {\n\t\tif(this.widget.editAutoHeight) {\n\t\t\tif(this.domNode && !this.domNode.isTiddlyWikiFakeDom) {\n\t\t\t\t$tw.utils.resizeTextAreaToFit(this.domNode,this.widget.editMinHeight);\n\t\t\t}\n\t\t} else {\n\t\t\tvar fixedHeight = parseInt(this.widget.wiki.getTiddlerText(HEIGHT_VALUE_TITLE,\"400px\"),10);\n\t\t\tfixedHeight = Math.max(fixedHeight,20);\n\t\t\tthis.domNode.style.height = fixedHeight + \"px\";\n\t\t}\n\t}\n};\n\n/*\nFocus the engine node\n*/\nSimpleEngine.prototype.focus = function() {\n\tif(this.domNode.focus && this.domNode.select) {\n\t\tthis.domNode.focus();\n\t\tthis.domNode.select();\n\t}\n};\n\n/*\nHandle a dom \"input\" event which occurs when the text has changed\n*/\nSimpleEngine.prototype.handleInputEvent = function(event) {\n\tthis.widget.saveChanges(this.getText());\n\tthis.fixHeight();\n\tif(this.widget.editInputActions) {\n\t\tthis.widget.invokeActionString(this.widget.editInputActions);\n\t}\n\treturn true;\n};\n\n/*\nHandle a dom \"focus\" event\n*/\nSimpleEngine.prototype.handleFocusEvent = function(event) {\n\tif(this.widget.editCancelPopups) {\n\t\t$tw.popup.cancel(0);\n\t}\n\tif(this.widget.editFocusPopup) {\n\t\t$tw.popup.triggerPopup({\n\t\t\tdomNode: this.domNode,\n\t\t\ttitle: this.widget.editFocusPopup,\n\t\t\twiki: this.widget.wiki,\n\t\t\tforce: true\n\t\t});\n\t}\n\treturn true;\n};\n\n/*\nCreate a blank structure representing a text operation\n*/\nSimpleEngine.prototype.createTextOperation = function() {\n\treturn null;\n};\n\n/*\nExecute a text operation\n*/\nSimpleEngine.prototype.executeTextOperation = function(operation) {\n};\n\nexports.SimpleEngine = SimpleEngine;\n\n})();\n",
"type": "application/javascript",
"module-type": "library"
},
"$:/core/modules/editor/factory.js": {
"title": "$:/core/modules/editor/factory.js",
"text": "/*\\\ntitle: $:/core/modules/editor/factory.js\ntype: application/javascript\nmodule-type: library\n\nFactory for constructing text editor widgets with specified engines for the toolbar and non-toolbar cases\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar DEFAULT_MIN_TEXT_AREA_HEIGHT = \"100px\"; // Minimum height of textareas in pixels\n\n// Configuration tiddlers\nvar HEIGHT_MODE_TITLE = \"$:/config/TextEditor/EditorHeight/Mode\";\nvar ENABLE_TOOLBAR_TITLE = \"$:/config/TextEditor/EnableToolbar\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nfunction editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {\n\n\tvar EditTextWidget = function(parseTreeNode,options) {\n\t\t// Initialise the editor operations if they've not been done already\n\t\tif(!this.editorOperations) {\n\t\t\tEditTextWidget.prototype.editorOperations = {};\n\t\t\t$tw.modules.applyMethods(\"texteditoroperation\",this.editorOperations);\n\t\t}\n\t\tthis.initialise(parseTreeNode,options);\n\t};\n\n\t/*\n\tInherit from the base widget class\n\t*/\n\tEditTextWidget.prototype = new Widget();\n\n\t/*\n\tRender this widget into the DOM\n\t*/\n\tEditTextWidget.prototype.render = function(parent,nextSibling) {\n\t\t// Save the parent dom node\n\t\tthis.parentDomNode = parent;\n\t\t// Compute our attributes\n\t\tthis.computeAttributes();\n\t\t// Execute our logic\n\t\tthis.execute();\n\t\t// Create the wrapper for the toolbar and render its content\n\t\tif(this.editShowToolbar) {\n\t\t\tthis.toolbarNode = this.document.createElement(\"div\");\n\t\t\tthis.toolbarNode.className = \"tc-editor-toolbar\";\n\t\t\tparent.insertBefore(this.toolbarNode,nextSibling);\n\t\t\tthis.renderChildren(this.toolbarNode,null);\n\t\t\tthis.domNodes.push(this.toolbarNode);\n\t\t}\n\t\t// Create our element\n\t\tvar editInfo = this.getEditInfo(),\n\t\t\tEngine = this.editShowToolbar ? toolbarEngine : nonToolbarEngine;\n\t\tthis.engine = new Engine({\n\t\t\t\twidget: this,\n\t\t\t\tvalue: editInfo.value,\n\t\t\t\ttype: editInfo.type,\n\t\t\t\tparentNode: parent,\n\t\t\t\tnextSibling: nextSibling\n\t\t\t});\n\t\t// Call the postRender hook\n\t\tif(this.postRender) {\n\t\t\tthis.postRender();\n\t\t}\n\t\t// Fix height\n\t\tthis.engine.fixHeight();\n\t\t// Focus if required\n\t\tif(this.editFocus === \"true\" || this.editFocus === \"yes\") {\n\t\t\tthis.engine.focus();\n\t\t}\n\t\t// Add widget message listeners\n\t\tthis.addEventListeners([\n\t\t\t{type: \"tm-edit-text-operation\", handler: \"handleEditTextOperationMessage\"}\n\t\t]);\n\t};\n\n\t/*\n\tGet the tiddler being edited and current value\n\t*/\n\tEditTextWidget.prototype.getEditInfo = function() {\n\t\t// Get the edit value\n\t\tvar self = this,\n\t\t\tvalue,\n\t\t\ttype = \"text/plain\",\n\t\t\tupdate;\n\t\tif(this.editIndex) {\n\t\t\tvalue = this.wiki.extractTiddlerDataItem(this.editTitle,this.editIndex,this.editDefault);\n\t\t\tupdate = function(value) {\n\t\t\t\tvar data = self.wiki.getTiddlerData(self.editTitle,{});\n\t\t\t\tif(data[self.editIndex] !== value) {\n\t\t\t\t\tdata[self.editIndex] = value;\n\t\t\t\t\tself.wiki.setTiddlerData(self.editTitle,data);\n\t\t\t\t}\n\t\t\t};\n\t\t} else {\n\t\t\t// Get the current tiddler and the field name\n\t\t\tvar tiddler = this.wiki.getTiddler(this.editTitle);\n\t\t\tif(tiddler) {\n\t\t\t\t// If we've got a tiddler, the value to display is the field string value\n\t\t\t\tif(tiddler.hasField(this.editField)) {\n\t\t\t\t\tvalue = tiddler.getFieldString(this.editField);\n\t\t\t\t} else {\n\t\t\t\t\tvalue = this.editDefault || \"\";\n\t\t\t\t}\n\t\t\t\tif(this.editField === \"text\") {\n\t\t\t\t\ttype = tiddler.fields.type || \"text/vnd.tiddlywiki\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Otherwise, we need to construct a default value for the editor\n\t\t\t\tswitch(this.editField) {\n\t\t\t\t\tcase \"text\":\n\t\t\t\t\t\tvalue = \"Type the text for the tiddler '\" + this.editTitle + \"'\";\n\t\t\t\t\t\ttype = \"text/vnd.tiddlywiki\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"title\":\n\t\t\t\t\t\tvalue = this.editTitle;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tvalue = \"\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(this.editDefault !== undefined) {\n\t\t\t\t\tvalue = this.editDefault;\n\t\t\t\t}\n\t\t\t}\n\t\t\tupdate = function(value) {\n\t\t\t\tvar tiddler = self.wiki.getTiddler(self.editTitle),\n\t\t\t\t\tupdateFields = {\n\t\t\t\t\t\ttitle: self.editTitle\n\t\t\t\t\t};\n\t\t\t\tupdateFields[self.editField] = value;\n\t\t\t\tself.wiki.addTiddler(new $tw.Tiddler(self.wiki.getCreationFields(),tiddler,updateFields,self.wiki.getModificationFields()));\n\t\t\t};\n\t\t}\n\t\tif(this.editType) {\n\t\t\ttype = this.editType;\n\t\t}\n\t\treturn {value: value || \"\", type: type, update: update};\n\t};\n\n\t/*\n\tHandle an edit text operation message from the toolbar\n\t*/\n\tEditTextWidget.prototype.handleEditTextOperationMessage = function(event) {\n\t\t// Prepare information about the operation\n\t\tvar operation = this.engine.createTextOperation();\n\t\t// Invoke the handler for the selected operation\n\t\tvar handler = this.editorOperations[event.param];\n\t\tif(handler) {\n\t\t\thandler.call(this,event,operation);\n\t\t}\n\t\t// Execute the operation via the engine\n\t\tvar newText = this.engine.executeTextOperation(operation);\n\t\t// Fix the tiddler height and save changes\n\t\tthis.engine.fixHeight();\n\t\tthis.saveChanges(newText);\n\t};\n\n\t/*\n\tCompute the internal state of the widget\n\t*/\n\tEditTextWidget.prototype.execute = function() {\n\t\t// Get our parameters\n\t\tthis.editTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\t\tthis.editField = this.getAttribute(\"field\",\"text\");\n\t\tthis.editIndex = this.getAttribute(\"index\");\n\t\tthis.editDefault = this.getAttribute(\"default\");\n\t\tthis.editClass = this.getAttribute(\"class\");\n\t\tthis.editPlaceholder = this.getAttribute(\"placeholder\");\n\t\tthis.editSize = this.getAttribute(\"size\");\n\t\tthis.editRows = this.getAttribute(\"rows\");\n\t\tthis.editAutoHeight = this.wiki.getTiddlerText(HEIGHT_MODE_TITLE,\"auto\");\n\t\tthis.editAutoHeight = this.getAttribute(\"autoHeight\",this.editAutoHeight === \"auto\" ? \"yes\" : \"no\") === \"yes\";\n\t\tthis.editMinHeight = this.getAttribute(\"minHeight\",DEFAULT_MIN_TEXT_AREA_HEIGHT);\n\t\tthis.editFocusPopup = this.getAttribute(\"focusPopup\");\n\t\tthis.editFocus = this.getAttribute(\"focus\");\n\t\tthis.editTabIndex = this.getAttribute(\"tabindex\");\n\t\tthis.editCancelPopups = this.getAttribute(\"cancelPopups\",\"\") === \"yes\";\n\t\tthis.editInputActions = this.getAttribute(\"inputActions\");\n\t\tthis.editRefreshTitle = this.getAttribute(\"refreshTitle\");\n\t\tthis.editAutoComplete = this.getAttribute(\"autocomplete\");\n\t\tthis.isDisabled = this.getAttribute(\"disabled\",\"no\");\n\t\tthis.isFileDropEnabled = this.getAttribute(\"fileDrop\",\"no\") === \"yes\";\n\t\t// Get the default editor element tag and type\n\t\tvar tag,type;\n\t\tif(this.editField === \"text\") {\n\t\t\ttag = \"textarea\";\n\t\t} else {\n\t\t\ttag = \"input\";\n\t\t\tvar fieldModule = $tw.Tiddler.fieldModules[this.editField];\n\t\t\tif(fieldModule && fieldModule.editTag) {\n\t\t\t\ttag = fieldModule.editTag;\n\t\t\t}\n\t\t\tif(fieldModule && fieldModule.editType) {\n\t\t\t\ttype = fieldModule.editType;\n\t\t\t}\n\t\t\ttype = type || \"text\";\n\t\t}\n\t\t// Get the rest of our parameters\n\t\tthis.editTag = this.getAttribute(\"tag\",tag) || \"input\";\n\t\tthis.editType = this.getAttribute(\"type\",type);\n\t\t// Make the child widgets\n\t\tthis.makeChildWidgets();\n\t\t// Determine whether to show the toolbar\n\t\tthis.editShowToolbar = this.wiki.getTiddlerText(ENABLE_TOOLBAR_TITLE,\"yes\");\n\t\tthis.editShowToolbar = (this.editShowToolbar === \"yes\") && !!(this.children && this.children.length > 0) && (!this.document.isTiddlyWikiFakeDom);\n\t};\n\n\t/*\n\tSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n\t*/\n\tEditTextWidget.prototype.refresh = function(changedTiddlers) {\n\t\tvar changedAttributes = this.computeAttributes();\n\t\t// Completely rerender if any of our attributes have changed\n\t\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes[\"default\"] || changedAttributes[\"class\"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE] || changedAttributes.disabled || changedAttributes.fileDrop) {\n\t\t\tthis.refreshSelf();\n\t\t\treturn true;\n\t\t} else if (changedTiddlers[this.editRefreshTitle]) {\n\t\t\tthis.engine.updateDomNodeText(this.getEditInfo().value);\n\t\t} else if(changedTiddlers[this.editTitle]) {\n\t\t\tvar editInfo = this.getEditInfo();\n\t\t\tthis.updateEditor(editInfo.value,editInfo.type);\n\t\t}\n\t\tthis.engine.fixHeight();\n\t\tif(this.editShowToolbar) {\n\t\t\treturn this.refreshChildren(changedTiddlers);\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\t/*\n\tUpdate the editor with new text. This method is separate from updateEditorDomNode()\n\tso that subclasses can override updateEditor() and still use updateEditorDomNode()\n\t*/\n\tEditTextWidget.prototype.updateEditor = function(text,type) {\n\t\tthis.updateEditorDomNode(text,type);\n\t};\n\n\t/*\n\tUpdate the editor dom node with new text\n\t*/\n\tEditTextWidget.prototype.updateEditorDomNode = function(text,type) {\n\t\tthis.engine.setText(text,type);\n\t};\n\n\t/*\n\tSave changes back to the tiddler store\n\t*/\n\tEditTextWidget.prototype.saveChanges = function(text) {\n\t\tvar editInfo = this.getEditInfo();\n\t\tif(text !== editInfo.value) {\n\t\t\teditInfo.update(text);\n\t\t}\n\t};\n\n\t/*\n\tHandle a dom \"keydown\" event, which we'll bubble up to our container for the keyboard widgets benefit\n\t*/\n\tEditTextWidget.prototype.handleKeydownEvent = function(event) {\n\t\t// Check for a keyboard shortcut\n\t\tif(this.toolbarNode) {\n\t\t\tvar shortcutElements = this.toolbarNode.querySelectorAll(\"[data-tw-keyboard-shortcut]\");\n\t\t\tfor(var index=0; index<shortcutElements.length; index++) {\n\t\t\t\tvar el = shortcutElements[index],\n\t\t\t\t\tshortcutData = el.getAttribute(\"data-tw-keyboard-shortcut\"),\n\t\t\t\t\tkeyInfoArray = $tw.keyboardManager.parseKeyDescriptors(shortcutData,{\n\t\t\t\t\t\twiki: this.wiki\n\t\t\t\t\t});\n\t\t\t\tif($tw.keyboardManager.checkKeyDescriptors(event,keyInfoArray)) {\n\t\t\t\t\tvar clickEvent = this.document.createEvent(\"Events\");\n\t\t\t\t clickEvent.initEvent(\"click\",true,false);\n\t\t\t\t el.dispatchEvent(clickEvent);\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Propogate the event to the container\n\t\tif(this.propogateKeydownEvent(event)) {\n\t\t\t// Ignore the keydown if it was already handled\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\treturn true;\n\t\t}\n\t\t// Otherwise, process the keydown normally\n\t\treturn false;\n\t};\n\n\t/*\n\tPropogate keydown events to our container for the keyboard widgets benefit\n\t*/\n\tEditTextWidget.prototype.propogateKeydownEvent = function(event) {\n\t\tvar newEvent = this.cloneEvent(event,[\"keyCode\",\"which\",\"metaKey\",\"ctrlKey\",\"altKey\",\"shiftKey\"]);\n\t\treturn !this.parentDomNode.dispatchEvent(newEvent);\n\t};\n\n\tEditTextWidget.prototype.cloneEvent = function(event,propertiesToCopy) {\n\t\tvar propertiesToCopy = propertiesToCopy || [],\n\t\t\tnewEvent = this.document.createEventObject ? this.document.createEventObject() : this.document.createEvent(\"Events\");\n\t\tif(newEvent.initEvent) {\n\t\t\tnewEvent.initEvent(event.type, true, true);\n\t\t}\n\t\t$tw.utils.each(propertiesToCopy,function(prop){\n\t\t\tnewEvent[prop] = event[prop];\n\t\t});\n\t\treturn newEvent;\n\t};\n\n\tEditTextWidget.prototype.dispatchDOMEvent = function(newEvent) {\n\t\tvar dispatchNode = this.engine.iframeNode || this.engine.parentNode;\n\t\treturn dispatchNode.dispatchEvent(newEvent);\n\t};\n\n\t/*\n\tPropogate drag and drop events with File data to our container for the dropzone widgets benefit.\n\tIf there are no Files, let the browser handle it.\n\t*/\n\tEditTextWidget.prototype.handleDropEvent = function(event) {\n\t\tif(event.dataTransfer.files.length) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tthis.dispatchDOMEvent(this.cloneEvent(event,[\"dataTransfer\"]));\n\t\t} \n\t};\n\n\tEditTextWidget.prototype.handlePasteEvent = function(event) {\n\t\tif(event.clipboardData.files.length) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tthis.dispatchDOMEvent(this.cloneEvent(event,[\"clipboardData\"]));\n\t\t}\n\t};\n\n\tEditTextWidget.prototype.handleDragEnterEvent = function(event) {\n\t\tif($tw.utils.dragEventContainsFiles(event)) {\n\t\t\t// Ignore excessive events fired by FF when entering and leaving text nodes in a text area.\n\t\t\tif( event.relatedTarget && (event.relatedTarget.nodeType === 3 || event.target === event.relatedTarget)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\treturn this.dispatchDOMEvent(this.cloneEvent(event,[\"dataTransfer\"]));\n\t\t}\n\t\treturn true;\n\t};\n\n\tEditTextWidget.prototype.handleDragOverEvent = function(event) {\n\t\tif($tw.utils.dragEventContainsFiles(event)) {\n\t\t\t// Call preventDefault() in browsers that default to not allowing drop events on textarea\n\t\t\tif($tw.browser.isFirefox || $tw.browser.isIE) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t\tevent.dataTransfer.dropEffect = \"copy\";\n\t\t\treturn this.dispatchDOMEvent(this.cloneEvent(event,[\"dataTransfer\"]));\n\t\t}\n\t\treturn true;\n\t};\n\n\tEditTextWidget.prototype.handleDragLeaveEvent = function(event) {\n\t\t// Ignore excessive events fired by FF when entering and leaving text nodes in a text area.\n\t\tif(event.relatedTarget && ((event.relatedTarget.nodeType === 3) || (event.target === event.relatedTarget))) {\n\t\t\treturn true;\n\t\t}\n\t\tevent.preventDefault();\n\t\tthis.dispatchDOMEvent(this.cloneEvent(event,[\"dataTransfer\"]));\n\t};\n\n\tEditTextWidget.prototype.handleDragEndEvent = function(event) {\n\t\tthis.dispatchDOMEvent(this.cloneEvent(event));\n\t};\n\n\tEditTextWidget.prototype.handleClickEvent = function(event) {\n\t\treturn !this.dispatchDOMEvent(this.cloneEvent(event));\n\t};\n\n\treturn EditTextWidget;\n}\n\nexports.editTextWidgetFactory = editTextWidgetFactory;\n\n})();\n",
"type": "application/javascript",
"module-type": "library"
},
"$:/core/modules/editor/operations/bitmap/clear.js": {
"title": "$:/core/modules/editor/operations/bitmap/clear.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/bitmap/clear.js\ntype: application/javascript\nmodule-type: bitmapeditoroperation\n\nBitmap editor operation to clear the image\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"clear\"] = function(event) {\n\tvar ctx = this.canvasDomNode.getContext(\"2d\");\n\tctx.globalAlpha = 1;\n\tctx.fillStyle = event.paramObject.colour || \"white\";\n\tctx.fillRect(0,0,this.canvasDomNode.width,this.canvasDomNode.height);\n\t// Save changes\n\tthis.strokeEnd();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "bitmapeditoroperation"
},
"$:/core/modules/editor/operations/bitmap/resize.js": {
"title": "$:/core/modules/editor/operations/bitmap/resize.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/bitmap/resize.js\ntype: application/javascript\nmodule-type: bitmapeditoroperation\n\nBitmap editor operation to resize the image\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"resize\"] = function(event) {\n\t// Get the new width\n\tvar newWidth = parseInt(event.paramObject.width || this.canvasDomNode.width,10),\n\t\tnewHeight = parseInt(event.paramObject.height || this.canvasDomNode.height,10);\n\t// Update if necessary\n\tif(newWidth > 0 && newHeight > 0 && !(newWidth === this.currCanvas.width && newHeight === this.currCanvas.height)) {\n\t\tthis.changeCanvasSize(newWidth,newHeight);\n\t}\n\t// Update the input controls\n\tthis.refreshToolbar();\n\t// Save the image into the tiddler\n\tthis.saveChanges();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "bitmapeditoroperation"
},
"$:/core/modules/editor/operations/bitmap/rotate-left.js": {
"title": "$:/core/modules/editor/operations/bitmap/rotate-left.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/bitmap/rotate-left.js\ntype: application/javascript\nmodule-type: bitmapeditoroperation\n\nBitmap editor operation to rotate the image left by 90 degrees\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"rotate-left\"] = function(event) {\n\t// Rotate the canvas left by 90 degrees\n\tthis.rotateCanvasLeft();\n\t// Update the input controls\n\tthis.refreshToolbar();\n\t// Save the image into the tiddler\n\tthis.saveChanges();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "bitmapeditoroperation"
},
"$:/core/modules/editor/operations/text/excise.js": {
"title": "$:/core/modules/editor/operations/text/excise.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/excise.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to excise the selection to a new tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"excise\"] = function(event,operation) {\n\tvar editTiddler = this.wiki.getTiddler(this.editTitle),\n\t\teditTiddlerTitle = this.editTitle;\n\tif(editTiddler && editTiddler.fields[\"draft.of\"]) {\n\t\teditTiddlerTitle = editTiddler.fields[\"draft.of\"];\n\t}\n\tvar excisionTitle = event.paramObject.title || this.wiki.generateNewTitle(\"New Excision\");\n\tthis.wiki.addTiddler(new $tw.Tiddler(\n\t\tthis.wiki.getCreationFields(),\n\t\tthis.wiki.getModificationFields(),\n\t\t{\n\t\t\ttitle: excisionTitle,\n\t\t\ttext: operation.selection,\n\t\t\ttags: event.paramObject.tagnew === \"yes\" ? [editTiddlerTitle] : []\n\t\t}\n\t));\n\toperation.replacement = excisionTitle;\n\tswitch(event.paramObject.type || \"transclude\") {\n\t\tcase \"transclude\":\n\t\t\toperation.replacement = \"{{\" + operation.replacement+ \"}}\";\n\t\t\tbreak;\n\t\tcase \"link\":\n\t\t\toperation.replacement = \"[[\" + operation.replacement+ \"]]\";\n\t\t\tbreak;\n\t\tcase \"macro\":\n\t\t\toperation.replacement = \"<<\" + (event.paramObject.macro || \"translink\") + \" \\\"\\\"\\\"\" + operation.replacement + \"\\\"\\\"\\\">>\";\n\t\t\tbreak;\n\t}\n\toperation.cutStart = operation.selStart;\n\toperation.cutEnd = operation.selEnd;\n\toperation.newSelStart = operation.selStart;\n\toperation.newSelEnd = operation.selStart + operation.replacement.length;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/insert-text.js": {
"title": "$:/core/modules/editor/operations/text/insert-text.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/insert-text.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation insert text at the caret position. If there is a selection it is replaced.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"insert-text\"] = function(event,operation) {\n\toperation.replacement = event.paramObject.text;\n\toperation.cutStart = operation.selStart;\n\toperation.cutEnd = operation.selEnd;\n\toperation.newSelStart = operation.selStart + operation.replacement.length;\n\toperation.newSelEnd = operation.newSelStart;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/make-link.js": {
"title": "$:/core/modules/editor/operations/text/make-link.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/make-link.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to make a link\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"make-link\"] = function(event,operation) {\n\tif(operation.selection) {\n\t\toperation.replacement = \"[[\" + operation.selection + \"|\" + event.paramObject.text + \"]]\";\n\t\toperation.cutStart = operation.selStart;\n\t\toperation.cutEnd = operation.selEnd;\n\t} else {\n\t\toperation.replacement = \"[[\" + event.paramObject.text + \"]]\";\n\t\toperation.cutStart = operation.selStart;\n\t\toperation.cutEnd = operation.selEnd;\n\t}\n\toperation.newSelStart = operation.selStart + operation.replacement.length;\n\toperation.newSelEnd = operation.newSelStart;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/prefix-lines.js": {
"title": "$:/core/modules/editor/operations/text/prefix-lines.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/prefix-lines.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to add a prefix to the selected lines\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"prefix-lines\"] = function(event,operation) {\n\tvar targetCount = parseInt(event.paramObject.count + \"\",10);\n\t// Cut just past the preceding line break, or the start of the text\n\toperation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart);\n\t// Cut to just past the following line break, or to the end of the text\n\toperation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd);\n\t// Compose the required prefix\n\tvar prefix = $tw.utils.repeat(event.paramObject.character,targetCount);\n\t// Process each line\n\tvar lines = operation.text.substring(operation.cutStart,operation.cutEnd).split(/\\r?\\n/mg);\n\t$tw.utils.each(lines,function(line,index) {\n\t\t// Remove and count any existing prefix characters\n\t\tvar count = 0;\n\t\twhile(line.charAt(0) === event.paramObject.character) {\n\t\t\tline = line.substring(1);\n\t\t\tcount++;\n\t\t}\n\t\t// Remove any whitespace\n\t\twhile(line.charAt(0) === \" \") {\n\t\t\tline = line.substring(1);\n\t\t}\n\t\t// We're done if we removed the exact required prefix, otherwise add it\n\t\tif(count !== targetCount) {\n\t\t\t// Apply the prefix\n\t\t\tline = prefix + \" \" + line;\n\t\t}\n\t\t// Save the modified line\n\t\tlines[index] = line;\n\t});\n\t// Stitch the replacement text together and set the selection\n\toperation.replacement = lines.join(\"\\n\");\n\tif(lines.length === 1) {\n\t\toperation.newSelStart = operation.cutStart + operation.replacement.length;\n\t\toperation.newSelEnd = operation.newSelStart;\n\t} else {\n\t\toperation.newSelStart = operation.cutStart;\n\t\toperation.newSelEnd = operation.newSelStart + operation.replacement.length;\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/replace-all.js": {
"title": "$:/core/modules/editor/operations/text/replace-all.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/replace-all.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to replace the entire text\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"replace-all\"] = function(event,operation) {\n\toperation.cutStart = 0;\n\toperation.cutEnd = operation.text.length;\n\toperation.replacement = event.paramObject.text;\n\toperation.newSelStart = 0;\n\toperation.newSelEnd = operation.replacement.length;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/replace-selection.js": {
"title": "$:/core/modules/editor/operations/text/replace-selection.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/replace-selection.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to replace the selection\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"replace-selection\"] = function(event,operation) {\n\toperation.replacement = event.paramObject.text;\n\toperation.cutStart = operation.selStart;\n\toperation.cutEnd = operation.selEnd;\n\toperation.newSelStart = operation.selStart;\n\toperation.newSelEnd = operation.selStart + operation.replacement.length;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/save-selection.js": {
"title": "$:/core/modules/editor/operations/text/save-selection.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/save-selection.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to save the current selection in a specified tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"save-selection\"] = function(event,operation) {\n\tvar tiddler = event.paramObject.tiddler,\n\t\tfield = event.paramObject.field || \"text\";\n\tif(tiddler && field) {\n\t\tthis.wiki.setText(tiddler,field,null,operation.text.substring(operation.selStart,operation.selEnd));\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/wrap-lines.js": {
"title": "$:/core/modules/editor/operations/text/wrap-lines.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/wrap-lines.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to wrap the selected lines with a prefix and suffix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"wrap-lines\"] = function(event,operation) {\n\t// Cut just past the preceding line break, or the start of the text\n\toperation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart);\n\t// Cut to just past the following line break, or to the end of the text\n\toperation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd);\n\t// Add the prefix and suffix\n\toperation.replacement = event.paramObject.prefix + \"\\n\" +\n\t\t\t\toperation.text.substring(operation.cutStart,operation.cutEnd) + \"\\n\" +\n\t\t\t\tevent.paramObject.suffix + \"\\n\";\n\toperation.newSelStart = operation.cutStart + event.paramObject.prefix.length + 1;\n\toperation.newSelEnd = operation.newSelStart + (operation.cutEnd - operation.cutStart);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/editor/operations/text/wrap-selection.js": {
"title": "$:/core/modules/editor/operations/text/wrap-selection.js",
"text": "/*\\\ntitle: $:/core/modules/editor/operations/text/wrap-selection.js\ntype: application/javascript\nmodule-type: texteditoroperation\n\nText editor operation to wrap the selection with the specified prefix and suffix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports[\"wrap-selection\"] = function(event,operation) {\n\tif(operation.selStart === operation.selEnd) {\n\t\t// No selection; check if we're within the prefix/suffix\n\t\tif(operation.text.substring(operation.selStart - event.paramObject.prefix.length,operation.selStart + event.paramObject.suffix.length) === event.paramObject.prefix + event.paramObject.suffix) {\n\t\t\t// Remove the prefix and suffix\n\t\t\toperation.cutStart = operation.selStart - event.paramObject.prefix.length;\n\t\t\toperation.cutEnd = operation.selEnd + event.paramObject.suffix.length;\n\t\t\toperation.replacement = \"\";\n\t\t\toperation.newSelStart = operation.cutStart;\n\t\t\toperation.newSelEnd = operation.newSelStart;\n\t\t} else {\n\t\t\t// Wrap the cursor instead\n\t\t\toperation.cutStart = operation.selStart;\n\t\t\toperation.cutEnd = operation.selEnd;\n\t\t\toperation.replacement = event.paramObject.prefix + event.paramObject.suffix;\n\t\t\toperation.newSelStart = operation.selStart + event.paramObject.prefix.length;\n\t\t\toperation.newSelEnd = operation.newSelStart;\n\t\t}\n\t} else if(operation.text.substring(operation.selStart,operation.selStart + event.paramObject.prefix.length) === event.paramObject.prefix && operation.text.substring(operation.selEnd - event.paramObject.suffix.length,operation.selEnd) === event.paramObject.suffix) {\n\t\t// Prefix and suffix are already present, so remove them\n\t\toperation.cutStart = operation.selStart;\n\t\toperation.cutEnd = operation.selEnd;\n\t\toperation.replacement = operation.selection.substring(event.paramObject.prefix.length,operation.selection.length - event.paramObject.suffix.length);\n\t\toperation.newSelStart = operation.selStart;\n\t\toperation.newSelEnd = operation.selStart + operation.replacement.length;\n\t} else {\n\t\t// Add the prefix and suffix\n\t\toperation.cutStart = operation.selStart;\n\t\toperation.cutEnd = operation.selEnd;\n\t\toperation.replacement = event.paramObject.prefix + operation.selection + event.paramObject.suffix;\n\t\toperation.newSelStart = operation.selStart;\n\t\toperation.newSelEnd = operation.selStart + operation.replacement.length;\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "texteditoroperation"
},
"$:/core/modules/filterrunprefixes/all.js": {
"title": "$:/core/modules/filterrunprefixes/all.js",
"text": "/*\\\ntitle: $:/core/modules/filterrunprefixes/all.js\ntype: application/javascript\nmodule-type: filterrunprefix\n\nUnion of sets without de-duplication.\nEquivalent to = filter run prefix.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter prefix function\n*/\nexports.all = function(operationSubFunction) {\n\treturn function(results,source,widget) {\n\t\tresults.push.apply(results, operationSubFunction(source,widget));\n\t};\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filterrunprefix"
},
"$:/core/modules/filterrunprefixes/and.js": {
"title": "$:/core/modules/filterrunprefixes/and.js",
"text": "/*\\\ntitle: $:/core/modules/filterrunprefixes/and.js\ntype: application/javascript\nmodule-type: filterrunprefix\n\nIntersection of sets.\nEquivalent to + filter run prefix.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter prefix function\n*/\nexports.and = function(operationSubFunction,options) {\n\treturn function(results,source,widget) {\n\t\t// This replaces all the elements of the array, but keeps the actual array so that references to it are preserved\n\t\tsource = options.wiki.makeTiddlerIterator(results.toArray());\n\t\tresults.clear();\n\t\tresults.pushTop(operationSubFunction(source,widget));\n\t};\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filterrunprefix"
},
"$:/core/modules/filterrunprefixes/else.js": {
"title": "$:/core/modules/filterrunprefixes/else.js",
"text": "/*\\\ntitle: $:/core/modules/filterrunprefixes/else.js\ntype: application/javascript\nmodule-type: filterrunprefix\n\nEquivalent to ~ filter run prefix.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter prefix function\n*/\nexports.else = function(operationSubFunction) {\n\treturn function(results,source,widget) {\n\t\tif(results.length === 0) {\n\t\t\t// Main result so far is empty\n\t\t\tresults.pushTop(operationSubFunction(source,widget));\n\t\t}\n\t};\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filterrunprefix"
},
"$:/core/modules/filterrunprefixes/except.js": {
"title": "$:/core/modules/filterrunprefixes/except.js",
"text": "/*\\\ntitle: $:/core/modules/filterrunprefixes/except.js\ntype: application/javascript\nmodule-type: filterrunprefix\n\nDifference of sets.\nEquivalent to - filter run prefix.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter prefix function\n*/\nexports.except = function(operationSubFunction) {\n\treturn function(results,source,widget) {\n\t\tresults.remove(operationSubFunction(source,widget));\n\t};\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filterrunprefix"
},
"$:/core/modules/filterrunprefixes/filter.js": {
"title": "$:/core/modules/filterrunprefixes/filter.js",
"text": "/*\\\ntitle: $:/core/modules/filterrunprefixes/filter.js\ntype: application/javascript\nmodule-type: filterrunprefix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.filter = function(operationSubFunction,options) {\n\treturn function(results,source,widget) {\n\t\tif(results.length > 0) {\n\t\t\tvar resultsToRemove = [];\n\t\t\tresults.each(function(title) {\n\t\t\t\tvar filtered = operationSubFunction(options.wiki.makeTiddlerIterator([title]),{\n\t\t\t\t\tgetVariable: function(name) {\n\t\t\t\t\t\tswitch(name) {\n\t\t\t\t\t\t\tcase \"currentTiddler\":\n\t\t\t\t\t\t\t\treturn \"\" + title;\n\t\t\t\t\t\t\tcase \"..currentTiddler\":\n\t\t\t\t\t\t\t\treturn widget.getVariable(\"currentTiddler\");\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn widget.getVariable(name);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif(filtered.length === 0) {\n\t\t\t\t\tresultsToRemove.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t\tresults.remove(resultsToRemove);\n\t\t}\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filterrunprefix"
},
"$:/core/modules/filterrunprefixes/intersection.js": {
"title": "$:/core/modules/filterrunprefixes/intersection.js",
"text": "/*\\\ntitle: $:/core/modules/filterrunprefixes/intersection.js\ntype: application/javascript\nmodule-type: filterrunprefix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter prefix function\n*/\nexports.intersection = function(operationSubFunction) {\n\treturn function(results,source,widget) {\n\t\tif(results.length !== 0) {\n\t\t\tvar secondRunResults = operationSubFunction(source,widget);\n\t\t\tvar firstRunResults = results.toArray();\n\t\t\tresults.clear();\n\t\t\t$tw.utils.each(firstRunResults,function(title) {\n\t\t\t\tif(secondRunResults.indexOf(title) !== -1) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filterrunprefix"
},
"$:/core/modules/filterrunprefixes/or.js": {
"title": "$:/core/modules/filterrunprefixes/or.js",
"text": "/*\\\ntitle: $:/core/modules/filterrunprefixes/or.js\ntype: application/javascript\nmodule-type: filterrunprefix\n\nEquivalent to a filter run with no prefix.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter prefix function\n*/\nexports.or = function(operationSubFunction) {\n\treturn function(results,source,widget) {\n\t\tresults.pushTop(operationSubFunction(source,widget));\n\t};\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filterrunprefix"
},
"$:/core/modules/filterrunprefixes/reduce.js": {
"title": "$:/core/modules/filterrunprefixes/reduce.js",
"text": "/*\\\ntitle: $:/core/modules/filterrunprefixes/reduce.js\ntype: application/javascript\nmodule-type: filterrunprefix\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter prefix function\n*/\nexports.reduce = function(operationSubFunction,options) {\n\treturn function(results,source,widget) {\n\t\tif(results.length > 0) {\n\t\t\tvar accumulator = \"\";\n\t\t\tvar index = 0;\n\t\t\tresults.each(function(title) {\n\t\t\t\tvar list = operationSubFunction(options.wiki.makeTiddlerIterator([title]),{\n\t\t\t\t\tgetVariable: function(name) {\n\t\t\t\t\t\tswitch(name) {\n\t\t\t\t\t\t\tcase \"currentTiddler\":\n\t\t\t\t\t\t\t\treturn \"\" + title;\n\t\t\t\t\t\t\tcase \"..currentTiddler\":\n\t\t\t\t\t\t\t\treturn widget.getVariable(\"currentTiddler\");\n\t\t\t\t\t\t\tcase \"accumulator\":\n\t\t\t\t\t\t\t\treturn \"\" + accumulator;\n\t\t\t\t\t\t\tcase \"index\":\n\t\t\t\t\t\t\t\treturn \"\" + index;\n\t\t\t\t\t\t\tcase \"revIndex\":\n\t\t\t\t\t\t\t\treturn \"\" + (results.length - 1 - index);\n\t\t\t\t\t\t\tcase \"length\":\n\t\t\t\t\t\t\t\treturn \"\" + results.length;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn widget.getVariable(name);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif(list.length > 0) {\n\t\t\t\t\taccumulator = \"\" + list[0];\n\t\t\t\t}\n\t\t\t\t++index;\n\t\t\t});\n\t\t\tresults.clear();\n\t\t\tresults.push(accumulator);\n\t\t}\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filterrunprefix"
},
"$:/core/modules/filterrunprefixes/sort.js": {
"title": "$:/core/modules/filterrunprefixes/sort.js",
"text": "/*\\\ntitle: $:/core/modules/filterrunprefixes/sort.js\ntype: application/javascript\nmodule-type: filterrunprefix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter prefix function\n*/\nexports.sort = function(operationSubFunction,options) {\n\treturn function(results,source,widget) {\n\t\tif(results.length > 0) {\n\t\t\tvar suffixes = options.suffixes,\n\t\t\t\tsortType = (suffixes[0] && suffixes[0][0]) ? suffixes[0][0] : \"string\",\n\t\t\t\tinvert = suffixes[1] ? (suffixes[1].indexOf(\"reverse\") !== -1) : false,\n\t\t\t\tisCaseSensitive = suffixes[1] ? (suffixes[1].indexOf(\"casesensitive\") !== -1) : false,\n\t\t\t\tinputTitles = results.toArray(),\n\t\t\t\tsortKeys = [],\n\t\t\t\tindexes = new Array(inputTitles.length),\n\t\t\t\tcompareFn;\n\t\t\tresults.each(function(title) {\n\t\t\t\tvar key = operationSubFunction(options.wiki.makeTiddlerIterator([title]),{\n\t\t\t\t\tgetVariable: function(name) {\n\t\t\t\t\t\tswitch(name) {\n\t\t\t\t\t\t\tcase \"currentTiddler\":\n\t\t\t\t\t\t\t\treturn \"\" + title;\n\t\t\t\t\t\t\tcase \"..currentTiddler\":\n\t\t\t\t\t\t\t\treturn widget.getVariable(\"currentTiddler\");\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn widget.getVariable(name);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tsortKeys.push(key[0] || \"\");\n\t\t\t});\n\t\t\tresults.clear();\n\t\t\t// Prepare an array of indexes to sort\n\t\t\tfor(var t=0; t<inputTitles.length; t++) {\n\t\t\t\tindexes[t] = t;\n\t\t\t}\n\t\t\t// Sort the indexes\n\t\t\tcompareFn = $tw.utils.makeCompareFunction(sortType,{defaultType: \"string\", invert:invert, isCaseSensitive:isCaseSensitive});\n\t\t\tindexes = indexes.sort(function(a,b) {\n\t\t\t\t\treturn compareFn(sortKeys[a],sortKeys[b]);\n\t\t\t});\n\t\t\t// Add to results in correct order\n\t\t\t$tw.utils.each(indexes,function(index) {\n\t\t\t\tresults.push(inputTitles[index]);\n\t\t\t});\n\t\t}\n\t}\n};\n\n})();",
"type": "application/javascript",
"module-type": "filterrunprefix"
},
"$:/core/modules/filters/addprefix.js": {
"title": "$:/core/modules/filters/addprefix.js",
"text": "/*\\\ntitle: $:/core/modules/filters/addprefix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for adding a prefix to each title in the list. This is\nespecially useful in contexts where only a filter expression is allowed\nand macro substitution isn't available.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.addprefix = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(operator.operand + title);\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/addsuffix.js": {
"title": "$:/core/modules/filters/addsuffix.js",
"text": "/*\\\ntitle: $:/core/modules/filters/addsuffix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for adding a suffix to each title in the list. This is\nespecially useful in contexts where only a filter expression is allowed\nand macro substitution isn't available.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.addsuffix = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title + operator.operand);\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/after.js": {
"title": "$:/core/modules/filters/after.js",
"text": "/*\\\ntitle: $:/core/modules/filters/after.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddler from the current list that is after the tiddler named in the operand.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.after = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\tvar index = results.indexOf(operator.operand);\n\tif(index === -1 || index > (results.length - 2)) {\n\t\treturn [];\n\t} else {\n\t\treturn [results[index + 1]];\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/all/current.js": {
"title": "$:/core/modules/filters/all/current.js",
"text": "/*\\\ntitle: $:/core/modules/filters/all/current.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[current]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.current = function(source,prefix,options) {\n\tvar currTiddlerTitle = options.widget && options.widget.getVariable(\"currentTiddler\");\n\tif(currTiddlerTitle) {\n\t\treturn [currTiddlerTitle];\n\t} else {\n\t\treturn [];\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all/missing.js": {
"title": "$:/core/modules/filters/all/missing.js",
"text": "/*\\\ntitle: $:/core/modules/filters/all/missing.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[missing]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.missing = function(source,prefix,options) {\n\treturn options.wiki.getMissingTitles();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all/orphans.js": {
"title": "$:/core/modules/filters/all/orphans.js",
"text": "/*\\\ntitle: $:/core/modules/filters/all/orphans.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[orphans]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.orphans = function(source,prefix,options) {\n\treturn options.wiki.getOrphanTitles();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all/shadows.js": {
"title": "$:/core/modules/filters/all/shadows.js",
"text": "/*\\\ntitle: $:/core/modules/filters/all/shadows.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[shadows]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.shadows = function(source,prefix,options) {\n\treturn options.wiki.allShadowTitles();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all/tags.js": {
"title": "$:/core/modules/filters/all/tags.js",
"text": "/*\\\ntitle: $:/core/modules/filters/all/tags.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[tags]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tags = function(source,prefix,options) {\n\treturn Object.keys(options.wiki.getTagMap());\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all/tiddlers.js": {
"title": "$:/core/modules/filters/all/tiddlers.js",
"text": "/*\\\ntitle: $:/core/modules/filters/all/tiddlers.js\ntype: application/javascript\nmodule-type: allfilteroperator\n\nFilter function for [all[tiddlers]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tiddlers = function(source,prefix,options) {\n\treturn options.wiki.allTitles();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "allfilteroperator"
},
"$:/core/modules/filters/all.js": {
"title": "$:/core/modules/filters/all.js",
"text": "/*\\\ntitle: $:/core/modules/filters/all.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for selecting tiddlers\n\n[all[shadows+tiddlers]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar allFilterOperators;\n\nfunction getAllFilterOperators() {\n\tif(!allFilterOperators) {\n\t\tallFilterOperators = {};\n\t\t$tw.modules.applyMethods(\"allfilteroperator\",allFilterOperators);\n\t}\n\treturn allFilterOperators;\n}\n\n/*\nExport our filter function\n*/\nexports.all = function(source,operator,options) {\n\t// Get our suboperators\n\tvar allFilterOperators = getAllFilterOperators();\n\t// Cycle through the suboperators accumulating their results\n\tvar results = new $tw.utils.LinkedList(),\n\t\tsubops = operator.operand.split(\"+\");\n\t// Check for common optimisations\n\tif(subops.length === 1 && subops[0] === \"\") {\n\t\treturn source;\n\t} else if(subops.length === 1 && subops[0] === \"tiddlers\") {\n\t\treturn options.wiki.each;\n\t} else if(subops.length === 1 && subops[0] === \"shadows\") {\n\t\treturn options.wiki.eachShadow;\n\t} else if(subops.length === 2 && subops[0] === \"tiddlers\" && subops[1] === \"shadows\") {\n\t\treturn options.wiki.eachTiddlerPlusShadows;\n\t} else if(subops.length === 2 && subops[0] === \"shadows\" && subops[1] === \"tiddlers\") {\n\t\treturn options.wiki.eachShadowPlusTiddlers;\n\t}\n\t// Do it the hard way\n\tfor(var t=0; t<subops.length; t++) {\n\t\tvar subop = allFilterOperators[subops[t]];\n\t\tif(subop) {\n\t\t\tresults.pushTop(subop(source,operator.prefix,options));\n\t\t}\n\t}\n\treturn results.toArray();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/backlinks.js": {
"title": "$:/core/modules/filters/backlinks.js",
"text": "/*\\\ntitle: $:/core/modules/filters/backlinks.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning all the backlinks from a tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.backlinks = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\t$tw.utils.pushTop(results,options.wiki.getTiddlerBacklinks(title));\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/before.js": {
"title": "$:/core/modules/filters/before.js",
"text": "/*\\\ntitle: $:/core/modules/filters/before.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddler from the current list that is before the tiddler named in the operand.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.before = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\tvar index = results.indexOf(operator.operand);\n\tif(index <= 0) {\n\t\treturn [];\n\t} else {\n\t\treturn [results[index - 1]];\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/commands.js": {
"title": "$:/core/modules/filters/commands.js",
"text": "/*\\\ntitle: $:/core/modules/filters/commands.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the commands available in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.commands = function(source,operator,options) {\n\tvar results = [];\n\t$tw.utils.each($tw.commands,function(commandInfo,name) {\n\t\tresults.push(name);\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/compare.js": {
"title": "$:/core/modules/filters/compare.js",
"text": "/*\\\ntitle: $:/core/modules/filters/compare.js\ntype: application/javascript\nmodule-type: filteroperator\n\nGeneral purpose comparison operator\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.compare = function(source,operator,options) {\n\tvar suffixes = operator.suffixes || [],\n\t\ttype = (suffixes[0] || [])[0],\n\t\tmode = (suffixes[1] || [])[0],\n\t\ttypeFn = $tw.utils.makeCompareFunction(type,{defaultType: \"number\"}),\n\t\tmodeFn = modes[mode] || modes.eq,\n\t\tinvert = operator.prefix === \"!\",\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tif(modeFn(typeFn(title,operator.operand)) !== invert) {\n\t\t\tresults.push(title);\n\t\t}\n\t});\n\treturn results;\n};\n\nvar modes = {\n\t\"eq\": function(value) {return value === 0;},\n\t\"ne\": function(value) {return value !== 0;},\n\t\"gteq\": function(value) {return value >= 0;},\n\t\"gt\": function(value) {return value > 0;},\n\t\"lteq\": function(value) {return value <= 0;},\n\t\"lt\": function(value) {return value < 0;}\n}\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/contains.js": {
"title": "$:/core/modules/filters/contains.js",
"text": "/*\\\ntitle: $:/core/modules/filters/contains.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for finding values in array fields\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.contains = function(source,operator,options) {\n\tvar results = [],\n\t\tfieldname = (operator.suffix || \"list\").toLowerCase();\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler) {\n\t\t\t\tvar list = tiddler.getFieldList(fieldname);\n\t\t\t\tif(list.indexOf(operator.operand) === -1) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler) {\n\t\t\t\tvar list = tiddler.getFieldList(fieldname);\n\t\t\t\tif(list.indexOf(operator.operand) !== -1) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/count.js": {
"title": "$:/core/modules/filters/count.js",
"text": "/*\\\ntitle: $:/core/modules/filters/count.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the number of entries in the current list.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.count = function(source,operator,options) {\n\tvar count = 0;\n\tsource(function(tiddler,title) {\n\t\tcount++;\n\t});\n\treturn [count + \"\"];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/days.js": {
"title": "$:/core/modules/filters/days.js",
"text": "/*\\\ntitle: $:/core/modules/filters/days.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that selects tiddlers with a specified date field within a specified date interval.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.days = function(source,operator,options) {\n\tvar results = [],\n\t\tfieldName = operator.suffix || \"modified\",\n\t\tdayInterval = (parseInt(operator.operand,10)||0),\n\t\tdayIntervalSign = $tw.utils.sign(dayInterval),\n\t\ttargetTimeStamp = (new Date()).setHours(0,0,0,0) + 1000*60*60*24*dayInterval,\n\t\tisWithinDays = function(dateField) {\n\t\t\tvar sign = $tw.utils.sign(targetTimeStamp - (new Date(dateField)).setHours(0,0,0,0));\n\t\t\treturn sign === 0 || sign === dayIntervalSign;\n\t\t};\n\n\tif(operator.prefix === \"!\") {\n\t\ttargetTimeStamp = targetTimeStamp - 1000*60*60*24*dayIntervalSign;\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler && tiddler.fields[fieldName]) {\n\t\t\t\tif(!isWithinDays($tw.utils.parseDate(tiddler.fields[fieldName]))) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler && tiddler.fields[fieldName]) {\n\t\t\t\tif(isWithinDays($tw.utils.parseDate(tiddler.fields[fieldName]))) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/deserializers.js": {
"title": "$:/core/modules/filters/deserializers.js",
"text": "/*\\\ntitle: $:/core/modules/filters/deserializers.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the deserializers in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.deserializers = function(source,operator,options) {\n\tvar results = [];\n\t$tw.utils.each($tw.Wiki.tiddlerDeserializerModules,function(deserializer,type) {\n\t\tresults.push(type);\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/duplicateslugs.js": {
"title": "$:/core/modules/filters/duplicateslugs.js",
"text": "/*\\\ntitle: $:/core/modules/filters/duplicateslugs.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter function for [duplicateslugs[]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.duplicateslugs = function(source,operator,options) {\n\tvar slugs = Object.create(null), // Hashmap by slug of title, replaced with \"true\" if the duplicate title has already been output\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tvar slug = options.wiki.slugify(title);\n\t\tif(slug in slugs) {\n\t\t\tif(slugs[slug] !== true) {\n\t\t\t\tresults.push(slugs[slug]);\n\t\t\t\tslugs[slug] = true;\n\t\t\t}\n\t\t\tresults.push(title);\n\t\t} else {\n\t\t\tslugs[slug] = title;\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/each.js": {
"title": "$:/core/modules/filters/each.js",
"text": "/*\\\ntitle: $:/core/modules/filters/each.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that selects one tiddler for each unique value of the specified field.\nWith suffix \"list\", selects all tiddlers that are values in a specified list field.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.each = function(source,operator,options) {\n\tvar results =[] ,\n\tvalue,values = {},\n\tfield = operator.operand || \"title\";\n\tif(operator.suffix === \"value\" && field === \"title\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!$tw.utils.hop(values,title)) {\n\t\t\t\tvalues[title] = true;\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else if(operator.suffix !== \"list-item\") {\n\t\tif(field === \"title\") {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler && !$tw.utils.hop(values,title)) {\n\t\t\t\t\tvalues[title] = true;\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler) {\n\t\t\t\t\tvalue = tiddler.getFieldString(field);\n\t\t\t\t\tif(!$tw.utils.hop(values,value)) {\n\t\t\t\t\t\tvalues[value] = true;\n\t\t\t\t\t\tresults.push(title);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler) {\n\t\t\t\t$tw.utils.each(\n\t\t\t\t\toptions.wiki.getTiddlerList(title,field),\n\t\t\t\t\tfunction(value) {\n\t\t\t\t\t\tif(!$tw.utils.hop(values,value)) {\n\t\t\t\t\t\t\tvalues[value] = true;\n\t\t\t\t\t\t\tresults.push(value);\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}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/eachday.js": {
"title": "$:/core/modules/filters/eachday.js",
"text": "/*\\\ntitle: $:/core/modules/filters/eachday.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that selects one tiddler for each unique day covered by the specified date field\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.eachday = function(source,operator,options) {\n\tvar results = [],\n\t\tvalues = [],\n\t\tfieldName = operator.operand || \"modified\";\n\t// Function to convert a date/time to a date integer\n\tvar toDate = function(value) {\n\t\tvalue = (new Date(value)).setHours(0,0,0,0);\n\t\treturn value+0;\n\t};\n\tsource(function(tiddler,title) {\n\t\tif(tiddler && tiddler.fields[fieldName]) {\n\t\t\tvar value = toDate($tw.utils.parseDate(tiddler.fields[fieldName]));\n\t\t\tif(values.indexOf(value) === -1) {\n\t\t\t\tvalues.push(value);\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/editiondescription.js": {
"title": "$:/core/modules/filters/editiondescription.js",
"text": "/*\\\ntitle: $:/core/modules/filters/editiondescription.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the descriptions of the specified edition names\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.editiondescription = function(source,operator,options) {\n\tvar results = [];\n\tif($tw.node) {\n\t\tvar editionInfo = $tw.utils.getEditionInfo();\n\t\tif(editionInfo) {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif($tw.utils.hop(editionInfo,title)) {\n\t\t\t\t\tresults.push(editionInfo[title].description || \"\");\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/editions.js": {
"title": "$:/core/modules/filters/editions.js",
"text": "/*\\\ntitle: $:/core/modules/filters/editions.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the available editions in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.editions = function(source,operator,options) {\n\tvar results = [];\n\tif($tw.node) {\n\t\tvar editionInfo = $tw.utils.getEditionInfo();\n\t\tif(editionInfo) {\n\t\t\t$tw.utils.each(editionInfo,function(info,name) {\n\t\t\t\tresults.push(name);\n\t\t\t});\n\t\t}\n\t\tresults.sort();\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/else.js": {
"title": "$:/core/modules/filters/else.js",
"text": "/*\\\ntitle: $:/core/modules/filters/else.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for replacing an empty input list with a constant, passing a non-empty input list straight through\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.else = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\tif(results.length === 0) {\n\t\treturn [operator.operand];\n\t} else {\n\t\treturn results;\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/decodeuricomponent.js": {
"title": "$:/core/modules/filters/decodeuricomponent.js",
"text": "/*\\\ntitle: $:/core/modules/filters/decodeuricomponent.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for applying decodeURIComponent() to each item.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter functions\n*/\n\nexports.decodeuricomponent = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar value = title;\n\t\ttry {\n\t\t\tvalue = decodeURIComponent(title);\n\t\t} catch(e) {\n\t\t}\n\t\tresults.push(value);\n\t});\n\treturn results;\n};\n\nexports.encodeuricomponent = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(encodeURIComponent(title));\n\t});\n\treturn results;\n};\n\nexports.decodeuri = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar value = title;\n\t\ttry {\n\t\t\tvalue = decodeURI(title);\n\t\t} catch(e) {\n\t\t}\n\t\tresults.push(value);\n\t});\n\treturn results;\n};\n\nexports.encodeuri = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(encodeURI(title));\n\t});\n\treturn results;\n};\n\nexports.decodehtml = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push($tw.utils.htmlDecode(title));\n\t});\n\treturn results;\n};\n\nexports.encodehtml = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push($tw.utils.htmlEncode(title));\n\t});\n\treturn results;\n};\n\nexports.stringify = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push($tw.utils.stringify(title,(operator.suffix === \"rawunicode\")));\n\t});\n\treturn results;\n};\n\nexports.jsonstringify = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push($tw.utils.jsonStringify(title,(operator.suffix === \"rawunicode\")));\n\t});\n\treturn results;\n};\n\nexports.escaperegexp = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push($tw.utils.escapeRegExp(title));\n\t});\n\treturn results;\n};\n\nexports.escapecss = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\t// escape any character with a special meaning in CSS using CSS.escape()\n\t\tresults.push($tw.utils.escapeCSS(title));\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/enlist.js": {
"title": "$:/core/modules/filters/enlist.js",
"text": "/*\\\ntitle: $:/core/modules/filters/enlist.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning its operand parsed as a list\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.enlist = function(source,operator,options) {\n\tvar allowDuplicates = false;\n\tswitch(operator.suffix) {\n\t\tcase \"raw\":\n\t\t\tallowDuplicates = true;\n\t\t\tbreak;\n\t\tcase \"dedupe\":\n\t\t\tallowDuplicates = false;\n\t\t\tbreak;\n\t}\n\tvar list = $tw.utils.parseStringArray(operator.operand,allowDuplicates);\n\tif(operator.prefix === \"!\") {\n\t\tvar results = [];\n\t\tsource(function(tiddler,title) {\n\t\t\tif(list.indexOf(title) === -1) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t\treturn results;\n\t} else {\n\t\treturn list;\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/field.js": {
"title": "$:/core/modules/filters/field.js",
"text": "/*\\\ntitle: $:/core/modules/filters/field.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for comparing fields for equality\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.field = function(source,operator,options) {\n\tvar results = [],indexedResults,\n\t\tfieldname = (operator.suffix || operator.operator || \"title\").toLowerCase();\n\tif(operator.prefix === \"!\") {\n\t\tif(operator.regexp) {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler) {\n\t\t\t\t\tvar text = tiddler.getFieldString(fieldname);\n\t\t\t\t\tif(text !== null && !operator.regexp.exec(text)) {\n\t\t\t\t\t\tresults.push(title);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler) {\n\t\t\t\t\tvar text = tiddler.getFieldString(fieldname);\n\t\t\t\t\tif(text !== null && text !== operator.operand) {\n\t\t\t\t\t\tresults.push(title);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t} else {\n\t\tif(operator.regexp) {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler) {\n\t\t\t\t\tvar text = tiddler.getFieldString(fieldname);\n\t\t\t\t\tif(text !== null && !!operator.regexp.exec(text)) {\n\t\t\t\t\t\tresults.push(title);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tif(source.byField && operator.operand) {\n\t\t\t\tindexedResults = source.byField(fieldname,operator.operand);\n\t\t\t\tif(indexedResults) {\n\t\t\t\t\treturn indexedResults\n\t\t\t\t}\n\t\t\t}\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler) {\n\t\t\t\t\tvar text = tiddler.getFieldString(fieldname);\n\t\t\t\t\tif(text !== null && text === operator.operand) {\n\t\t\t\t\t\tresults.push(title);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/fields.js": {
"title": "$:/core/modules/filters/fields.js",
"text": "/*\\\ntitle: $:/core/modules/filters/fields.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the fields on the selected tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.fields = function(source,operator,options) {\n\tvar results = [],\n\t\tfieldName,\n\t\tsuffixes = (operator.suffixes || [])[0] || [],\n\t\toperand = $tw.utils.parseStringArray(operator.operand);\n\n\tsource(function(tiddler,title) {\n\t\tif(tiddler) {\n\t\t\tif(suffixes.indexOf(\"include\") !== -1) {\n\t\t\t\tfor(fieldName in tiddler.fields) {\n\t\t\t\t\t(operand.indexOf(fieldName) !== -1) ? $tw.utils.pushTop(results,fieldName) : \"\";\n\t\t\t\t}\n\t\t\t} else if (suffixes.indexOf(\"exclude\") !== -1) {\n\t\t\t\tfor(fieldName in tiddler.fields) {\n\t\t\t\t\t(operand.indexOf(fieldName) !== -1) ? \"\" : $tw.utils.pushTop(results,fieldName);\n\t\t\t\t}\n\t\t\t} // else if\n\t\t\telse {\n\t\t\t\tfor(fieldName in tiddler.fields) {\n\t\t\t\t\t$tw.utils.pushTop(results,fieldName);\n\t\t\t\t}\n\t\t\t} // else\n\t\t} // if (tiddler)\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/filter.js": {
"title": "$:/core/modules/filters/filter.js",
"text": "/*\\\ntitle: $:/core/modules/filters/filter.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning those input titles that pass a subfilter\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.filter = function(source,operator,options) {\n\tvar filterFn = options.wiki.compileFilter(operator.operand),\n\t\tresults = [],\n\t\ttarget = operator.prefix !== \"!\";\n\tsource(function(tiddler,title) {\n\t\tvar list = filterFn.call(options.wiki,options.wiki.makeTiddlerIterator([title]),{\n\t\t\t\tgetVariable: function(name) {\n\t\t\t\t\tswitch(name) {\n\t\t\t\t\t\tcase \"currentTiddler\":\n\t\t\t\t\t\t\treturn \"\" + title;\n\t\t\t\t\t\tcase \"..currentTiddler\":\n\t\t\t\t\t\t\treturn options.widget.getVariable(\"currentTiddler\");\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn options.widget.getVariable(name);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\tif((list.length > 0) === target) {\n\t\t\tresults.push(title);\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/format/date.js": {
"title": "$:/core/modules/filters/format/date.js",
"text": "/*\\\ntitle: $:/core/modules/filters/format/date.js\ntype: application/javascript\nmodule-type: formatfilteroperator\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.date = function(source,operand,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar value = $tw.utils.parseDate(title);\n\t\tif(value && $tw.utils.isDate(value) && value.toString() !== \"Invalid Date\") {\n\t\t\tresults.push($tw.utils.formatDateString(value,operand || \"YYYY MM DD 0hh:0mm\"));\n\t\t}\n\t});\n\treturn results;\n};\n\n})();",
"type": "application/javascript",
"module-type": "formatfilteroperator"
},
"$:/core/modules/filters/format/relativedate.js": {
"title": "$:/core/modules/filters/format/relativedate.js",
"text": "/*\\\ntitle: $:/core/modules/filters/format/relativedate.js\ntype: application/javascript\nmodule-type: formatfilteroperator\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.relativedate = function(source,operand,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar value = $tw.utils.parseDate(title);\n\t\tif(value && $tw.utils.isDate(value) && value.toString() !== \"Invalid Date\") {\n\t\t\tresults.push($tw.utils.getRelativeDate((new Date()) - (new Date(value))).description);\n\t\t}\n\t});\n\treturn results;\n};\n\n})();",
"type": "application/javascript",
"module-type": "formatfilteroperator"
},
"$:/core/modules/filters/format/titlelist.js": {
"title": "$:/core/modules/filters/format/titlelist.js",
"text": "/*\\\ntitle: $:/core/modules/filters/format/titlelist.js\ntype: application/javascript\nmodule-type: formatfilteroperator\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.titlelist = function(source,operand,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tif(title && title.length) {\n\t\t\tresults.push($tw.utils.stringifyList([title]));\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "formatfilteroperator"
},
"$:/core/modules/filters/format.js": {
"title": "$:/core/modules/filters/format.js",
"text": "/*\\\ntitle: $:/core/modules/filters/format.js\ntype: application/javascript\nmodule-type: filteroperator\nFilter operator for formatting strings\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar formatFilterOperators;\n\nfunction getFormatFilterOperators() {\n\tif(!formatFilterOperators) {\n\t\tformatFilterOperators = {};\n\t\t$tw.modules.applyMethods(\"formatfilteroperator\",formatFilterOperators);\n\t}\n\treturn formatFilterOperators;\n}\n\n/*\nExport our filter function\n*/\nexports.format = function(source,operator,options) {\n\t// Dispatch to the correct formatfilteroperator\n\tvar formatFilterOperators = getFormatFilterOperators();\n\tif(operator.suffix) {\n\t\tvar formatFilterOperator = formatFilterOperators[operator.suffix];\n\t\tif(formatFilterOperator) {\n\t\t\treturn formatFilterOperator(source,operator.operand,options);\n\t\t} else {\n\t\t\treturn [$tw.language.getString(\"Error/FormatFilterOperator\")];\n\t\t}\n\t} else {\n\t\t// Return all unchanged if the suffix is missing\n\t\tvar results = [];\n\t\tsource(function(tiddler,title) {\n\t\t\tresults.push(title);\n\t\t});\n\t\treturn results;\n\t}\n};\n\n})();",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/get.js": {
"title": "$:/core/modules/filters/get.js",
"text": "/*\\\ntitle: $:/core/modules/filters/get.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for replacing tiddler titles by the value of the field specified in the operand.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.get = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tif(tiddler) {\n\t\t\tvar value = tiddler.getFieldString(operator.operand);\n\t\t\tif(value) {\n\t\t\t\tresults.push(value);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/getindex.js": {
"title": "$:/core/modules/filters/getindex.js",
"text": "/*\\\ntitle: $:/core/modules/filters/getindex.js\ntype: application/javascript\nmodule-type: filteroperator\n\nreturns the value at a given index of datatiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.getindex = function(source,operator,options) {\n\tvar data,title,results = [];\n\tif(operator.operand){\n\t\tsource(function(tiddler,title) {\n\t\t\ttitle = tiddler ? tiddler.fields.title : title;\n\t\t\tdata = options.wiki.extractTiddlerDataItem(tiddler,operator.operand);\n\t\t\tif(data) {\n\t\t\t\tresults.push(data);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/getvariable.js": {
"title": "$:/core/modules/filters/getvariable.js",
"text": "/*\\\ntitle: $:/core/modules/filters/getvariable.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for replacing input values by the value of the variable with the same name, or blank if the variable is missing\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.getvariable = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(options.widget.getVariable(title) || \"\");\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/has.js": {
"title": "$:/core/modules/filters/has.js",
"text": "/*\\\ntitle: $:/core/modules/filters/has.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking if a tiddler has the specified field or index\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.has = function(source,operator,options) {\n\tvar results = [],\n\t\tinvert = operator.prefix === \"!\";\n\n\tif(operator.suffix === \"field\") {\n\t\tif(invert) {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(!tiddler || (tiddler && (!$tw.utils.hop(tiddler.fields,operator.operand)))) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler && $tw.utils.hop(tiddler.fields,operator.operand)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\telse if(operator.suffix === \"index\") {\n\t\tif(invert) {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(!tiddler || (tiddler && (!$tw.utils.hop(options.wiki.getTiddlerDataCached(tiddler,Object.create(null)),operator.operand)))) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler && $tw.utils.hop(options.wiki.getTiddlerDataCached(tiddler,Object.create(null)),operator.operand)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\telse {\n\t\tif(invert) {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(!tiddler || !$tw.utils.hop(tiddler.fields,operator.operand) || (tiddler.fields[operator.operand].length === 0)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && (tiddler.fields[operator.operand].length !== 0)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/haschanged.js": {
"title": "$:/core/modules/filters/haschanged.js",
"text": "/*\\\ntitle: $:/core/modules/filters/haschanged.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returns tiddlers from the list that have a non-zero changecount.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.haschanged = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.getChangeCount(title) === 0) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.getChangeCount(title) > 0) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/indexes.js": {
"title": "$:/core/modules/filters/indexes.js",
"text": "/*\\\ntitle: $:/core/modules/filters/indexes.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the indexes of a data tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.indexes = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar data = options.wiki.getTiddlerDataCached(title);\n\t\tif(data) {\n\t\t\t$tw.utils.pushTop(results,Object.keys(data));\n\t\t}\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/insertbefore.js": {
"title": "$:/core/modules/filters/insertbefore.js",
"text": "/*\\\ntitle: $:/core/modules/filters/insertbefore.js\ntype: application/javascript\nmodule-type: filteroperator\n\nInsert an item before another item in a list\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nOrder a list\n*/\nexports.insertbefore = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\tvar target = options.widget && options.widget.getVariable(operator.suffix || \"currentTiddler\");\n\tif(target !== operator.operand) {\n\t\t// Remove the entry from the list if it is present\n\t\tvar pos = results.indexOf(operator.operand);\n\t\tif(pos !== -1) {\n\t\t\tresults.splice(pos,1);\n\t\t}\n\t\t// Insert the entry before the target marker\n\t\tpos = results.indexOf(target);\n\t\tif(pos !== -1) {\n\t\t\tresults.splice(pos,0,operator.operand);\n\t\t} else {\n\t\t\tresults.push(operator.operand);\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/is/binary.js": {
"title": "$:/core/modules/filters/is/binary.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/binary.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[binary]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.binary = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!options.wiki.isBinaryTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.isBinaryTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/blank.js": {
"title": "$:/core/modules/filters/is/blank.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/blank.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[blank]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.blank = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!title) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/current.js": {
"title": "$:/core/modules/filters/is/current.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/current.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[current]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.current = function(source,prefix,options) {\n\tvar results = [],\n\t\tcurrTiddlerTitle = options.widget && options.widget.getVariable(\"currentTiddler\");\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title !== currTiddlerTitle) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title === currTiddlerTitle) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/draft.js": {
"title": "$:/core/modules/filters/is/draft.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/draft.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[draft]] analagous to [has[draft.of]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.draft = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!tiddler || !$tw.utils.hop(tiddler.fields,\"draft.of\")) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler && $tw.utils.hop(tiddler.fields,\"draft.of\") && (tiddler.fields[\"draft.of\"].length !== 0)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/image.js": {
"title": "$:/core/modules/filters/is/image.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/image.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[image]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.image = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!options.wiki.isImageTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.isImageTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/missing.js": {
"title": "$:/core/modules/filters/is/missing.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/missing.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[missing]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.missing = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.tiddlerExists(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!options.wiki.tiddlerExists(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/orphan.js": {
"title": "$:/core/modules/filters/is/orphan.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/orphan.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[orphan]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.orphan = function(source,prefix,options) {\n\tvar results = [],\n\t\torphanTitles = options.wiki.getOrphanTitles();\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(orphanTitles.indexOf(title) === -1) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(orphanTitles.indexOf(title) !== -1) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/shadow.js": {
"title": "$:/core/modules/filters/is/shadow.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/shadow.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[shadow]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.shadow = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!options.wiki.isShadowTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.isShadowTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/system.js": {
"title": "$:/core/modules/filters/is/system.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/system.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[system]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.system = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!options.wiki.isSystemTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.isSystemTiddler(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/tag.js": {
"title": "$:/core/modules/filters/is/tag.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/tag.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[tag]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tag = function(source,prefix,options) {\n\tvar results = [],\n\t\ttagMap = options.wiki.getTagMap();\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!$tw.utils.hop(tagMap,title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif($tw.utils.hop(tagMap,title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/tiddler.js": {
"title": "$:/core/modules/filters/is/tiddler.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/tiddler.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[tiddler]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tiddler = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!options.wiki.tiddlerExists(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(options.wiki.tiddlerExists(title)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is/variable.js": {
"title": "$:/core/modules/filters/is/variable.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is/variable.js\ntype: application/javascript\nmodule-type: isfilteroperator\n\nFilter function for [is[variable]]\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.variable = function(source,prefix,options) {\n\tvar results = [];\n\tif(prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!(title in options.widget.variables)) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title in options.widget.variables) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "isfilteroperator"
},
"$:/core/modules/filters/is.js": {
"title": "$:/core/modules/filters/is.js",
"text": "/*\\\ntitle: $:/core/modules/filters/is.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking tiddler properties\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar isFilterOperators;\n\nfunction getIsFilterOperators() {\n\tif(!isFilterOperators) {\n\t\tisFilterOperators = {};\n\t\t$tw.modules.applyMethods(\"isfilteroperator\",isFilterOperators);\n\t}\n\treturn isFilterOperators;\n}\n\n/*\nExport our filter function\n*/\nexports.is = function(source,operator,options) {\n\t// Dispatch to the correct isfilteroperator\n\tvar isFilterOperators = getIsFilterOperators();\n\tif(operator.operand) {\n\t\tvar isFilterOperator = isFilterOperators[operator.operand];\n\t\tif(isFilterOperator) {\n\t\t\treturn isFilterOperator(source,operator.prefix,options);\n\t\t} else {\n\t\t\treturn [$tw.language.getString(\"Error/IsFilterOperator\")];\n\t\t}\n\t} else {\n\t\t// Return all tiddlers if the operand is missing\n\t\tvar results = [];\n\t\tsource(function(tiddler,title) {\n\t\t\tresults.push(title);\n\t\t});\n\t\treturn results;\n\t}\n};\n\n})();",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/limit.js": {
"title": "$:/core/modules/filters/limit.js",
"text": "/*\\\ntitle: $:/core/modules/filters/limit.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for chopping the results to a specified maximum number of entries\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.limit = function(source,operator,options) {\n\tvar results = [];\n\t// Convert to an array\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\t// Slice the array if necessary\n\tvar limit = Math.min(results.length,parseInt(operator.operand,10));\n\tif(operator.prefix === \"!\") {\n\t\tresults = results.slice(-limit);\n\t} else {\n\t\tresults = results.slice(0,limit);\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/links.js": {
"title": "$:/core/modules/filters/links.js",
"text": "/*\\\ntitle: $:/core/modules/filters/links.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning all the links from a tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.links = function(source,operator,options) {\n\tvar results = new $tw.utils.LinkedList();\n\tsource(function(tiddler,title) {\n\t\tresults.pushTop(options.wiki.getTiddlerLinks(title));\n\t});\n\treturn results.toArray();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/list.js": {
"title": "$:/core/modules/filters/list.js",
"text": "/*\\\ntitle: $:/core/modules/filters/list.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddlers whose title is listed in the operand tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.list = function(source,operator,options) {\n\tvar results = [],\n\t\ttr = $tw.utils.parseTextReference(operator.operand),\n\t\tcurrTiddlerTitle = options.widget && options.widget.getVariable(\"currentTiddler\"),\n\t\tlist = options.wiki.getTiddlerList(tr.title || currTiddlerTitle,tr.field,tr.index);\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(list.indexOf(title) === -1) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tresults = list;\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/listed.js": {
"title": "$:/core/modules/filters/listed.js",
"text": "/*\\\ntitle: $:/core/modules/filters/listed.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all tiddlers that have the selected tiddlers in a list\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.listed = function(source,operator,options) {\n\tvar field = operator.operand || \"list\",\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\t$tw.utils.pushTop(results,options.wiki.findListingsOfTiddler(title,field));\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/listops.js": {
"title": "$:/core/modules/filters/listops.js",
"text": "/*\\\ntitle: $:/core/modules/filters/listops.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operators for manipulating the current selection list\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nOrder a list\n*/\nexports.order = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.operand.toLowerCase() === \"reverse\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tresults.unshift(title);\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tresults.push(title);\n\t\t});\n\t}\n\treturn results;\n};\n\n/*\nReverse list\n*/\nexports.reverse = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.unshift(title);\n\t});\n\treturn results;\n};\n\n/*\nFirst entry/entries in list\n*/\nexports.first = function(source,operator,options) {\n\tvar count = $tw.utils.getInt(operator.operand,1),\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results.slice(0,count);\n};\n\n/*\nLast entry/entries in list\n*/\nexports.last = function(source,operator,options) {\n\tvar count = $tw.utils.getInt(operator.operand,1),\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results.slice(-count);\n};\n\n/*\nAll but the first entry/entries of the list\n*/\nexports.rest = function(source,operator,options) {\n\tvar count = $tw.utils.getInt(operator.operand,1),\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results.slice(count);\n};\nexports.butfirst = exports.rest;\nexports.bf = exports.rest;\n\n/*\nAll but the last entry/entries of the list\n*/\nexports.butlast = function(source,operator,options) {\n\tvar count = $tw.utils.getInt(operator.operand,1),\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results.slice(0,-count);\n};\nexports.bl = exports.butlast;\n\n/*\nThe nth member of the list\n*/\nexports.nth = function(source,operator,options) {\n\tvar count = $tw.utils.getInt(operator.operand,1),\n\t\tresults = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results.slice(count - 1,count);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/lookup.js": {
"title": "$:/core/modules/filters/lookup.js",
"text": "/*\\\ntitle: $:/core/modules/filters/lookup.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that looks up values via a title prefix\n\n[lookup:<field>[<prefix>]]\n\nPrepends the prefix to the selected items and returns the specified field value\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.lookup = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(options.wiki.getTiddlerText(operator.operand + title) || operator.suffix || '');\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/match.js": {
"title": "$:/core/modules/filters/match.js",
"text": "/*\\\ntitle: $:/core/modules/filters/match.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking if a title matches a string\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.match = function(source,operator,options) {\n\tvar results = [],\n\t\tsuffixes = (operator.suffixes || [])[0] || [];\n\tif(suffixes.indexOf(\"caseinsensitive\") !== -1) {\n\t\tif(operator.prefix === \"!\") {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(title.toLowerCase() !== (operator.operand || \"\").toLowerCase()) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(title.toLowerCase() === (operator.operand || \"\").toLowerCase()) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t} else {\n\t\tif(operator.prefix === \"!\") {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(title !== operator.operand) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(title === operator.operand) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/math.js": {
"title": "$:/core/modules/filters/math.js",
"text": "/*\\\ntitle: $:/core/modules/filters/math.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operators for math. Unary/binary operators work on each item in turn, and return a new item list.\n\nSum/product/maxall/minall operate on the entire list, returning a single item.\n\nNote that strings are converted to numbers automatically. Trailing non-digits are ignored.\n\n* \"\" converts to 0\n* \"12kk\" converts to 12\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.negate = makeNumericBinaryOperator(\n\tfunction(a) {return -a}\n);\n\nexports.abs = makeNumericBinaryOperator(\n\tfunction(a) {return Math.abs(a)}\n);\n\nexports.ceil = makeNumericBinaryOperator(\n\tfunction(a) {return Math.ceil(a)}\n);\n\nexports.floor = makeNumericBinaryOperator(\n\tfunction(a) {return Math.floor(a)}\n);\n\nexports.round = makeNumericBinaryOperator(\n\tfunction(a) {return Math.round(a)}\n);\n\nexports.trunc = makeNumericBinaryOperator(\n\tfunction(a) {return Math.trunc(a)}\n);\n\nexports.untrunc = makeNumericBinaryOperator(\n\tfunction(a) {return Math.ceil(Math.abs(a)) * Math.sign(a)}\n);\n\nexports.sign = makeNumericBinaryOperator(\n\tfunction(a) {return Math.sign(a)}\n);\n\nexports.add = makeNumericBinaryOperator(\n\tfunction(a,b) {return a + b;}\n);\n\nexports.subtract = makeNumericBinaryOperator(\n\tfunction(a,b) {return a - b;}\n);\n\nexports.multiply = makeNumericBinaryOperator(\n\tfunction(a,b) {return a * b;}\n);\n\nexports.divide = makeNumericBinaryOperator(\n\tfunction(a,b) {return a / b;}\n);\n\nexports.remainder = makeNumericBinaryOperator(\n\tfunction(a,b) {return a % b;}\n);\n\nexports.max = makeNumericBinaryOperator(\n\tfunction(a,b) {return Math.max(a,b);}\n);\n\nexports.min = makeNumericBinaryOperator(\n\tfunction(a,b) {return Math.min(a,b);}\n);\n\nexports.fixed = makeNumericBinaryOperator(\n\tfunction(a,b) {return Number.prototype.toFixed.call(a,Math.min(Math.max(b,0),100));}\n);\n\nexports.precision = makeNumericBinaryOperator(\n\tfunction(a,b) {return Number.prototype.toPrecision.call(a,Math.min(Math.max(b,1),100));}\n);\n\nexports.exponential = makeNumericBinaryOperator(\n\tfunction(a,b) {return Number.prototype.toExponential.call(a,Math.min(Math.max(b,0),100));}\n);\n\nexports.power = makeNumericBinaryOperator(\n\tfunction(a,b) {return Math.pow(a,b);}\n);\n\nexports.log = makeNumericBinaryOperator(\n\tfunction(a,b) {\n\t\tif(b) {\n\t\t\treturn Math.log(a)/Math.log(b);\n\t\t} else {\n\t\t\treturn Math.log(a);\n\t\t}\n\t}\n);\n\nexports.sum = makeNumericReducingOperator(\n\tfunction(accumulator,value) {return accumulator + value},\n\t0 // Initial value\n);\n\nexports.product = makeNumericReducingOperator(\n\tfunction(accumulator,value) {return accumulator * value},\n\t1 // Initial value\n);\n\nexports.maxall = makeNumericReducingOperator(\n\tfunction(accumulator,value) {return Math.max(accumulator,value)},\n\t-Infinity // Initial value\n);\n\nexports.minall = makeNumericReducingOperator(\n\tfunction(accumulator,value) {return Math.min(accumulator,value)},\n\tInfinity // Initial value\n);\n\nexports.median = makeNumericArrayOperator(\n\tfunction(values) {\n\t\tvar len = values.length, median;\n\t\tvalues.sort();\n\t\tif(len % 2) { \n\t\t\t// Odd, return the middle number\n\t\t\tmedian = values[(len - 1) / 2];\n\t\t} else {\n\t\t\t// Even, return average of two middle numbers\n\t\t\tmedian = (values[len / 2 - 1] + values[len / 2]) / 2;\n\t\t}\n\t\treturn [median];\n\t}\n);\n\nexports.average = makeNumericReducingOperator(\n\tfunction(accumulator,value) {return accumulator + value},\n\t0, // Initial value\n\tfunction(finalValue,numberOfValues) {\n\t\treturn finalValue/numberOfValues;\n\t}\n);\n\nexports.variance = makeNumericReducingOperator(\n\tfunction(accumulator,value) {return accumulator + value},\n\t0,\n\tfunction(finalValue,numberOfValues,originalValues) {\n\t\treturn getVarianceFromArray(originalValues,finalValue/numberOfValues);\n\t}\n);\n\nexports[\"standard-deviation\"] = makeNumericReducingOperator(\n\tfunction(accumulator,value) {return accumulator + value},\n\t0,\n\tfunction(finalValue,numberOfValues,originalValues) {\n\t\tvar variance = getVarianceFromArray(originalValues,finalValue/numberOfValues);\n\t\treturn Math.sqrt(variance);\n\t}\n);\n\n//Calculate the variance of a population of numbers in an array given its mean\nfunction getVarianceFromArray(values,mean) {\n\tvar deviationTotal = values.reduce(function(accumulator,value) {\n\t\treturn accumulator + Math.pow(value - mean, 2);\n\t},0);\n\treturn deviationTotal/values.length;\n};\n\nfunction makeNumericBinaryOperator(fnCalc) {\n\treturn function(source,operator,options) {\n\t\tvar result = [],\n\t\t\tnumOperand = $tw.utils.parseNumber(operator.operand);\n\t\tsource(function(tiddler,title) {\n\t\t\tresult.push($tw.utils.stringifyNumber(fnCalc($tw.utils.parseNumber(title),numOperand)));\n\t\t});\n\t\treturn result;\n\t};\n};\n\nfunction makeNumericReducingOperator(fnCalc,initialValue,fnFinal) {\n\tinitialValue = initialValue || 0;\n\treturn function(source,operator,options) {\n\t\tvar result = [];\n\t\tsource(function(tiddler,title) {\n\t\t\tresult.push($tw.utils.parseNumber(title));\n\t\t});\n\t\tvar value = result.reduce(function(accumulator,currentValue) {\n\t\t\t\treturn fnCalc(accumulator,currentValue);\n\t\t\t},initialValue);\n\t\tif(fnFinal) {\n\t\t\tvalue = fnFinal(value,result.length,result);\n\t\t}\n\t\treturn [$tw.utils.stringifyNumber(value)];\n\t};\n};\n\nfunction makeNumericArrayOperator(fnCalc) {\n\treturn function(source,operator,options) {\n\t\tvar results = [];\n\t\tsource(function(tiddler,title) {\n\t\t\tresults.push($tw.utils.parseNumber(title));\n\t\t});\n\t\tresults = fnCalc(results);\n\t\t$tw.utils.each(results,function(value,index) {\n\t\t\tresults[index] = $tw.utils.stringifyNumber(value);\n\t\t});\n\t\treturn results;\n\t};\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/minlength.js": {
"title": "$:/core/modules/filters/minlength.js",
"text": "/*\\\ntitle: $:/core/modules/filters/minlength.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for filtering out titles that don't meet the minimum length in the operand\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.minlength = function(source,operator,options) {\n\tvar results = [],\n\t\tminLength = parseInt(operator.operand || \"\",10) || 0;\n\tsource(function(tiddler,title) {\n\t\tif(title.length >= minLength) {\n\t\t\tresults.push(title);\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/moduleproperty.js": {
"title": "$:/core/modules/filters/moduleproperty.js",
"text": "/*\\\ntitle: $:/core/modules/filters/moduleproperty.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter [[module-name]moduleproperty[name]] retrieve a module property\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.moduleproperty = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar value = require(title)[operator.operand || \"\"];\n\t\tif(value !== undefined) {\n\t\t\tresults.push(value);\n\t\t}\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/modules.js": {
"title": "$:/core/modules/filters/modules.js",
"text": "/*\\\ntitle: $:/core/modules/filters/modules.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the titles of the modules of a given type in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.modules = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.operands.length === 1) {\n\t\t// Return all the module names without filtering\n\t\tsource(function(tiddler,title) {\n\t\t\t$tw.utils.each($tw.modules.types[title],function(moduleInfo,moduleName) {\n\t\t\t\tresults.push(moduleName);\n\t\t\t});\n\t\t});\n\t} else if(operator.operands.length >= 2) {\n\t\t// Return the modules that have the module property specified in the first operand with the value in the second operand\n\t\tsource(function(tiddler,title) {\n\t\t\t$tw.utils.each($tw.modules.types[title],function(moduleInfo,moduleName) {\n\t\t\t\tif(require(moduleName)[operator.operands[0]] === operator.operands[1]) {\n\t\t\t\t\tresults.push(moduleName);\t\t\t\t\t\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/modulestring.js": {
"title": "$:/core/modules/filters/modulestring.js",
"text": "/*\\\ntitle: $:/core/modules/filters/modulestring.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter [[module-name]modulestring[en-gb]] retrieve a module strings in a particular language\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.modulestring = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar s = $tw.modules.getModuleString(title,operator.operands[0] || \"\",operator.operands[1] || \"\");\n\t\tif(s !== null) {\n\t\t\tresults.push(s);\n\t\t}\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/moduletypes.js": {
"title": "$:/core/modules/filters/moduletypes.js",
"text": "/*\\\ntitle: $:/core/modules/filters/moduletypes.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the module types in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.moduletypes = function(source,operator,options) {\n\tvar results = [];\n\t$tw.utils.each($tw.modules.types,function(moduleInfo,type) {\n\t\tresults.push(type);\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/next.js": {
"title": "$:/core/modules/filters/next.js",
"text": "/*\\\ntitle: $:/core/modules/filters/next.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddler whose title occurs next in the list supplied in the operand tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.next = function(source,operator,options) {\n\tvar results = [],\n\t\tlist = options.wiki.getTiddlerList(operator.operand);\n\tsource(function(tiddler,title) {\n\t\tvar match = list.indexOf(title);\n\t\t// increment match and then test if result is in range\n\t\tmatch++;\n\t\tif(match > 0 && match < list.length) {\n\t\t\tresults.push(list[match]);\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/plugintiddlers.js": {
"title": "$:/core/modules/filters/plugintiddlers.js",
"text": "/*\\\ntitle: $:/core/modules/filters/plugintiddlers.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the titles of the shadow tiddlers within a plugin\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.plugintiddlers = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar pluginInfo = options.wiki.getPluginInfo(title) || options.wiki.getTiddlerDataCached(title,{tiddlers:[]});\n\t\tif(pluginInfo && pluginInfo.tiddlers) {\n\t\t\t$tw.utils.each(pluginInfo.tiddlers,function(fields,title) {\n\t\t\t\tresults.push(title);\n\t\t\t});\n\t\t}\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/prefix.js": {
"title": "$:/core/modules/filters/prefix.js",
"text": "/*\\\ntitle: $:/core/modules/filters/prefix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking if a title starts with a prefix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.prefix = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title.substr(0,operator.operand.length) !== operator.operand) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title.substr(0,operator.operand.length) === operator.operand) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/previous.js": {
"title": "$:/core/modules/filters/previous.js",
"text": "/*\\\ntitle: $:/core/modules/filters/previous.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning the tiddler whose title occurs immediately prior in the list supplied in the operand tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.previous = function(source,operator,options) {\n\tvar results = [],\n\t\tlist = options.wiki.getTiddlerList(operator.operand);\n\tsource(function(tiddler,title) {\n\t\tvar match = list.indexOf(title);\n\t\t// increment match and then test if result is in range\n\t\tmatch--;\n\t\tif(match >= 0) {\n\t\t\tresults.push(list[match]);\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/range.js": {
"title": "$:/core/modules/filters/range.js",
"text": "/*\\\ntitle: $:/core/modules/filters/range.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for generating a numeric range.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.range = function(source,operator,options) {\n\tvar results = [];\n\t// Split the operand into numbers delimited by these symbols\n\tvar parts = operator.operand.split(/[,:;]/g),\n\t\tbeg, end, inc, i, fixed = 0;\n\tfor (i=0; i<parts.length; i++) {\n\t\t// Validate real number\n\t\tif(!/^\\s*[+-]?((\\d+(\\.\\d*)?)|(\\.\\d+))\\s*$/.test(parts[i])) {\n\t\t\treturn [\"range: bad number \\\"\" + parts[i] + \"\\\"\"];\n\t\t}\n\t\t// Count digits; the most precise number determines decimal places in output.\n\t\tvar frac = /\\.\\d+/.exec(parts[i]);\n\t\tif(frac) {\n\t\t\tfixed = Math.max(fixed,frac[0].length-1);\n\t\t}\n\t\tparts[i] = parseFloat(parts[i]);\n\t}\n\tswitch(parts.length) {\n\t\tcase 1:\n\t\t\tend = parts[0];\n\t\t\tif (end >= 1) {\n\t\t\t\tbeg = 1;\n\t\t\t}\n\t\t\telse if (end <= -1) {\n\t\t\t\tbeg = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tinc = 1;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tbeg = parts[0];\n\t\t\tend = parts[1];\n\t\t\tinc = 1;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tbeg = parts[0];\n\t\t\tend = parts[1];\n\t\t\tinc = Math.abs(parts[2]);\n\t\t\tbreak;\n\t}\n\tif(inc === 0) {\n\t\treturn [\"range: increment 0 causes infinite loop\"];\n\t}\n\t// May need to count backwards\n\tvar direction = ((end < beg) ? -1 : 1);\n\tinc *= direction;\n\t// Estimate number of resulting elements\n\tif((end - beg) / inc > 10000) {\n\t\treturn [\"range: too many steps (over 10K)\"];\n\t}\n\t// Avoid rounding error on last step\n\tend += direction * 0.5 * Math.pow(0.1,fixed);\n\tvar safety = 10010;\n\t// Enumerate the range\n\tif (end<beg) {\n\t\tfor(i=beg; i>end; i+=inc) {\n\t\t\tresults.push(i.toFixed(fixed));\n\t\t\tif(--safety<0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor(i=beg; i<end; i+=inc) {\n\t\t\tresults.push(i.toFixed(fixed));\n\t\t\tif(--safety<0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif(safety<0) {\n\t\treturn [\"range: unexpectedly large output\"];\n\t}\n\t// Reverse?\n\tif(operator.prefix === \"!\") {\n\t\tresults.reverse();\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/reduce.js": {
"title": "$:/core/modules/filters/reduce.js",
"text": "/*\\\ntitle: $:/core/modules/filters/reduce.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator evaluates a subfilter for each item, making the running total available in the variable `accumulator`, and the current index available in the variable `index`\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.reduce = function(source,operator,options) {\n\t// Accumulate the list\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\t// Run the filter over each item\n\tvar filterFn = options.wiki.compileFilter(operator.operand),\n\t\taccumulator = operator.operands[1] || \"\";\n\tfor(var index=0; index<results.length; index++) {\n\t\tvar title = results[index],\n\t\t\tlist = filterFn.call(options.wiki,options.wiki.makeTiddlerIterator([title]),{\n\t\t\t\tgetVariable: function(name) {\n\t\t\t\t\tswitch(name) {\n\t\t\t\t\t\tcase \"currentTiddler\":\n\t\t\t\t\t\t\treturn \"\" + title;\n\t\t\t\t\t\tcase \"..currentTiddler\":\n\t\t\t\t\t\t\treturn options.widget.getVariable(\"currentTiddler\");\n\t\t\t\t\t\tcase \"accumulator\":\n\t\t\t\t\t\t\treturn \"\" + accumulator;\n\t\t\t\t\t\tcase \"index\":\n\t\t\t\t\t\t\treturn \"\" + index;\n\t\t\t\t\t\tcase \"revIndex\":\n\t\t\t\t\t\t\treturn \"\" + (results.length - 1 - index);\n\t\t\t\t\t\tcase \"length\":\n\t\t\t\t\t\t\treturn \"\" + results.length;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn options.widget.getVariable(name);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\tif(list.length > 0) {\n\t\t\taccumulator = \"\" + list[0];\n\t\t}\n\t}\n\tif(results.length > 0) {\n\t\treturn [accumulator];\n\t} else {\n\t\treturn [];\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/regexp.js": {
"title": "$:/core/modules/filters/regexp.js",
"text": "/*\\\ntitle: $:/core/modules/filters/regexp.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for regexp matching\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.regexp = function(source,operator,options) {\n\tvar results = [],\n\t\tfieldname = (operator.suffix || \"title\").toLowerCase(),\n\t\tregexpString, regexp, flags = \"\", match,\n\t\tgetFieldString = function(tiddler,title) {\n\t\t\tif(tiddler) {\n\t\t\t\treturn tiddler.getFieldString(fieldname);\n\t\t\t} else if(fieldname === \"title\") {\n\t\t\t\treturn title;\n\t\t\t} else {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t};\n\t// Process flags and construct regexp\n\tregexpString = operator.operand;\n\tmatch = /^\\(\\?([gim]+)\\)/.exec(regexpString);\n\tif(match) {\n\t\tflags = match[1];\n\t\tregexpString = regexpString.substr(match[0].length);\n\t} else {\n\t\tmatch = /\\(\\?([gim]+)\\)$/.exec(regexpString);\n\t\tif(match) {\n\t\t\tflags = match[1];\n\t\t\tregexpString = regexpString.substr(0,regexpString.length - match[0].length);\n\t\t}\n\t}\n\ttry {\n\t\tregexp = new RegExp(regexpString,flags);\n\t} catch(e) {\n\t\treturn [\"\" + e];\n\t}\n\t// Process the incoming tiddlers\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tvar text = getFieldString(tiddler,title);\n\t\t\tif(text !== null) {\n\t\t\t\tif(!regexp.exec(text)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tvar text = getFieldString(tiddler,title);\n\t\t\tif(text !== null) {\n\t\t\t\tif(!!regexp.exec(text)) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/removeprefix.js": {
"title": "$:/core/modules/filters/removeprefix.js",
"text": "/*\\\ntitle: $:/core/modules/filters/removeprefix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for removing a prefix from each title in the list. Titles that do not start with the prefix are removed.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.removeprefix = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tif(title.substr(0,operator.operand.length) === operator.operand) {\n\t\t\tresults.push(title.substr(operator.operand.length));\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/removesuffix.js": {
"title": "$:/core/modules/filters/removesuffix.js",
"text": "/*\\\ntitle: $:/core/modules/filters/removesuffix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for removing a suffix from each title in the list. Titles that do not end with the suffix are removed.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.removesuffix = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tif(title && title.substr(-operator.operand.length) === operator.operand) {\n\t\t\tresults.push(title.substr(0,title.length - operator.operand.length));\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/sameday.js": {
"title": "$:/core/modules/filters/sameday.js",
"text": "/*\\\ntitle: $:/core/modules/filters/sameday.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that selects tiddlers with a modified date field on the same day as the provided value.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.sameday = function(source,operator,options) {\n\tvar results = [],\n\t\tfieldName = operator.suffix || \"modified\",\n\t\ttargetDate = (new Date($tw.utils.parseDate(operator.operand))).setHours(0,0,0,0);\n\t// Function to convert a date/time to a date integer\n\tsource(function(tiddler,title) {\n\t\tif(tiddler) {\n\t\t\tif(tiddler.getFieldDay(fieldName) === targetDate) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/search.js": {
"title": "$:/core/modules/filters/search.js",
"text": "/*\\\ntitle: $:/core/modules/filters/search.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for searching for the text in the operand tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.search = function(source,operator,options) {\n\tvar invert = operator.prefix === \"!\";\n\tif(operator.suffixes) {\n\t\tvar hasFlag = function(flag) {\n\t\t\t\treturn (operator.suffixes[1] || []).indexOf(flag) !== -1;\n\t\t\t},\n\t\t\texcludeFields = false,\n\t\t\tfieldList = operator.suffixes[0] || [],\n\t\t\tfirstField = fieldList[0] || \"\", \n\t\t\tfirstChar = firstField.charAt(0),\n\t\t\tfields;\n\t\tif(firstChar === \"-\") {\n\t\t\tfields = [firstField.slice(1)].concat(fieldList.slice(1));\n\t\t\texcludeFields = true;\n\t\t} else if(fieldList[0] === \"*\"){\n\t\t\tfields = [];\n\t\t\texcludeFields = true;\n\t\t} else {\n\t\t\tfields = fieldList.slice(0);\n\t\t}\n\t\treturn options.wiki.search(operator.operand,{\n\t\t\tsource: source,\n\t\t\tinvert: invert,\n\t\t\tfield: fields,\n\t\t\texcludeField: excludeFields,\n\t\t\tcaseSensitive: hasFlag(\"casesensitive\"),\n\t\t\tliteral: hasFlag(\"literal\"),\n\t\t\twhitespace: hasFlag(\"whitespace\"),\n\t\t\tanchored: hasFlag(\"anchored\"),\n\t\t\tregexp: hasFlag(\"regexp\"),\n\t\t\twords: hasFlag(\"words\")\n\t\t});\n\t} else {\n\t\treturn options.wiki.search(operator.operand,{\n\t\t\tsource: source,\n\t\t\tinvert: invert\n\t\t});\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/shadowsource.js": {
"title": "$:/core/modules/filters/shadowsource.js",
"text": "/*\\\ntitle: $:/core/modules/filters/shadowsource.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the source plugins for shadow tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.shadowsource = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar source = options.wiki.getShadowSource(title);\n\t\tif(source) {\n\t\t\t$tw.utils.pushTop(results,source);\n\t\t}\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/slugify.js": {
"title": "$:/core/modules/filters/slugify.js",
"text": "/*\\\ntitle: $:/core/modules/filters/slugify.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for slugifying a tiddler title\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.slugify = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(options.wiki.slugify(title));\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/sort.js": {
"title": "$:/core/modules/filters/sort.js",
"text": "/*\\\ntitle: $:/core/modules/filters/sort.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for sorting\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.sort = function(source,operator,options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand || \"title\",operator.prefix === \"!\",false,false);\n\treturn results;\n};\n\nexports.nsort = function(source,operator,options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand || \"title\",operator.prefix === \"!\",false,true);\n\treturn results;\n};\n\nexports.sortan = function(source, operator, options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results, operator.operand || \"title\", operator.prefix === \"!\",false,false,true);\n\treturn results;\n};\n\nexports.sortcs = function(source,operator,options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand || \"title\",operator.prefix === \"!\",true,false);\n\treturn results;\n};\n\nexports.nsortcs = function(source,operator,options) {\n\tvar results = prepare_results(source);\n\toptions.wiki.sortTiddlers(results,operator.operand || \"title\",operator.prefix === \"!\",true,true);\n\treturn results;\n};\n\nvar prepare_results = function (source) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(title);\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/sortsub.js": {
"title": "$:/core/modules/filters/sortsub.js",
"text": "/*\\\ntitle: $:/core/modules/filters/sortsub.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for sorting by a subfilter\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.sortsub = function(source,operator,options) {\n\t// Compile the subfilter\n\tvar filterFn = options.wiki.compileFilter(operator.operand);\n\t// Collect the input titles and the corresponding sort keys\n\tvar inputTitles = [],\n\t\tsortKeys = [];\n\tsource(function(tiddler,title) {\n\t\tinputTitles.push(title);\n\t\tvar r = filterFn.call(options.wiki,function(iterator) {\n\t\t\titerator(options.wiki.getTiddler(title),title);\n\t\t},{\n\t\t\tgetVariable: function(name) {\n\t\t\t\tswitch(name) {\n\t\t\t\t\tcase \"currentTiddler\":\n\t\t\t\t\t\treturn \"\" + title;\n\t\t\t\t\tcase \"..currentTiddler\":\n\t\t\t\t\t\treturn options.widget.getVariable(\"currentTiddler\");\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn options.widget.getVariable(name);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tsortKeys.push(r[0] || \"\");\n\t});\n\t// Rather than sorting the titles array, we'll sort the indexes so that we can consult both arrays\n\tvar indexes = new Array(inputTitles.length);\n\tfor(var t=0; t<inputTitles.length; t++) {\n\t\tindexes[t] = t;\n\t}\n\t// Sort the indexes\n\tvar compareFn = $tw.utils.makeCompareFunction(operator.suffix,{defaultType: \"string\",invert: operator.prefix === \"!\"});\n\tindexes = indexes.sort(function(a,b) {\n\t\treturn compareFn(sortKeys[a],sortKeys[b]);\n\t});\n\t// Make the results array in order\n\tvar results = [];\n\t$tw.utils.each(indexes,function(index) {\n\t\tresults.push(inputTitles[index]);\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/splitbefore.js": {
"title": "$:/core/modules/filters/splitbefore.js",
"text": "/*\\\ntitle: $:/core/modules/filters/splitbefore.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator that splits each result on the first occurance of the specified separator and returns the unique values.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.splitbefore = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar parts = title.split(operator.operand);\n\t\tif(parts.length === 1) {\n\t\t\t$tw.utils.pushTop(results,parts[0]);\n\t\t} else {\n\t\t\t$tw.utils.pushTop(results,parts[0] + operator.operand);\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/storyviews.js": {
"title": "$:/core/modules/filters/storyviews.js",
"text": "/*\\\ntitle: $:/core/modules/filters/storyviews.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the story views in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.storyviews = function(source,operator,options) {\n\tvar results = [],\n\t\tstoryviews = {};\n\t$tw.modules.applyMethods(\"storyview\",storyviews);\n\t$tw.utils.each(storyviews,function(info,name) {\n\t\tresults.push(name);\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/strings.js": {
"title": "$:/core/modules/filters/strings.js",
"text": "/*\\\ntitle: $:/core/modules/filters/strings.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operators for strings. Unary/binary operators work on each item in turn, and return a new item list.\n\nSum/product/maxall/minall operate on the entire list, returning a single item.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.length = makeStringBinaryOperator(\n\tfunction(a) {return [\"\" + (\"\" + a).length];}\n);\n\nexports.uppercase = makeStringBinaryOperator(\n\tfunction(a) {return [(\"\" + a).toUpperCase()];}\n);\n\nexports.lowercase = makeStringBinaryOperator(\n\tfunction(a) {return [(\"\" + a).toLowerCase()];}\n);\n\nexports.sentencecase = makeStringBinaryOperator(\n\tfunction(a) {return [$tw.utils.toSentenceCase(a)];}\n);\n\nexports.titlecase = makeStringBinaryOperator(\n\tfunction(a) {return [$tw.utils.toTitleCase(a)];}\n);\n\nexports.trim = function(source,operator,options) {\n\tvar result = [],\n\t\tsuffix = operator.suffix || \"\",\n\t\toperand = (operator.operand || \"\"),\n\t\tfnCalc;\n\tif(suffix === \"prefix\") {\n\t\tfnCalc = function(a,b) {return [$tw.utils.trimPrefix(a,b)];}\n\t} else if(suffix === \"suffix\") {\n\t\tfnCalc = function(a,b) {return [$tw.utils.trimSuffix(a,b)];}\n\t} else {\n\t\tif(operand === \"\") {\n\t\t\tfnCalc = function(a) {return [$tw.utils.trim(a)];}\n\t\t} else {\n\t\t\tfnCalc = function(a,b) {return [$tw.utils.trimSuffix($tw.utils.trimPrefix(a,b),b)];}\n\t\t}\n\t}\n\tsource(function(tiddler,title) {\n\t\tArray.prototype.push.apply(result,fnCalc(title,operand));\n\t});\n\treturn result;\n};\n\nexports.split = makeStringBinaryOperator(\n\tfunction(a,b) {return (\"\" + a).split(b);}\n);\n\nexports[\"enlist-input\"] = makeStringBinaryOperator(\n\tfunction(a,o,s) {return $tw.utils.parseStringArray(\"\" + a,(s === \"raw\"));}\n);\n\nexports.join = makeStringReducingOperator(\n\tfunction(accumulator,value,operand) {\n\t\tif(accumulator === null) {\n\t\t\treturn value;\n\t\t} else {\n\t\t\treturn accumulator + operand + value;\n\t\t}\n\t},null\n);\n\nfunction makeStringBinaryOperator(fnCalc) {\n\treturn function(source,operator,options) {\n\t\tvar result = [];\n\t\tsource(function(tiddler,title) {\n\t\t\tArray.prototype.push.apply(result,fnCalc(title,operator.operand || \"\",operator.suffix || \"\"));\n\t\t});\n\t\treturn result;\n\t};\n}\n\nfunction makeStringReducingOperator(fnCalc,initialValue) {\n\treturn function(source,operator,options) {\n\t\tvar result = [];\n\t\tsource(function(tiddler,title) {\n\t\t\tresult.push(title);\n\t\t});\n\t\tif(result.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\treturn [result.reduce(function(accumulator,currentValue) {\n\t\t\treturn fnCalc(accumulator,currentValue,operator.operand || \"\");\n\t\t},initialValue) || \"\"];\n\t};\n}\n\nexports.splitregexp = function(source,operator,options) {\n\tvar result = [],\n\t\tsuffix = operator.suffix || \"\",\n\t\tflags = (suffix.indexOf(\"m\") !== -1 ? \"m\" : \"\") + (suffix.indexOf(\"i\") !== -1 ? \"i\" : \"\"),\n\t\tregExp;\n\ttry {\n\t\tregExp = new RegExp(operator.operand || \"\",flags);\n\t} catch(ex) {\n\t\treturn [\"RegExp error: \" + ex];\n\t}\n\tsource(function(tiddler,title) {\n\t\tArray.prototype.push.apply(result,title.split(regExp));\n\t});\n\treturn result;\n};\n\nexports[\"search-replace\"] = function(source,operator,options) {\n\tvar results = [],\n\t\tsuffixes = operator.suffixes || [],\n\t\tflagSuffix = (suffixes[0] ? (suffixes[0][0] || \"\") : \"\"),\n\t\tflags = (flagSuffix.indexOf(\"g\") !== -1 ? \"g\" : \"\") + (flagSuffix.indexOf(\"i\") !== -1 ? \"i\" : \"\"),\n\t\tisRegExp = (suffixes[1] && suffixes[1][0] === \"regexp\") ? true : false,\n\t\tsearchTerm,\n\t\tregExp;\n\n\tsource(function(tiddler,title) {\n\t\tif(title && (operator.operands.length > 1)) {\n\t\t\t//Escape regexp characters if the operand is not a regular expression\n\t\t\tsearchTerm = isRegExp ? operator.operand : $tw.utils.escapeRegExp(operator.operand);\n\t\t\ttry {\n\t\t\t\tregExp = new RegExp(searchTerm,flags);\n\t\t\t} catch(ex) {\n\t\t\t\treturn [\"RegExp error: \" + ex];\n\t\t\t}\n\t\t\tresults.push(\n\t\t\t\ttitle.replace(regExp,operator.operands[1])\n\t\t\t);\n\t\t} else {\n\t\t\tresults.push(title);\n\t\t}\n\t});\n\treturn results;\n};\n\nexports.pad = function(source,operator,options) {\n\tvar results = [],\n\t\ttargetLength = operator.operand ? parseInt(operator.operand) : 0,\n\t\tfill = operator.operands[1] || \"0\";\n\n\tsource(function(tiddler,title) {\n\t\tif(title && title.length) {\n\t\t\tif(title.length >= targetLength) {\n\t\t\t\tresults.push(title);\n\t\t\t} else {\n\t\t\t\tvar padString = \"\",\n\t\t\t\t\tpadStringLength = targetLength - title.length;\n\t\t\t\twhile (padStringLength > padString.length) {\n\t\t\t\t\tpadString += fill;\n\t\t\t\t}\n\t\t\t\t//make sure we do not exceed the specified length\n\t\t\t\tpadString = padString.slice(0,padStringLength);\n\t\t\t\tif(operator.suffix && (operator.suffix === \"suffix\")) {\n\t\t\t\t\ttitle = title + padString;\n\t\t\t\t} else {\n\t\t\t\t\ttitle = padString + title;\n\t\t\t\t}\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n}\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/subfilter.js": {
"title": "$:/core/modules/filters/subfilter.js",
"text": "/*\\\ntitle: $:/core/modules/filters/subfilter.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning its operand evaluated as a filter\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.subfilter = function(source,operator,options) {\n\tvar list = options.wiki.filterTiddlers(operator.operand,options.widget,source);\n\tif(operator.prefix === \"!\") {\n\t\tvar results = [];\n\t\tsource(function(tiddler,title) {\n\t\t\tif(list.indexOf(title) === -1) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t\treturn results;\n\t} else {\n\t\treturn list;\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/subtiddlerfields.js": {
"title": "$:/core/modules/filters/subtiddlerfields.js",
"text": "/*\\\ntitle: $:/core/modules/filters/subtiddlerfields.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the fields on the selected subtiddlers of the plugin named in the operand\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.subtiddlerfields = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar subtiddler = options.wiki.getSubTiddler(operator.operand,title);\n\t\tif(subtiddler) {\n\t\t\tfor(var fieldName in subtiddler.fields) {\n\t\t\t\t$tw.utils.pushTop(results,fieldName);\n\t\t\t}\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/suffix.js": {
"title": "$:/core/modules/filters/suffix.js",
"text": "/*\\\ntitle: $:/core/modules/filters/suffix.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking if a title ends with a suffix\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.suffix = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title.substr(-operator.operand.length) !== operator.operand) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(title.substr(-operator.operand.length) === operator.operand) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/tag.js": {
"title": "$:/core/modules/filters/tag.js",
"text": "/*\\\ntitle: $:/core/modules/filters/tag.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for checking for the presence of a tag\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tag = function(source,operator,options) {\n\tvar results = [],indexedResults;\n\tif((operator.suffix || \"\").toLowerCase() === \"strict\" && !operator.operand) {\n\t\t// New semantics:\n\t\t// Always return copy of input if operator.operand is missing\n\t\tsource(function(tiddler,title) {\n\t\t\tresults.push(title);\n\t\t});\n\t} else {\n\t\t// Old semantics:\n\t\tvar tiddlers;\n\t\tif(operator.prefix === \"!\") {\n\t\t\t// Returns a copy of the input if operator.operand is missing\n\t\t\ttiddlers = options.wiki.getTiddlersWithTag(operator.operand);\n\t\t\tsource(function(tiddler,title) {\n\t\t\t\tif(tiddlers.indexOf(title) === -1) {\n\t\t\t\t\tresults.push(title);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\t// Returns empty results if operator.operand is missing\n\t\t\tif(source.byTag) {\n\t\t\t\tindexedResults = source.byTag(operator.operand);\n\t\t\t\tif(indexedResults) {\n\t\t\t\t\treturn indexedResults;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttiddlers = options.wiki.getTiddlersWithTag(operator.operand);\n\t\t\t\tsource(function(tiddler,title) {\n\t\t\t\t\tif(tiddlers.indexOf(title) !== -1) {\n\t\t\t\t\t\tresults.push(title);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tresults = options.wiki.sortByList(results,operator.operand);\n\t\t\t}\n\t\t}\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/tagging.js": {
"title": "$:/core/modules/filters/tagging.js",
"text": "/*\\\ntitle: $:/core/modules/filters/tagging.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all tiddlers that are tagged with the selected tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tagging = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\t$tw.utils.pushTop(results,options.wiki.getTiddlersWithTag(title));\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/tags.js": {
"title": "$:/core/modules/filters/tags.js",
"text": "/*\\\ntitle: $:/core/modules/filters/tags.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all the tags of the selected tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.tags = function(source,operator,options) {\n\tvar tags = {};\n\tsource(function(tiddler,title) {\n\t\tvar t, length;\n\t\tif(tiddler && tiddler.fields.tags) {\n\t\t\tfor(t=0, length=tiddler.fields.tags.length; t<length; t++) {\n\t\t\t\ttags[tiddler.fields.tags[t]] = true;\n\t\t\t}\n\t\t}\n\t});\n\treturn Object.keys(tags);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/then.js": {
"title": "$:/core/modules/filters/then.js",
"text": "/*\\\ntitle: $:/core/modules/filters/then.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for replacing any titles with a constant\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.then = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tresults.push(operator.operand);\n\t});\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/title.js": {
"title": "$:/core/modules/filters/title.js",
"text": "/*\\\ntitle: $:/core/modules/filters/title.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for comparing title fields for equality\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.title = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler && tiddler.fields.title !== operator.operand) {\n\t\t\t\tresults.push(title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tresults.push(operator.operand);\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/untagged.js": {
"title": "$:/core/modules/filters/untagged.js",
"text": "/*\\\ntitle: $:/core/modules/filters/untagged.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator returning all the selected tiddlers that are untagged\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.untagged = function(source,operator,options) {\n\tvar results = [];\n\tif(operator.prefix === \"!\") {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(tiddler && $tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length > 0) {\n\t\t\t\t$tw.utils.pushTop(results,title);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsource(function(tiddler,title) {\n\t\t\tif(!tiddler || !tiddler.hasField(\"tags\") || ($tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length === 0)) {\n\t\t\t\t$tw.utils.pushTop(results,title);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/variables.js": {
"title": "$:/core/modules/filters/variables.js",
"text": "/*\\\ntitle: $:/core/modules/filters/variables.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the active variables\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.variables = function(source,operator,options) {\n\tvar names = [];\n\tfor(var variable in options.widget.variables) {\n\t\tnames.push(variable);\n\t}\n\treturn names.sort();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/wikiparserrules.js": {
"title": "$:/core/modules/filters/wikiparserrules.js",
"text": "/*\\\ntitle: $:/core/modules/filters/wikiparserrules.js\ntype: application/javascript\nmodule-type: filteroperator\n\nFilter operator for returning the names of the wiki parser rules in this wiki\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.wikiparserrules = function(source,operator,options) {\n\tvar results = [],\n\t\toperand = operator.operand;\n\t$tw.utils.each($tw.modules.types.wikirule,function(mod) {\n\t\tvar exp = mod.exports;\n\t\tif(!operand || exp.types[operand]) {\n\t\t\tresults.push(exp.name);\n\t\t}\n\t});\n\tresults.sort();\n\treturn results;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters/x-listops.js": {
"title": "$:/core/modules/filters/x-listops.js",
"text": "/*\\\ntitle: $:/core/modules/filters/x-listops.js\ntype: application/javascript\nmodule-type: filteroperator\n\nExtended filter operators to manipulate the current list.\n\n\\*/\n(function () {\n\n\t/*jslint node: true, browser: true */\n\t/*global $tw: false */\n\t\"use strict\";\n\n\t/*\n\tFetch titles from the current list\n\t*/\n\tvar prepare_results = function (source) {\n\tvar results = [];\n\t\tsource(function (tiddler, title) {\n\t\t\tresults.push(title);\n\t\t});\n\t\treturn results;\n\t};\n\n\t/*\n\tMoves a number of items from the tail of the current list before the item named in the operand\n\t*/\n\texports.putbefore = function (source, operator) {\n\t\tvar results = prepare_results(source),\n\t\t\tindex = results.indexOf(operator.operand),\n\t\t\tcount = $tw.utils.getInt(operator.suffix,1);\n\t\treturn (index === -1) ?\n\t\t\tresults.slice(0, -1) :\n\t\t\tresults.slice(0, index).concat(results.slice(-count)).concat(results.slice(index, -count));\n\t};\n\n\t/*\n\tMoves a number of items from the tail of the current list after the item named in the operand\n\t*/\n\texports.putafter = function (source, operator) {\n\t\tvar results = prepare_results(source),\n\t\t\tindex = results.indexOf(operator.operand),\n\t\t\tcount = $tw.utils.getInt(operator.suffix,1);\n\t\treturn (index === -1) ?\n\t\t\tresults.slice(0, -1) :\n\t\t\tresults.slice(0, index + 1).concat(results.slice(-count)).concat(results.slice(index + 1, -count));\n\t};\n\n\t/*\n\tReplaces the item named in the operand with a number of items from the tail of the current list\n\t*/\n\texports.replace = function (source, operator) {\n\t\tvar results = prepare_results(source),\n\t\t\tindex = results.indexOf(operator.operand),\n\t\t\tcount = $tw.utils.getInt(operator.suffix,1);\n\t\treturn (index === -1) ?\n\t\t\tresults.slice(0, -count) :\n\t\t\tresults.slice(0, index).concat(results.slice(-count)).concat(results.slice(index + 1, -count));\n\t};\n\n\t/*\n\tMoves a number of items from the tail of the current list to the head of the list\n\t*/\n\texports.putfirst = function (source, operator) {\n\t\tvar results = prepare_results(source),\n\t\t\tcount = $tw.utils.getInt(operator.suffix,1);\n\t\treturn results.slice(-count).concat(results.slice(0, -count));\n\t};\n\n\t/*\n\tMoves a number of items from the head of the current list to the tail of the list\n\t*/\n\texports.putlast = function (source, operator) {\n\t\tvar results = prepare_results(source),\n\t\t\tcount = $tw.utils.getInt(operator.suffix,1);\n\t\treturn results.slice(count).concat(results.slice(0, count));\n\t};\n\n\t/*\n\tMoves the item named in the operand a number of places forward or backward in the list\n\t*/\n\texports.move = function (source, operator) {\n\t\tvar results = prepare_results(source),\n\t\t\tindex = results.indexOf(operator.operand),\n\t\t\tcount = $tw.utils.getInt(operator.suffix,1),\n\t\t\tmarker = results.splice(index, 1),\n\t\t\toffset = (index + count) > 0 ? index + count : 0;\n\t\treturn results.slice(0, offset).concat(marker).concat(results.slice(offset));\n\t};\n\n\t/*\n\tReturns the items from the current list that are after the item named in the operand\n\t*/\n\texports.allafter = function (source, operator) {\n\t\tvar results = prepare_results(source),\n\t\t\tindex = results.indexOf(operator.operand);\n\t\treturn (index === -1) ? [] :\n\t\t\t(operator.suffix) ? results.slice(index) :\n\t\t\tresults.slice(index + 1);\n\t};\n\n\t/*\n\tReturns the items from the current list that are before the item named in the operand\n\t*/\n\texports.allbefore = function (source, operator) {\n\t\tvar results = prepare_results(source),\n\t\t\tindex = results.indexOf(operator.operand);\n\t\treturn (index === -1) ? [] :\n\t\t\t(operator.suffix) ? results.slice(0, index + 1) :\n\t\t\tresults.slice(0, index);\n\t};\n\n\t/*\n\tAppends the items listed in the operand array to the tail of the current list\n\t*/\n\texports.append = function (source, operator) {\n\t\tvar append = $tw.utils.parseStringArray(operator.operand, \"true\"),\n\t\t\tresults = prepare_results(source),\n\t\t\tcount = parseInt(operator.suffix) || append.length;\n\t\treturn (append.length === 0) ? results :\n\t\t\t(operator.prefix) ? results.concat(append.slice(-count)) :\n\t\t\tresults.concat(append.slice(0, count));\n\t};\n\n\t/*\n\tPrepends the items listed in the operand array to the head of the current list\n\t*/\n\texports.prepend = function (source, operator) {\n\t\tvar prepend = $tw.utils.parseStringArray(operator.operand, \"true\"),\n\t\t\tresults = prepare_results(source),\n\t\t\tcount = $tw.utils.getInt(operator.suffix,prepend.length);\n\t\treturn (prepend.length === 0) ? results :\n\t\t\t(operator.prefix) ? prepend.slice(-count).concat(results) :\n\t\t\tprepend.slice(0, count).concat(results);\n\t};\n\n\t/*\n\tReturns all items from the current list except the items listed in the operand array\n\t*/\n\texports.remove = function (source, operator) {\n\t\tvar array = $tw.utils.parseStringArray(operator.operand, \"true\"),\n\t\t\tresults = prepare_results(source),\n\t\t\tcount = parseInt(operator.suffix) || array.length,\n\t\t\tp,\n\t\t\tlen,\n\t\t\tindex;\n\t\tlen = array.length - 1;\n\t\tfor (p = 0; p < count; ++p) {\n\t\t\tif (operator.prefix) {\n\t\t\t\tindex = results.indexOf(array[len - p]);\n\t\t\t} else {\n\t\t\t\tindex = results.indexOf(array[p]);\n\t\t\t}\n\t\t\tif (index !== -1) {\n\t\t\t\tresults.splice(index, 1);\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t};\n\n\t/*\n\tReturns all items from the current list sorted in the order of the items in the operand array\n\t*/\n\texports.sortby = function (source, operator) {\n\t\tvar results = prepare_results(source);\n\t\tif (!results || results.length < 2) {\n\t\t\treturn results;\n\t\t}\n\t\tvar lookup = $tw.utils.parseStringArray(operator.operand, \"true\");\n\t\tresults.sort(function (a, b) {\n\t\t\treturn lookup.indexOf(a) - lookup.indexOf(b);\n\t\t});\n\t\treturn results;\n\t};\n\n\t/*\n\tRemoves all duplicate items from the current list\n\t*/\n\texports.unique = function (source, operator) {\n\t\tvar results = prepare_results(source);\n\t\tvar set = results.reduce(function (a, b) {\n\t\t\tif (a.indexOf(b) < 0) {\n\t\t\t\ta.push(b);\n\t\t\t}\n\t\t\treturn a;\n\t\t}, []);\n\t\treturn set;\n\t};\n\n\tvar cycleValueInArray = function(results,operands,stepSize) {\n\t\tvar resultsIndex,\n\t\t\tstep = stepSize || 1,\n\t\t\ti = 0,\n\t\t\topLength = operands.length,\n\t\t\tnextOperandIndex;\n\t\tfor(i; i < opLength; i++) {\n\t\t\tresultsIndex = results.indexOf(operands[i]);\n\t\t\tif(resultsIndex !== -1) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(resultsIndex !== -1) {\n\t\t\ti = i + step;\n\t\t\tnextOperandIndex = (i < opLength ? i : i - opLength);\n\t\t\tif(operands.length > 1) {\n\t\t\t\tresults.splice(resultsIndex,1,operands[nextOperandIndex]);\n\t\t\t} else {\n\t\t\t\tresults.splice(resultsIndex,1);\n\t\t\t}\n\t\t} else {\n\t\t\tresults.push(operands[0]);\n\t\t}\n\t\treturn results;\n\t}\n\n\t/*\n\tToggles an item in the current list.\n\t*/\n\texports.toggle = function(source,operator) {\n\t\treturn cycleValueInArray(prepare_results(source),operator.operands);\n\t}\n\n\texports.cycle = function(source,operator) {\n\t\tvar results = prepare_results(source),\n\t\t\toperands = (operator.operand.length ? $tw.utils.parseStringArray(operator.operand, \"true\") : [\"\"]),\n\t\t\tstep = $tw.utils.getInt(operator.operands[1]||\"\",1);\n\t\tif(step < 0) {\n\t\t\toperands.reverse();\n\t\t\tstep = Math.abs(step);\n\t\t}\n\t\treturn cycleValueInArray(results,operands,step);\n\t}\n\n})();\n",
"type": "application/javascript",
"module-type": "filteroperator"
},
"$:/core/modules/filters.js": {
"title": "$:/core/modules/filters.js",
"text": "/*\\\ntitle: $:/core/modules/filters.js\ntype: application/javascript\nmodule-type: wikimethod\n\nAdds tiddler filtering methods to the $tw.Wiki object.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nParses an operation (i.e. a run) within a filter string\n\toperators: Array of array of operator nodes into which results should be inserted\n\tfilterString: filter string\n\tp: start position within the string\nReturns the new start position, after the parsed operation\n*/\nfunction parseFilterOperation(operators,filterString,p) {\n\tvar nextBracketPos, operator;\n\t// Skip the starting square bracket\n\tif(filterString.charAt(p++) !== \"[\") {\n\t\tthrow \"Missing [ in filter expression\";\n\t}\n\t// Process each operator in turn\n\tdo {\n\t\toperator = {};\n\t\t// Check for an operator prefix\n\t\tif(filterString.charAt(p) === \"!\") {\n\t\t\toperator.prefix = filterString.charAt(p++);\n\t\t}\n\t\t// Get the operator name\n\t\tnextBracketPos = filterString.substring(p).search(/[\\[\\{<\\/]/);\n\t\tif(nextBracketPos === -1) {\n\t\t\tthrow \"Missing [ in filter expression\";\n\t\t}\n\t\tnextBracketPos += p;\n\t\tvar bracket = filterString.charAt(nextBracketPos);\n\t\toperator.operator = filterString.substring(p,nextBracketPos);\n\t\t// Any suffix?\n\t\tvar colon = operator.operator.indexOf(':');\n\t\tif(colon > -1) {\n\t\t\t// The raw suffix for older filters\n\t\t\toperator.suffix = operator.operator.substring(colon + 1);\n\t\t\toperator.operator = operator.operator.substring(0,colon) || \"field\";\n\t\t\t// The processed suffix for newer filters\n\t\t\toperator.suffixes = [];\n\t\t\t$tw.utils.each(operator.suffix.split(\":\"),function(subsuffix) {\n\t\t\t\toperator.suffixes.push([]);\n\t\t\t\t$tw.utils.each(subsuffix.split(\",\"),function(entry) {\n\t\t\t\t\tentry = $tw.utils.trim(entry);\n\t\t\t\t\tif(entry) {\n\t\t\t\t\t\toperator.suffixes[operator.suffixes.length - 1].push(entry); \n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t\t// Empty operator means: title\n\t\telse if(operator.operator === \"\") {\n\t\t\toperator.operator = \"title\";\n\t\t}\n\t\toperator.operands = [];\n\t\tvar parseOperand = function(bracketType) {\n\t\t\tvar operand = {};\n\t\t\tswitch (bracketType) {\n\t\t\t\tcase \"{\": // Curly brackets\n\t\t\t\t\toperand.indirect = true;\n\t\t\t\t\tnextBracketPos = filterString.indexOf(\"}\",p);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"[\": // Square brackets\n\t\t\t\t\tnextBracketPos = filterString.indexOf(\"]\",p);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"<\": // Angle brackets\n\t\t\t\t\toperand.variable = true;\n\t\t\t\t\tnextBracketPos = filterString.indexOf(\">\",p);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"/\": // regexp brackets\n\t\t\t\t\tvar rex = /^((?:[^\\\\\\/]|\\\\.)*)\\/(?:\\(([mygi]+)\\))?/g,\n\t\t\t\t\t\trexMatch = rex.exec(filterString.substring(p));\n\t\t\t\t\tif(rexMatch) {\n\t\t\t\t\t\toperator.regexp = new RegExp(rexMatch[1], rexMatch[2]);\n\t// DEPRECATION WARNING\n\tconsole.log(\"WARNING: Filter\",operator.operator,\"has a deprecated regexp operand\",operator.regexp);\n\t\t\t\t\t\tnextBracketPos = p + rex.lastIndex - 1;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthrow \"Unterminated regular expression in filter expression\";\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif(nextBracketPos === -1) {\n\t\t\t\tthrow \"Missing closing bracket in filter expression\";\n\t\t\t}\n\t\t\tif(!operator.regexp) {\n\t\t\t\toperand.text = filterString.substring(p,nextBracketPos);\n\t\t\t\toperator.operands.push(operand);\n\t\t\t}\n\t\t\tp = nextBracketPos + 1;\n\t\t}\n\n\t\tp = nextBracketPos + 1;\n\t\tparseOperand(bracket);\n\n\t\t// Check for multiple operands\n\t\twhile(filterString.charAt(p) === \",\") {\n\t\t\tp++;\n\t\t\tif(/^[\\[\\{<\\/]/.test(filterString.substring(p))) {\n\t\t\t\tnextBracketPos = p;\n\t\t\t\tp++;\n\t\t\t\tparseOperand(filterString.charAt(nextBracketPos));\n\t\t\t} else {\n\t\t\t\tthrow \"Missing [ in filter expression\";\n\t\t\t}\n\t\t}\n\n\t\t// Push this operator\n\t\toperators.push(operator);\n\t} while(filterString.charAt(p) !== \"]\");\n\t// Skip the ending square bracket\n\tif(filterString.charAt(p++) !== \"]\") {\n\t\tthrow \"Missing ] in filter expression\";\n\t}\n\t// Return the parsing position\n\treturn p;\n}\n\n/*\nParse a filter string\n*/\nexports.parseFilter = function(filterString) {\n\tfilterString = filterString || \"\";\n\tvar results = [], // Array of arrays of operator nodes {operator:,operand:}\n\t\tp = 0, // Current position in the filter string\n\t\tmatch;\n\tvar whitespaceRegExp = /(\\s+)/mg,\n\t\toperandRegExp = /((?:\\+|\\-|~|=|\\:(\\w+)(?:\\:([\\w\\:, ]*))?)?)(?:(\\[)|(?:\"([^\"]*)\")|(?:'([^']*)')|([^\\s\\[\\]]+))/mg;\n\twhile(p < filterString.length) {\n\t\t// Skip any whitespace\n\t\twhitespaceRegExp.lastIndex = p;\n\t\tmatch = whitespaceRegExp.exec(filterString);\n\t\tif(match && match.index === p) {\n\t\t\tp = p + match[0].length;\n\t\t}\n\t\t// Match the start of the operation\n\t\tif(p < filterString.length) {\n\t\t\toperandRegExp.lastIndex = p;\n\t\t\tmatch = operandRegExp.exec(filterString);\n\t\t\tif(!match || match.index !== p) {\n\t\t\t\tthrow $tw.language.getString(\"Error/FilterSyntax\");\n\t\t\t}\n\t\t\tvar operation = {\n\t\t\t\tprefix: \"\",\n\t\t\t\toperators: []\n\t\t\t};\n\t\t\tif(match[1]) {\n\t\t\t\toperation.prefix = match[1];\n\t\t\t\tp = p + operation.prefix.length;\n\t\t\t\tif(match[2]) {\n\t\t\t\t\toperation.namedPrefix = match[2];\n\t\t\t\t}\n\t\t\t\tif(match[3]) {\n\t\t\t\t\toperation.suffixes = [];\n\t\t\t\t\t $tw.utils.each(match[3].split(\":\"),function(subsuffix) {\n\t\t\t\t\t\toperation.suffixes.push([]);\n\t\t\t\t\t\t$tw.utils.each(subsuffix.split(\",\"),function(entry) {\n\t\t\t\t\t\t\tentry = $tw.utils.trim(entry);\n\t\t\t\t\t\t\tif(entry) {\n\t\t\t\t\t\t\t\toperation.suffixes[operation.suffixes.length -1].push(entry);\n\t\t\t\t\t\t\t}\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\tif(match[4]) { // Opening square bracket\n\t\t\t\tp = parseFilterOperation(operation.operators,filterString,p);\n\t\t\t} else {\n\t\t\t\tp = match.index + match[0].length;\n\t\t\t}\n\t\t\tif(match[5] || match[6] || match[7]) { // Double quoted string, single quoted string or unquoted title\n\t\t\t\toperation.operators.push(\n\t\t\t\t\t{operator: \"title\", operands: [{text: match[5] || match[6] || match[7]}]}\n\t\t\t\t);\n\t\t\t}\n\t\t\tresults.push(operation);\n\t\t}\n\t}\n\treturn results;\n};\n\nexports.getFilterOperators = function() {\n\tif(!this.filterOperators) {\n\t\t$tw.Wiki.prototype.filterOperators = {};\n\t\t$tw.modules.applyMethods(\"filteroperator\",this.filterOperators);\n\t}\n\treturn this.filterOperators;\n};\n\nexports.getFilterRunPrefixes = function() {\n\tif(!this.filterRunPrefixes) {\n\t\t$tw.Wiki.prototype.filterRunPrefixes = {};\n\t\t$tw.modules.applyMethods(\"filterrunprefix\",this.filterRunPrefixes);\n\t}\n\treturn this.filterRunPrefixes;\n}\n\nexports.filterTiddlers = function(filterString,widget,source) {\n\tvar fn = this.compileFilter(filterString);\n\treturn fn.call(this,source,widget);\n};\n\n/*\nCompile a filter into a function with the signature fn(source,widget) where:\nsource: an iterator function for the source tiddlers, called source(iterator), where iterator is called as iterator(tiddler,title)\nwidget: an optional widget node for retrieving the current tiddler etc.\n*/\nexports.compileFilter = function(filterString) {\n\tvar filterParseTree;\n\ttry {\n\t\tfilterParseTree = this.parseFilter(filterString);\n\t} catch(e) {\n\t\treturn function(source,widget) {\n\t\t\treturn [$tw.language.getString(\"Error/Filter\") + \": \" + e];\n\t\t};\n\t}\n\t// Get the hashmap of filter operator functions\n\tvar filterOperators = this.getFilterOperators();\n\t// Assemble array of functions, one for each operation\n\tvar operationFunctions = [];\n\t// Step through the operations\n\tvar self = this;\n\t$tw.utils.each(filterParseTree,function(operation) {\n\t\t// Create a function for the chain of operators in the operation\n\t\tvar operationSubFunction = function(source,widget) {\n\t\t\tvar accumulator = source,\n\t\t\t\tresults = [],\n\t\t\t\tcurrTiddlerTitle = widget && widget.getVariable(\"currentTiddler\");\n\t\t\t$tw.utils.each(operation.operators,function(operator) {\n\t\t\t\tvar operands = [],\n\t\t\t\t\toperatorFunction;\n\t\t\t\tif(!operator.operator) {\n\t\t\t\t\toperatorFunction = filterOperators.title;\n\t\t\t\t} else if(!filterOperators[operator.operator]) {\n\t\t\t\t\toperatorFunction = filterOperators.field;\n\t\t\t\t} else {\n\t\t\t\t\toperatorFunction = filterOperators[operator.operator];\n\t\t\t\t}\n\n\t\t\t\t$tw.utils.each(operator.operands,function(operand) {\n\t\t\t\t\tif(operand.indirect) {\n\t\t\t\t\t\toperand.value = self.getTextReference(operand.text,\"\",currTiddlerTitle);\n\t\t\t\t\t} else if(operand.variable) {\n\t\t\t\t\t\toperand.value = widget.getVariable(operand.text,{defaultValue: \"\"});\n\t\t\t\t\t} else {\n\t\t\t\t\t\toperand.value = operand.text;\n\t\t\t\t\t}\n\t\t\t\t\toperands.push(operand.value);\n\t\t\t\t});\n\n\t\t\t\t// Invoke the appropriate filteroperator module\n\t\t\t\tresults = operatorFunction(accumulator,{\n\t\t\t\t\t\t\toperator: operator.operator,\n\t\t\t\t\t\t\toperand: operands.length > 0 ? operands[0] : undefined,\n\t\t\t\t\t\t\toperands: operands,\n\t\t\t\t\t\t\tprefix: operator.prefix,\n\t\t\t\t\t\t\tsuffix: operator.suffix,\n\t\t\t\t\t\t\tsuffixes: operator.suffixes,\n\t\t\t\t\t\t\tregexp: operator.regexp\n\t\t\t\t\t\t},{\n\t\t\t\t\t\t\twiki: self,\n\t\t\t\t\t\t\twidget: widget\n\t\t\t\t\t\t});\n\t\t\t\tif($tw.utils.isArray(results)) {\n\t\t\t\t\taccumulator = self.makeTiddlerIterator(results);\n\t\t\t\t} else {\n\t\t\t\t\taccumulator = results;\n\t\t\t\t}\n\t\t\t});\n\t\t\tif($tw.utils.isArray(results)) {\n\t\t\t\treturn results;\n\t\t\t} else {\n\t\t\t\tvar resultArray = [];\n\t\t\t\tresults(function(tiddler,title) {\n\t\t\t\t\tresultArray.push(title);\n\t\t\t\t});\n\t\t\t\treturn resultArray;\n\t\t\t}\n\t\t};\n\t\tvar filterRunPrefixes = self.getFilterRunPrefixes();\n\t\t// Wrap the operator functions in a wrapper function that depends on the prefix\n\t\toperationFunctions.push((function() {\n\t\t\tvar options = {wiki: self, suffixes: operation.suffixes || []};\n\t\t\tswitch(operation.prefix || \"\") {\n\t\t\t\tcase \"\": // No prefix means that the operation is unioned into the result\n\t\t\t\t\treturn filterRunPrefixes[\"or\"](operationSubFunction, options);\n\t\t\t\tcase \"=\": // The results of the operation are pushed into the result without deduplication\n\t\t\t\t\treturn filterRunPrefixes[\"all\"](operationSubFunction, options);\n\t\t\t\tcase \"-\": // The results of this operation are removed from the main result\n\t\t\t\t\treturn filterRunPrefixes[\"except\"](operationSubFunction, options);\n\t\t\t\tcase \"+\": // This operation is applied to the main results so far\n\t\t\t\t\treturn filterRunPrefixes[\"and\"](operationSubFunction, options);\n\t\t\t\tcase \"~\": // This operation is unioned into the result only if the main result so far is empty\n\t\t\t\t\treturn filterRunPrefixes[\"else\"](operationSubFunction, options);\n\t\t\t\tdefault: \n\t\t\t\t\tif(operation.namedPrefix && filterRunPrefixes[operation.namedPrefix]) {\n\t\t\t\t\t\treturn filterRunPrefixes[operation.namedPrefix](operationSubFunction, options);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn function(results,source,widget) {\n\t\t\t\t\t\t\tresults.clear();\n\t\t\t\t\t\t\tresults.push($tw.language.getString(\"Error/FilterRunPrefix\"));\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t}\n\t\t})());\n\t});\n\t// Return a function that applies the operations to a source iterator of tiddler titles\n\treturn $tw.perf.measure(\"filter: \" + filterString,function filterFunction(source,widget) {\n\t\tif(!source) {\n\t\t\tsource = self.each;\n\t\t} else if(typeof source === \"object\") { // Array or hashmap\n\t\t\tsource = self.makeTiddlerIterator(source);\n\t\t}\n\t\tif(!widget) {\n\t\t\twidget = $tw.rootWidget;\n\t\t}\n\t\tvar results = new $tw.utils.LinkedList();\n\t\t$tw.utils.each(operationFunctions,function(operationFunction) {\n\t\t\toperationFunction(results,source,widget);\n\t\t});\n\t\treturn results.toArray();\n\t});\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikimethod"
},
"$:/core/modules/indexers/backlinks-indexer.js": {
"title": "$:/core/modules/indexers/backlinks-indexer.js",
"text": "/*\\\ntitle: $:/core/modules/indexers/backlinks-indexer.js\ntype: application/javascript\nmodule-type: indexer\n\nIndexes the tiddlers' backlinks\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global modules: false */\n\"use strict\";\n\n\nfunction BacklinksIndexer(wiki) {\n\tthis.wiki = wiki;\n}\n\nBacklinksIndexer.prototype.init = function() {\n\tthis.index = null;\n}\n\nBacklinksIndexer.prototype.rebuild = function() {\n\tthis.index = null;\n}\n\nBacklinksIndexer.prototype._getLinks = function(tiddler) {\n\tvar parser = this.wiki.parseText(tiddler.fields.type, tiddler.fields.text, {});\n\tif(parser) {\n\t\treturn this.wiki.extractLinks(parser.tree);\n\t}\n\treturn [];\n}\n\nBacklinksIndexer.prototype.update = function(updateDescriptor) {\n\tif(!this.index) {\n\t\treturn;\n\t}\n\tvar newLinks = [],\n\t oldLinks = [],\n\t self = this;\n\tif(updateDescriptor.old.exists) {\n\t\toldLinks = this._getLinks(updateDescriptor.old.tiddler);\n\t}\n\tif(updateDescriptor.new.exists) {\n\t\tnewLinks = this._getLinks(updateDescriptor.new.tiddler);\n\t}\n\n\t$tw.utils.each(oldLinks,function(link) {\n\t\tif(self.index[link]) {\n\t\t\tdelete self.index[link][updateDescriptor.old.tiddler.fields.title];\n\t\t}\n\t});\n\t$tw.utils.each(newLinks,function(link) {\n\t\tif(!self.index[link]) {\n\t\t\tself.index[link] = Object.create(null);\n\t\t}\n\t\tself.index[link][updateDescriptor.new.tiddler.fields.title] = true;\n\t});\n}\n\nBacklinksIndexer.prototype.lookup = function(title) {\n\tif(!this.index) {\n\t\tthis.index = Object.create(null);\n\t\tvar self = this;\n\t\tthis.wiki.forEachTiddler(function(title,tiddler) {\n\t\t\tvar links = self._getLinks(tiddler);\n\t\t\t$tw.utils.each(links, function(link) {\n\t\t\t\tif(!self.index[link]) {\n\t\t\t\t\tself.index[link] = Object.create(null);\n\t\t\t\t}\n\t\t\t\tself.index[link][title] = true;\n\t\t\t});\n\t\t});\n\t}\n\tif(this.index[title]) {\n\t\treturn Object.keys(this.index[title]);\n\t} else {\n\t\treturn [];\n\t}\n}\n\nexports.BacklinksIndexer = BacklinksIndexer;\n\n})();\n",
"type": "application/javascript",
"module-type": "indexer"
},
"$:/core/modules/indexers/field-indexer.js": {
"title": "$:/core/modules/indexers/field-indexer.js",
"text": "/*\\\ntitle: $:/core/modules/indexers/field-indexer.js\ntype: application/javascript\nmodule-type: indexer\n\nIndexes the tiddlers with each field value\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global modules: false */\n\"use strict\";\n\nvar DEFAULT_MAXIMUM_INDEXED_VALUE_LENGTH = 128;\n\nfunction FieldIndexer(wiki) {\n\tthis.wiki = wiki;\n}\n\nFieldIndexer.prototype.init = function() {\n\tthis.index = null;\n\tthis.maxIndexedValueLength = DEFAULT_MAXIMUM_INDEXED_VALUE_LENGTH;\n\tthis.addIndexMethods();\n}\n\n// Provided for testing\nFieldIndexer.prototype.setMaxIndexedValueLength = function(length) {\n\tthis.index = null;\n\tthis.maxIndexedValueLength = length;\n};\n\nFieldIndexer.prototype.addIndexMethods = function() {\n\tvar self = this;\n\tthis.wiki.each.byField = function(name,value) {\n\t\tvar titles = self.wiki.allTitles(),\n\t\t\tlookup = self.lookup(name,value);\n\t\treturn lookup && lookup.filter(function(title) {\n\t\t\treturn titles.indexOf(title) !== -1;\n\t\t});\n\t};\n\tthis.wiki.eachShadow.byField = function(name,value) {\n\t\tvar titles = self.wiki.allShadowTitles(),\n\t\t\tlookup = self.lookup(name,value);\n\t\treturn lookup && lookup.filter(function(title) {\n\t\t\treturn titles.indexOf(title) !== -1;\n\t\t});\n\t};\n\tthis.wiki.eachTiddlerPlusShadows.byField = function(name,value) {\n\t\tvar lookup = self.lookup(name,value);\n\t\treturn lookup ? lookup.slice(0) : null;\n\t};\n\tthis.wiki.eachShadowPlusTiddlers.byField = function(name,value) {\n\t\tvar lookup = self.lookup(name,value);\n\t\treturn lookup ? lookup.slice(0) : null;\n\t};\n};\n\n/*\nTear down and then rebuild the index as if all tiddlers have changed\n*/\nFieldIndexer.prototype.rebuild = function() {\n\t// Invalidate the index so that it will be rebuilt when it is next used\n\tthis.index = null;\n};\n\n/*\nBuild the index for a particular field\n*/\nFieldIndexer.prototype.buildIndexForField = function(name) {\n\tvar self = this;\n\t// Hashmap by field name of hashmap by field value of array of tiddler titles\n\tthis.index = this.index || Object.create(null);\n\tthis.index[name] = Object.create(null);\n\tvar baseIndex = this.index[name];\n\t// Update the index for each tiddler\n\tthis.wiki.eachTiddlerPlusShadows(function(tiddler,title) {\n\t\tif(name in tiddler.fields) {\n\t\t\tvar value = tiddler.getFieldString(name);\n\t\t\t// Skip any values above the maximum length\n\t\t\tif(value.length < self.maxIndexedValueLength) {\n\t\t\t\tbaseIndex[value] = baseIndex[value] || [];\n\t\t\t\tbaseIndex[value].push(title);\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\nUpdate the index in the light of a tiddler value changing; note that the title must be identical. (Renames are handled as a separate delete and create)\nupdateDescriptor: {old: {tiddler: <tiddler>, shadow: <boolean>, exists: <boolean>},new: {tiddler: <tiddler>, shadow: <boolean>, exists: <boolean>}}\n*/\nFieldIndexer.prototype.update = function(updateDescriptor) {\n\tvar self = this;\n\t// Don't do anything if the index hasn't been built yet\n\tif(this.index === null) {\n\t\treturn;\n\t}\n\t// Remove the old tiddler from the index\n\tif(updateDescriptor.old.tiddler) {\n\t\t$tw.utils.each(this.index,function(indexEntry,name) {\n\t\t\tif(name in updateDescriptor.old.tiddler.fields) {\n\t\t\t\tvar value = updateDescriptor.old.tiddler.getFieldString(name),\n\t\t\t\t\ttiddlerList = indexEntry[value];\n\t\t\t\tif(tiddlerList) {\n\t\t\t\t\tvar index = tiddlerList.indexOf(updateDescriptor.old.tiddler.fields.title);\n\t\t\t\t\tif(index !== -1) {\n\t\t\t\t\t\ttiddlerList.splice(index,1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t// Add the new tiddler to the index\n\tif(updateDescriptor[\"new\"].tiddler) {\n\t\t$tw.utils.each(this.index,function(indexEntry,name) {\n\t\t\tif(name in updateDescriptor[\"new\"].tiddler.fields) {\n\t\t\t\tvar value = updateDescriptor[\"new\"].tiddler.getFieldString(name);\n\t\t\t\tif(value.length < self.maxIndexedValueLength) {\n\t\t\t\t\tindexEntry[value] = indexEntry[value] || [];\n\t\t\t\t\tindexEntry[value].push(updateDescriptor[\"new\"].tiddler.fields.title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n};\n\n// Lookup the given field returning a list of tiddler titles\nFieldIndexer.prototype.lookup = function(name,value) {\n\t// Fail the lookup if the value is too long\n\tif(value.length >= this.maxIndexedValueLength) {\n\t\treturn null;\n\t}\n\t// Update the index if it has yet to be built\n\tif(this.index === null || !this.index[name]) {\n\t\tthis.buildIndexForField(name);\n\t}\n\treturn this.index[name][value] || [];\n};\n\nexports.FieldIndexer = FieldIndexer;\n\n})();\n",
"type": "application/javascript",
"module-type": "indexer"
},
"$:/core/modules/indexers/tag-indexer.js": {
"title": "$:/core/modules/indexers/tag-indexer.js",
"text": "/*\\\ntitle: $:/core/modules/indexers/tag-indexer.js\ntype: application/javascript\nmodule-type: indexer\n\nIndexes the tiddlers with each tag\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global modules: false */\n\"use strict\";\n\nfunction TagIndexer(wiki) {\n\tthis.wiki = wiki;\n}\n\nTagIndexer.prototype.init = function() {\n\tthis.subIndexers = [\n\t\tnew TagSubIndexer(this,\"each\"),\n\t\tnew TagSubIndexer(this,\"eachShadow\"),\n\t\tnew TagSubIndexer(this,\"eachTiddlerPlusShadows\"),\n\t\tnew TagSubIndexer(this,\"eachShadowPlusTiddlers\")\n\t];\n\t$tw.utils.each(this.subIndexers,function(subIndexer) {\n\t\tsubIndexer.addIndexMethod();\n\t});\n};\n\nTagIndexer.prototype.rebuild = function() {\n\t$tw.utils.each(this.subIndexers,function(subIndexer) {\n\t\tsubIndexer.rebuild();\n\t});\n};\n\nTagIndexer.prototype.update = function(updateDescriptor) {\n\t$tw.utils.each(this.subIndexers,function(subIndexer) {\n\t\tsubIndexer.update(updateDescriptor);\n\t});\n};\n\nfunction TagSubIndexer(indexer,iteratorMethod) {\n\tthis.indexer = indexer;\n\tthis.iteratorMethod = iteratorMethod;\n\tthis.index = null; // Hashmap of tag title to {isSorted: bool, titles: [array]} or null if not yet initialised\n}\n\nTagSubIndexer.prototype.addIndexMethod = function() {\n\tvar self = this;\n\tthis.indexer.wiki[this.iteratorMethod].byTag = function(tag) {\n\t\treturn self.lookup(tag).slice(0);\n\t};\n};\n\nTagSubIndexer.prototype.rebuild = function() {\n\tvar self = this;\n\t// Hashmap by tag of array of {isSorted:, titles:[]}\n\tthis.index = Object.create(null);\n\t// Add all the tags\n\tthis.indexer.wiki[this.iteratorMethod](function(tiddler,title) {\n\t\t$tw.utils.each(tiddler.fields.tags,function(tag) {\n\t\t\tif(!self.index[tag]) {\n\t\t\t\tself.index[tag] = {isSorted: false, titles: [title]};\n\t\t\t} else {\n\t\t\t\tself.index[tag].titles.push(title);\n\t\t\t}\n\t\t});\n\t});\n};\n\nTagSubIndexer.prototype.update = function(updateDescriptor) {\n\tthis.index = null;\n};\n\nTagSubIndexer.prototype.lookup = function(tag) {\n\t// Update the index if it has yet to be built\n\tif(this.index === null) {\n\t\tthis.rebuild();\n\t}\n\tvar indexRecord = this.index[tag];\n\tif(indexRecord) {\n\t\tif(!indexRecord.isSorted) {\n\t\t\tif(this.indexer.wiki.sortByList) {\n\t\t\t\tindexRecord.titles = this.indexer.wiki.sortByList(indexRecord.titles,tag);\n\t\t\t}\n\t\t\tindexRecord.isSorted = true;\n\t\t}\n\t\treturn indexRecord.titles;\n\t} else {\n\t\treturn [];\n\t}\n};\n\n\nexports.TagIndexer = TagIndexer;\n\n})();\n",
"type": "application/javascript",
"module-type": "indexer"
},
"$:/core/modules/info/platform.js": {
"title": "$:/core/modules/info/platform.js",
"text": "/*\\\ntitle: $:/core/modules/info/platform.js\ntype: application/javascript\nmodule-type: info\n\nInitialise basic platform $:/info/ tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.getInfoTiddlerFields = function(updateInfoTiddlersCallback) {\n\tvar mapBoolean = function(value) {return value ? \"yes\" : \"no\";},\n\t\tinfoTiddlerFields = [];\n\t// Basics\n\tinfoTiddlerFields.push({title: \"$:/info/browser\", text: mapBoolean(!!$tw.browser)});\n\tinfoTiddlerFields.push({title: \"$:/info/node\", text: mapBoolean(!!$tw.node)});\n\tinfoTiddlerFields.push({title: \"$:/info/startup-timestamp\", text: $tw.utils.stringifyDate(new Date())});\n\tif($tw.browser) {\n\t\t// Document location\n\t\tvar setLocationProperty = function(name,value) {\n\t\t\t\tinfoTiddlerFields.push({title: \"$:/info/url/\" + name, text: value});\n\t\t\t},\n\t\t\tlocation = document.location;\n\t\tsetLocationProperty(\"full\", (location.toString()).split(\"#\")[0]);\n\t\tsetLocationProperty(\"host\", location.host);\n\t\tsetLocationProperty(\"hostname\", location.hostname);\n\t\tsetLocationProperty(\"protocol\", location.protocol);\n\t\tsetLocationProperty(\"port\", location.port);\n\t\tsetLocationProperty(\"pathname\", location.pathname);\n\t\tsetLocationProperty(\"search\", location.search);\n\t\tsetLocationProperty(\"origin\", location.origin);\n\t\t// Screen size\n\t\tinfoTiddlerFields.push({title: \"$:/info/browser/screen/width\", text: window.screen.width.toString()});\n\t\tinfoTiddlerFields.push({title: \"$:/info/browser/screen/height\", text: window.screen.height.toString()});\n \t\t// Dark mode through event listener on MediaQueryList\n \t\tvar mqList = window.matchMedia(\"(prefers-color-scheme: dark)\"),\n \t\t\tgetDarkModeTiddler = function() {return {title: \"$:/info/darkmode\", text: mqList.matches ? \"yes\" : \"no\"};};\n \t\tinfoTiddlerFields.push(getDarkModeTiddler());\n \t\tmqList.addListener(function(event) {\n \t\t\tupdateInfoTiddlersCallback([getDarkModeTiddler()]);\n \t\t});\n\t\t// Language\n\t\tinfoTiddlerFields.push({title: \"$:/info/browser/language\", text: navigator.language || \"\"});\n\t}\n\treturn infoTiddlerFields;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "info"
},
"$:/core/modules/keyboard.js": {
"title": "$:/core/modules/keyboard.js",
"text": "/*\\\ntitle: $:/core/modules/keyboard.js\ntype: application/javascript\nmodule-type: global\n\nKeyboard handling utilities\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar namedKeys = {\n\t\"cancel\": 3,\n\t\"help\": 6,\n\t\"backspace\": 8,\n\t\"tab\": 9,\n\t\"clear\": 12,\n\t\"return\": 13,\n\t\"enter\": 13,\n\t\"pause\": 19,\n\t\"escape\": 27,\n\t\"space\": 32,\n\t\"page_up\": 33,\n\t\"page_down\": 34,\n\t\"end\": 35,\n\t\"home\": 36,\n\t\"left\": 37,\n\t\"up\": 38,\n\t\"right\": 39,\n\t\"down\": 40,\n\t\"printscreen\": 44,\n\t\"insert\": 45,\n\t\"delete\": 46,\n\t\"0\": 48,\n\t\"1\": 49,\n\t\"2\": 50,\n\t\"3\": 51,\n\t\"4\": 52,\n\t\"5\": 53,\n\t\"6\": 54,\n\t\"7\": 55,\n\t\"8\": 56,\n\t\"9\": 57,\n\t\"firefoxsemicolon\": 59,\n\t\"firefoxequals\": 61,\n\t\"a\": 65,\n\t\"b\": 66,\n\t\"c\": 67,\n\t\"d\": 68,\n\t\"e\": 69,\n\t\"f\": 70,\n\t\"g\": 71,\n\t\"h\": 72,\n\t\"i\": 73,\n\t\"j\": 74,\n\t\"k\": 75,\n\t\"l\": 76,\n\t\"m\": 77,\n\t\"n\": 78,\n\t\"o\": 79,\n\t\"p\": 80,\n\t\"q\": 81,\n\t\"r\": 82,\n\t\"s\": 83,\n\t\"t\": 84,\n\t\"u\": 85,\n\t\"v\": 86,\n\t\"w\": 87,\n\t\"x\": 88,\n\t\"y\": 89,\n\t\"z\": 90,\n\t\"numpad0\": 96,\n\t\"numpad1\": 97,\n\t\"numpad2\": 98,\n\t\"numpad3\": 99,\n\t\"numpad4\": 100,\n\t\"numpad5\": 101,\n\t\"numpad6\": 102,\n\t\"numpad7\": 103,\n\t\"numpad8\": 104,\n\t\"numpad9\": 105,\n\t\"multiply\": 106,\n\t\"add\": 107,\n\t\"separator\": 108,\n\t\"subtract\": 109,\n\t\"decimal\": 110,\n\t\"divide\": 111,\n\t\"f1\": 112,\n\t\"f2\": 113,\n\t\"f3\": 114,\n\t\"f4\": 115,\n\t\"f5\": 116,\n\t\"f6\": 117,\n\t\"f7\": 118,\n\t\"f8\": 119,\n\t\"f9\": 120,\n\t\"f10\": 121,\n\t\"f11\": 122,\n\t\"f12\": 123,\n\t\"f13\": 124,\n\t\"f14\": 125,\n\t\"f15\": 126,\n\t\"f16\": 127,\n\t\"f17\": 128,\n\t\"f18\": 129,\n\t\"f19\": 130,\n\t\"f20\": 131,\n\t\"f21\": 132,\n\t\"f22\": 133,\n\t\"f23\": 134,\n\t\"f24\": 135,\n\t\"firefoxminus\": 173,\n\t\"semicolon\": 186,\n\t\"equals\": 187,\n\t\"comma\": 188,\n\t\"dash\": 189,\n\t\"period\": 190,\n\t\"slash\": 191,\n\t\"backquote\": 192,\n\t\"openbracket\": 219,\n\t\"backslash\": 220,\n\t\"closebracket\": 221,\n\t\"quote\": 222\n};\n\nfunction KeyboardManager(options) {\n\tvar self = this;\n\toptions = options || \"\";\n\t// Save the named key hashmap\n\tthis.namedKeys = namedKeys;\n\t// Create a reverse mapping of code to keyname\n\tthis.keyNames = [];\n\t$tw.utils.each(namedKeys,function(keyCode,name) {\n\t\tself.keyNames[keyCode] = name.substr(0,1).toUpperCase() + name.substr(1);\n\t});\n\t// Save the platform-specific name of the \"meta\" key\n\tthis.metaKeyName = $tw.platform.isMac ? \"cmd-\" : \"win-\";\n\tthis.shortcutKeysList = [], // Stores the shortcut-key descriptors\n\tthis.shortcutActionList = [], // Stores the corresponding action strings\n\tthis.shortcutParsedList = []; // Stores the parsed key descriptors\n\tthis.lookupNames = [\"shortcuts\"];\n\tthis.lookupNames.push($tw.platform.isMac ? \"shortcuts-mac\" : \"shortcuts-not-mac\")\n\tthis.lookupNames.push($tw.platform.isWindows ? \"shortcuts-windows\" : \"shortcuts-not-windows\");\n\tthis.lookupNames.push($tw.platform.isLinux ? \"shortcuts-linux\" : \"shortcuts-not-linux\");\n\tthis.updateShortcutLists(this.getShortcutTiddlerList());\n\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\tself.handleShortcutChanges(changes);\n\t});\n}\n\n/*\nReturn an array of keycodes for the modifier keys ctrl, shift, alt, meta\n*/\nKeyboardManager.prototype.getModifierKeys = function() {\n\treturn [\n\t\t16, // Shift\n\t\t17, // Ctrl\n\t\t18, // Alt\n\t\t20, // CAPS LOCK\n\t\t91, // Meta (left)\n\t\t93, // Meta (right)\n\t\t224 // Meta (Firefox)\n\t]\n};\n\n/*\nParses a key descriptor into the structure:\n{\n\tkeyCode: numeric keycode\n\tshiftKey: boolean\n\taltKey: boolean\n\tctrlKey: boolean\n\tmetaKey: boolean\n}\nKey descriptors have the following format:\n\tctrl+enter\n\tctrl+shift+alt+A\n*/\nKeyboardManager.prototype.parseKeyDescriptor = function(keyDescriptor) {\n\tvar components = keyDescriptor.split(/\\+|\\-/),\n\t\tinfo = {\n\t\t\tkeyCode: 0,\n\t\t\tshiftKey: false,\n\t\t\taltKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\tfor(var t=0; t<components.length; t++) {\n\t\tvar s = components[t].toLowerCase(),\n\t\t\tc = s.charCodeAt(0);\n\t\t// Look for modifier keys\n\t\tif(s === \"ctrl\") {\n\t\t\tinfo.ctrlKey = true;\n\t\t} else if(s === \"shift\") {\n\t\t\tinfo.shiftKey = true;\n\t\t} else if(s === \"alt\") {\n\t\t\tinfo.altKey = true;\n\t\t} else if(s === \"meta\" || s === \"cmd\" || s === \"win\") {\n\t\t\tinfo.metaKey = true;\n\t\t}\n\t\t// Replace named keys with their code\n\t\tif(this.namedKeys[s]) {\n\t\t\tinfo.keyCode = this.namedKeys[s];\n\t\t}\n\t}\n\tif(info.keyCode) {\n\t\treturn info;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nParse a list of key descriptors into an array of keyInfo objects. The key descriptors can be passed as an array of strings or a space separated string\n*/\nKeyboardManager.prototype.parseKeyDescriptors = function(keyDescriptors,options) {\n\tvar self = this;\n\toptions = options || {};\n\toptions.stack = options.stack || [];\n\tvar wiki = options.wiki || $tw.wiki;\n\tif(typeof keyDescriptors === \"string\" && keyDescriptors === \"\") {\n\t\treturn [];\n\t}\n\tif(!$tw.utils.isArray(keyDescriptors)) {\n\t\tkeyDescriptors = keyDescriptors.split(\" \");\n\t}\n\tvar result = [];\n\t$tw.utils.each(keyDescriptors,function(keyDescriptor) {\n\t\t// Look for a named shortcut\n\t\tif(keyDescriptor.substr(0,2) === \"((\" && keyDescriptor.substr(-2,2) === \"))\") {\n\t\t\tif(options.stack.indexOf(keyDescriptor) === -1) {\n\t\t\t\toptions.stack.push(keyDescriptor);\n\t\t\t\tvar name = keyDescriptor.substring(2,keyDescriptor.length - 2),\n\t\t\t\t\tlookupName = function(configName) {\n\t\t\t\t\t\tvar keyDescriptors = wiki.getTiddlerText(\"$:/config/\" + configName + \"/\" + name);\n\t\t\t\t\t\tif(keyDescriptors) {\n\t\t\t\t\t\t\tresult.push.apply(result,self.parseKeyDescriptors(keyDescriptors,options));\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t$tw.utils.each(self.lookupNames,function(platformDescriptor) {\n\t\t\t\t\tlookupName(platformDescriptor);\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tresult.push(self.parseKeyDescriptor(keyDescriptor));\n\t\t}\n\t});\n\treturn result;\n};\n\nKeyboardManager.prototype.getPrintableShortcuts = function(keyInfoArray) {\n\tvar self = this,\n\t\tresult = [];\n\t$tw.utils.each(keyInfoArray,function(keyInfo) {\n\t\tif(keyInfo) {\n\t\t\tresult.push((keyInfo.ctrlKey ? \"ctrl-\" : \"\") + \n\t\t\t\t (keyInfo.shiftKey ? \"shift-\" : \"\") + \n\t\t\t\t (keyInfo.altKey ? \"alt-\" : \"\") + \n\t\t\t\t (keyInfo.metaKey ? self.metaKeyName : \"\") + \n\t\t\t\t (self.keyNames[keyInfo.keyCode]));\n\t\t}\n\t});\n\treturn result;\n}\n\nKeyboardManager.prototype.checkKeyDescriptor = function(event,keyInfo) {\n\treturn keyInfo &&\n\t\t\tevent.keyCode === keyInfo.keyCode && \n\t\t\tevent.shiftKey === keyInfo.shiftKey && \n\t\t\tevent.altKey === keyInfo.altKey && \n\t\t\tevent.ctrlKey === keyInfo.ctrlKey && \n\t\t\tevent.metaKey === keyInfo.metaKey;\n};\n\nKeyboardManager.prototype.checkKeyDescriptors = function(event,keyInfoArray) {\n\tfor(var t=0; t<keyInfoArray.length; t++) {\n\t\tif(this.checkKeyDescriptor(event,keyInfoArray[t])) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n\nKeyboardManager.prototype.getEventModifierKeyDescriptor = function(event) {\n\treturn event.ctrlKey && !event.shiftKey\t&& !event.altKey && !event.metaKey ? \"ctrl\" : \n\t\tevent.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey ? \"shift\" : \n\t\tevent.ctrlKey && event.shiftKey && !event.altKey && !event.metaKey ? \"ctrl-shift\" : \n\t\tevent.altKey && !event.shiftKey && !event.ctrlKey && !event.metaKey ? \"alt\" : \n\t\tevent.altKey && event.shiftKey && !event.ctrlKey && !event.metaKey ? \"alt-shift\" : \n\t\tevent.altKey && event.ctrlKey && !event.shiftKey && !event.metaKey ? \"ctrl-alt\" : \n\t\tevent.altKey && event.shiftKey && event.ctrlKey && !event.metaKey ? \"ctrl-alt-shift\" : \n\t\tevent.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey ? \"meta\" : \n\t\tevent.metaKey && event.ctrlKey && !event.shiftKey && !event.altKey ? \"meta-ctrl\" :\n\t\tevent.metaKey && event.ctrlKey && event.shiftKey && !event.altKey ? \"meta-ctrl-shift\" :\n\t\tevent.metaKey && event.ctrlKey && event.shiftKey && event.altKey ? \"meta-ctrl-alt-shift\" : \"normal\";\n};\n\nKeyboardManager.prototype.getShortcutTiddlerList = function() {\n\treturn $tw.wiki.getTiddlersWithTag(\"$:/tags/KeyboardShortcut\");\n};\n\nKeyboardManager.prototype.updateShortcutLists = function(tiddlerList) {\n\tthis.shortcutTiddlers = tiddlerList;\n\tfor(var i=0; i<tiddlerList.length; i++) {\n\t\tvar title = tiddlerList[i],\n\t\t\ttiddlerFields = $tw.wiki.getTiddler(title).fields;\n\t\tthis.shortcutKeysList[i] = tiddlerFields.key !== undefined ? tiddlerFields.key : undefined;\n\t\tthis.shortcutActionList[i] = tiddlerFields.text;\n\t\tthis.shortcutParsedList[i] = this.shortcutKeysList[i] !== undefined ? this.parseKeyDescriptors(this.shortcutKeysList[i]) : undefined;\n\t}\n};\n\nKeyboardManager.prototype.handleKeydownEvent = function(event) {\n\tvar key, action;\n\tfor(var i=0; i<this.shortcutTiddlers.length; i++) {\n\t\tif(this.shortcutParsedList[i] !== undefined && this.checkKeyDescriptors(event,this.shortcutParsedList[i])) {\n\t\t\tkey = this.shortcutParsedList[i];\n\t\t\taction = this.shortcutActionList[i];\n\t\t}\n\t}\n\tif(key !== undefined) {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\t$tw.rootWidget.invokeActionString(action,$tw.rootWidget);\n\t\treturn true;\n\t}\n\treturn false;\n};\n\nKeyboardManager.prototype.detectNewShortcuts = function(changedTiddlers) {\n\tvar shortcutConfigTiddlers = [],\n\t\thandled = false;\n\t$tw.utils.each(this.lookupNames,function(platformDescriptor) {\n\t\tvar descriptorString = \"$:/config/\" + platformDescriptor + \"/\";\n\t\tObject.keys(changedTiddlers).forEach(function(configTiddler) {\n\t\t\tvar configString = configTiddler.substr(0, configTiddler.lastIndexOf(\"/\") + 1);\n\t\t\tif(configString === descriptorString) {\n\t\t\t\tshortcutConfigTiddlers.push(configTiddler);\n\t\t\t\thandled = true;\n\t\t\t}\n\t\t});\n\t});\n\tif(handled) {\n\t\treturn $tw.utils.hopArray(changedTiddlers,shortcutConfigTiddlers);\n\t} else {\n\t\treturn false;\n\t}\n};\n\nKeyboardManager.prototype.handleShortcutChanges = function(changedTiddlers) {\n\tvar newList = this.getShortcutTiddlerList();\n\tvar hasChanged = $tw.utils.hopArray(changedTiddlers,this.shortcutTiddlers) ? true :\n\t\t($tw.utils.hopArray(changedTiddlers,newList) ? true :\n\t\t(this.detectNewShortcuts(changedTiddlers))\n\t);\n\t// Re-cache shortcuts if something changed\n\tif(hasChanged) {\n\t\tthis.updateShortcutLists(newList);\n\t}\n};\n\nexports.KeyboardManager = KeyboardManager;\n\n})();\n",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/language.js": {
"title": "$:/core/modules/language.js",
"text": "/*\\\ntitle: $:/core/modules/language.js\ntype: application/javascript\nmodule-type: global\n\nThe $tw.Language() manages translateable strings\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nCreate an instance of the language manager. Options include:\nwiki: wiki from which to retrieve translation tiddlers\n*/\nfunction Language(options) {\n\toptions = options || \"\";\n\tthis.wiki = options.wiki || $tw.wiki;\n}\n\n/*\nReturn a wikified translateable string. The title is automatically prefixed with \"$:/language/\"\nOptions include:\nvariables: optional hashmap of variables to supply to the language wikification\n*/\nLanguage.prototype.getString = function(title,options) {\n\toptions = options || {};\n\ttitle = \"$:/language/\" + title;\n\treturn this.wiki.renderTiddler(\"text/plain\",title,{variables: options.variables});\n};\n\n/*\nReturn a raw, unwikified translateable string. The title is automatically prefixed with \"$:/language/\"\n*/\nLanguage.prototype.getRawString = function(title) {\n\ttitle = \"$:/language/\" + title;\n\treturn this.wiki.getTiddlerText(title);\n};\n\nexports.Language = Language;\n\n})();\n",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/macros/changecount.js": {
"title": "$:/core/modules/macros/changecount.js",
"text": "/*\\\ntitle: $:/core/modules/macros/changecount.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to return the changecount for the current tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"changecount\";\n\nexports.params = [];\n\n/*\nRun the macro\n*/\nexports.run = function() {\n\treturn this.wiki.getChangeCount(this.getVariable(\"currentTiddler\")) + \"\";\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/contrastcolour.js": {
"title": "$:/core/modules/macros/contrastcolour.js",
"text": "/*\\\ntitle: $:/core/modules/macros/contrastcolour.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to choose which of two colours has the highest contrast with a base colour\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"contrastcolour\";\n\nexports.params = [\n\t{name: \"target\"},\n\t{name: \"fallbackTarget\"},\n\t{name: \"colourA\"},\n\t{name: \"colourB\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(target,fallbackTarget,colourA,colourB) {\n\tvar rgbTarget = $tw.utils.parseCSSColor(target) || $tw.utils.parseCSSColor(fallbackTarget);\n\tif(!rgbTarget) {\n\t\treturn colourA;\n\t}\n\tvar rgbColourA = $tw.utils.parseCSSColor(colourA),\n\t\trgbColourB = $tw.utils.parseCSSColor(colourB);\n\tif(rgbColourA && !rgbColourB) {\n\t\treturn rgbColourA;\n\t}\n\tif(rgbColourB && !rgbColourA) {\n\t\treturn rgbColourB;\n\t}\n\tif(!rgbColourA && !rgbColourB) {\n\t\t// If neither colour is readable, return a crude inverse of the target\n\t\treturn [255 - rgbTarget[0],255 - rgbTarget[1],255 - rgbTarget[2],rgbTarget[3]];\n\t}\n\t// Colour brightness formula derived from http://www.w3.org/WAI/ER/WD-AERT/#color-contrast\n\tvar brightnessTarget = rgbTarget[0] * 0.299 + rgbTarget[1] * 0.587 + rgbTarget[2] * 0.114,\n\t\tbrightnessA = rgbColourA[0] * 0.299 + rgbColourA[1] * 0.587 + rgbColourA[2] * 0.114,\n\t\tbrightnessB = rgbColourB[0] * 0.299 + rgbColourB[1] * 0.587 + rgbColourB[2] * 0.114;\n\treturn Math.abs(brightnessTarget - brightnessA) > Math.abs(brightnessTarget - brightnessB) ? colourA : colourB;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/csvtiddlers.js": {
"title": "$:/core/modules/macros/csvtiddlers.js",
"text": "/*\\\ntitle: $:/core/modules/macros/csvtiddlers.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to output tiddlers matching a filter to CSV\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"csvtiddlers\";\n\nexports.params = [\n\t{name: \"filter\"},\n\t{name: \"format\"},\n];\n\n/*\nRun the macro\n*/\nexports.run = function(filter,format) {\n\tvar self = this,\n\t\ttiddlers = this.wiki.filterTiddlers(filter),\n\t\ttiddler,\n\t\tfields = [],\n\t\tt,f;\n\t// Collect all the fields\n\tfor(t=0;t<tiddlers.length; t++) {\n\t\ttiddler = this.wiki.getTiddler(tiddlers[t]);\n\t\tfor(f in tiddler.fields) {\n\t\t\tif(fields.indexOf(f) === -1) {\n\t\t\t\tfields.push(f);\n\t\t\t}\n\t\t}\n\t}\n\t// Sort the fields and bring the standard ones to the front\n\tfields.sort();\n\t\"title text modified modifier created creator\".split(\" \").reverse().forEach(function(value,index) {\n\t\tvar p = fields.indexOf(value);\n\t\tif(p !== -1) {\n\t\t\tfields.splice(p,1);\n\t\t\tfields.unshift(value)\n\t\t}\n\t});\n\t// Output the column headings\n\tvar output = [], row = [];\n\tfields.forEach(function(value) {\n\t\trow.push(quoteAndEscape(value))\n\t});\n\toutput.push(row.join(\",\"));\n\t// Output each tiddler\n\tfor(var t=0;t<tiddlers.length; t++) {\n\t\trow = [];\n\t\ttiddler = this.wiki.getTiddler(tiddlers[t]);\n\t\t\tfor(f=0; f<fields.length; f++) {\n\t\t\t\trow.push(quoteAndEscape(tiddler ? tiddler.getFieldString(fields[f]) || \"\" : \"\"));\n\t\t\t}\n\t\toutput.push(row.join(\",\"));\n\t}\n\treturn output.join(\"\\n\");\n};\n\nfunction quoteAndEscape(value) {\n\treturn \"\\\"\" + value.replace(/\"/mg,\"\\\"\\\"\") + \"\\\"\";\n}\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/displayshortcuts.js": {
"title": "$:/core/modules/macros/displayshortcuts.js",
"text": "/*\\\ntitle: $:/core/modules/macros/displayshortcuts.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to display a list of keyboard shortcuts in human readable form. Notably, it resolves named shortcuts like `((bold))` to the underlying keystrokes.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"displayshortcuts\";\n\nexports.params = [\n\t{name: \"shortcuts\"},\n\t{name: \"prefix\"},\n\t{name: \"separator\"},\n\t{name: \"suffix\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(shortcuts,prefix,separator,suffix) {\n\tvar shortcutArray = $tw.keyboardManager.getPrintableShortcuts($tw.keyboardManager.parseKeyDescriptors(shortcuts,{\n\t\twiki: this.wiki\n\t}));\n\tif(shortcutArray.length > 0) {\n\t\tshortcutArray.sort(function(a,b) {\n\t\t return a.toLowerCase().localeCompare(b.toLowerCase());\n\t\t})\n\t\treturn prefix + shortcutArray.join(separator) + suffix;\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/jsontiddler.js": {
"title": "$:/core/modules/macros/jsontiddler.js",
"text": "/*\\\ntitle: $:/core/modules/macros/jsontiddler.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to output a single tiddler to JSON\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"jsontiddler\";\n\nexports.params = [\n\t{name: \"title\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(title) {\n\ttitle = title || this.getVariable(\"currentTiddler\");\n\tvar tiddler = !!title && this.wiki.getTiddler(title),\n\t\tfields = new Object();\n\tif(tiddler) {\n\t\tfor(var field in tiddler.fields) {\n\t\t\tfields[field] = tiddler.getFieldString(field);\n\t\t}\n\t}\n\treturn JSON.stringify(fields,null,$tw.config.preferences.jsonSpaces);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/jsontiddlers.js": {
"title": "$:/core/modules/macros/jsontiddlers.js",
"text": "/*\\\ntitle: $:/core/modules/macros/jsontiddlers.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to output tiddlers matching a filter to JSON\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"jsontiddlers\";\n\nexports.params = [\n\t{name: \"filter\"},\n\t{name: \"spaces\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(filter,spaces) {\n\treturn this.wiki.getTiddlersAsJson(filter,$tw.utils.parseInt(spaces));\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/makedatauri.js": {
"title": "$:/core/modules/macros/makedatauri.js",
"text": "/*\\\ntitle: $:/core/modules/macros/makedatauri.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to convert a string of text to a data URI\n\n<<makedatauri text:\"Text to be converted\" type:\"text/vnd.tiddlywiki\">>\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"makedatauri\";\n\nexports.params = [\n\t{name: \"text\"},\n\t{name: \"type\"},\n\t{name: \"_canonical_uri\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(text,type,_canonical_uri) {\n\treturn $tw.utils.makeDataUri(text,type,_canonical_uri);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/now.js": {
"title": "$:/core/modules/macros/now.js",
"text": "/*\\\ntitle: $:/core/modules/macros/now.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to return a formatted version of the current time\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"now\";\n\nexports.params = [\n\t{name: \"format\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(format) {\n\treturn $tw.utils.formatDateString(new Date(),format || \"0hh:0mm, DDth MMM YYYY\");\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/qualify.js": {
"title": "$:/core/modules/macros/qualify.js",
"text": "/*\\\ntitle: $:/core/modules/macros/qualify.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to qualify a state tiddler title according\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"qualify\";\n\nexports.params = [\n\t{name: \"title\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(title) {\n\treturn title + \"-\" + this.getStateQualifier();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/resolvepath.js": {
"title": "$:/core/modules/macros/resolvepath.js",
"text": "/*\\\ntitle: $:/core/modules/macros/resolvepath.js\ntype: application/javascript\nmodule-type: macro\n\nResolves a relative path for an absolute rootpath.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"resolvepath\";\n\nexports.params = [\n\t{name: \"source\"},\n\t{name: \"root\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(source, root) {\n\treturn $tw.utils.resolvePath(source, root);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/unusedtitle.js": {
"title": "$:/core/modules/macros/unusedtitle.js",
"text": "/*\\\ntitle: $:/core/modules/macros/unusedtitle.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to return a new title that is unused in the wiki. It can be given a name as a base.\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"unusedtitle\";\n\nexports.params = [\n\t{name: \"baseName\"},\n\t{name: \"separator\"},\n\t{name: \"template\"}\n];\n\n/*\nRun the macro\n*/\nexports.run = function(baseName,separator,template) {\n\tseparator = separator || \" \";\n\tif(!baseName) {\n\t\tbaseName = $tw.language.getString(\"DefaultNewTiddlerTitle\");\n\t}\n\t// $tw.wiki.generateNewTitle = function(baseTitle,options)\n\t// options.prefix must be a string! \n\treturn this.wiki.generateNewTitle(baseName, {\"prefix\": separator, \"template\": template});\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/macros/version.js": {
"title": "$:/core/modules/macros/version.js",
"text": "/*\\\ntitle: $:/core/modules/macros/version.js\ntype: application/javascript\nmodule-type: macro\n\nMacro to return the TiddlyWiki core version number\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInformation about this macro\n*/\n\nexports.name = \"version\";\n\nexports.params = [];\n\n/*\nRun the macro\n*/\nexports.run = function() {\n\treturn $tw.version;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "macro"
},
"$:/core/modules/parsers/audioparser.js": {
"title": "$:/core/modules/parsers/audioparser.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/audioparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe audio parser parses an audio tiddler into an embeddable HTML element\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar AudioParser = function(type,text,options) {\n\tvar element = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"audio\",\n\t\t\tattributes: {\n\t\t\t\tcontrols: {type: \"string\", value: \"controls\"},\n\t\t\t\tstyle: {type: \"string\", value: \"width: 100%; object-fit: contain\"}\n\t\t\t}\n\t\t},\n\t\tsrc;\n\tif(options._canonical_uri) {\n\t\telement.attributes.src = {type: \"string\", value: options._canonical_uri};\n\t} else if(text) {\n\t\telement.attributes.src = {type: \"string\", value: \"data:\" + type + \";base64,\" + text};\n\t}\n\tthis.tree = [element];\n};\n\nexports[\"audio/ogg\"] = AudioParser;\nexports[\"audio/mpeg\"] = AudioParser;\nexports[\"audio/mp3\"] = AudioParser;\nexports[\"audio/mp4\"] = AudioParser;\n\n})();\n\n",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/binaryparser.js": {
"title": "$:/core/modules/parsers/binaryparser.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/binaryparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe binary parser parses a binary tiddler into a warning message and download link\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar BINARY_WARNING_MESSAGE = \"$:/core/ui/BinaryWarning\";\nvar EXPORT_BUTTON_IMAGE = \"$:/core/images/export-button\";\n\nvar BinaryParser = function(type,text,options) {\n\t// Transclude the binary data tiddler warning message\n\tvar warn = {\n\t\ttype: \"element\",\n\t\ttag: \"p\",\n\t\tchildren: [{\n\t\t\ttype: \"transclude\",\n\t\t\tattributes: {\n\t\t\t\ttiddler: {type: \"string\", value: BINARY_WARNING_MESSAGE}\n\t\t\t}\n\t\t}]\n\t};\n\t// Create download link based on binary tiddler title\n\tvar link = {\n\t\ttype: \"element\",\n\t\ttag: \"a\",\n\t\tattributes: {\n\t\t\ttitle: {type: \"indirect\", textReference: \"!!title\"},\n\t\t\tdownload: {type: \"indirect\", textReference: \"!!title\"}\n\t\t},\n\t\tchildren: [{\n\t\t\ttype: \"transclude\",\n\t\t\tattributes: {\n\t\t\t\ttiddler: {type: \"string\", value: EXPORT_BUTTON_IMAGE}\n\t\t\t}\n\t\t}]\n\t};\n\t// Set the link href to external or internal data URI\n\tif(options._canonical_uri) {\n\t\tlink.attributes.href = {\n\t\t\ttype: \"string\", \n\t\t\tvalue: options._canonical_uri\n\t\t};\n\t} else if(text) {\n\t\tlink.attributes.href = {\n\t\t\ttype: \"string\", \n\t\t\tvalue: \"data:\" + type + \";base64,\" + text\n\t\t};\n\t}\n\t// Combine warning message and download link in a div\n\tvar element = {\n\t\ttype: \"element\",\n\t\ttag: \"div\",\n\t\tattributes: {\n\t\t\tclass: {type: \"string\", value: \"tc-binary-warning\"}\n\t\t},\n\t\tchildren: [warn, link]\n\t}\n\tthis.tree = [element];\n};\n\nexports[\"application/octet-stream\"] = BinaryParser;\n\n})();\n\n",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/csvparser.js": {
"title": "$:/core/modules/parsers/csvparser.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/csvparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe CSV text parser processes CSV files into a table wrapped in a scrollable widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar CsvParser = function(type,text,options) {\n\t// Table framework\n\tthis.tree = [{\n\t\t\"type\": \"scrollable\", \"children\": [{\n\t\t\t\"type\": \"element\", \"tag\": \"table\", \"children\": [{\n\t\t\t\t\"type\": \"element\", \"tag\": \"tbody\", \"children\": []\n\t\t\t}], \"attributes\": {\n\t\t\t\t\"class\": {\"type\": \"string\", \"value\": \"tc-csv-table\"}\n\t\t\t}\n\t\t}]\n\t}];\n\t// Split the text into lines\n\tvar lines = text.split(/\\r?\\n/mg),\n\t\ttag = \"th\";\n\tfor(var line=0; line<lines.length; line++) {\n\t\tvar lineText = lines[line];\n\t\tif(lineText) {\n\t\t\tvar row = {\n\t\t\t\t\t\"type\": \"element\", \"tag\": \"tr\", \"children\": []\n\t\t\t\t};\n\t\t\tvar columns = lineText.split(\",\");\n\t\t\tfor(var column=0; column<columns.length; column++) {\n\t\t\t\trow.children.push({\n\t\t\t\t\t\t\"type\": \"element\", \"tag\": tag, \"children\": [{\n\t\t\t\t\t\t\t\"type\": \"text\",\n\t\t\t\t\t\t\t\"text\": columns[column]\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t}\n\t\t\ttag = \"td\";\n\t\t\tthis.tree[0].children[0].children[0].children.push(row);\n\t\t}\n\t}\n};\n\nexports[\"text/csv\"] = CsvParser;\n\n})();\n\n",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/htmlparser.js": {
"title": "$:/core/modules/parsers/htmlparser.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/htmlparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe HTML parser displays text as raw HTML\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar HtmlParser = function(type,text,options) {\n\tvar src;\n\tif(options._canonical_uri) {\n\t\tsrc = options._canonical_uri;\n\t} else if(text) {\n\t\tsrc = \"data:text/html;charset=utf-8,\" + encodeURIComponent(text);\n\t}\n\tthis.tree = [{\n\t\ttype: \"element\",\n\t\ttag: \"iframe\",\n\t\tattributes: {\n\t\t\tsrc: {type: \"string\", value: src}\n\t\t}\n\t}];\n\tif($tw.wiki.getTiddlerText(\"$:/config/HtmlParser/DisableSandbox\",\"no\") !== \"yes\") {\n\t\tthis.tree[0].attributes.sandbox = {type: \"string\", value: $tw.wiki.getTiddlerText(\"$:/config/HtmlParser/SandboxTokens\",\"\")};\n\t}\n};\n\nexports[\"text/html\"] = HtmlParser;\n\n})();\n\n",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/imageparser.js": {
"title": "$:/core/modules/parsers/imageparser.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/imageparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe image parser parses an image into an embeddable HTML element\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ImageParser = function(type,text,options) {\n\tvar element = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"img\",\n\t\t\tattributes: {}\n\t\t};\n\tif(options._canonical_uri) {\n\t\telement.attributes.src = {type: \"string\", value: options._canonical_uri};\n\t} else if(text) {\n\t\tif(type === \"image/svg+xml\" || type === \".svg\") {\n\t\t\telement.attributes.src = {type: \"string\", value: \"data:image/svg+xml,\" + encodeURIComponent(text)};\n\t\t} else {\n\t\t\telement.attributes.src = {type: \"string\", value: \"data:\" + type + \";base64,\" + text};\n\t\t}\n\t}\n\tthis.tree = [element];\n};\n\nexports[\"image/svg+xml\"] = ImageParser;\nexports[\"image/jpg\"] = ImageParser;\nexports[\"image/jpeg\"] = ImageParser;\nexports[\"image/png\"] = ImageParser;\nexports[\"image/gif\"] = ImageParser;\nexports[\"image/webp\"] = ImageParser;\nexports[\"image/heic\"] = ImageParser;\nexports[\"image/heif\"] = ImageParser;\nexports[\"image/x-icon\"] = ImageParser;\nexports[\"image/vnd.microsoft.icon\"] = ImageParser;\n\n})();\n\n",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/utils/parseutils.js": {
"title": "$:/core/modules/utils/parseutils.js",
"text": "/*\\\ntitle: $:/core/modules/utils/parseutils.js\ntype: application/javascript\nmodule-type: utils\n\nUtility functions concerned with parsing text into tokens.\n\nMost functions have the following pattern:\n\n* The parameters are:\n** `source`: the source string being parsed\n** `pos`: the current parse position within the string\n** Any further parameters are used to identify the token that is being parsed\n* The return value is:\n** null if the token was not found at the specified position\n** an object representing the token with the following standard fields:\n*** `type`: string indicating the type of the token\n*** `start`: start position of the token in the source string\n*** `end`: end position of the token in the source string\n*** Any further fields required to describe the token\n\nThe exception is `skipWhiteSpace`, which just returns the position after the whitespace.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nLook for a whitespace token. Returns null if not found, otherwise returns {type: \"whitespace\", start:, end:,}\n*/\nexports.parseWhiteSpace = function(source,pos) {\n\tvar p = pos,c;\n\twhile(true) {\n\t\tc = source.charAt(p);\n\t\tif((c === \" \") || (c === \"\\f\") || (c === \"\\n\") || (c === \"\\r\") || (c === \"\\t\") || (c === \"\\v\") || (c === \"\\u00a0\")) { // Ignores some obscure unicode spaces\n\t\t\tp++;\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(p === pos) {\n\t\treturn null;\n\t} else {\n\t\treturn {\n\t\t\ttype: \"whitespace\",\n\t\t\tstart: pos,\n\t\t\tend: p\n\t\t}\n\t}\n};\n\n/*\nConvenience wrapper for parseWhiteSpace. Returns the position after the whitespace\n*/\nexports.skipWhiteSpace = function(source,pos) {\n\tvar c;\n\twhile(true) {\n\t\tc = source.charAt(pos);\n\t\tif((c === \" \") || (c === \"\\f\") || (c === \"\\n\") || (c === \"\\r\") || (c === \"\\t\") || (c === \"\\v\") || (c === \"\\u00a0\")) { // Ignores some obscure unicode spaces\n\t\t\tpos++;\n\t\t} else {\n\t\t\treturn pos;\n\t\t}\n\t}\n};\n\n/*\nLook for a given string token. Returns null if not found, otherwise returns {type: \"token\", value:, start:, end:,}\n*/\nexports.parseTokenString = function(source,pos,token) {\n\tvar match = source.indexOf(token,pos) === pos;\n\tif(match) {\n\t\treturn {\n\t\t\ttype: \"token\",\n\t\t\tvalue: token,\n\t\t\tstart: pos,\n\t\t\tend: pos + token.length\n\t\t};\n\t}\n\treturn null;\n};\n\n/*\nLook for a token matching a regex. Returns null if not found, otherwise returns {type: \"regexp\", match:, start:, end:,}\n*/\nexports.parseTokenRegExp = function(source,pos,reToken) {\n\tvar node = {\n\t\ttype: \"regexp\",\n\t\tstart: pos\n\t};\n\treToken.lastIndex = pos;\n\tnode.match = reToken.exec(source);\n\tif(node.match && node.match.index === pos) {\n\t\tnode.end = pos + node.match[0].length;\n\t\treturn node;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nLook for a string literal. Returns null if not found, otherwise returns {type: \"string\", value:, start:, end:,}\n*/\nexports.parseStringLiteral = function(source,pos) {\n\tvar node = {\n\t\ttype: \"string\",\n\t\tstart: pos\n\t};\n\tvar reString = /(?:\"\"\"([\\s\\S]*?)\"\"\"|\"([^\"]*)\")|(?:'([^']*)')/g;\n\treString.lastIndex = pos;\n\tvar match = reString.exec(source);\n\tif(match && match.index === pos) {\n\t\tnode.value = match[1] !== undefined ? match[1] :(\n\t\t\tmatch[2] !== undefined ? match[2] : match[3] \n\t\t\t\t\t);\n\t\tnode.end = pos + match[0].length;\n\t\treturn node;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nLook for a macro invocation parameter. Returns null if not found, or {type: \"macro-parameter\", name:, value:, start:, end:}\n*/\nexports.parseMacroParameter = function(source,pos) {\n\tvar node = {\n\t\ttype: \"macro-parameter\",\n\t\tstart: pos\n\t};\n\t// Define our regexp\n\tvar reMacroParameter = /(?:([A-Za-z0-9\\-_]+)\\s*:)?(?:\\s*(?:\"\"\"([\\s\\S]*?)\"\"\"|\"([^\"]*)\"|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|((?:(?:>(?!>))|[^\\s>\"'])+)))/g;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for the parameter\n\tvar token = $tw.utils.parseTokenRegExp(source,pos,reMacroParameter);\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Get the parameter details\n\tnode.value = token.match[2] !== undefined ? token.match[2] : (\n\t\t\t\t\ttoken.match[3] !== undefined ? token.match[3] : (\n\t\t\t\t\t\ttoken.match[4] !== undefined ? token.match[4] : (\n\t\t\t\t\t\t\ttoken.match[5] !== undefined ? token.match[5] : (\n\t\t\t\t\t\t\t\ttoken.match[6] !== undefined ? token.match[6] : (\n\t\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\tif(token.match[1]) {\n\t\tnode.name = token.match[1];\n\t}\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n/*\nLook for a macro invocation. Returns null if not found, or {type: \"macrocall\", name:, parameters:, start:, end:}\n*/\nexports.parseMacroInvocation = function(source,pos) {\n\tvar node = {\n\t\ttype: \"macrocall\",\n\t\tstart: pos,\n\t\tparams: []\n\t};\n\t// Define our regexps\n\tvar reMacroName = /([^\\s>\"'=]+)/g;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for a double less than sign\n\tvar token = $tw.utils.parseTokenString(source,pos,\"<<\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Get the macro name\n\tvar name = $tw.utils.parseTokenRegExp(source,pos,reMacroName);\n\tif(!name) {\n\t\treturn null;\n\t}\n\tnode.name = name.match[1];\n\tpos = name.end;\n\t// Process parameters\n\tvar parameter = $tw.utils.parseMacroParameter(source,pos);\n\twhile(parameter) {\n\t\tnode.params.push(parameter);\n\t\tpos = parameter.end;\n\t\t// Get the next parameter\n\t\tparameter = $tw.utils.parseMacroParameter(source,pos);\n\t}\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for a double greater than sign\n\ttoken = $tw.utils.parseTokenString(source,pos,\">>\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n/*\nLook for an HTML attribute definition. Returns null if not found, otherwise returns {type: \"attribute\", name:, valueType: \"string|indirect|macro\", value:, start:, end:,}\n*/\nexports.parseAttribute = function(source,pos) {\n\tvar node = {\n\t\tstart: pos\n\t};\n\t// Define our regexps\n\tvar reAttributeName = /([^\\/\\s>\"'=]+)/g,\n\t\treUnquotedAttribute = /([^\\/\\s<>\"'=]+)/g,\n\t\treFilteredValue = /\\{\\{\\{(.+?)\\}\\}\\}/g,\n\t\treIndirectValue = /\\{\\{([^\\}]+)\\}\\}/g;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Get the attribute name\n\tvar name = $tw.utils.parseTokenRegExp(source,pos,reAttributeName);\n\tif(!name) {\n\t\treturn null;\n\t}\n\tnode.name = name.match[1];\n\tpos = name.end;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for an equals sign\n\tvar token = $tw.utils.parseTokenString(source,pos,\"=\");\n\tif(token) {\n\t\tpos = token.end;\n\t\t// Skip whitespace\n\t\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t\t// Look for a string literal\n\t\tvar stringLiteral = $tw.utils.parseStringLiteral(source,pos);\n\t\tif(stringLiteral) {\n\t\t\tpos = stringLiteral.end;\n\t\t\tnode.type = \"string\";\n\t\t\tnode.value = stringLiteral.value;\n\t\t} else {\n\t\t\t// Look for a filtered value\n\t\t\tvar filteredValue = $tw.utils.parseTokenRegExp(source,pos,reFilteredValue);\n\t\t\tif(filteredValue) {\n\t\t\t\tpos = filteredValue.end;\n\t\t\t\tnode.type = \"filtered\";\n\t\t\t\tnode.filter = filteredValue.match[1];\n\t\t\t} else {\n\t\t\t\t// Look for an indirect value\n\t\t\t\tvar indirectValue = $tw.utils.parseTokenRegExp(source,pos,reIndirectValue);\n\t\t\t\tif(indirectValue) {\n\t\t\t\t\tpos = indirectValue.end;\n\t\t\t\t\tnode.type = \"indirect\";\n\t\t\t\t\tnode.textReference = indirectValue.match[1];\n\t\t\t\t} else {\n\t\t\t\t\t// Look for a unquoted value\n\t\t\t\t\tvar unquotedValue = $tw.utils.parseTokenRegExp(source,pos,reUnquotedAttribute);\n\t\t\t\t\tif(unquotedValue) {\n\t\t\t\t\t\tpos = unquotedValue.end;\n\t\t\t\t\t\tnode.type = \"string\";\n\t\t\t\t\t\tnode.value = unquotedValue.match[1];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Look for a macro invocation value\n\t\t\t\t\t\tvar macroInvocation = $tw.utils.parseMacroInvocation(source,pos);\n\t\t\t\t\t\tif(macroInvocation) {\n\t\t\t\t\t\t\tpos = macroInvocation.end;\n\t\t\t\t\t\t\tnode.type = \"macro\";\n\t\t\t\t\t\t\tnode.value = macroInvocation;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode.type = \"string\";\n\t\t\t\t\t\t\tnode.value = \"true\";\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} else {\n\t\tnode.type = \"string\";\n\t\tnode.value = \"true\";\n\t}\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/parsers/pdfparser.js": {
"title": "$:/core/modules/parsers/pdfparser.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/pdfparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe PDF parser embeds a PDF viewer\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ImageParser = function(type,text,options) {\n\tvar element = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"embed\",\n\t\t\tattributes: {}\n\t\t},\n\t\tsrc;\n\tif(options._canonical_uri) {\n\t\telement.attributes.src = {type: \"string\", value: options._canonical_uri};\n\t} else if(text) {\n\t\telement.attributes.src = {type: \"string\", value: \"data:application/pdf;base64,\" + text};\n\t}\n\tthis.tree = [element];\n};\n\nexports[\"application/pdf\"] = ImageParser;\n\n})();\n\n",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/textparser.js": {
"title": "$:/core/modules/parsers/textparser.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/textparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe plain text parser processes blocks of source text into a degenerate parse tree consisting of a single text node\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar TextParser = function(type,text,options) {\n\tthis.tree = [{\n\t\ttype: \"codeblock\",\n\t\tattributes: {\n\t\t\tcode: {type: \"string\", value: text},\n\t\t\tlanguage: {type: \"string\", value: type}\n\t\t}\n\t}];\n};\n\nexports[\"text/plain\"] = TextParser;\nexports[\"text/x-tiddlywiki\"] = TextParser;\nexports[\"application/javascript\"] = TextParser;\nexports[\"application/json\"] = TextParser;\nexports[\"text/css\"] = TextParser;\nexports[\"application/x-tiddler-dictionary\"] = TextParser;\n\n})();\n\n",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/videoparser.js": {
"title": "$:/core/modules/parsers/videoparser.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/videoparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe video parser parses a video tiddler into an embeddable HTML element\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar VideoParser = function(type,text,options) {\n\tvar element = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"video\",\n\t\t\tattributes: {\n\t\t\t\tcontrols: {type: \"string\", value: \"controls\"},\n\t\t\t\tstyle: {type: \"string\", value: \"width: 100%; object-fit: contain\"}\n\t\t\t}\n\t\t},\n\t\tsrc;\n\tif(options._canonical_uri) {\n\t\telement.attributes.src = {type: \"string\", value: options._canonical_uri};\n\t} else if(text) {\n\t\telement.attributes.src = {type: \"string\", value: \"data:\" + type + \";base64,\" + text};\n\t}\n\tthis.tree = [element];\n};\n\nexports[\"video/ogg\"] = VideoParser;\nexports[\"video/webm\"] = VideoParser;\nexports[\"video/mp4\"] = VideoParser;\nexports[\"video/quicktime\"] = VideoParser;\n\n})();\n",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/wikiparser/rules/codeblock.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/codeblock.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/codeblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for code blocks. For example:\n\n```\n\t```\n\tThis text will not be //wikified//\n\t```\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"codeblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match and get language if defined\n\tthis.matchRegExp = /```([\\w-]*)\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /(\\r?\\n```$)/mg;\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Look for the end of the block\n\treEnd.lastIndex = this.parser.pos;\n\tvar match = reEnd.exec(this.parser.source),\n\t\ttext;\n\t// Process the block\n\tif(match) {\n\t\ttext = this.parser.source.substring(this.parser.pos,match.index);\n\t\tthis.parser.pos = match.index + match[0].length;\n\t} else {\n\t\ttext = this.parser.source.substr(this.parser.pos);\n\t\tthis.parser.pos = this.parser.sourceLength;\n\t}\n\t// Return the $codeblock widget\n\treturn [{\n\t\t\ttype: \"codeblock\",\n\t\t\tattributes: {\n\t\t\t\t\tcode: {type: \"string\", value: text},\n\t\t\t\t\tlanguage: {type: \"string\", value: this.match[1]}\n\t\t\t}\n\t}];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/codeinline.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/codeinline.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/codeinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for code runs. For example:\n\n```\n\tThis is a `code run`.\n\tThis is another ``code run``\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"codeinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(``?)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar reEnd = new RegExp(this.match[1], \"mg\");\n\t// Look for the end marker\n\treEnd.lastIndex = this.parser.pos;\n\tvar match = reEnd.exec(this.parser.source),\n\t\ttext;\n\t// Process the text\n\tif(match) {\n\t\ttext = this.parser.source.substring(this.parser.pos,match.index);\n\t\tthis.parser.pos = match.index + match[0].length;\n\t} else {\n\t\ttext = this.parser.source.substr(this.parser.pos);\n\t\tthis.parser.pos = this.parser.sourceLength;\n\t}\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"code\",\n\t\tchildren: [{\n\t\t\ttype: \"text\",\n\t\t\ttext: text\n\t\t}]\n\t}];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/commentblock.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/commentblock.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/commentblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for HTML comments. For example:\n\n```\n<!-- This is a comment -->\n```\n\nNote that the syntax for comments is simplified to an opening \"<!--\" sequence and a closing \"-->\" sequence -- HTML itself implements a more complex format (see http://ostermiller.org/findhtmlcomment.html)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"commentblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\tthis.matchRegExp = /<!--/mg;\n\tthis.endMatchRegExp = /-->/mg;\n};\n\nexports.findNextMatch = function(startPos) {\n\tthis.matchRegExp.lastIndex = startPos;\n\tthis.match = this.matchRegExp.exec(this.parser.source);\n\tif(this.match) {\n\t\tthis.endMatchRegExp.lastIndex = this.match.index + this.match[0].length;\n\t\tthis.endMatch = this.endMatchRegExp.exec(this.parser.source);\n\t\tif(this.endMatch) {\n\t\t\treturn this.match.index;\n\t\t}\n\t}\n\treturn undefined;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.endMatchRegExp.lastIndex;\n\t// Don't return any elements\n\treturn [];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/commentinline.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/commentinline.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/commentinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for HTML comments. For example:\n\n```\n<!-- This is a comment -->\n```\n\nNote that the syntax for comments is simplified to an opening \"<!--\" sequence and a closing \"-->\" sequence -- HTML itself implements a more complex format (see http://ostermiller.org/findhtmlcomment.html)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"commentinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\tthis.matchRegExp = /<!--/mg;\n\tthis.endMatchRegExp = /-->/mg;\n};\n\nexports.findNextMatch = function(startPos) {\n\tthis.matchRegExp.lastIndex = startPos;\n\tthis.match = this.matchRegExp.exec(this.parser.source);\n\tif(this.match) {\n\t\tthis.endMatchRegExp.lastIndex = this.match.index + this.match[0].length;\n\t\tthis.endMatch = this.endMatchRegExp.exec(this.parser.source);\n\t\tif(this.endMatch) {\n\t\t\treturn this.match.index;\n\t\t}\n\t}\n\treturn undefined;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.endMatchRegExp.lastIndex;\n\t// Don't return any elements\n\treturn [];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/dash.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/dash.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/dash.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for dashes. For example:\n\n```\nThis is an en-dash: --\n\nThis is an em-dash: ---\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"dash\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /-{2,3}(?!-)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar dash = this.match[0].length === 2 ? \"–\" : \"—\";\n\treturn [{\n\t\ttype: \"entity\",\n\t\tentity: dash\n\t}];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/bold.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/bold.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/bold.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - bold. For example:\n\n```\n\tThis is ''bold'' text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except bold \n\\rules only bold \n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"bold\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /''/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/''/mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"strong\",\n\t\tchildren: tree\n\t}];\n};\n\n})();",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/italic.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/italic.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/italic.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - italic. For example:\n\n```\n\tThis is //italic// text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except italic\n\\rules only italic\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"italic\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\/\\//mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/\\/\\//mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"em\",\n\t\tchildren: tree\n\t}];\n};\n\n})();",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/strikethrough.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/strikethrough.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/strikethrough.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - strikethrough. For example:\n\n```\n\tThis is ~~strikethrough~~ text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except strikethrough \n\\rules only strikethrough \n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"strikethrough\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /~~/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/~~/mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"strike\",\n\t\tchildren: tree\n\t}];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/subscript.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/subscript.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/subscript.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - subscript. For example:\n\n```\n\tThis is ,,subscript,, text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except subscript \n\\rules only subscript \n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"subscript\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /,,/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/,,/mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"sub\",\n\t\tchildren: tree\n\t}];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/superscript.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/superscript.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/superscript.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - superscript. For example:\n\n```\n\tThis is ^^superscript^^ text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except superscript \n\\rules only superscript \n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"superscript\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\^\\^/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/\\^\\^/mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"sup\",\n\t\tchildren: tree\n\t}];\n};\n\n})();",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/emphasis/underscore.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/emphasis/underscore.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/emphasis/underscore.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for emphasis - underscore. For example:\n\n```\n\tThis is __underscore__ text\n```\n\nThis wikiparser can be modified using the rules eg:\n\n```\n\\rules except underscore \n\\rules only underscore\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"underscore\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /__/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\t// Parse the run including the terminator\n\tvar tree = this.parser.parseInlineRun(/__/mg,{eatTerminator: true});\n\n\t// Return the classed span\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"u\",\n\t\tchildren: tree\n\t}];\n};\n\n})();",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/entity.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/entity.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/entity.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for HTML entities. For example:\n\n```\n\tThis is a copyright symbol: ©\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"entity\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(&#?[a-zA-Z0-9]{2,8};)/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get all the details of the match\n\tvar entityString = this.match[1];\n\t// Move past the macro call\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Return the entity\n\treturn [{type: \"entity\", entity: this.match[0]}];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/extlink.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/extlink.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/extlink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for external links. For example:\n\n```\nAn external link: https://www.tiddlywiki.com/\n\nA suppressed external link: ~http://www.tiddlyspace.com/\n```\n\nExternal links can be suppressed by preceding them with `~`.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"extlink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /~?(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\\s<>{}\\[\\]`|\"\\\\^]+(?:\\/|\\b)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Create the link unless it is suppressed\n\tif(this.match[0].substr(0,1) === \"~\") {\n\t\treturn [{type: \"text\", text: this.match[0].substr(1)}];\n\t} else {\n\t\treturn [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"a\",\n\t\t\tattributes: {\n\t\t\t\thref: {type: \"string\", value: this.match[0]},\n\t\t\t\t\"class\": {type: \"string\", value: \"tc-tiddlylink-external\"},\n\t\t\t\ttarget: {type: \"string\", value: \"_blank\"},\n\t\t\t\trel: {type: \"string\", value: \"noopener noreferrer\"}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\", text: this.match[0]\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for block-level filtered transclusion. For example:\n\n```\n{{{ [tag[docs]] }}}\n{{{ [tag[docs]] |tooltip}}}\n{{{ [tag[docs]] ||TemplateTitle}}}\n{{{ [tag[docs]] |tooltip||TemplateTitle}}}\n{{{ [tag[docs]] }}width:40;height:50;}.class.class\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"filteredtranscludeblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{\\{([^\\|]+?)(?:\\|([^\\|\\{\\}]+))?(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}([^\\}]*)\\}(?:\\.(\\S+))?(?:\\r?\\n|$)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar filter = this.match[1],\n\t\ttooltip = this.match[2],\n\t\ttemplate = $tw.utils.trim(this.match[3]),\n\t\tstyle = this.match[4],\n\t\tclasses = this.match[5];\n\t// Return the list widget\n\tvar node = {\n\t\ttype: \"list\",\n\t\tattributes: {\n\t\t\tfilter: {type: \"string\", value: filter}\n\t\t},\n\t\tisBlock: true\n\t};\n\tif(tooltip) {\n\t\tnode.attributes.tooltip = {type: \"string\", value: tooltip};\n\t}\n\tif(template) {\n\t\tnode.attributes.template = {type: \"string\", value: template};\n\t}\n\tif(style) {\n\t\tnode.attributes.style = {type: \"string\", value: style};\n\t}\n\tif(classes) {\n\t\tnode.attributes.itemClass = {type: \"string\", value: classes.split(\".\").join(\" \")};\n\t}\n\treturn [node];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for inline filtered transclusion. For example:\n\n```\n{{{ [tag[docs]] }}}\n{{{ [tag[docs]] |tooltip}}}\n{{{ [tag[docs]] ||TemplateTitle}}}\n{{{ [tag[docs]] |tooltip||TemplateTitle}}}\n{{{ [tag[docs]] }}width:40;height:50;}.class.class\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"filteredtranscludeinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{\\{([^\\|]+?)(?:\\|([^\\|\\{\\}]+))?(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}([^\\}]*)\\}(?:\\.(\\S+))?/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar filter = this.match[1],\n\t\ttooltip = this.match[2],\n\t\ttemplate = $tw.utils.trim(this.match[3]),\n\t\tstyle = this.match[4],\n\t\tclasses = this.match[5];\n\t// Return the list widget\n\tvar node = {\n\t\ttype: \"list\",\n\t\tattributes: {\n\t\t\tfilter: {type: \"string\", value: filter}\n\t\t}\n\t};\n\tif(tooltip) {\n\t\tnode.attributes.tooltip = {type: \"string\", value: tooltip};\n\t}\n\tif(template) {\n\t\tnode.attributes.template = {type: \"string\", value: template};\n\t}\n\tif(style) {\n\t\tnode.attributes.style = {type: \"string\", value: style};\n\t}\n\tif(classes) {\n\t\tnode.attributes.itemClass = {type: \"string\", value: classes.split(\".\").join(\" \")};\n\t}\n\treturn [node];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/hardlinebreaks.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/hardlinebreaks.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/hardlinebreaks.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for marking areas with hard line breaks. For example:\n\n```\n\"\"\"\nThis is some text\nThat is set like\nIt is a Poem\nWhen it is\nClearly\nNot\n\"\"\"\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"hardlinebreaks\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\"\"\"(?:\\r?\\n)?/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /(\"\"\")|(\\r?\\n)/mg,\n\t\ttree = [],\n\t\tmatch;\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tdo {\n\t\t// Parse the run up to the terminator\n\t\ttree.push.apply(tree,this.parser.parseInlineRun(reEnd,{eatTerminator: false}));\n\t\t// Redo the terminator match\n\t\treEnd.lastIndex = this.parser.pos;\n\t\tmatch = reEnd.exec(this.parser.source);\n\t\tif(match) {\n\t\t\tthis.parser.pos = reEnd.lastIndex;\n\t\t\t// Add a line break if the terminator was a line break\n\t\t\tif(match[2]) {\n\t\t\t\ttree.push({type: \"element\", tag: \"br\"});\n\t\t\t}\n\t\t}\n\t} while(match && !match[1]);\n\t// Return the nodes\n\treturn tree;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/heading.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/heading.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/heading.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for headings\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"heading\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(!{1,6})/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get all the details of the match\n\tvar headingLevel = this.match[1].length;\n\t// Move past the !s\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse any classes, whitespace and then the heading itself\n\tvar classes = this.parser.parseClasses();\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\tvar tree = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t// Return the heading\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"h\" + headingLevel, \n\t\tattributes: {\n\t\t\t\"class\": {type: \"string\", value: classes.join(\" \")}\n\t\t},\n\t\tchildren: tree\n\t}];\n};\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/horizrule.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/horizrule.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/horizrule.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for rules. For example:\n\n```\n---\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"horizrule\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /-{3,}\\r?(?:\\n|$)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\treturn [{type: \"element\", tag: \"hr\"}];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/html.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/html.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/html.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki rule for HTML elements and widgets. For example:\n\n{{{\n<aside>\nThis is an HTML5 aside element\n</aside>\n\n<$slider target=\"MyTiddler\">\nThis is a widget invocation\n</$slider>\n\n}}}\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"html\";\nexports.types = {inline: true, block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n};\n\nexports.findNextMatch = function(startPos) {\n\t// Find the next tag\n\tthis.nextTag = this.findNextTag(this.parser.source,startPos,{\n\t\trequireLineBreak: this.is.block\n\t});\n\treturn this.nextTag ? this.nextTag.start : undefined;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Retrieve the most recent match so that recursive calls don't overwrite it\n\tvar tag = this.nextTag;\n\tthis.nextTag = null;\n\t// Advance the parser position to past the tag\n\tthis.parser.pos = tag.end;\n\t// Check for an immediately following double linebreak\n\tvar hasLineBreak = !tag.isSelfClosing && !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\\S\\n\\r]*\\r?\\n(?:[^\\S\\n\\r]*\\r?\\n|$))/g);\n\t// Set whether we're in block mode\n\ttag.isBlock = this.is.block || hasLineBreak;\n\t// Parse the body if we need to\n\tif(!tag.isSelfClosing && $tw.config.htmlVoidElements.indexOf(tag.tag) === -1) {\n\t\tvar reEndString = \"</\" + $tw.utils.escapeRegExp(tag.tag) + \">\";\n\t\tif(hasLineBreak) {\n\t\t\ttag.children = this.parser.parseBlocks(reEndString);\n\t\t} else {\n\t\t\tvar reEnd = new RegExp(\"(\" + reEndString + \")\",\"mg\");\n\t\t\ttag.children = this.parser.parseInlineRun(reEnd,{eatTerminator: true});\n\t\t}\n\t}\n\t// Return the tag\n\treturn [tag];\n};\n\n/*\nLook for an HTML tag. Returns null if not found, otherwise returns {type: \"element\", name:, attributes: [], isSelfClosing:, start:, end:,}\n*/\nexports.parseTag = function(source,pos,options) {\n\toptions = options || {};\n\tvar token,\n\t\tnode = {\n\t\t\ttype: \"element\",\n\t\t\tstart: pos,\n\t\t\tattributes: {}\n\t\t};\n\t// Define our regexps\n\tvar reTagName = /([a-zA-Z0-9\\-\\$]+)/g;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for a less than sign\n\ttoken = $tw.utils.parseTokenString(source,pos,\"<\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Get the tag name\n\ttoken = $tw.utils.parseTokenRegExp(source,pos,reTagName);\n\tif(!token) {\n\t\treturn null;\n\t}\n\tnode.tag = token.match[1];\n\tif(node.tag.slice(1).indexOf(\"$\") !== -1) {\n\t\treturn null;\n\t}\n\tif(node.tag.charAt(0) === \"$\") {\n\t\tnode.type = node.tag.substr(1);\n\t}\n\tpos = token.end;\n\t// Check that the tag is terminated by a space, / or >\n\tif(!$tw.utils.parseWhiteSpace(source,pos) && !(source.charAt(pos) === \"/\") && !(source.charAt(pos) === \">\") ) {\n\t\treturn null;\n\t}\n\t// Process attributes\n\tvar attribute = $tw.utils.parseAttribute(source,pos);\n\twhile(attribute) {\n\t\tnode.attributes[attribute.name] = attribute;\n\t\tpos = attribute.end;\n\t\t// Get the next attribute\n\t\tattribute = $tw.utils.parseAttribute(source,pos);\n\t}\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for a closing slash\n\ttoken = $tw.utils.parseTokenString(source,pos,\"/\");\n\tif(token) {\n\t\tpos = token.end;\n\t\tnode.isSelfClosing = true;\n\t}\n\t// Look for a greater than sign\n\ttoken = $tw.utils.parseTokenString(source,pos,\">\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Check for a required line break\n\tif(options.requireLineBreak) {\n\t\ttoken = $tw.utils.parseTokenRegExp(source,pos,/([^\\S\\n\\r]*\\r?\\n(?:[^\\S\\n\\r]*\\r?\\n|$))/g);\n\t\tif(!token) {\n\t\t\treturn null;\n\t\t}\n\t}\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\nexports.findNextTag = function(source,pos,options) {\n\t// A regexp for finding candidate HTML tags\n\tvar reLookahead = /<([a-zA-Z\\-\\$]+)/g;\n\t// Find the next candidate\n\treLookahead.lastIndex = pos;\n\tvar match = reLookahead.exec(source);\n\twhile(match) {\n\t\t// Try to parse the candidate as a tag\n\t\tvar tag = this.parseTag(source,match.index,options);\n\t\t// Return success\n\t\tif(tag && this.isLegalTag(tag)) {\n\t\t\treturn tag;\n\t\t}\n\t\t// Look for the next match\n\t\treLookahead.lastIndex = match.index + 1;\n\t\tmatch = reLookahead.exec(source);\n\t}\n\t// Failed\n\treturn null;\n};\n\nexports.isLegalTag = function(tag) {\n\t// Widgets are always OK\n\tif(tag.type !== \"element\") {\n\t\treturn true;\n\t// If it's an HTML tag that starts with a dash then it's not legal\n\t} else if(tag.tag.charAt(0) === \"-\") {\n\t\treturn false;\n\t} else {\n\t\t// Otherwise it's OK\n\t\treturn true;\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/image.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/image.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/image.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for embedding images. For example:\n\n```\n[img[https://tiddlywiki.com/fractalveg.jpg]]\n[img width=23 height=24 [https://tiddlywiki.com/fractalveg.jpg]]\n[img width={{!!width}} height={{!!height}} [https://tiddlywiki.com/fractalveg.jpg]]\n[img[Description of image|https://tiddlywiki.com/fractalveg.jpg]]\n[img[TiddlerTitle]]\n[img[Description of image|TiddlerTitle]]\n```\n\nGenerates the `<$image>` widget.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"image\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n};\n\nexports.findNextMatch = function(startPos) {\n\t// Find the next tag\n\tthis.nextImage = this.findNextImage(this.parser.source,startPos);\n\treturn this.nextImage ? this.nextImage.start : undefined;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.nextImage.end;\n\tvar node = {\n\t\ttype: \"image\",\n\t\tattributes: this.nextImage.attributes\n\t};\n\treturn [node];\n};\n\n/*\nFind the next image from the current position\n*/\nexports.findNextImage = function(source,pos) {\n\t// A regexp for finding candidate HTML tags\n\tvar reLookahead = /(\\[img)/g;\n\t// Find the next candidate\n\treLookahead.lastIndex = pos;\n\tvar match = reLookahead.exec(source);\n\twhile(match) {\n\t\t// Try to parse the candidate as a tag\n\t\tvar tag = this.parseImage(source,match.index);\n\t\t// Return success\n\t\tif(tag) {\n\t\t\treturn tag;\n\t\t}\n\t\t// Look for the next match\n\t\treLookahead.lastIndex = match.index + 1;\n\t\tmatch = reLookahead.exec(source);\n\t}\n\t// Failed\n\treturn null;\n};\n\n/*\nLook for an image at the specified position. Returns null if not found, otherwise returns {type: \"image\", attributes: [], isSelfClosing:, start:, end:,}\n*/\nexports.parseImage = function(source,pos) {\n\tvar token,\n\t\tnode = {\n\t\t\ttype: \"image\",\n\t\t\tstart: pos,\n\t\t\tattributes: {}\n\t\t};\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for the `[img`\n\ttoken = $tw.utils.parseTokenString(source,pos,\"[img\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Process attributes\n\tif(source.charAt(pos) !== \"[\") {\n\t\tvar attribute = $tw.utils.parseAttribute(source,pos);\n\t\twhile(attribute) {\n\t\t\tnode.attributes[attribute.name] = attribute;\n\t\t\tpos = attribute.end;\n\t\t\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t\t\tif(source.charAt(pos) !== \"[\") {\n\t\t\t\t// Get the next attribute\n\t\t\t\tattribute = $tw.utils.parseAttribute(source,pos);\n\t\t\t} else {\n\t\t\t\tattribute = null;\n\t\t\t}\n\t\t}\n\t}\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for the `[` after the attributes\n\ttoken = $tw.utils.parseTokenString(source,pos,\"[\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Get the source up to the terminating `]]`\n\ttoken = $tw.utils.parseTokenRegExp(source,pos,/(?:([^|\\]]*?)\\|)?([^\\]]+?)\\]\\]/g);\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\tif(token.match[1]) {\n\t\tnode.attributes.tooltip = {type: \"string\", value: token.match[1].trim()};\n\t}\n\tnode.attributes.source = {type: \"string\", value: (token.match[2] || \"\").trim()};\n\t// Update the end position\n\tnode.end = pos;\n\treturn node;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/import.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/import.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/import.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki pragma rule for importing variable definitions\n\n```\n\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"import\";\nexports.types = {pragma: true};\n\n/*\nInstantiate parse rule\n*/\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /^\\\\import[^\\S\\n]/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\tvar self = this;\n\t// Move past the pragma invocation\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse the filter terminated by a line break\n\tvar reMatch = /(.*)(?:$|\\r?\\n)/mg;\n\treMatch.lastIndex = this.parser.pos;\n\tvar match = reMatch.exec(this.parser.source);\n\tthis.parser.pos = reMatch.lastIndex;\n\t// Parse tree nodes to return\n\treturn [{\n\t\ttype: \"importvariables\",\n\t\tattributes: {\n\t\t\tfilter: {type: \"string\", value: match[1]}\n\t\t},\n\t\tchildren: []\n\t}];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/list.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/list.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/list.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for lists. For example:\n\n```\n* This is an unordered list\n* It has two items\n\n# This is a numbered list\n## With a subitem\n# And a third item\n\n; This is a term that is being defined\n: This is the definition of that term\n```\n\nNote that lists can be nested arbitrarily:\n\n```\n#** One\n#* Two\n#** Three\n#**** Four\n#**# Five\n#**## Six\n## Seven\n### Eight\n## Nine\n```\n\nA CSS class can be applied to a list item as follows:\n\n```\n* List item one\n*.active List item two has the class `active`\n* List item three\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"list\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /([\\*#;:>]+)/mg;\n};\n\nvar listTypes = {\n\t\"*\": {listTag: \"ul\", itemTag: \"li\"},\n\t\"#\": {listTag: \"ol\", itemTag: \"li\"},\n\t\";\": {listTag: \"dl\", itemTag: \"dt\"},\n\t\":\": {listTag: \"dl\", itemTag: \"dd\"},\n\t\">\": {listTag: \"blockquote\", itemTag: \"div\"}\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Array of parse tree nodes for the previous row of the list\n\tvar listStack = [];\n\t// Cycle through the items in the list\n\twhile(true) {\n\t\t// Match the list marker\n\t\tvar reMatch = /([\\*#;:>]+)/mg;\n\t\treMatch.lastIndex = this.parser.pos;\n\t\tvar match = reMatch.exec(this.parser.source);\n\t\tif(!match || match.index !== this.parser.pos) {\n\t\t\tbreak;\n\t\t}\n\t\t// Check whether the list type of the top level matches\n\t\tvar listInfo = listTypes[match[0].charAt(0)];\n\t\tif(listStack.length > 0 && listStack[0].tag !== listInfo.listTag) {\n\t\t\tbreak;\n\t\t}\n\t\t// Move past the list marker\n\t\tthis.parser.pos = match.index + match[0].length;\n\t\t// Walk through the list markers for the current row\n\t\tfor(var t=0; t<match[0].length; t++) {\n\t\t\tlistInfo = listTypes[match[0].charAt(t)];\n\t\t\t// Remove any stacked up element if we can't re-use it because the list type doesn't match\n\t\t\tif(listStack.length > t && listStack[t].tag !== listInfo.listTag) {\n\t\t\t\tlistStack.splice(t,listStack.length - t);\n\t\t\t}\n\t\t\t// Construct the list element or reuse the previous one at this level\n\t\t\tif(listStack.length <= t) {\n\t\t\t\tvar listElement = {type: \"element\", tag: listInfo.listTag, children: [\n\t\t\t\t\t{type: \"element\", tag: listInfo.itemTag, children: []}\n\t\t\t\t]};\n\t\t\t\t// Link this list element into the last child item of the parent list item\n\t\t\t\tif(t) {\n\t\t\t\t\tvar prevListItem = listStack[t-1].children[listStack[t-1].children.length-1];\n\t\t\t\t\tprevListItem.children.push(listElement);\n\t\t\t\t}\n\t\t\t\t// Save this element in the stack\n\t\t\t\tlistStack[t] = listElement;\n\t\t\t} else if(t === (match[0].length - 1)) {\n\t\t\t\tlistStack[t].children.push({type: \"element\", tag: listInfo.itemTag, children: []});\n\t\t\t}\n\t\t}\n\t\tif(listStack.length > match[0].length) {\n\t\t\tlistStack.splice(match[0].length,listStack.length - match[0].length);\n\t\t}\n\t\t// Process the body of the list item into the last list item\n\t\tvar lastListChildren = listStack[listStack.length-1].children,\n\t\t\tlastListItem = lastListChildren[lastListChildren.length-1],\n\t\t\tclasses = this.parser.parseClasses();\n\t\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\t\tvar tree = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t\tlastListItem.children.push.apply(lastListItem.children,tree);\n\t\tif(classes.length > 0) {\n\t\t\t$tw.utils.addClassToParseTreeNode(lastListItem,classes.join(\" \"));\n\t\t}\n\t\t// Consume any whitespace following the list item\n\t\tthis.parser.skipWhitespace();\n\t}\n\t// Return the root element of the list\n\treturn [listStack[0]];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/macrocallblock.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/macrocallblock.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/macrocallblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki rule for block macro calls\n\n```\n<<name value value2>>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"macrocallblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n};\n\nexports.findNextMatch = function(startPos) {\n\tvar nextStart = startPos;\n\t// Try parsing at all possible macrocall openers until we match\n\twhile((nextStart = this.parser.source.indexOf(\"<<\",nextStart)) >= 0) {\n\t\tvar nextCall = $tw.utils.parseMacroInvocation(this.parser.source,nextStart);\n\t\tif(nextCall) {\n\t\t\tvar c = this.parser.source.charAt(nextCall.end);\n\t\t\t// Ensure EOL after parsed macro\n\t\t\t// If we didn't need to support IE, we'd just use /(?:\\r?\\n|$)/ym\n\t\t\tif ((c === \"\") || (c === \"\\n\") || ((c === \"\\r\") && this.parser.source.charAt(nextCall.end+1) === \"\\n\")) {\n\t\t\t\tthis.nextCall = nextCall;\n\t\t\t\treturn nextStart;\n\t\t\t}\n\t\t}\n\t\tnextStart += 2;\n\t}\n\treturn undefined;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\tvar call = this.nextCall;\n\tcall.isBlock = true;\n\tthis.nextCall = null;\n\tthis.parser.pos = call.end;\n\treturn [call];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/macrocallinline.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/macrocallinline.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/macrocallinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki rule for macro calls\n\n```\n<<name value value2>>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"macrocallinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n};\n\nexports.findNextMatch = function(startPos) {\n\tvar nextStart = startPos;\n\t// Try parsing at all possible macrocall openers until we match\n\twhile((nextStart = this.parser.source.indexOf(\"<<\",nextStart)) >= 0) {\n\t\tthis.nextCall = $tw.utils.parseMacroInvocation(this.parser.source,nextStart);\n\t\tif(this.nextCall) {\n\t\t\treturn nextStart;\n\t\t}\n\t\tnextStart += 2;\n\t}\n\treturn undefined;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\tvar call = this.nextCall;\n\tthis.nextCall = null;\n\tthis.parser.pos = call.end;\n\treturn [call];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/macrodef.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/macrodef.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/macrodef.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki pragma rule for macro definitions\n\n```\n\\define name(param:defaultvalue,param2:defaultvalue)\ndefinition text, including $param$ markers\n\\end\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"macrodef\";\nexports.types = {pragma: true};\n\n/*\nInstantiate parse rule\n*/\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /^\\\\define\\s+([^(\\s]+)\\(\\s*([^)]*)\\)(\\s*\\r?\\n)?/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Move past the macro name and parameters\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse the parameters\n\tvar paramString = this.match[2],\n\t\tparams = [];\n\tif(paramString !== \"\") {\n\t\tvar reParam = /\\s*([A-Za-z0-9\\-_]+)(?:\\s*:\\s*(?:\"\"\"([\\s\\S]*?)\"\"\"|\"([^\"]*)\"|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\"'\\s]+)))?/mg,\n\t\t\tparamMatch = reParam.exec(paramString);\n\t\twhile(paramMatch) {\n\t\t\t// Save the parameter details\n\t\t\tvar paramInfo = {name: paramMatch[1]},\n\t\t\t\tdefaultValue = paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5] || paramMatch[6];\n\t\t\tif(defaultValue) {\n\t\t\t\tparamInfo[\"default\"] = defaultValue;\n\t\t\t}\n\t\t\tparams.push(paramInfo);\n\t\t\t// Look for the next parameter\n\t\t\tparamMatch = reParam.exec(paramString);\n\t\t}\n\t}\n\t// Is this a multiline definition?\n\tvar reEnd;\n\tif(this.match[3]) {\n\t\t// If so, the end of the body is marked with \\end\n\t\treEnd = /(\\r?\\n\\\\end[^\\S\\n\\r]*(?:$|\\r?\\n))/mg;\n\t} else {\n\t\t// Otherwise, the end of the definition is marked by the end of the line\n\t\treEnd = /($|\\r?\\n)/mg;\n\t\t// Move past any whitespace\n\t\tthis.parser.pos = $tw.utils.skipWhiteSpace(this.parser.source,this.parser.pos);\n\t}\n\t// Find the end of the definition\n\treEnd.lastIndex = this.parser.pos;\n\tvar text,\n\t\tendMatch = reEnd.exec(this.parser.source);\n\tif(endMatch) {\n\t\ttext = this.parser.source.substring(this.parser.pos,endMatch.index);\n\t\tthis.parser.pos = endMatch.index + endMatch[0].length;\n\t} else {\n\t\t// We didn't find the end of the definition, so we'll make it blank\n\t\ttext = \"\";\n\t}\n\t// Save the macro definition\n\treturn [{\n\t\ttype: \"set\",\n\t\tattributes: {\n\t\t\tname: {type: \"string\", value: this.match[1]},\n\t\t\tvalue: {type: \"string\", value: text}\n\t\t},\n\t\tchildren: [],\n\t\tparams: params,\n\t\tisMacroDefinition: true\n\t}];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/prettyextlink.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/prettyextlink.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/prettyextlink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for external links. For example:\n\n```\n[ext[https://tiddlywiki.com/fractalveg.jpg]]\n[ext[Tooltip|https://tiddlywiki.com/fractalveg.jpg]]\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"prettyextlink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n};\n\nexports.findNextMatch = function(startPos) {\n\t// Find the next tag\n\tthis.nextLink = this.findNextLink(this.parser.source,startPos);\n\treturn this.nextLink ? this.nextLink.start : undefined;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.nextLink.end;\n\treturn [this.nextLink];\n};\n\n/*\nFind the next link from the current position\n*/\nexports.findNextLink = function(source,pos) {\n\t// A regexp for finding candidate links\n\tvar reLookahead = /(\\[ext\\[)/g;\n\t// Find the next candidate\n\treLookahead.lastIndex = pos;\n\tvar match = reLookahead.exec(source);\n\twhile(match) {\n\t\t// Try to parse the candidate as a link\n\t\tvar link = this.parseLink(source,match.index);\n\t\t// Return success\n\t\tif(link) {\n\t\t\treturn link;\n\t\t}\n\t\t// Look for the next match\n\t\treLookahead.lastIndex = match.index + 1;\n\t\tmatch = reLookahead.exec(source);\n\t}\n\t// Failed\n\treturn null;\n};\n\n/*\nLook for an link at the specified position. Returns null if not found, otherwise returns {type: \"element\", tag: \"a\", attributes: [], isSelfClosing:, start:, end:,}\n*/\nexports.parseLink = function(source,pos) {\n\tvar token,\n\t\ttextNode = {\n\t\t\ttype: \"text\"\n\t\t},\n\t\tnode = {\n\t\t\ttype: \"element\",\n\t\t\ttag: \"a\",\n\t\t\tstart: pos,\n\t\t\tattributes: {\n\t\t\t\t\"class\": {type: \"string\", value: \"tc-tiddlylink-external\"},\n\t\t\t},\n\t\t\tchildren: [textNode]\n\t\t};\n\t// Skip whitespace\n\tpos = $tw.utils.skipWhiteSpace(source,pos);\n\t// Look for the `[ext[`\n\ttoken = $tw.utils.parseTokenString(source,pos,\"[ext[\");\n\tif(!token) {\n\t\treturn null;\n\t}\n\tpos = token.end;\n\t// Look ahead for the terminating `]]`\n\tvar closePos = source.indexOf(\"]]\",pos);\n\tif(closePos === -1) {\n\t\treturn null;\n\t}\n\t// Look for a `|` separating the tooltip\n\tvar splitPos = source.indexOf(\"|\",pos);\n\tif(splitPos === -1 || splitPos > closePos) {\n\t\tsplitPos = null;\n\t}\n\t// Pull out the tooltip and URL\n\tvar tooltip, URL;\n\tif(splitPos) {\n\t\tURL = source.substring(splitPos + 1,closePos).trim();\n\t\ttextNode.text = source.substring(pos,splitPos).trim();\n\t} else {\n\t\tURL = source.substring(pos,closePos).trim();\n\t\ttextNode.text = URL;\n\t}\n\tnode.attributes.href = {type: \"string\", value: URL};\n\tnode.attributes.target = {type: \"string\", value: \"_blank\"};\n\tnode.attributes.rel = {type: \"string\", value: \"noopener noreferrer\"};\n\t// Update the end position\n\tnode.end = closePos + 2;\n\treturn node;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/prettylink.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/prettylink.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/prettylink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for pretty links. For example:\n\n```\n[[Introduction]]\n\n[[Link description|TiddlerTitle]]\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"prettylink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\[\\[(.*?)(?:\\|(.*?))?\\]\\]/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Process the link\n\tvar text = this.match[1],\n\t\tlink = this.match[2] || text;\n\tif($tw.utils.isLinkExternal(link)) {\n\t\treturn [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"a\",\n\t\t\tattributes: {\n\t\t\t\thref: {type: \"string\", value: link},\n\t\t\t\t\"class\": {type: \"string\", value: \"tc-tiddlylink-external\"},\n\t\t\t\ttarget: {type: \"string\", value: \"_blank\"},\n\t\t\t\trel: {type: \"string\", value: \"noopener noreferrer\"}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\", text: text\n\t\t\t}]\n\t\t}];\n\t} else {\n\t\treturn [{\n\t\t\ttype: \"link\",\n\t\t\tattributes: {\n\t\t\t\tto: {type: \"string\", value: link}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\", text: text\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/quoteblock.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/quoteblock.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/quoteblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for quote blocks. For example:\n\n```\n\t<<<.optionalClass(es) optional cited from\n\ta quote\n\t<<<\n\t\n\t<<<.optionalClass(es)\n\ta quote\n\t<<< optional cited from\n```\n\nQuotes can be quoted by putting more <s\n\n```\n\t<<<\n\tQuote Level 1\n\t\n\t<<<<\n\tQuoteLevel 2\n\t<<<<\n\t\n\t<<<\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"quoteblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /(<<<+)/mg;\n};\n\nexports.parse = function() {\n\tvar classes = [\"tc-quote\"];\n\t// Get all the details of the match\n\tvar reEndString = \"^\" + this.match[1] + \"(?!<)\";\n\t// Move past the <s\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t\n\t// Parse any classes, whitespace and then the optional cite itself\n\tclasses.push.apply(classes, this.parser.parseClasses());\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\tvar cite = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t// before handling the cite, parse the body of the quote\n\tvar tree= this.parser.parseBlocks(reEndString);\n\t// If we got a cite, put it before the text\n\tif(cite.length > 0) {\n\t\ttree.unshift({\n\t\t\ttype: \"element\",\n\t\t\ttag: \"cite\",\n\t\t\tchildren: cite\n\t\t});\n\t}\n\t// Parse any optional cite\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\tcite = this.parser.parseInlineRun(/(\\r?\\n)/mg);\n\t// If we got a cite, push it\n\tif(cite.length > 0) {\n\t\ttree.push({\n\t\t\ttype: \"element\",\n\t\t\ttag: \"cite\",\n\t\t\tchildren: cite\n\t\t});\n\t}\n\t// Return the blockquote element\n\treturn [{\n\t\ttype: \"element\",\n\t\ttag: \"blockquote\",\n\t\tattributes: {\n\t\t\tclass: { type: \"string\", value: classes.join(\" \") },\n\t\t},\n\t\tchildren: tree\n\t}];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/rules.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/rules.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/rules.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki pragma rule for rules specifications\n\n```\n\\rules except ruleone ruletwo rulethree\n\\rules only ruleone ruletwo rulethree\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"rules\";\nexports.types = {pragma: true};\n\n/*\nInstantiate parse rule\n*/\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /^\\\\rules[^\\S\\n]/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Move past the pragma invocation\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse whitespace delimited tokens terminated by a line break\n\tvar reMatch = /[^\\S\\n]*(\\S+)|(\\r?\\n)/mg,\n\t\ttokens = [];\n\treMatch.lastIndex = this.parser.pos;\n\tvar match = reMatch.exec(this.parser.source);\n\twhile(match && match.index === this.parser.pos) {\n\t\tthis.parser.pos = reMatch.lastIndex;\n\t\t// Exit if we've got the line break\n\t\tif(match[2]) {\n\t\t\tbreak;\n\t\t}\n\t\t// Process the token\n\t\tif(match[1]) {\n\t\t\ttokens.push(match[1]);\n\t\t}\n\t\t// Match the next token\n\t\tmatch = reMatch.exec(this.parser.source);\n\t}\n\t// Process the tokens\n\tif(tokens.length > 0) {\n\t\tthis.parser.amendRules(tokens[0],tokens.slice(1));\n\t}\n\t// No parse tree nodes to return\n\treturn [];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/styleblock.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/styleblock.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/styleblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for assigning styles and classes to paragraphs and other blocks. For example:\n\n```\n@@.myClass\n@@background-color:red;\nThis paragraph will have the CSS class `myClass`.\n\n* The `<ul>` around this list will also have the class `myClass`\n* List item 2\n\n@@\n```\n\nNote that classes and styles can be mixed subject to the rule that styles must precede classes. For example\n\n```\n@@.myFirstClass.mySecondClass\n@@width:100px;.myThirdClass\nThis is a paragraph\n@@\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"styleblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /@@((?:[^\\.\\r\\n\\s:]+:[^\\r\\n;]+;)+)?(?:\\.([^\\r\\n\\s]+))?\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\tvar reEndString = \"^@@(?:\\\\r?\\\\n)?\";\n\tvar classes = [], styles = [];\n\tdo {\n\t\t// Get the class and style\n\t\tif(this.match[1]) {\n\t\t\tstyles.push(this.match[1]);\n\t\t}\n\t\tif(this.match[2]) {\n\t\t\tclasses.push(this.match[2].split(\".\").join(\" \"));\n\t\t}\n\t\t// Move past the match\n\t\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t\t// Look for another line of classes and styles\n\t\tthis.match = this.matchRegExp.exec(this.parser.source);\n\t} while(this.match && this.match.index === this.parser.pos);\n\t// Parse the body\n\tvar tree = this.parser.parseBlocks(reEndString);\n\tfor(var t=0; t<tree.length; t++) {\n\t\tif(classes.length > 0) {\n\t\t\t$tw.utils.addClassToParseTreeNode(tree[t],classes.join(\" \"));\n\t\t}\n\t\tif(styles.length > 0) {\n\t\t\t$tw.utils.addAttributeToParseTreeNode(tree[t],\"style\",styles.join(\"\"));\n\t\t}\n\t}\n\treturn tree;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/styleinline.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/styleinline.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/styleinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for assigning styles and classes to inline runs. For example:\n\n```\n@@.myClass This is some text with a class@@\n@@background-color:red;This is some text with a background colour@@\n@@width:100px;.myClass This is some text with a class and a width@@\n```\n\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"styleinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /@@((?:[^\\.\\r\\n\\s:]+:[^\\r\\n;]+;)+)?(\\.(?:[^\\r\\n\\s]+)\\s+)?/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /@@/g;\n\t// Get the styles and class\n\tvar stylesString = this.match[1],\n\t\tclassString = this.match[2] ? this.match[2].split(\".\").join(\" \") : undefined;\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse the run up to the terminator\n\tvar tree = this.parser.parseInlineRun(reEnd,{eatTerminator: true});\n\t// Return the classed span\n\tvar node = {\n\t\ttype: \"element\",\n\t\ttag: \"span\",\n\t\tattributes: {\n\t\t\t\"class\": {type: \"string\", value: \"tc-inline-style\"}\n\t\t},\n\t\tchildren: tree\n\t};\n\tif(classString) {\n\t\t$tw.utils.addClassToParseTreeNode(node,classString);\n\t}\n\tif(stylesString) {\n\t\t$tw.utils.addAttributeToParseTreeNode(node,\"style\",stylesString);\n\t}\n\treturn [node];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/syslink.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/syslink.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/syslink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for system tiddler links.\nCan be suppressed preceding them with `~`.\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"syslink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = new RegExp(\n\t\t\"~?\\\\$:\\\\/[\" +\n\t\t$tw.config.textPrimitives.anyLetter.substr(1,$tw.config.textPrimitives.anyLetter.length - 2) +\n\t\t\"\\/._-]+\",\n\t\t\"mg\"\n\t);\n};\n\nexports.parse = function() {\n\tvar match = this.match[0];\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Create the link unless it is suppressed\n\tif(match.substr(0,1) === \"~\") {\n\t\treturn [{type: \"text\", text: match.substr(1)}];\n\t} else {\n\t\treturn [{\n\t\t\ttype: \"link\",\n\t\t\tattributes: {\n\t\t\t\tto: {type: \"string\", value: match}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: match\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/table.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/table.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/table.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text block rule for tables.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"table\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /^\\|(?:[^\\n]*)\\|(?:[fhck]?)\\r?(?:\\n|$)/mg;\n};\n\nvar processRow = function(prevColumns) {\n\tvar cellRegExp = /(?:\\|([^\\n\\|]*)\\|)|(\\|[fhck]?\\r?(?:\\n|$))/mg,\n\t\tcellTermRegExp = /((?:\\x20*)\\|)/mg,\n\t\ttree = [],\n\t\tcol = 0,\n\t\tcolSpanCount = 1,\n\t\tprevCell,\n\t\tvAlign;\n\t// Match a single cell\n\tcellRegExp.lastIndex = this.parser.pos;\n\tvar cellMatch = cellRegExp.exec(this.parser.source);\n\twhile(cellMatch && cellMatch.index === this.parser.pos) {\n\t\tif(cellMatch[1] === \"~\") {\n\t\t\t// Rowspan\n\t\t\tvar last = prevColumns[col];\n\t\t\tif(last) {\n\t\t\t\tlast.rowSpanCount++;\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\"rowspan\",last.rowSpanCount);\n\t\t\t\tvAlign = $tw.utils.getAttributeValueFromParseTreeNode(last.element,\"valign\",\"center\");\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\"valign\",vAlign);\n\t\t\t\tif(colSpanCount > 1) {\n\t\t\t\t\t$tw.utils.addAttributeToParseTreeNode(last.element,\"colspan\",colSpanCount);\n\t\t\t\t\tcolSpanCount = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Move to just before the `|` terminating the cell\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t} else if(cellMatch[1] === \">\") {\n\t\t\t// Colspan\n\t\t\tcolSpanCount++;\n\t\t\t// Move to just before the `|` terminating the cell\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t} else if(cellMatch[1] === \"<\" && prevCell) {\n\t\t\tcolSpanCount = 1 + $tw.utils.getAttributeValueFromParseTreeNode(prevCell,\"colspan\",1);\n\t\t\t$tw.utils.addAttributeToParseTreeNode(prevCell,\"colspan\",colSpanCount);\n\t\t\tcolSpanCount = 1;\n\t\t\t// Move to just before the `|` terminating the cell\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t} else if(cellMatch[2]) {\n\t\t\t// End of row\n\t\t\tif(prevCell && colSpanCount > 1) {\n\t\t\t\tif(prevCell.attributes && prevCell.attributes && prevCell.attributes.colspan) {\n\t\t\t\t\t\tcolSpanCount += prevCell.attributes.colspan.value;\n\t\t\t\t} else {\n\t\t\t\t\tcolSpanCount -= 1;\n\t\t\t\t}\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(prevCell,\"colspan\",colSpanCount);\n\t\t\t}\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t\tbreak;\n\t\t} else {\n\t\t\t// For ordinary cells, step beyond the opening `|`\n\t\t\tthis.parser.pos++;\n\t\t\t// Look for a space at the start of the cell\n\t\t\tvar spaceLeft = false;\n\t\t\tvAlign = null;\n\t\t\tif(this.parser.source.substr(this.parser.pos).search(/^\\^([^\\^]|\\^\\^)/) === 0) {\n\t\t\t\tvAlign = \"top\";\n\t\t\t} else if(this.parser.source.substr(this.parser.pos).search(/^,([^,]|,,)/) === 0) {\n\t\t\t\tvAlign = \"bottom\";\n\t\t\t}\n\t\t\tif(vAlign) {\n\t\t\t\tthis.parser.pos++;\n\t\t\t}\n\t\t\tvar chr = this.parser.source.substr(this.parser.pos,1);\n\t\t\twhile(chr === \" \") {\n\t\t\t\tspaceLeft = true;\n\t\t\t\tthis.parser.pos++;\n\t\t\t\tchr = this.parser.source.substr(this.parser.pos,1);\n\t\t\t}\n\t\t\t// Check whether this is a heading cell\n\t\t\tvar cell;\n\t\t\tif(chr === \"!\") {\n\t\t\t\tthis.parser.pos++;\n\t\t\t\tcell = {type: \"element\", tag: \"th\", children: []};\n\t\t\t} else {\n\t\t\t\tcell = {type: \"element\", tag: \"td\", children: []};\n\t\t\t}\n\t\t\ttree.push(cell);\n\t\t\t// Record information about this cell\n\t\t\tprevCell = cell;\n\t\t\tprevColumns[col] = {rowSpanCount:1,element:cell};\n\t\t\t// Check for a colspan\n\t\t\tif(colSpanCount > 1) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"colspan\",colSpanCount);\n\t\t\t\tcolSpanCount = 1;\n\t\t\t}\n\t\t\t// Parse the cell\n\t\t\tcell.children = this.parser.parseInlineRun(cellTermRegExp,{eatTerminator: true});\n\t\t\t// Set the alignment for the cell\n\t\t\tif(vAlign) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"valign\",vAlign);\n\t\t\t}\n\t\t\tif(this.parser.source.substr(this.parser.pos - 2,1) === \" \") { // spaceRight\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"align\",spaceLeft ? \"center\" : \"left\");\n\t\t\t} else if(spaceLeft) {\n\t\t\t\t$tw.utils.addAttributeToParseTreeNode(cell,\"align\",\"right\");\n\t\t\t}\n\t\t\t// Move back to the closing `|`\n\t\t\tthis.parser.pos--;\n\t\t}\n\t\tcol++;\n\t\tcellRegExp.lastIndex = this.parser.pos;\n\t\tcellMatch = cellRegExp.exec(this.parser.source);\n\t}\n\treturn tree;\n};\n\nexports.parse = function() {\n\tvar rowContainerTypes = {\"c\":\"caption\", \"h\":\"thead\", \"\":\"tbody\", \"f\":\"tfoot\"},\n\t\ttable = {type: \"element\", tag: \"table\", children: []},\n\t\trowRegExp = /^\\|([^\\n]*)\\|([fhck]?)\\r?(?:\\n|$)/mg,\n\t\trowTermRegExp = /(\\|(?:[fhck]?)\\r?(?:\\n|$))/mg,\n\t\tprevColumns = [],\n\t\tcurrRowType,\n\t\trowContainer,\n\t\trowCount = 0;\n\t// Match the row\n\trowRegExp.lastIndex = this.parser.pos;\n\tvar rowMatch = rowRegExp.exec(this.parser.source);\n\twhile(rowMatch && rowMatch.index === this.parser.pos) {\n\t\tvar rowType = rowMatch[2];\n\t\t// Check if it is a class assignment\n\t\tif(rowType === \"k\") {\n\t\t\t$tw.utils.addClassToParseTreeNode(table,rowMatch[1]);\n\t\t\tthis.parser.pos = rowMatch.index + rowMatch[0].length;\n\t\t} else {\n\t\t\t// Otherwise, create a new row if this one is of a different type\n\t\t\tif(rowType !== currRowType) {\n\t\t\t\trowContainer = {type: \"element\", tag: rowContainerTypes[rowType], children: []};\n\t\t\t\ttable.children.push(rowContainer);\n\t\t\t\tcurrRowType = rowType;\n\t\t\t}\n\t\t\t// Is this a caption row?\n\t\t\tif(currRowType === \"c\") {\n\t\t\t\t// If so, move past the opening `|` of the row\n\t\t\t\tthis.parser.pos++;\n\t\t\t\t// Move the caption to the first row if it isn't already\n\t\t\t\tif(table.children.length !== 1) {\n\t\t\t\t\ttable.children.pop(); // Take rowContainer out of the children array\n\t\t\t\t\ttable.children.splice(0,0,rowContainer); // Insert it at the bottom\n\t\t\t\t}\n\t\t\t\t// Set the alignment - TODO: figure out why TW did this\n//\t\t\t\trowContainer.attributes.align = rowCount === 0 ? \"top\" : \"bottom\";\n\t\t\t\t// Parse the caption\n\t\t\t\trowContainer.children = this.parser.parseInlineRun(rowTermRegExp,{eatTerminator: true});\n\t\t\t} else {\n\t\t\t\t// Create the row\n\t\t\t\tvar theRow = {type: \"element\", tag: \"tr\", children: []};\n\t\t\t\t$tw.utils.addClassToParseTreeNode(theRow,rowCount%2 ? \"oddRow\" : \"evenRow\");\n\t\t\t\trowContainer.children.push(theRow);\n\t\t\t\t// Process the row\n\t\t\t\ttheRow.children = processRow.call(this,prevColumns);\n\t\t\t\tthis.parser.pos = rowMatch.index + rowMatch[0].length;\n\t\t\t\t// Increment the row count\n\t\t\t\trowCount++;\n\t\t\t}\n\t\t}\n\t\trowMatch = rowRegExp.exec(this.parser.source);\n\t}\n\treturn [table];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/transcludeblock.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/transcludeblock.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/transcludeblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for block-level transclusion. For example:\n\n```\n{{MyTiddler}}\n{{MyTiddler||TemplateTitle}}\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"transcludeblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{([^\\{\\}\\|]*)(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}(?:\\r?\\n|$)/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar template = $tw.utils.trim(this.match[2]),\n\t\ttextRef = $tw.utils.trim(this.match[1]);\n\t// Prepare the transclude widget\n\tvar transcludeNode = {\n\t\t\ttype: \"transclude\",\n\t\t\tattributes: {},\n\t\t\tisBlock: true\n\t\t};\n\t// Prepare the tiddler widget\n\tvar tr, targetTitle, targetField, targetIndex, tiddlerNode;\n\tif(textRef) {\n\t\ttr = $tw.utils.parseTextReference(textRef);\n\t\ttargetTitle = tr.title;\n\t\ttargetField = tr.field;\n\t\ttargetIndex = tr.index;\n\t\ttiddlerNode = {\n\t\t\ttype: \"tiddler\",\n\t\t\tattributes: {\n\t\t\t\ttiddler: {type: \"string\", value: targetTitle}\n\t\t\t},\n\t\t\tisBlock: true,\n\t\t\tchildren: [transcludeNode]\n\t\t};\n\t}\n\tif(template) {\n\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: template};\n\t\tif(textRef) {\n\t\t\treturn [tiddlerNode];\n\t\t} else {\n\t\t\treturn [transcludeNode];\n\t\t}\n\t} else {\n\t\tif(textRef) {\n\t\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: targetTitle};\n\t\t\tif(targetField) {\n\t\t\t\ttranscludeNode.attributes.field = {type: \"string\", value: targetField};\n\t\t\t}\n\t\t\tif(targetIndex) {\n\t\t\t\ttranscludeNode.attributes.index = {type: \"string\", value: targetIndex};\n\t\t\t}\n\t\t\treturn [tiddlerNode];\n\t\t} else {\n\t\t\treturn [transcludeNode];\n\t\t}\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/transcludeinline.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/transcludeinline.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/transcludeinline.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for inline-level transclusion. For example:\n\n```\n{{MyTiddler}}\n{{MyTiddler||TemplateTitle}}\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"transcludeinline\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\{\\{([^\\{\\}\\|]*)(?:\\|\\|([^\\|\\{\\}]+))?\\}\\}/mg;\n};\n\nexports.parse = function() {\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Get the match details\n\tvar template = $tw.utils.trim(this.match[2]),\n\t\ttextRef = $tw.utils.trim(this.match[1]);\n\t// Prepare the transclude widget\n\tvar transcludeNode = {\n\t\t\ttype: \"transclude\",\n\t\t\tattributes: {}\n\t\t};\n\t// Prepare the tiddler widget\n\tvar tr, targetTitle, targetField, targetIndex, tiddlerNode;\n\tif(textRef) {\n\t\ttr = $tw.utils.parseTextReference(textRef);\n\t\ttargetTitle = tr.title;\n\t\ttargetField = tr.field;\n\t\ttargetIndex = tr.index;\n\t\ttiddlerNode = {\n\t\t\ttype: \"tiddler\",\n\t\t\tattributes: {\n\t\t\t\ttiddler: {type: \"string\", value: targetTitle}\n\t\t\t},\n\t\t\tchildren: [transcludeNode]\n\t\t};\n\t}\n\tif(template) {\n\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: template};\n\t\tif(textRef) {\n\t\t\treturn [tiddlerNode];\n\t\t} else {\n\t\t\treturn [transcludeNode];\n\t\t}\n\t} else {\n\t\tif(textRef) {\n\t\t\ttranscludeNode.attributes.tiddler = {type: \"string\", value: targetTitle};\n\t\t\tif(targetField) {\n\t\t\t\ttranscludeNode.attributes.field = {type: \"string\", value: targetField};\n\t\t\t}\n\t\t\tif(targetIndex) {\n\t\t\t\ttranscludeNode.attributes.index = {type: \"string\", value: targetIndex};\n\t\t\t}\n\t\t\treturn [tiddlerNode];\n\t\t} else {\n\t\t\treturn [transcludeNode];\n\t\t}\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/typedblock.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/typedblock.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/typedblock.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text rule for typed blocks. For example:\n\n```\n$$$.js\nThis will be rendered as JavaScript\n$$$\n\n$$$.svg\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"150\" height=\"100\">\n <circle cx=\"100\" cy=\"50\" r=\"40\" stroke=\"black\" stroke-width=\"2\" fill=\"red\" />\n</svg>\n$$$\n\n$$$text/vnd.tiddlywiki>text/html\nThis will be rendered as an //HTML representation// of WikiText\n$$$\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.name = \"typedblock\";\nexports.types = {block: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /\\$\\$\\$([^ >\\r\\n]*)(?: *> *([^ \\r\\n]+))?\\r?\\n/mg;\n};\n\nexports.parse = function() {\n\tvar reEnd = /\\r?\\n\\$\\$\\$\\r?(?:\\n|$)/mg;\n\t// Save the type\n\tvar parseType = this.match[1],\n\t\trenderType = this.match[2];\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Look for the end of the block\n\treEnd.lastIndex = this.parser.pos;\n\tvar match = reEnd.exec(this.parser.source),\n\t\ttext;\n\t// Process the block\n\tif(match) {\n\t\ttext = this.parser.source.substring(this.parser.pos,match.index);\n\t\tthis.parser.pos = match.index + match[0].length;\n\t} else {\n\t\ttext = this.parser.source.substr(this.parser.pos);\n\t\tthis.parser.pos = this.parser.sourceLength;\n\t}\n\t// Parse the block according to the specified type\n\tvar parser = this.parser.wiki.parseText(parseType,text,{defaultType: \"text/plain\"});\n\t// If there's no render type, just return the parse tree\n\tif(!renderType) {\n\t\treturn parser.tree;\n\t} else {\n\t\t// Otherwise, render to the rendertype and return in a <PRE> tag\n\t\tvar widgetNode = this.parser.wiki.makeWidget(parser),\n\t\t\tcontainer = $tw.fakeDocument.createElement(\"div\");\n\t\twidgetNode.render(container,null);\n\t\ttext = renderType === \"text/html\" ? container.innerHTML : container.textContent;\n\t\treturn [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"pre\",\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: text\n\t\t\t}]\n\t\t}];\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/whitespace.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/whitespace.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/whitespace.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki pragma rule for whitespace specifications\n\n```\n\\whitespace trim\n\\whitespace notrim\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"whitespace\";\nexports.types = {pragma: true};\n\n/*\nInstantiate parse rule\n*/\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = /^\\\\whitespace[^\\S\\n]/mg;\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\tvar self = this;\n\t// Move past the pragma invocation\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Parse whitespace delimited tokens terminated by a line break\n\tvar reMatch = /[^\\S\\n]*(\\S+)|(\\r?\\n)/mg,\n\t\ttokens = [];\n\treMatch.lastIndex = this.parser.pos;\n\tvar match = reMatch.exec(this.parser.source);\n\twhile(match && match.index === this.parser.pos) {\n\t\tthis.parser.pos = reMatch.lastIndex;\n\t\t// Exit if we've got the line break\n\t\tif(match[2]) {\n\t\t\tbreak;\n\t\t}\n\t\t// Process the token\n\t\tif(match[1]) {\n\t\t\ttokens.push(match[1]);\n\t\t}\n\t\t// Match the next token\n\t\tmatch = reMatch.exec(this.parser.source);\n\t}\n\t// Process the tokens\n\t$tw.utils.each(tokens,function(token) {\n\t\tswitch(token) {\n\t\t\tcase \"trim\":\n\t\t\t\tself.parser.configTrimWhiteSpace = true;\n\t\t\t\tbreak;\n\t\t\tcase \"notrim\":\n\t\t\t\tself.parser.configTrimWhiteSpace = false;\n\t\t\t\tbreak;\n\t\t}\n\t});\n\t// No parse tree nodes to return\n\treturn [];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/rules/wikilink.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/wikilink.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/wikilink.js\ntype: application/javascript\nmodule-type: wikirule\n\nWiki text inline rule for wiki links. For example:\n\n```\nAWikiLink\nAnotherLink\n~SuppressedLink\n```\n\nPrecede a camel case word with `~` to prevent it from being recognised as a link.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"wikilink\";\nexports.types = {inline: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\t// Regexp to match\n\tthis.matchRegExp = new RegExp($tw.config.textPrimitives.unWikiLink + \"?\" + $tw.config.textPrimitives.wikiLink,\"mg\");\n};\n\n/*\nParse the most recent match\n*/\nexports.parse = function() {\n\t// Get the details of the match\n\tvar linkText = this.match[0];\n\t// Move past the macro call\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// If the link starts with the unwikilink character then just output it as plain text\n\tif(linkText.substr(0,1) === $tw.config.textPrimitives.unWikiLink) {\n\t\treturn [{type: \"text\", text: linkText.substr(1)}];\n\t}\n\t// If the link has been preceded with a blocked letter then don't treat it as a link\n\tif(this.match.index > 0) {\n\t\tvar preRegExp = new RegExp($tw.config.textPrimitives.blockPrefixLetters,\"mg\");\n\t\tpreRegExp.lastIndex = this.match.index-1;\n\t\tvar preMatch = preRegExp.exec(this.parser.source);\n\t\tif(preMatch && preMatch.index === this.match.index-1) {\n\t\t\treturn [{type: \"text\", text: linkText}];\n\t\t}\n\t}\n\treturn [{\n\t\ttype: \"link\",\n\t\tattributes: {\n\t\t\tto: {type: \"string\", value: linkText}\n\t\t},\n\t\tchildren: [{\n\t\t\ttype: \"text\",\n\t\t\ttext: linkText\n\t\t}]\n\t}];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikirule"
},
"$:/core/modules/parsers/wikiparser/wikiparser.js": {
"title": "$:/core/modules/parsers/wikiparser/wikiparser.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/wikiparser.js\ntype: application/javascript\nmodule-type: parser\n\nThe wiki text parser processes blocks of source text into a parse tree.\n\nThe parse tree is made up of nested arrays of these JavaScript objects:\n\n\t{type: \"element\", tag: <string>, attributes: {}, children: []} - an HTML element\n\t{type: \"text\", text: <string>} - a text node\n\t{type: \"entity\", value: <string>} - an entity\n\t{type: \"raw\", html: <string>} - raw HTML\n\nAttributes are stored as hashmaps of the following objects:\n\n\t{type: \"string\", value: <string>} - literal string\n\t{type: \"indirect\", textReference: <textReference>} - indirect through a text reference\n\t{type: \"macro\", macro: <TBD>} - indirect through a macro invocation\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\ntype: content type of text\ntext: text to be parsed\noptions: see below:\n\tparseAsInline: true to parse text as inline instead of block\n\twiki: reference to wiki to use\n\t_canonical_uri: optional URI of content if text is missing or empty\n*/\nvar WikiParser = function(type,text,options) {\n\tthis.wiki = options.wiki;\n\tvar self = this;\n\t// Check for an externally linked tiddler\n\tif($tw.browser && (text || \"\") === \"\" && options._canonical_uri) {\n\t\tthis.loadRemoteTiddler(options._canonical_uri);\n\t\ttext = $tw.language.getRawString(\"LazyLoadingWarning\");\n\t}\n\t// Save the parse text\n\tthis.type = type || \"text/vnd.tiddlywiki\";\n\tthis.source = text || \"\";\n\tthis.sourceLength = this.source.length;\n\t// Flag for ignoring whitespace\n\tthis.configTrimWhiteSpace = false;\n\t// Set current parse position\n\tthis.pos = 0;\n\t// Start with empty output\n\tthis.tree = [];\n\t// Assemble the rule classes we're going to use\n\tvar pragmaRuleClasses, blockRuleClasses, inlineRuleClasses;\n\tif(options.rules) {\n\t\tpragmaRuleClasses = options.rules.pragma;\n\t\tblockRuleClasses = options.rules.block;\n\t\tinlineRuleClasses = options.rules.inline;\n\t} else {\n\t\t// Setup the rule classes if we don't have them already\n\t\tif(!this.pragmaRuleClasses) {\n\t\t\tWikiParser.prototype.pragmaRuleClasses = $tw.modules.createClassesFromModules(\"wikirule\",\"pragma\",$tw.WikiRuleBase);\n\t\t\tthis.setupRules(WikiParser.prototype.pragmaRuleClasses,\"$:/config/WikiParserRules/Pragmas/\");\n\t\t}\n\t\tpragmaRuleClasses = this.pragmaRuleClasses;\n\t\tif(!this.blockRuleClasses) {\n\t\t\tWikiParser.prototype.blockRuleClasses = $tw.modules.createClassesFromModules(\"wikirule\",\"block\",$tw.WikiRuleBase);\n\t\t\tthis.setupRules(WikiParser.prototype.blockRuleClasses,\"$:/config/WikiParserRules/Block/\");\n\t\t}\n\t\tblockRuleClasses = this.blockRuleClasses;\n\t\tif(!this.inlineRuleClasses) {\n\t\t\tWikiParser.prototype.inlineRuleClasses = $tw.modules.createClassesFromModules(\"wikirule\",\"inline\",$tw.WikiRuleBase);\n\t\t\tthis.setupRules(WikiParser.prototype.inlineRuleClasses,\"$:/config/WikiParserRules/Inline/\");\n\t\t}\n\t\tinlineRuleClasses = this.inlineRuleClasses;\n\t}\n\t// Instantiate the pragma parse rules\n\tthis.pragmaRules = this.instantiateRules(pragmaRuleClasses,\"pragma\",0);\n\t// Instantiate the parser block and inline rules\n\tthis.blockRules = this.instantiateRules(blockRuleClasses,\"block\",0);\n\tthis.inlineRules = this.instantiateRules(inlineRuleClasses,\"inline\",0);\n\t// Parse any pragmas\n\tvar topBranch = this.parsePragmas();\n\t// Parse the text into inline runs or blocks\n\tif(options.parseAsInline) {\n\t\ttopBranch.push.apply(topBranch,this.parseInlineRun());\n\t} else {\n\t\ttopBranch.push.apply(topBranch,this.parseBlocks());\n\t}\n\t// Return the parse tree\n};\n\n/*\n*/\nWikiParser.prototype.loadRemoteTiddler = function(url) {\n\tvar self = this;\n\t$tw.utils.httpRequest({\n\t\turl: url,\n\t\ttype: \"GET\",\n\t\tcallback: function(err,data) {\n\t\t\tif(!err) {\n\t\t\t\tvar tiddlers = self.wiki.deserializeTiddlers(\".tid\",data,self.wiki.getCreationFields());\n\t\t\t\t$tw.utils.each(tiddlers,function(tiddler) {\n\t\t\t\t\ttiddler[\"_canonical_uri\"] = url;\n\t\t\t\t});\n\t\t\t\tif(tiddlers) {\n\t\t\t\t\tself.wiki.addTiddlers(tiddlers);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\n*/\nWikiParser.prototype.setupRules = function(proto,configPrefix) {\n\tvar self = this;\n\tif(!$tw.safemode) {\n\t\t$tw.utils.each(proto,function(object,name) {\n\t\t\tif(self.wiki.getTiddlerText(configPrefix + name,\"enable\") !== \"enable\") {\n\t\t\t\tdelete proto[name];\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\nInstantiate an array of parse rules\n*/\nWikiParser.prototype.instantiateRules = function(classes,type,startPos) {\n\tvar rulesInfo = [],\n\t\tself = this;\n\t$tw.utils.each(classes,function(RuleClass) {\n\t\t// Instantiate the rule\n\t\tvar rule = new RuleClass(self);\n\t\trule.is = {};\n\t\trule.is[type] = true;\n\t\trule.init(self);\n\t\tvar matchIndex = rule.findNextMatch(startPos);\n\t\tif(matchIndex !== undefined) {\n\t\t\trulesInfo.push({\n\t\t\t\trule: rule,\n\t\t\t\tmatchIndex: matchIndex\n\t\t\t});\n\t\t}\n\t});\n\treturn rulesInfo;\n};\n\n/*\nSkip any whitespace at the current position. Options are:\n\ttreatNewlinesAsNonWhitespace: true if newlines are NOT to be treated as whitespace\n*/\nWikiParser.prototype.skipWhitespace = function(options) {\n\toptions = options || {};\n\tvar whitespaceRegExp = options.treatNewlinesAsNonWhitespace ? /([^\\S\\n]+)/mg : /(\\s+)/mg;\n\twhitespaceRegExp.lastIndex = this.pos;\n\tvar whitespaceMatch = whitespaceRegExp.exec(this.source);\n\tif(whitespaceMatch && whitespaceMatch.index === this.pos) {\n\t\tthis.pos = whitespaceRegExp.lastIndex;\n\t}\n};\n\n/*\nGet the next match out of an array of parse rule instances\n*/\nWikiParser.prototype.findNextMatch = function(rules,startPos) {\n\t// Find the best matching rule by finding the closest match position\n\tvar matchingRule,\n\t\tmatchingRulePos = this.sourceLength;\n\t// Step through each rule\n\tfor(var t=0; t<rules.length; t++) {\n\t\tvar ruleInfo = rules[t];\n\t\t// Ask the rule to get the next match if we've moved past the current one\n\t\tif(ruleInfo.matchIndex !== undefined && ruleInfo.matchIndex < startPos) {\n\t\t\truleInfo.matchIndex = ruleInfo.rule.findNextMatch(startPos);\n\t\t}\n\t\t// Adopt this match if it's closer than the current best match\n\t\tif(ruleInfo.matchIndex !== undefined && ruleInfo.matchIndex <= matchingRulePos) {\n\t\t\tmatchingRule = ruleInfo;\n\t\t\tmatchingRulePos = ruleInfo.matchIndex;\n\t\t}\n\t}\n\treturn matchingRule;\n};\n\n/*\nParse any pragmas at the beginning of a block of parse text\n*/\nWikiParser.prototype.parsePragmas = function() {\n\tvar currentTreeBranch = this.tree;\n\twhile(true) {\n\t\t// Skip whitespace\n\t\tthis.skipWhitespace();\n\t\t// Check for the end of the text\n\t\tif(this.pos >= this.sourceLength) {\n\t\t\tbreak;\n\t\t}\n\t\t// Check if we've arrived at a pragma rule match\n\t\tvar nextMatch = this.findNextMatch(this.pragmaRules,this.pos);\n\t\t// If not, just exit\n\t\tif(!nextMatch || nextMatch.matchIndex !== this.pos) {\n\t\t\tbreak;\n\t\t}\n\t\t// Process the pragma rule\n\t\tvar subTree = nextMatch.rule.parse();\n\t\tif(subTree.length > 0) {\n\t\t\t// Quick hack; we only cope with a single parse tree node being returned, which is true at the moment\n\t\t\tcurrentTreeBranch.push.apply(currentTreeBranch,subTree);\n\t\t\tsubTree[0].children = [];\n\t\t\tcurrentTreeBranch = subTree[0].children;\n\t\t}\n\t}\n\treturn currentTreeBranch;\n};\n\n/*\nParse a block from the current position\n\tterminatorRegExpString: optional regular expression string that identifies the end of plain paragraphs. Must not include capturing parenthesis\n*/\nWikiParser.prototype.parseBlock = function(terminatorRegExpString) {\n\tvar terminatorRegExp = terminatorRegExpString ? new RegExp(\"(\" + terminatorRegExpString + \"|\\\\r?\\\\n\\\\r?\\\\n)\",\"mg\") : /(\\r?\\n\\r?\\n)/mg;\n\tthis.skipWhitespace();\n\tif(this.pos >= this.sourceLength) {\n\t\treturn [];\n\t}\n\t// Look for a block rule that applies at the current position\n\tvar nextMatch = this.findNextMatch(this.blockRules,this.pos);\n\tif(nextMatch && nextMatch.matchIndex === this.pos) {\n\t\treturn nextMatch.rule.parse();\n\t}\n\t// Treat it as a paragraph if we didn't find a block rule\n\treturn [{type: \"element\", tag: \"p\", children: this.parseInlineRun(terminatorRegExp)}];\n};\n\n/*\nParse a series of blocks of text until a terminating regexp is encountered or the end of the text\n\tterminatorRegExpString: terminating regular expression\n*/\nWikiParser.prototype.parseBlocks = function(terminatorRegExpString) {\n\tif(terminatorRegExpString) {\n\t\treturn this.parseBlocksTerminated(terminatorRegExpString);\n\t} else {\n\t\treturn this.parseBlocksUnterminated();\n\t}\n};\n\n/*\nParse a block from the current position to the end of the text\n*/\nWikiParser.prototype.parseBlocksUnterminated = function() {\n\tvar tree = [];\n\twhile(this.pos < this.sourceLength) {\n\t\ttree.push.apply(tree,this.parseBlock());\n\t}\n\treturn tree;\n};\n\n/*\nParse blocks of text until a terminating regexp is encountered\n*/\nWikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {\n\tvar terminatorRegExp = new RegExp(\"(\" + terminatorRegExpString + \")\",\"mg\"),\n\t\ttree = [];\n\t// Skip any whitespace\n\tthis.skipWhitespace();\n\t// Check if we've got the end marker\n\tterminatorRegExp.lastIndex = this.pos;\n\tvar match = terminatorRegExp.exec(this.source);\n\t// Parse the text into blocks\n\twhile(this.pos < this.sourceLength && !(match && match.index === this.pos)) {\n\t\tvar blocks = this.parseBlock(terminatorRegExpString);\n\t\ttree.push.apply(tree,blocks);\n\t\t// Skip any whitespace\n\t\tthis.skipWhitespace();\n\t\t// Check if we've got the end marker\n\t\tterminatorRegExp.lastIndex = this.pos;\n\t\tmatch = terminatorRegExp.exec(this.source);\n\t}\n\tif(match && match.index === this.pos) {\n\t\tthis.pos = match.index + match[0].length;\n\t}\n\treturn tree;\n};\n\n/*\nParse a run of text at the current position\n\tterminatorRegExp: a regexp at which to stop the run\n\toptions: see below\nOptions available:\n\teatTerminator: move the parse position past any encountered terminator (default false)\n*/\nWikiParser.prototype.parseInlineRun = function(terminatorRegExp,options) {\n\tif(terminatorRegExp) {\n\t\treturn this.parseInlineRunTerminated(terminatorRegExp,options);\n\t} else {\n\t\treturn this.parseInlineRunUnterminated(options);\n\t}\n};\n\nWikiParser.prototype.parseInlineRunUnterminated = function(options) {\n\tvar tree = [];\n\t// Find the next occurrence of an inline rule\n\tvar nextMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t// Loop around the matches until we've reached the end of the text\n\twhile(this.pos < this.sourceLength && nextMatch) {\n\t\t// Process the text preceding the run rule\n\t\tif(nextMatch.matchIndex > this.pos) {\n\t\t\tthis.pushTextWidget(tree,this.source.substring(this.pos,nextMatch.matchIndex));\n\t\t\tthis.pos = nextMatch.matchIndex;\n\t\t}\n\t\t// Process the run rule\n\t\ttree.push.apply(tree,nextMatch.rule.parse());\n\t\t// Look for the next run rule\n\t\tnextMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t}\n\t// Process the remaining text\n\tif(this.pos < this.sourceLength) {\n\t\tthis.pushTextWidget(tree,this.source.substr(this.pos));\n\t}\n\tthis.pos = this.sourceLength;\n\treturn tree;\n};\n\nWikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) {\n\toptions = options || {};\n\tvar tree = [];\n\t// Find the next occurrence of the terminator\n\tterminatorRegExp.lastIndex = this.pos;\n\tvar terminatorMatch = terminatorRegExp.exec(this.source);\n\t// Find the next occurrence of a inlinerule\n\tvar inlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t// Loop around until we've reached the end of the text\n\twhile(this.pos < this.sourceLength && (terminatorMatch || inlineRuleMatch)) {\n\t\t// Return if we've found the terminator, and it precedes any inline rule match\n\t\tif(terminatorMatch) {\n\t\t\tif(!inlineRuleMatch || inlineRuleMatch.matchIndex >= terminatorMatch.index) {\n\t\t\t\tif(terminatorMatch.index > this.pos) {\n\t\t\t\t\tthis.pushTextWidget(tree,this.source.substring(this.pos,terminatorMatch.index));\n\t\t\t\t}\n\t\t\t\tthis.pos = terminatorMatch.index;\n\t\t\t\tif(options.eatTerminator) {\n\t\t\t\t\tthis.pos += terminatorMatch[0].length;\n\t\t\t\t}\n\t\t\t\treturn tree;\n\t\t\t}\n\t\t}\n\t\t// Process any inline rule, along with the text preceding it\n\t\tif(inlineRuleMatch) {\n\t\t\t// Preceding text\n\t\t\tif(inlineRuleMatch.matchIndex > this.pos) {\n\t\t\t\tthis.pushTextWidget(tree,this.source.substring(this.pos,inlineRuleMatch.matchIndex));\n\t\t\t\tthis.pos = inlineRuleMatch.matchIndex;\n\t\t\t}\n\t\t\t// Process the inline rule\n\t\t\ttree.push.apply(tree,inlineRuleMatch.rule.parse());\n\t\t\t// Look for the next inline rule\n\t\t\tinlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos);\n\t\t\t// Look for the next terminator match\n\t\t\tterminatorRegExp.lastIndex = this.pos;\n\t\t\tterminatorMatch = terminatorRegExp.exec(this.source);\n\t\t}\n\t}\n\t// Process the remaining text\n\tif(this.pos < this.sourceLength) {\n\t\tthis.pushTextWidget(tree,this.source.substr(this.pos));\n\t}\n\tthis.pos = this.sourceLength;\n\treturn tree;\n};\n\n/*\nPush a text widget onto an array, respecting the configTrimWhiteSpace setting\n*/\nWikiParser.prototype.pushTextWidget = function(array,text) {\n\tif(this.configTrimWhiteSpace) {\n\t\ttext = $tw.utils.trim(text);\n\t}\n\tif(text) {\n\t\tarray.push({type: \"text\", text: text});\n\t}\n};\n\n/*\nParse zero or more class specifiers `.classname`\n*/\nWikiParser.prototype.parseClasses = function() {\n\tvar classRegExp = /\\.([^\\s\\.]+)/mg,\n\t\tclassNames = [];\n\tclassRegExp.lastIndex = this.pos;\n\tvar match = classRegExp.exec(this.source);\n\twhile(match && match.index === this.pos) {\n\t\tthis.pos = match.index + match[0].length;\n\t\tclassNames.push(match[1]);\n\t\tmatch = classRegExp.exec(this.source);\n\t}\n\treturn classNames;\n};\n\n/*\nAmend the rules used by this instance of the parser\n\ttype: `only` keeps just the named rules, `except` keeps all but the named rules\n\tnames: array of rule names\n*/\nWikiParser.prototype.amendRules = function(type,names) {\n\tnames = names || [];\n\t// Define the filter function\n\tvar target;\n\tif(type === \"only\") {\n\t\ttarget = true;\n\t} else if(type === \"except\") {\n\t\ttarget = false;\n\t} else {\n\t\treturn;\n\t}\n\t// Define a function to process each of our rule arrays\n\tvar processRuleArray = function(ruleArray) {\n\t\tfor(var t=ruleArray.length-1; t>=0; t--) {\n\t\t\tif((names.indexOf(ruleArray[t].rule.name) === -1) === target) {\n\t\t\t\truleArray.splice(t,1);\n\t\t\t}\n\t\t}\n\t};\n\t// Process each rule array\n\tprocessRuleArray(this.pragmaRules);\n\tprocessRuleArray(this.blockRules);\n\tprocessRuleArray(this.inlineRules);\n};\n\nexports[\"text/vnd.tiddlywiki\"] = WikiParser;\n\n})();\n\n",
"type": "application/javascript",
"module-type": "parser"
},
"$:/core/modules/parsers/wikiparser/rules/wikirulebase.js": {
"title": "$:/core/modules/parsers/wikiparser/rules/wikirulebase.js",
"text": "/*\\\ntitle: $:/core/modules/parsers/wikiparser/rules/wikirulebase.js\ntype: application/javascript\nmodule-type: global\n\nBase class for wiki parser rules\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nThis constructor is always overridden with a blank constructor, and so shouldn't be used\n*/\nvar WikiRuleBase = function() {\n};\n\n/*\nTo be overridden by individual rules\n*/\nWikiRuleBase.prototype.init = function(parser) {\n\tthis.parser = parser;\n};\n\n/*\nDefault implementation of findNextMatch uses RegExp matching\n*/\nWikiRuleBase.prototype.findNextMatch = function(startPos) {\n\tthis.matchRegExp.lastIndex = startPos;\n\tthis.match = this.matchRegExp.exec(this.parser.source);\n\treturn this.match ? this.match.index : undefined;\n};\n\nexports.WikiRuleBase = WikiRuleBase;\n\n})();\n",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/pluginswitcher.js": {
"title": "$:/core/modules/pluginswitcher.js",
"text": "/*\\\ntitle: $:/core/modules/pluginswitcher.js\ntype: application/javascript\nmodule-type: global\n\nManages switching plugins for themes and languages.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\noptions:\nwiki: wiki store to be used\npluginType: type of plugin to be switched\ncontrollerTitle: title of tiddler used to control switching of this resource\ndefaultPlugins: array of default plugins to be used if nominated plugin isn't found\nonSwitch: callback when plugin is switched (single parameter is array of plugin titles)\n*/\nfunction PluginSwitcher(options) {\n\tthis.wiki = options.wiki;\n\tthis.pluginType = options.pluginType;\n\tthis.controllerTitle = options.controllerTitle;\n\tthis.defaultPlugins = options.defaultPlugins || [];\n\tthis.onSwitch = options.onSwitch;\n\t// Switch to the current plugin\n\tthis.switchPlugins();\n\t// Listen for changes to the selected plugin\n\tvar self = this;\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\tif($tw.utils.hop(changes,self.controllerTitle)) {\n\t\t\tself.switchPlugins();\n\t\t}\n\t});\n}\n\nPluginSwitcher.prototype.switchPlugins = function() {\n\t// Get the name of the current theme\n\tvar selectedPluginTitle = this.wiki.getTiddlerText(this.controllerTitle);\n\t// If it doesn't exist, then fallback to one of the default themes\n\tvar index = 0;\n\twhile(!this.wiki.getTiddler(selectedPluginTitle) && index < this.defaultPlugins.length) {\n\t\tselectedPluginTitle = this.defaultPlugins[index++];\n\t}\n\t// Accumulate the titles of the plugins that we need to load\n\tvar plugins = [],\n\t\tself = this,\n\t\taccumulatePlugin = function(title) {\n\t\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\t\tif(tiddler && tiddler.isPlugin() && plugins.indexOf(title) === -1) {\n\t\t\t\tplugins.push(title);\n\t\t\t\tvar pluginInfo = JSON.parse(self.wiki.getTiddlerText(title)),\n\t\t\t\t\tdependents = $tw.utils.parseStringArray(tiddler.fields.dependents || \"\");\n\t\t\t\t$tw.utils.each(dependents,function(title) {\n\t\t\t\t\taccumulatePlugin(title);\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\taccumulatePlugin(selectedPluginTitle);\n\t// Read the plugin info for the incoming plugins\n\tvar changes = $tw.wiki.readPluginInfo(plugins);\n\t// Unregister any existing theme tiddlers\n\tvar unregisteredTiddlers = $tw.wiki.unregisterPluginTiddlers(this.pluginType);\n\t// Register any new theme tiddlers\n\tvar registeredTiddlers = $tw.wiki.registerPluginTiddlers(this.pluginType,plugins);\n\t// Unpack the current theme tiddlers\n\t$tw.wiki.unpackPluginTiddlers();\n\t// Call the switch handler\n\tif(this.onSwitch) {\n\t\tthis.onSwitch(plugins);\n\t}\n};\n\nexports.PluginSwitcher = PluginSwitcher;\n\n})();\n",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/publisherhandler.js": {
"title": "$:/core/modules/publisherhandler.js",
"text": "/*\\\ntitle: $:/core/modules/publisherhandler.js\ntype: application/javascript\nmodule-type: global\n\nThe publisher manages publishing extracts of wikis as external files\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar PUBLISHING_MODAL_TITLE = \"$:/language/Publishing/Modal\";\n\n/*\nInstantiate the publisher manager with the following options\nwiki: wiki object to be used\ncommander: commander object to be used for output\n*/\nfunction PublisherHandler(options) {\n\tthis.wiki = options.wiki;\n\tthis.commander = options.commander;\n}\n\n/*\nPublish a job\n\njobTitle: title of tiddler containing details of the job\ncallback: completion callback invoked callback(err)\noptions: Include:\n\ncommander: commander object associated with publishing under Node.js\nvariables: hashmap of variables to be passed to renderings\n*/\nPublisherHandler.prototype.publish = function(jobTitle,callback,options) {\n\tif(jobTitle) {\n\t\tvar job = new PublishingJob(jobTitle,this,options);\n\t\tjob.publish(callback);\n\t}\n};\n\nfunction PublishingJob(jobTitle,publisherHandler,options) {\n\toptions = options || {};\n\t// Save params\n\tthis.jobTitle = jobTitle;\n\tthis.publisherHandler = publisherHandler;\n\tthis.commander = options.commander;\n\tthis.publishVariables = options.variables || Object.create(null);\n}\n\n/*\nStart publishing\n*/\nPublishingJob.prototype.publish = function(callback) {\n\tvar self = this;\n\t// Get the job tiddler and check it is enabled\n\tthis.jobTiddler = this.publisherHandler.wiki.getTiddler(this.jobTitle);\n\tif(this.jobTiddler && this.jobTiddler.fields.enabled === \"yes\") {\n\t\t// Get the list of tiddlers to be exported, defaulting to all non-system tiddlers\n\t\tthis.exportList = this.publisherHandler.wiki.filterTiddlers(this.jobTiddler.fields[\"export-filter\"] || \"[!is[system]]\");\n\t\t// Get publisher\n\t\tthis.publisher = this.getPublisher(this.jobTiddler.fields.publisher);\n\t\tif(this.publisher) {\n\t\t\t// Get the sitemap\n\t\t\tthis.sitemap = new $tw.Sitemap(this.jobTiddler.fields.sitemap,{\n\t\t\t\twiki: this.publisherHandler.wiki,\n\t\t\t\tvariables: this.publishVariables\n\t\t\t});\n\t\t\tthis.sitemap.load();\n\t\t\t// Get the output operations\n\t\t\tthis.operations = this.sitemap.getAllFileDetails(this.exportList);\n\t\t\t// Display the progress modal\n\t\t\tif($tw.modal) {\n\t\t\t\tthis.progressModal = $tw.modal.display(PUBLISHING_MODAL_TITLE,{\n\t\t\t\t\tprogress: true,\n\t\t\t\t\tvariables: {\n\t\t\t\t\t\tcurrentTiddler: this.jobTitle,\n\t\t\t\t\t\ttotalFiles: this.operations.length + \"\"\n\t\t\t\t\t},\n\t\t\t\t\tonclose: function(event) {\n\t\t\t\t\t\tif(event !== self) {\n\t\t\t\t\t\t\t// The modal was closed other than by us programmatically\n\t\t\t\t\t\t\tself.isCancelled = true;\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// Send the operations to the publisher\n\t\t\tthis.executeOperations(function(err) {\n\t\t\t\tif(self.progressModal) {\n\t\t\t\t\tself.progressModal.closeHandler(self);\n\t\t\t\t}\n\t\t\t\tcallback(err);\n\t\t\t});\n\t\t} else {\n\t\t\treturn callback(\"Unrecognised publisher\");\n\t\t}\n\t} else {\n\t\treturn callback(\"Missing or disabled job tiddler\");\n\t}\n};\n\n/*\nInstantiate the required publisher object\n*/\nPublishingJob.prototype.getPublisher = function(publisherName) {\n\tvar publisher;\n\t$tw.modules.forEachModuleOfType(\"publisher\",function(title,module) {\n\t\tif(module.name === publisherName) {\n\t\t\tpublisher = module;\n\t\t}\n\t});\n\treturn publisher && publisher.create(this.jobTiddler.fields,this.publisherHandler,this);\n};\n\n/*\nExecute the operations for this job\n*/\nPublishingJob.prototype.executeOperations = function(callback) {\n\tvar self = this,\n\t\treport = {overwrites: []},\n\t\tnextOperation = 0,\n\t\tperformNextOperation = function() {\n\t\t\t// Check for having been cancelled\n\t\t\tif(self.isCancelled) {\n\t\t\t\tif(self.publisher.publishCancel) {\n\t\t\t\t\tself.publisher.publishCancel();\n\t\t\t\t}\n\t\t\t\treturn callback(\"CANCELLED\");\n\t\t\t}\n\t\t\t// Update progress\n\t\t\tif(self.progressModal) {\n\t\t\t\tself.progressModal.setProgress(nextOperation,self.operations.length);\n\t\t\t}\n\t\t\t// Check for having finished\n\t\t\tif(nextOperation >= self.operations.length) {\n\t\t\t\t$tw.utils.nextTick(function() {\n\t\t\t\t\tself.publisher.publishEnd(callback);\t\t\t\t\t\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Execute this operation\n\t\t\t\tvar fileDetails = self.operations[nextOperation]();\n\t\t\t\tnextOperation += 1;\n\t\t\t\tself.publisher.publishFile(fileDetails,function() {\n\t\t\t\t\t$tw.utils.nextTick(performNextOperation);\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t// Tell the publisher to start, and get back an array of the existing paths\n\tself.publisher.publishStart(function(existingPaths) {\n\t\tvar paths = {};\n\t\t$tw.utils.each(self.operations,function(operation) {\n\t\t\tif(operation.path in paths) {\n\t\t\t\treport.overwrites.push(operation.path);\n\t\t\t}\n\t\t\tpaths[operation.path] = true;\n\t\t});\n\t\t// Run the operations\n\t\tperformNextOperation();\n\t});\n};\n\nPublishingJob.prototype.saveReport = function(report) {\n\t// Create the report tiddler\n\tvar reportTitle = this.wiki.generateNewTitle(\"$:/temp/publish-report\");\n\t$tw.wiki.addTiddler({\n\t\ttitle: reportTitle,\n\t\ttext: \"* \" + report.overwrites.join(\"\\n* \")\n\t});\n\t// Add the report tiddler title to the list field of the publisher parameters tiddler\n\tvar paramsTiddler = $tw.wiki.getTiddler(this.publisherParamsTitle),\n\t\tlist = (paramsTiddler.fields.list || []).slice(0);\n\tlist.unshift(reportTitle);\n\t$tw.wiki.addTiddler(new $tw.Tiddler(paramsTiddler,{list: list}));\n};\n\nexports.PublisherHandler = PublisherHandler;\n\n})();\n",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/publishers/filesystem.js": {
"title": "$:/core/modules/publishers/filesystem.js",
"text": "/*\\\ntitle: $:/core/modules/publishers/filesystem.js\ntype: application/javascript\nmodule-type: publisher\n\nHandles publishing to the Node.js filesystem\n\n\\*/\n(function(){\n\n\t/*jslint node: true, browser: true */\n\t/*global $tw: false */\n\t\"use strict\";\n\t\n\texports.name = \"filesystem\";\n\t\n\texports.create = function(params,publisherHandler,publishingJob) {\n\t\treturn new FileSystemPublisher(params,publisherHandler,publishingJob);\n\t};\n\t\n\tfunction FileSystemPublisher(params,publisherHandler,publishingJob) {\n\t\tthis.params = params;\n\t\tthis.publisherHandler = publisherHandler;\n\t\tthis.publishingJob = publishingJob;\n\t};\n\t\n\tFileSystemPublisher.prototype.publishStart = function(callback) {\n\t\tconsole.log(\"publishStart\");\n\t\t// Returns a list of the previously published files\n\t\tcallback([]);\n\t};\n\t\n\tFileSystemPublisher.prototype.publishFile = function(item,callback) {\n\t\tvar fs = require(\"fs\"),\n\t\t\tpath = require(\"path\"),\n\t\t\tfilepath = path.resolve(this.publishingJob.commander.outputPath,item.path);\n\t\t$tw.utils.createFileDirectories(filepath);\n\t\tfs.writeFile(filepath,item.text,item.isBase64 ? \"base64\" : \"utf8\",function(err) {\n\t\t\tif(err) {\n\t\t\t\tconsole.log(\"File writing error\",err)\n\t\t\t}\n\t\t\tcallback(err);\n\t\t});\n\t};\n\t\n\tFileSystemPublisher.prototype.publishEnd = function(callback) {\n\t\tconsole.log(\"publishEnd\");\n\t\tcallback(null);\n\t};\n\t\n\t})();\n\t",
"type": "application/javascript",
"module-type": "publisher"
},
"$:/core/modules/saver-handler.js": {
"title": "$:/core/modules/saver-handler.js",
"text": "/*\\\ntitle: $:/core/modules/saver-handler.js\ntype: application/javascript\nmodule-type: global\n\nThe saver handler tracks changes to the store and handles saving the entire wiki via saver modules.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nInstantiate the saver handler with the following options:\nwiki: wiki to be synced\ndirtyTracking: true if dirty tracking should be performed\n*/\nfunction SaverHandler(options) {\n\tvar self = this;\n\tthis.wiki = options.wiki;\n\tthis.dirtyTracking = options.dirtyTracking;\n\tthis.preloadDirty = options.preloadDirty || [];\n\tthis.pendingAutoSave = false;\n\t// Make a logger\n\tthis.logger = new $tw.utils.Logger(\"saver-handler\");\n\t// Initialise our savers\n\tif($tw.browser) {\n\t\tthis.initSavers();\n\t}\n\t// Only do dirty tracking if required\n\tif($tw.browser && this.dirtyTracking) {\n\t\t// Compile the dirty tiddler filter\n\t\tthis.filterFn = this.wiki.compileFilter(this.wiki.getTiddlerText(this.titleSyncFilter));\n\t\t// Count of changes that have not yet been saved\n\t\tvar filteredChanges = self.filterFn.call(self.wiki,function(iterator) {\n\t\t\t\t$tw.utils.each(self.preloadDirty,function(title) {\n\t\t\t\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\t\t\t\titerator(tiddler,title);\n\t\t\t\t});\n\t\t});\n\t\tthis.numChanges = filteredChanges.length;\n\t\t// Listen out for changes to tiddlers\n\t\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\t\t// Filter the changes so that we only count changes to tiddlers that we care about\n\t\t\tvar filteredChanges = self.filterFn.call(self.wiki,function(iterator) {\n\t\t\t\t$tw.utils.each(changes,function(change,title) {\n\t\t\t\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\t\t\t\titerator(tiddler,title);\n\t\t\t\t});\n\t\t\t});\n\t\t\t// Adjust the number of changes\n\t\t\tself.numChanges += filteredChanges.length;\n\t\t\tself.updateDirtyStatus();\n\t\t\t// Do any autosave if one is pending and there's no more change events\n\t\t\tif(self.pendingAutoSave && self.wiki.getSizeOfTiddlerEventQueue() === 0) {\n\t\t\t\t// Check if we're dirty\n\t\t\t\tif(self.numChanges > 0) {\n\t\t\t\t\tself.saveWiki({\n\t\t\t\t\t\tmethod: \"autosave\",\n\t\t\t\t\t\tdownloadType: \"text/plain\"\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tself.pendingAutoSave = false;\n\t\t\t}\n\t\t});\n\t\t// Listen for the autosave event\n\t\t$tw.rootWidget.addEventListener(\"tm-auto-save-wiki\",function(event) {\n\t\t\t// Do the autosave unless there are outstanding tiddler change events\n\t\t\tif(self.wiki.getSizeOfTiddlerEventQueue() === 0) {\n\t\t\t\t// Check if we're dirty\n\t\t\t\tif(self.numChanges > 0) {\n\t\t\t\t\tself.saveWiki({\n\t\t\t\t\t\tmethod: \"autosave\",\n\t\t\t\t\t\tdownloadType: \"text/plain\"\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Otherwise put ourselves in the \"pending autosave\" state and wait for the change event before we do the autosave\n\t\t\t\tself.pendingAutoSave = true;\n\t\t\t}\n\t\t});\n\t\t// Set up our beforeunload handler\n\t\t$tw.addUnloadTask(function(event) {\n\t\t\tvar confirmationMessage;\n\t\t\tif(self.isDirty()) {\n\t\t\t\tconfirmationMessage = $tw.language.getString(\"UnsavedChangesWarning\");\n\t\t\t\tevent.returnValue = confirmationMessage; // Gecko\n\t\t\t}\n\t\t\treturn confirmationMessage;\n\t\t});\n\t}\n\t// Install the save action handlers\n\tif($tw.browser) {\n\t\t$tw.rootWidget.addEventListener(\"tm-save-wiki\",function(event) {\n\t\t\tself.saveWiki({\n\t\t\t\ttemplate: event.param,\n\t\t\t\tdownloadType: \"text/plain\",\n\t\t\t\tvariables: event.paramObject\n\t\t\t});\n\t\t});\n\t\t$tw.rootWidget.addEventListener(\"tm-download-file\",function(event) {\n\t\t\tself.saveWiki({\n\t\t\t\tmethod: \"download\",\n\t\t\t\ttemplate: event.param,\n\t\t\t\tdownloadType: \"text/plain\",\n\t\t\t\tvariables: event.paramObject\n\t\t\t});\n\t\t});\n\t}\n}\n\nSaverHandler.prototype.titleSyncFilter = \"$:/config/SaverFilter\";\nSaverHandler.prototype.titleAutoSave = \"$:/config/AutoSave\";\nSaverHandler.prototype.titleSavedNotification = \"$:/language/Notifications/Save/Done\";\n\n/*\nSelect the appropriate saver modules and set them up\n*/\nSaverHandler.prototype.initSavers = function(moduleType) {\n\tmoduleType = moduleType || \"saver\";\n\t// Instantiate the available savers\n\tthis.savers = [];\n\tvar self = this;\n\t$tw.modules.forEachModuleOfType(moduleType,function(title,module) {\n\t\tif(module.canSave(self)) {\n\t\t\tself.savers.push(module.create(self.wiki));\n\t\t}\n\t});\n\t// Sort the savers into priority order\n\tthis.savers.sort(function(a,b) {\n\t\tif(a.info.priority < b.info.priority) {\n\t\t\treturn -1;\n\t\t} else {\n\t\t\tif(a.info.priority > b.info.priority) {\n\t\t\t\treturn +1;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\nSave the wiki contents. Options are:\n\tmethod: \"save\", \"autosave\" or \"download\"\n\ttemplate: the tiddler containing the template to save\n\tdownloadType: the content type for the saved file\n*/\nSaverHandler.prototype.saveWiki = function(options) {\n\toptions = options || {};\n\tvar self = this,\n\t\tmethod = options.method || \"save\";\n\t// Ignore autosave if disabled\n\tif(method === \"autosave\" && ($tw.config.disableAutoSave || this.wiki.getTiddlerText(this.titleAutoSave,\"yes\") !== \"yes\")) {\n\t\treturn false;\n\t}\n\tvar\tvariables = options.variables || {},\n\t\ttemplate = options.template || \"$:/core/save/all\",\n\t\tdownloadType = options.downloadType || \"text/plain\",\n\t\ttext = this.wiki.renderTiddler(downloadType,template,options),\n\t\tcallback = function(err) {\n\t\t\tif(err) {\n\t\t\t\talert($tw.language.getString(\"Error/WhileSaving\") + \":\\n\\n\" + err);\n\t\t\t} else {\n\t\t\t\t// Clear the task queue if we're saving (rather than downloading)\n\t\t\t\tif(method !== \"download\") {\n\t\t\t\t\tself.numChanges = 0;\n\t\t\t\t\tself.updateDirtyStatus();\n\t\t\t\t}\n\t\t\t\t$tw.notifier.display(self.titleSavedNotification);\n\t\t\t\tif(options.callback) {\n\t\t\t\t\toptions.callback();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t// Call the highest priority saver that supports this method\n\tfor(var t=this.savers.length-1; t>=0; t--) {\n\t\tvar saver = this.savers[t];\n\t\tif(saver.info.capabilities.indexOf(method) !== -1 && saver.save(text,method,callback,{variables: {filename: variables.filename}})) {\n\t\t\tthis.logger.log(\"Saving wiki with method\",method,\"through saver\",saver.info.name);\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n\n/*\nChecks whether the wiki is dirty (ie the window shouldn't be closed)\n*/\nSaverHandler.prototype.isDirty = function() {\n\treturn this.numChanges > 0;\n};\n\n/*\nUpdate the document body with the class \"tc-dirty\" if the wiki has unsaved/unsynced changes\n*/\nSaverHandler.prototype.updateDirtyStatus = function() {\n\tvar self = this;\n\tif($tw.browser) {\n\t\t$tw.utils.toggleClass(document.body,\"tc-dirty\",this.isDirty());\n\t\t$tw.utils.each($tw.windows,function(win) {\n\t\t\t$tw.utils.toggleClass(win.document.body,\"tc-dirty\",self.isDirty());\n\t\t});\n\t}\n};\n\nexports.SaverHandler = SaverHandler;\n\n})();\n",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/savers/andtidwiki.js": {
"title": "$:/core/modules/savers/andtidwiki.js",
"text": "/*\\\ntitle: $:/core/modules/savers/andtidwiki.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via the AndTidWiki Android app\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, netscape: false, Components: false */\n\"use strict\";\n\nvar AndTidWiki = function(wiki) {\n};\n\nAndTidWiki.prototype.save = function(text,method,callback,options) {\n\tvar filename = options && options.variables ? options.variables.filename : null;\n\tif (method === \"download\") {\n\t\t// Support download\n\t\tif (window.twi.saveDownload) {\n\t\t\ttry {\n\t\t\t\twindow.twi.saveDownload(text,filename);\n\t\t\t} catch(err) {\n\t\t\t\tif (err.message === \"Method not found\") {\n\t\t\t\t\twindow.twi.saveDownload(text);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tvar link = document.createElement(\"a\");\n\t\t\tlink.setAttribute(\"href\",\"data:text/plain,\" + encodeURIComponent(text));\n\t\t\tif (filename) {\n\t\t\t link.setAttribute(\"download\",filename);\n\t\t\t}\n\t\t\tdocument.body.appendChild(link);\n\t\t\tlink.click();\n\t\t\tdocument.body.removeChild(link);\n\t\t}\n\t} else if (window.twi.saveWiki) {\n\t\t// Direct save in Tiddloid\n\t\twindow.twi.saveWiki(text);\n\t} else {\n\t\t// Get the pathname of this document\n\t\tvar pathname = decodeURIComponent(document.location.toString().split(\"#\")[0]);\n\t\t// Strip the file://\n\t\tif(pathname.indexOf(\"file://\") === 0) {\n\t\t\tpathname = pathname.substr(7);\n\t\t}\n\t\t// Strip any query or location part\n\t\tvar p = pathname.indexOf(\"?\");\n\t\tif(p !== -1) {\n\t\t\tpathname = pathname.substr(0,p);\n\t\t}\n\t\tp = pathname.indexOf(\"#\");\n\t\tif(p !== -1) {\n\t\t\tpathname = pathname.substr(0,p);\n\t\t}\n\t\t// Save the file\n\t\twindow.twi.saveFile(pathname,text);\n\t}\n\t// Call the callback\n\tcallback(null);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nAndTidWiki.prototype.info = {\n\tname: \"andtidwiki\",\n\tpriority: 1600,\n\tcapabilities: [\"save\", \"autosave\", \"download\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn !!window.twi && !!window.twi.saveFile;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new AndTidWiki(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/beaker.js": {
"title": "$:/core/modules/savers/beaker.js",
"text": "/*\\\ntitle: $:/core/modules/savers/beaker.js\ntype: application/javascript\nmodule-type: saver\n\nSaves files using the Beaker browser's (https://beakerbrowser.com) Dat protocol (https://datproject.org/)\nCompatible with beaker >= V0.7.2\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSet up the saver\n*/\nvar BeakerSaver = function(wiki) {\n\tthis.wiki = wiki;\n};\n\nBeakerSaver.prototype.save = function(text,method,callback) {\n\tvar dat = new DatArchive(\"\" + window.location),\n\t\tpathname = (\"\" + window.location.pathname).split(\"#\")[0];\n\tdat.stat(pathname).then(function(value) {\n\t\tif(value.isDirectory()) {\n\t\t\tpathname = pathname + \"/index.html\";\n\t\t}\n\t\tdat.writeFile(pathname,text,\"utf8\").then(function(value) {\n\t\t\tcallback(null);\n\t\t},function(reason) {\n\t\t\tcallback(\"Beaker Saver Write Error: \" + reason);\n\t\t});\n\t},function(reason) {\n\t\tcallback(\"Beaker Saver Stat Error: \" + reason);\n\t});\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nBeakerSaver.prototype.info = {\n\tname: \"beaker\",\n\tpriority: 3000,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn !!window.DatArchive && location.protocol===\"dat:\";\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new BeakerSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/custom.js": {
"title": "$:/core/modules/savers/custom.js",
"text": "/*\\\ntitle: $:/core/modules/savers/custom.js\ntype: application/javascript\nmodule-type: saver\n\nLooks for `window.$tw.customSaver` first on the current window, then\non the parent window (of an iframe). If present, the saver must define\n\tsave: function(text,method,callback) { ... }\nand the saver may define\n\tpriority: number\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar findSaver = function(window) {\n\ttry {\n\t\treturn window && window.$tw && window.$tw.customSaver;\n\t} catch (err) {\n\t\t// Catching the exception is the most reliable way to detect cross-origin iframe errors.\n\t\t// For example, instead of saying that `window.parent.$tw` is undefined, Firefox will throw\n\t\t// Uncaught DOMException: Permission denied to access property \"$tw\" on cross-origin object\n\t\tconsole.log({ msg: \"custom saver is disabled\", reason: err });\n\t\treturn null;\n\t}\n}\nvar saver = findSaver(window) || findSaver(window.parent) || {};\n\nvar CustomSaver = function(wiki) {\n};\n\nCustomSaver.prototype.save = function(text,method,callback) {\n\treturn saver.save(text, method, callback);\n};\n\n/*\nInformation about this saver\n*/\nCustomSaver.prototype.info = {\n\tname: \"custom\",\n\tpriority: saver.priority || 4000,\n\tcapabilities: [\"save\",\"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn !!(saver.save);\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new CustomSaver(wiki);\n};\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/download.js": {
"title": "$:/core/modules/savers/download.js",
"text": "/*\\\ntitle: $:/core/modules/savers/download.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via HTML5's download APIs\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar DownloadSaver = function(wiki) {\n};\n\nDownloadSaver.prototype.save = function(text,method,callback,options) {\n\toptions = options || {};\n\t// Get the current filename\n\tvar filename = options.variables.filename;\n\tif(!filename) {\n\t\tvar p = document.location.pathname.lastIndexOf(\"/\");\n\t\tif(p !== -1) {\n\t\t\t// We decode the pathname because document.location is URL encoded by the browser\n\t\t\tfilename = decodeURIComponent(document.location.pathname.substr(p+1));\n\t\t}\n\t}\n\tif(!filename) {\n\t\tfilename = \"tiddlywiki.html\";\n\t}\n\t// Set up the link\n\tvar link = document.createElement(\"a\");\n\tif(Blob !== undefined) {\n\t\tvar blob = new Blob([text], {type: \"text/html\"});\n\t\tlink.setAttribute(\"href\", URL.createObjectURL(blob));\n\t} else {\n\t\tlink.setAttribute(\"href\",\"data:text/html,\" + encodeURIComponent(text));\n\t}\n\tlink.setAttribute(\"download\",filename);\n\tdocument.body.appendChild(link);\n\tlink.click();\n\tdocument.body.removeChild(link);\n\t// Callback that we succeeded\n\tcallback(null);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nDownloadSaver.prototype.info = {\n\tname: \"download\",\n\tpriority: 100\n};\n\nObject.defineProperty(DownloadSaver.prototype.info, \"capabilities\", {\n\tget: function() {\n\t\tvar capabilities = [\"save\", \"download\"];\n\t\tif(($tw.wiki.getTextReference(\"$:/config/DownloadSaver/AutoSave\") || \"\").toLowerCase() === \"yes\") {\n\t\t\tcapabilities.push(\"autosave\");\n\t\t}\n\t\treturn capabilities;\n\t}\n});\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn document.createElement(\"a\").download !== undefined;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new DownloadSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/fsosaver.js": {
"title": "$:/core/modules/savers/fsosaver.js",
"text": "/*\\\ntitle: $:/core/modules/savers/fsosaver.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via MS FileSystemObject ActiveXObject\n\nNote: Since TiddlyWiki's markup contains the MOTW, the FileSystemObject normally won't be available. \nHowever, if the wiki is loaded as an .HTA file (Windows HTML Applications) then the FSO can be used.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar FSOSaver = function(wiki) {\n};\n\nFSOSaver.prototype.save = function(text,method,callback) {\n\t// Get the pathname of this document\n\tvar pathname = unescape(document.location.pathname);\n\t// Test for a Windows path of the form /x:\\blah...\n\tif(/^\\/[A-Z]\\:\\\\[^\\\\]+/i.test(pathname)) {\t// ie: ^/[a-z]:/[^/]+\n\t\t// Remove the leading slash\n\t\tpathname = pathname.substr(1);\n\t} else if(document.location.hostname !== \"\" && /^\\/\\\\[^\\\\]+\\\\[^\\\\]+/i.test(pathname)) {\t// test for \\\\server\\share\\blah... - ^/[^/]+/[^/]+\n\t\t// Remove the leading slash\n\t\tpathname = pathname.substr(1);\n\t\t// reconstruct UNC path\n\t\tpathname = \"\\\\\\\\\" + document.location.hostname + pathname;\n\t} else {\n\t\treturn false;\n\t}\n\t// Save the file (as UTF-16)\n\tvar fso = new ActiveXObject(\"Scripting.FileSystemObject\");\n\tvar file = fso.OpenTextFile(pathname,2,-1,-1);\n\tfile.Write(text);\n\tfile.Close();\n\t// Callback that we succeeded\n\tcallback(null);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nFSOSaver.prototype.info = {\n\tname: \"FSOSaver\",\n\tpriority: 120,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\ttry {\n\t\treturn (window.location.protocol === \"file:\") && !!(new ActiveXObject(\"Scripting.FileSystemObject\"));\n\t} catch(e) { return false; }\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new FSOSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/gitea.js": {
"title": "$:/core/modules/savers/gitea.js",
"text": "/*\\\ntitle: $:/core/modules/savers/gitea.js\ntype: application/javascript\nmodule-type: saver\n\nSaves wiki by pushing a commit to the gitea\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar GiteaSaver = function(wiki) {\n\tthis.wiki = wiki;\n};\n\nGiteaSaver.prototype.save = function(text,method,callback) {\n\tvar self = this,\n\t\tusername = this.wiki.getTiddlerText(\"$:/Gitea/Username\"),\n\t\tpassword = $tw.utils.getPassword(\"Gitea\"),\n\t\trepo = this.wiki.getTiddlerText(\"$:/Gitea/Repo\"),\n\t\tpath = this.wiki.getTiddlerText(\"$:/Gitea/Path\",\"\"),\n\t\tfilename = this.wiki.getTiddlerText(\"$:/Gitea/Filename\"),\n\t\tbranch = this.wiki.getTiddlerText(\"$:/Gitea/Branch\") || \"master\",\n\t\tendpoint = this.wiki.getTiddlerText(\"$:/Gitea/ServerURL\") || \"https://gitea\",\n\t\theaders = {\n\t\t\t\"Accept\": \"application/json\",\n\t\t\t\"Content-Type\": \"application/json;charset=UTF-8\",\n\t\t\t\"Authorization\": \"token \" + password\n\t\t};\n\t// Bail if we don't have everything we need\n\tif(!username || !password || !repo || !filename) {\n\t\treturn false;\n\t}\n\t// Make sure the path start and ends with a slash\n\tif(path.substring(0,1) !== \"/\") {\n\t\tpath = \"/\" + path;\n\t}\n\tif(path.substring(path.length - 1) !== \"/\") {\n\t\tpath = path + \"/\";\n\t}\n\t// Compose the base URI\n\tvar uri = endpoint + \"/repos/\" + repo + \"/contents\" + path;\n\t// Perform a get request to get the details (inc shas) of files in the same path as our file\n\t$tw.utils.httpRequest({\n\t\turl: uri,\n\t\ttype: \"GET\",\n\t\theaders: headers,\n\t\tdata: {\n\t\t\tref: branch\n\t\t},\n\t\tcallback: function(err,getResponseDataJson,xhr) {\n\t\t\tvar getResponseData,sha = \"\";\n\t\t\tif(err && xhr.status !== 404) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tvar use_put = true;\n\t\t\tif(xhr.status !== 404) {\n\t\t\t\tgetResponseData = JSON.parse(getResponseDataJson);\n\t\t\t\t$tw.utils.each(getResponseData,function(details) {\n\t\t\t\t\tif(details.name === filename) {\n\t\t\t\t\t\tsha = details.sha;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif(sha === \"\"){\n\t\t\t\t\tuse_put = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\tmessage: $tw.language.getRawString(\"ControlPanel/Saving/GitService/CommitMessage\"),\n\t\t\t\tcontent: $tw.utils.base64Encode(text),\n\t\t\t\tsha: sha\n\t\t\t};\n\t\t\t$tw.utils.httpRequest({\n\t\t\t\turl: endpoint + \"/repos/\" + repo + \"/branches/\" + branch,\n\t\t\t\ttype: \"GET\",\n\t\t\t\theaders: headers,\n\t\t\t\tcallback: function(err,getResponseDataJson,xhr) {\n\t\t\t\t\tif(xhr.status === 404) {\n\t\t\t\t\t\tcallback(\"Please ensure the branch in the Gitea repo exists\");\n\t\t\t\t\t}else{\n\t\t\t\t\t\tdata[\"branch\"] = branch;\n\t\t\t\t\t\tself.upload(uri + filename, use_put?\"PUT\":\"POST\", headers, data, callback);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\treturn true;\n};\n\nGiteaSaver.prototype.upload = function(uri,method,headers,data,callback) {\n\t$tw.utils.httpRequest({\n\t\turl: uri,\n\t\ttype: method,\n\t\theaders: headers,\n\t\tdata: JSON.stringify(data),\n\t\tcallback: function(err,putResponseDataJson,xhr) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tvar putResponseData = JSON.parse(putResponseDataJson);\n\t\t\tcallback(null);\n\t\t}\n\t});\n};\n\n/*\nInformation about this saver\n*/\nGiteaSaver.prototype.info = {\n\tname: \"Gitea\",\n\tpriority: 2000,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new GiteaSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/github.js": {
"title": "$:/core/modules/savers/github.js",
"text": "/*\\\ntitle: $:/core/modules/savers/github.js\ntype: application/javascript\nmodule-type: saver\n\nSaves wiki by pushing a commit to the GitHub v3 REST API\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar GitHubSaver = function(wiki) {\n\tthis.wiki = wiki;\n};\n\nGitHubSaver.prototype.save = function(text,method,callback) {\n\tvar self = this,\n\t\tusername = this.wiki.getTiddlerText(\"$:/GitHub/Username\"),\n\t\tpassword = $tw.utils.getPassword(\"github\"),\n\t\trepo = this.wiki.getTiddlerText(\"$:/GitHub/Repo\"),\n\t\tpath = this.wiki.getTiddlerText(\"$:/GitHub/Path\",\"\"),\n\t\tfilename = this.wiki.getTiddlerText(\"$:/GitHub/Filename\"),\n\t\tbranch = this.wiki.getTiddlerText(\"$:/GitHub/Branch\") || \"main\",\n\t\tendpoint = this.wiki.getTiddlerText(\"$:/GitHub/ServerURL\") || \"https://api.github.com\",\n\t\theaders = {\n\t\t\t\"Accept\": \"application/vnd.github.v3+json\",\n\t\t\t\"Content-Type\": \"application/json;charset=UTF-8\",\n\t\t\t\"Authorization\": \"Basic \" + window.btoa(username + \":\" + password),\n\t\t\t\"If-None-Match\": \"\"\n\t\t};\n\t// Bail if we don't have everything we need\n\tif(!username || !password || !repo || !filename) {\n\t\treturn false;\n\t}\n\t// Make sure the path start and ends with a slash\n\tif(path.substring(0,1) !== \"/\") {\n\t\tpath = \"/\" + path;\n\t}\n\tif(path.substring(path.length - 1) !== \"/\") {\n\t\tpath = path + \"/\";\n\t}\n\t// Compose the base URI\n\tvar uri = endpoint + \"/repos/\" + repo + \"/contents\" + path;\n\t// Perform a get request to get the details (inc shas) of files in the same path as our file\n\t$tw.utils.httpRequest({\n\t\turl: uri,\n\t\ttype: \"GET\",\n\t\theaders: headers,\n\t\tdata: {\n\t\t\tref: branch\n\t\t},\n\t\tcallback: function(err,getResponseDataJson,xhr) {\n\t\t\tvar getResponseData,sha = \"\";\n\t\t\tif(err && xhr.status !== 404) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tif(xhr.status !== 404) {\n\t\t\t\tgetResponseData = JSON.parse(getResponseDataJson);\n\t\t\t\t$tw.utils.each(getResponseData,function(details) {\n\t\t\t\t\tif(details.name === filename) {\n\t\t\t\t\t\tsha = details.sha;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\tmessage: $tw.language.getRawString(\"ControlPanel/Saving/GitService/CommitMessage\"),\n\t\t\t\tcontent: $tw.utils.base64Encode(text),\n\t\t\t\tbranch: branch,\n\t\t\t\tsha: sha\n\t\t\t};\n\t\t\t// Perform a PUT request to save the file\n\t\t\t$tw.utils.httpRequest({\n\t\t\t\turl: uri + filename,\n\t\t\t\ttype: \"PUT\",\n\t\t\t\theaders: headers,\n\t\t\t\tdata: JSON.stringify(data),\n\t\t\t\tcallback: function(err,putResponseDataJson,xhr) {\n\t\t\t\t\tif(err) {\n\t\t\t\t\t\treturn callback(err);\n\t\t\t\t\t}\n\t\t\t\t\tvar putResponseData = JSON.parse(putResponseDataJson);\n\t\t\t\t\tcallback(null);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nGitHubSaver.prototype.info = {\n\tname: \"github\",\n\tpriority: 2000,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new GitHubSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/gitlab.js": {
"title": "$:/core/modules/savers/gitlab.js",
"text": "/*\\\ntitle: $:/core/modules/savers/gitlab.js\ntype: application/javascript\nmodule-type: saver\n\nSaves wiki by pushing a commit to the GitLab REST API\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: true */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar GitLabSaver = function(wiki) {\n\tthis.wiki = wiki;\n};\n\nGitLabSaver.prototype.save = function(text,method,callback) {\n\t/* See https://docs.gitlab.com/ee/api/repository_files.html */\n\tvar self = this,\n\t\tusername = this.wiki.getTiddlerText(\"$:/GitLab/Username\"),\n\t\tpassword = $tw.utils.getPassword(\"gitlab\"),\n\t\trepo = this.wiki.getTiddlerText(\"$:/GitLab/Repo\"),\n\t\tpath = this.wiki.getTiddlerText(\"$:/GitLab/Path\",\"\"),\n\t\tfilename = this.wiki.getTiddlerText(\"$:/GitLab/Filename\"),\n\t\tbranch = this.wiki.getTiddlerText(\"$:/GitLab/Branch\") || \"master\",\n\t\tendpoint = this.wiki.getTiddlerText(\"$:/GitLab/ServerURL\") || \"https://gitlab.com/api/v4\",\n\t\theaders = {\n\t\t\t\"Content-Type\": \"application/json;charset=UTF-8\",\n\t\t\t\"Private-Token\": password\n\t\t};\n\t// Bail if we don't have everything we need\n\tif(!username || !password || !repo || !filename) {\n\t\treturn false;\n\t}\n\t// Make sure the path start and ends with a slash\n\tif(path.substring(0,1) !== \"/\") {\n\t\tpath = \"/\" + path;\n\t}\n\tif(path.substring(path.length - 1) !== \"/\") {\n\t\tpath = path + \"/\";\n\t}\n\t// Compose the base URI\n\tvar uri = endpoint + \"/projects/\" + encodeURIComponent(repo) + \"/repository/\";\n\t// Perform a get request to get the details (inc shas) of files in the same path as our file\n\t$tw.utils.httpRequest({\n\t\turl: uri + \"tree/?path=\" + encodeURIComponent(path.replace(/^\\/+|\\/$/g, '')) + \"&branch=\" + encodeURIComponent(branch.replace(/^\\/+|\\/$/g, '')),\n\t\ttype: \"GET\",\n\t\theaders: headers,\n\t\tcallback: function(err,getResponseDataJson,xhr) {\n\t\t\tvar getResponseData,sha = \"\";\n\t\t\tif(err && xhr.status !== 404) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tvar requestType = \"POST\";\n\t\t\tif(xhr.status !== 404) {\n\t\t\t\tgetResponseData = JSON.parse(getResponseDataJson);\n\t\t\t\t$tw.utils.each(getResponseData,function(details) {\n\t\t\t\t\tif(details.name === filename) {\n\t\t\t\t\t\trequestType = \"PUT\";\n\t\t\t\t\t\tsha = details.sha;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\tcommit_message: $tw.language.getRawString(\"ControlPanel/Saving/GitService/CommitMessage\"),\n\t\t\t\tcontent: text,\n\t\t\t\tbranch: branch,\n\t\t\t\tsha: sha\n\t\t\t};\n\t\t\t// Perform a request to save the file\n\t\t\t$tw.utils.httpRequest({\n\t\t\t\turl: uri + \"files/\" + encodeURIComponent(path.replace(/^\\/+/, '') + filename),\n\t\t\t\ttype: requestType,\n\t\t\t\theaders: headers,\n\t\t\t\tdata: JSON.stringify(data),\n\t\t\t\tcallback: function(err,putResponseDataJson,xhr) {\n\t\t\t\t\tif(err) {\n\t\t\t\t\t\treturn callback(err);\n\t\t\t\t\t}\n\t\t\t\t\tvar putResponseData = JSON.parse(putResponseDataJson);\n\t\t\t\t\tcallback(null);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nGitLabSaver.prototype.info = {\n\tname: \"gitlab\",\n\tpriority: 2000,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new GitLabSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/hyperdrive.js": {
"title": "$:/core/modules/savers/hyperdrive.js",
"text": "/*\\\ntitle: $:/core/modules/savers/hyperdrive.js\ntype: application/javascript\nmodule-type: saver\n\nSaves files using the Hyperdrive Protocol (https://hypercore-protocol.org/#hyperdrive) Beaker browser beta-1.0 and later (https://beakerbrowser.com)\nCompatible with beaker >= V1.0.0\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSet up the saver\n*/\nvar HyperdriveSaver = function(wiki) {\n\tthis.wiki = wiki;\n};\n\nHyperdriveSaver.prototype.save = function(text,method,callback) {\n\tvar dat = beaker.hyperdrive.drive(\"\" + window.location),\n\t\tpathname = (\"\" + window.location.pathname).split(\"#\")[0];\n\tdat.stat(pathname).then(function(value) {\n\t\tif(value.isDirectory()) {\n\t\t\tpathname = pathname + \"/index.html\";\n\t\t}\n\t\tdat.writeFile(pathname,text,\"utf8\").then(function(value) {\n\t\t\tcallback(null);\n\t\t},function(reason) {\n\t\t\tcallback(\"Hyperdrive Saver Write Error: \" + reason);\n\t\t});\n\t},function(reason) {\n\t\tcallback(\"Hyperdrive Saver Stat Error: \" + reason);\n\t});\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nHyperdriveSaver.prototype.info = {\n\tname: \"beaker-1.x\",\n\tpriority: 3000,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn !!window.beaker && !!beaker.hyperdrive && location.protocol===\"hyper:\";\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new HyperdriveSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/manualdownload.js": {
"title": "$:/core/modules/savers/manualdownload.js",
"text": "/*\\\ntitle: $:/core/modules/savers/manualdownload.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via HTML5's download APIs\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Title of the tiddler containing the download message\nvar downloadInstructionsTitle = \"$:/language/Modals/Download\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar ManualDownloadSaver = function(wiki) {\n};\n\nManualDownloadSaver.prototype.save = function(text,method,callback) {\n\t$tw.modal.display(downloadInstructionsTitle,{\n\t\tdownloadLink: \"data:text/html,\" + encodeURIComponent(text)\n\t});\n\t// Callback that we succeeded\n\tcallback(null);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nManualDownloadSaver.prototype.info = {\n\tname: \"manualdownload\",\n\tpriority: 0,\n\tcapabilities: [\"save\", \"download\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new ManualDownloadSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/msdownload.js": {
"title": "$:/core/modules/savers/msdownload.js",
"text": "/*\\\ntitle: $:/core/modules/savers/msdownload.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via window.navigator.msSaveBlob()\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar MsDownloadSaver = function(wiki) {\n};\n\nMsDownloadSaver.prototype.save = function(text,method,callback) {\n\t// Get the current filename\n\tvar filename = \"tiddlywiki.html\",\n\t\tp = document.location.pathname.lastIndexOf(\"/\");\n\tif(p !== -1) {\n\t\tfilename = document.location.pathname.substr(p+1);\n\t}\n\t// Set up the link\n\tvar blob = new Blob([text], {type: \"text/html\"});\n\twindow.navigator.msSaveBlob(blob,filename);\n\t// Callback that we succeeded\n\tcallback(null);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nMsDownloadSaver.prototype.info = {\n\tname: \"msdownload\",\n\tpriority: 110,\n\tcapabilities: [\"save\", \"download\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn !!window.navigator.msSaveBlob;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new MsDownloadSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/put.js": {
"title": "$:/core/modules/savers/put.js",
"text": "/*\\\ntitle: $:/core/modules/savers/put.js\ntype: application/javascript\nmodule-type: saver\n\nSaves wiki by performing a PUT request to the server\n\nWorks with any server which accepts a PUT request\nto the current URL, such as a WebDAV server.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nRetrieve ETag if available\n*/\nvar retrieveETag = function(self) {\n\tvar headers = {\n\t\tAccept: \"*/*;charset=UTF-8\"\n\t};\n\t$tw.utils.httpRequest({\n\t\turl: self.uri(),\n\t\ttype: \"HEAD\",\n\t\theaders: headers,\n\t\tcallback: function(err,data,xhr) {\n\t\t\tif(err) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar etag = xhr.getResponseHeader(\"ETag\");\n\t\t\tif(!etag) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tself.etag = etag.replace(/^W\\//,\"\");\n\t\t}\n\t});\n};\n\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar PutSaver = function(wiki) {\n\tthis.wiki = wiki;\n\tvar self = this;\n\tvar uri = this.uri();\n\t// Async server probe. Until probe finishes, save will fail fast\n\t// See also https://github.com/Jermolene/TiddlyWiki5/issues/2276\n\t$tw.utils.httpRequest({\n\t\turl: uri,\n\t\ttype: \"OPTIONS\",\n\t\tcallback: function(err,data,xhr) {\n\t\t\t// Check DAV header http://www.webdav.org/specs/rfc2518.html#rfc.section.9.1\n\t\t\tif(!err) {\n\t\t\t\tself.serverAcceptsPuts = xhr.status === 200 && !!xhr.getResponseHeader(\"dav\");\n\t\t\t}\n\t\t}\n\t});\n\tretrieveETag(this);\n};\n\nPutSaver.prototype.uri = function() {\n\treturn document.location.toString().split(\"#\")[0];\n};\n\n// TODO: in case of edit conflict\n// Prompt: Do you want to save over this? Y/N\n// Merging would be ideal, and may be possible using future generic merge flow\nPutSaver.prototype.save = function(text,method,callback) {\n\tif(!this.serverAcceptsPuts) {\n\t\treturn false;\n\t}\n\tvar self = this;\n\tvar headers = {\n\t\t\"Content-Type\": \"text/html;charset=UTF-8\"\n\t};\n\tif(this.etag) {\n\t\theaders[\"If-Match\"] = this.etag;\n\t}\n\t$tw.utils.httpRequest({\n\t\turl: this.uri(),\n\t\ttype: \"PUT\",\n\t\theaders: headers,\n\t\tdata: text,\n\t\tcallback: function(err,data,xhr) {\n\t\t\tif(err) {\n\t\t\t\t// response is textual: \"XMLHttpRequest error code: 412\"\n\t\t\t\tvar status = Number(err.substring(err.indexOf(':') + 2, err.length))\n\t\t\t\tif(status === 412) { // file changed on server\n\t\t\t\t\tcallback($tw.language.getString(\"Error/PutEditConflict\"));\n\t\t\t\t} else if(status === 401) { // authentication required\n\t\t\t\t\tcallback($tw.language.getString(\"Error/PutUnauthorized\"));\n\t\t\t\t} else if(status === 403) { // permission denied\n\t\t\t\t\tcallback($tw.language.getString(\"Error/PutForbidden\"));\n\t\t\t\t} else {\n\t\t\t\t\tcallback(err); // fail\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tself.etag = xhr.getResponseHeader(\"ETag\");\n\t\t\t\tif(self.etag == null) {\n\t\t\t\t\tretrieveETag(self);\n\t\t\t\t}\n\t\t\t\tcallback(null); // success\n\t\t\t}\n\t\t}\n\t});\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nPutSaver.prototype.info = {\n\tname: \"put\",\n\tpriority: 2000,\n\tcapabilities: [\"save\",\"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn /^https?:/.test(location.protocol);\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new PutSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/tiddlyfox.js": {
"title": "$:/core/modules/savers/tiddlyfox.js",
"text": "/*\\\ntitle: $:/core/modules/savers/tiddlyfox.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via the TiddlyFox file extension\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, netscape: false, Components: false */\n\"use strict\";\n\nvar TiddlyFoxSaver = function(wiki) {\n};\n\nTiddlyFoxSaver.prototype.save = function(text,method,callback) {\n\tvar messageBox = document.getElementById(\"tiddlyfox-message-box\");\n\tif(messageBox) {\n\t\t// Get the pathname of this document\n\t\tvar pathname = document.location.toString().split(\"#\")[0];\n\t\t// Replace file://localhost/ with file:///\n\t\tif(pathname.indexOf(\"file://localhost/\") === 0) {\n\t\t\tpathname = \"file://\" + pathname.substr(16);\n\t\t}\n\t\t// Windows path file:///x:/blah/blah --> x:\\blah\\blah\n\t\tif(/^file\\:\\/\\/\\/[A-Z]\\:\\//i.test(pathname)) {\n\t\t\t// Remove the leading slash and convert slashes to backslashes\n\t\t\tpathname = pathname.substr(8).replace(/\\//g,\"\\\\\");\n\t\t// Firefox Windows network path file://///server/share/blah/blah --> //server/share/blah/blah\n\t\t} else if(pathname.indexOf(\"file://///\") === 0) {\n\t\t\tpathname = \"\\\\\\\\\" + unescape(pathname.substr(10)).replace(/\\//g,\"\\\\\");\n\t\t// Mac/Unix local path file:///path/path --> /path/path\n\t\t} else if(pathname.indexOf(\"file:///\") === 0) {\n\t\t\tpathname = unescape(pathname.substr(7));\n\t\t// Mac/Unix local path file:/path/path --> /path/path\n\t\t} else if(pathname.indexOf(\"file:/\") === 0) {\n\t\t\tpathname = unescape(pathname.substr(5));\n\t\t// Otherwise Windows networth path file://server/share/path/path --> \\\\server\\share\\path\\path\n\t\t} else {\n\t\t\tpathname = \"\\\\\\\\\" + unescape(pathname.substr(7)).replace(new RegExp(\"/\",\"g\"),\"\\\\\");\n\t\t}\n\t\t// Create the message element and put it in the message box\n\t\tvar message = document.createElement(\"div\");\n\t\tmessage.setAttribute(\"data-tiddlyfox-path\",decodeURIComponent(pathname));\n\t\tmessage.setAttribute(\"data-tiddlyfox-content\",text);\n\t\tmessageBox.appendChild(message);\n\t\t// Add an event handler for when the file has been saved\n\t\tmessage.addEventListener(\"tiddlyfox-have-saved-file\",function(event) {\n\t\t\tcallback(null);\n\t\t}, false);\n\t\t// Create and dispatch the custom event to the extension\n\t\tvar event = document.createEvent(\"Events\");\n\t\tevent.initEvent(\"tiddlyfox-save-file\",true,false);\n\t\tmessage.dispatchEvent(event);\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\n/*\nInformation about this saver\n*/\nTiddlyFoxSaver.prototype.info = {\n\tname: \"tiddlyfox\",\n\tpriority: 1500,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new TiddlyFoxSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/tiddlyie.js": {
"title": "$:/core/modules/savers/tiddlyie.js",
"text": "/*\\\ntitle: $:/core/modules/savers/tiddlyie.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via Internet Explorer BHO extenion (TiddlyIE)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar TiddlyIESaver = function(wiki) {\n};\n\nTiddlyIESaver.prototype.save = function(text,method,callback) {\n\t// Check existence of TiddlyIE BHO extension (note: only works after document is complete)\n\tif(typeof(window.TiddlyIE) != \"undefined\") {\n\t\t// Get the pathname of this document\n\t\tvar pathname = unescape(document.location.pathname);\n\t\t// Test for a Windows path of the form /x:/blah...\n\t\tif(/^\\/[A-Z]\\:\\/[^\\/]+/i.test(pathname)) {\t// ie: ^/[a-z]:/[^/]+ (is this better?: ^/[a-z]:/[^/]+(/[^/]+)*\\.[^/]+ )\n\t\t\t// Remove the leading slash\n\t\t\tpathname = pathname.substr(1);\n\t\t\t// Convert slashes to backslashes\n\t\t\tpathname = pathname.replace(/\\//g,\"\\\\\");\n\t\t} else if(document.hostname !== \"\" && /^\\/[^\\/]+\\/[^\\/]+/i.test(pathname)) {\t// test for \\\\server\\share\\blah... - ^/[^/]+/[^/]+\n\t\t\t// Convert slashes to backslashes\n\t\t\tpathname = pathname.replace(/\\//g,\"\\\\\");\n\t\t\t// reconstruct UNC path\n\t\t\tpathname = \"\\\\\\\\\" + document.location.hostname + pathname;\n\t\t} else return false;\n\t\t// Prompt the user to save the file\n\t\twindow.TiddlyIE.save(pathname, text);\n\t\t// Callback that we succeeded\n\t\tcallback(null);\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\n/*\nInformation about this saver\n*/\nTiddlyIESaver.prototype.info = {\n\tname: \"tiddlyiesaver\",\n\tpriority: 1500,\n\tcapabilities: [\"save\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn (window.location.protocol === \"file:\");\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new TiddlyIESaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/twedit.js": {
"title": "$:/core/modules/savers/twedit.js",
"text": "/*\\\ntitle: $:/core/modules/savers/twedit.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via the TWEdit iOS app\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, netscape: false, Components: false */\n\"use strict\";\n\nvar TWEditSaver = function(wiki) {\n};\n\nTWEditSaver.prototype.save = function(text,method,callback) {\n\t// Bail if we're not running under TWEdit\n\tif(typeof DeviceInfo !== \"object\") {\n\t\treturn false;\n\t}\n\t// Get the pathname of this document\n\tvar pathname = decodeURIComponent(document.location.pathname);\n\t// Strip any query or location part\n\tvar p = pathname.indexOf(\"?\");\n\tif(p !== -1) {\n\t\tpathname = pathname.substr(0,p);\n\t}\n\tp = pathname.indexOf(\"#\");\n\tif(p !== -1) {\n\t\tpathname = pathname.substr(0,p);\n\t}\n\t// Remove the leading \"/Documents\" from path\n\tvar prefix = \"/Documents\";\n\tif(pathname.indexOf(prefix) === 0) {\n\t\tpathname = pathname.substr(prefix.length);\n\t}\n\t// Error handler\n\tvar errorHandler = function(event) {\n\t\t// Error\n\t\tcallback($tw.language.getString(\"Error/SavingToTWEdit\") + \": \" + event.target.error.code);\n\t};\n\t// Get the file system\n\twindow.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem) {\n\t\t// Now we've got the filesystem, get the fileEntry\n\t\tfileSystem.root.getFile(pathname, {create: true}, function(fileEntry) {\n\t\t\t// Now we've got the fileEntry, create the writer\n\t\t\tfileEntry.createWriter(function(writer) {\n\t\t\t\twriter.onerror = errorHandler;\n\t\t\t\twriter.onwrite = function() {\n\t\t\t\t\tcallback(null);\n\t\t\t\t};\n\t\t\t\twriter.position = 0;\n\t\t\t\twriter.write(text);\n\t\t\t},errorHandler);\n\t\t}, errorHandler);\n\t}, errorHandler);\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nTWEditSaver.prototype.info = {\n\tname: \"twedit\",\n\tpriority: 1600,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new TWEditSaver(wiki);\n};\n\n/////////////////////////// Hack\n// HACK: This ensures that TWEdit recognises us as a TiddlyWiki document\nif($tw.browser) {\n\twindow.version = {title: \"TiddlyWiki\"};\n}\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/savers/upload.js": {
"title": "$:/core/modules/savers/upload.js",
"text": "/*\\\ntitle: $:/core/modules/savers/upload.js\ntype: application/javascript\nmodule-type: saver\n\nHandles saving changes via upload to a server.\n\nDesigned to be compatible with BidiX's UploadPlugin at http://tiddlywiki.bidix.info/#UploadPlugin\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSelect the appropriate saver module and set it up\n*/\nvar UploadSaver = function(wiki) {\n\tthis.wiki = wiki;\n};\n\nUploadSaver.prototype.save = function(text,method,callback) {\n\t// Get the various parameters we need\n\tvar backupDir = this.wiki.getTextReference(\"$:/UploadBackupDir\") || \".\",\n\t\tusername = this.wiki.getTextReference(\"$:/UploadName\"),\n\t\tpassword = $tw.utils.getPassword(\"upload\"),\n\t\tuploadDir = this.wiki.getTextReference(\"$:/UploadDir\") || \".\",\n\t\tuploadFilename = this.wiki.getTextReference(\"$:/UploadFilename\") || \"index.html\",\n\t\tuploadWithUrlOnly = this.wiki.getTextReference(\"$:/UploadWithUrlOnly\") || \"no\",\n\t\turl = this.wiki.getTextReference(\"$:/UploadURL\");\n\t// Bail out if we don't have the bits we need\n\tif (uploadWithUrlOnly === \"yes\") {\n\t\t// The url is good enough. No need for a username and password.\n\t\t// Assume the server uses some other kind of auth mechanism.\n\t\tif(!url || url.toString().trim() === \"\") {\n\t\t\treturn false;\n\t\t}\n\t}\n\telse {\n\t\t// Require username and password to be present.\n\t\t// Assume the server uses the standard UploadPlugin username/password.\n\t\tif(!username || username.toString().trim() === \"\" || !password || password.toString().trim() === \"\") {\n\t\t\treturn false;\n\t\t}\n\t}\n\t// Construct the url if not provided\n\tif(!url) {\n\t\turl = \"http://\" + username + \".tiddlyspot.com/store.cgi\";\n\t}\n\t// Assemble the header\n\tvar boundary = \"---------------------------\" + \"AaB03x\";\n\tvar uploadFormName = \"UploadPlugin\";\n\tvar head = [];\n\thead.push(\"--\" + boundary + \"\\r\\nContent-disposition: form-data; name=\\\"UploadPlugin\\\"\\r\\n\");\n\thead.push(\"backupDir=\" + backupDir + \";user=\" + username + \";password=\" + password + \";uploaddir=\" + uploadDir + \";;\"); \n\thead.push(\"\\r\\n\" + \"--\" + boundary);\n\thead.push(\"Content-disposition: form-data; name=\\\"userfile\\\"; filename=\\\"\" + uploadFilename + \"\\\"\");\n\thead.push(\"Content-Type: text/html;charset=UTF-8\");\n\thead.push(\"Content-Length: \" + text.length + \"\\r\\n\");\n\thead.push(\"\");\n\t// Assemble the tail and the data itself\n\tvar tail = \"\\r\\n--\" + boundary + \"--\\r\\n\",\n\t\tdata = head.join(\"\\r\\n\") + text + tail;\n\t// Do the HTTP post\n\tvar http = new XMLHttpRequest();\n\thttp.open(\"POST\",url,true,username,password);\n\thttp.setRequestHeader(\"Content-Type\",\"multipart/form-data; charset=UTF-8; boundary=\" + boundary);\n\thttp.onreadystatechange = function() {\n\t\tif(http.readyState == 4 && http.status == 200) {\n\t\t\tif(http.responseText.substr(0,4) === \"0 - \") {\n\t\t\t\tcallback(null);\n\t\t\t} else {\n\t\t\t\tcallback(http.responseText);\n\t\t\t}\n\t\t}\n\t};\n\ttry {\n\t\thttp.send(data);\n\t} catch(ex) {\n\t\treturn callback($tw.language.getString(\"Error/Caption\") + \":\" + ex);\n\t}\n\t$tw.notifier.display(\"$:/language/Notifications/Save/Starting\");\n\treturn true;\n};\n\n/*\nInformation about this saver\n*/\nUploadSaver.prototype.info = {\n\tname: \"upload\",\n\tpriority: 2000,\n\tcapabilities: [\"save\", \"autosave\"]\n};\n\n/*\nStatic method that returns true if this saver is capable of working\n*/\nexports.canSave = function(wiki) {\n\treturn true;\n};\n\n/*\nCreate an instance of this saver\n*/\nexports.create = function(wiki) {\n\treturn new UploadSaver(wiki);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "saver"
},
"$:/core/modules/server/authenticators/basic.js": {
"title": "$:/core/modules/server/authenticators/basic.js",
"text": "/*\\\ntitle: $:/core/modules/server/authenticators/basic.js\ntype: application/javascript\nmodule-type: authenticator\n\nAuthenticator for WWW basic authentication\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nif($tw.node) {\n\tvar util = require(\"util\"),\n\t\tfs = require(\"fs\"),\n\t\turl = require(\"url\"),\n\t\tpath = require(\"path\");\n}\n\nfunction BasicAuthenticator(server) {\n\tthis.server = server;\n\tthis.credentialsData = [];\n}\n\n/*\nReturns true if the authenticator is active, false if it is inactive, or a string if there is an error\n*/\nBasicAuthenticator.prototype.init = function() {\n\t// Read the credentials data\n\tthis.credentialsFilepath = this.server.get(\"credentials\");\n\tif(this.credentialsFilepath) {\n\t\tvar resolveCredentialsFilepath = path.resolve(this.server.boot.wikiPath,this.credentialsFilepath);\n\t\tif(fs.existsSync(resolveCredentialsFilepath) && !fs.statSync(resolveCredentialsFilepath).isDirectory()) {\n\t\t\tvar credentialsText = fs.readFileSync(resolveCredentialsFilepath,\"utf8\"),\n\t\t\t\tcredentialsData = $tw.utils.parseCsvStringWithHeader(credentialsText);\n\t\t\tif(typeof credentialsData === \"string\") {\n\t\t\t\treturn \"Error: \" + credentialsData + \" reading credentials from '\" + resolveCredentialsFilepath + \"'\";\n\t\t\t} else {\n\t\t\t\tthis.credentialsData = credentialsData;\n\t\t\t}\n\t\t} else {\n\t\t\treturn \"Error: Unable to load user credentials from '\" + resolveCredentialsFilepath + \"'\";\n\t\t}\n\t}\n\t// Add the hardcoded username and password if specified\n\tif(this.server.get(\"username\") && this.server.get(\"password\")) {\n\t\tthis.credentialsData = this.credentialsData || [];\n\t\tthis.credentialsData.push({\n\t\t\tusername: this.server.get(\"username\"),\n\t\t\tpassword: this.server.get(\"password\")\n\t\t});\n\t}\n\treturn this.credentialsData.length > 0;\n};\n\n/*\nReturns true if the request is authenticated and assigns the \"authenticatedUsername\" state variable.\nReturns false if the request couldn't be authenticated having sent an appropriate response to the browser\n*/\nBasicAuthenticator.prototype.authenticateRequest = function(request,response,state) {\n\t// Extract the incoming username and password from the request\n\tvar header = request.headers.authorization || \"\";\n\tif(!header && state.allowAnon) {\n\t\t// If there's no header and anonymous access is allowed then we don't set authenticatedUsername\n\t\treturn true;\n\t}\n\tvar token = header.split(/\\s+/).pop() || \"\",\n\t\tauth = $tw.utils.base64Decode(token),\n\t\tparts = auth.split(/:/),\n\t\tincomingUsername = parts[0],\n\t\tincomingPassword = parts[1];\n\t// Check that at least one of the credentials matches\n\tvar matchingCredentials = this.credentialsData.find(function(credential) {\n\t\treturn credential.username === incomingUsername && credential.password === incomingPassword;\n\t});\n\tif(matchingCredentials) {\n\t\t// If so, add the authenticated username to the request state\n\t\tstate.authenticatedUsername = incomingUsername;\n\t\treturn true;\n\t} else {\n\t\t// If not, return an authentication challenge\n\t\tresponse.writeHead(401,\"Authentication required\",{\n\t\t\t\"WWW-Authenticate\": 'Basic realm=\"Please provide your username and password to login to ' + state.server.servername + '\"'\n\t\t});\n\t\tresponse.end();\n\t\treturn false;\n\t}\n};\n\nexports.AuthenticatorClass = BasicAuthenticator;\n\n})();\n",
"type": "application/javascript",
"module-type": "authenticator"
},
"$:/core/modules/server/authenticators/header.js": {
"title": "$:/core/modules/server/authenticators/header.js",
"text": "/*\\\ntitle: $:/core/modules/server/authenticators/header.js\ntype: application/javascript\nmodule-type: authenticator\n\nAuthenticator for trusted header authentication\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nfunction HeaderAuthenticator(server) {\n\tthis.server = server;\n\tthis.header = server.get(\"authenticated-user-header\") ? server.get(\"authenticated-user-header\").toLowerCase() : undefined;\n}\n\n/*\nReturns true if the authenticator is active, false if it is inactive, or a string if there is an error\n*/\nHeaderAuthenticator.prototype.init = function() {\n\treturn !!this.header;\n};\n\n/*\nReturns true if the request is authenticated and assigns the \"authenticatedUsername\" state variable.\nReturns false if the request couldn't be authenticated having sent an appropriate response to the browser\n*/\nHeaderAuthenticator.prototype.authenticateRequest = function(request,response,state) {\n\t// Otherwise, authenticate as the username in the specified header\n\tvar username = request.headers[this.header];\n\tif(!username && !state.allowAnon) {\n\t\tresponse.writeHead(401,\"Authorization header required to login to '\" + state.server.servername + \"'\");\n\t\tresponse.end();\n\t\treturn false;\n\t} else {\n\t\t// authenticatedUsername will be undefined for anonymous users\n\t\tstate.authenticatedUsername = username;\n\t\treturn true;\n\t}\n};\n\nexports.AuthenticatorClass = HeaderAuthenticator;\n\n})();\n",
"type": "application/javascript",
"module-type": "authenticator"
},
"$:/core/modules/server/routes/delete-tiddler.js": {
"title": "$:/core/modules/server/routes/delete-tiddler.js",
"text": "/*\\\ntitle: $:/core/modules/server/routes/delete-tiddler.js\ntype: application/javascript\nmodule-type: route\n\nDELETE /recipes/default/tiddlers/:title\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.method = \"DELETE\";\n\nexports.path = /^\\/bags\\/default\\/tiddlers\\/(.+)$/;\n\nexports.handler = function(request,response,state) {\n\tvar title = decodeURIComponent(state.params[0]);\n\tstate.wiki.deleteTiddler(title);\n\tresponse.writeHead(204, \"OK\", {\n\t\t\"Content-Type\": \"text/plain\"\n\t});\n\tresponse.end();\n};\n\n}());\n",
"type": "application/javascript",
"module-type": "route"
},
"$:/core/modules/server/routes/get-favicon.js": {
"title": "$:/core/modules/server/routes/get-favicon.js",
"text": "/*\\\ntitle: $:/core/modules/server/routes/get-favicon.js\ntype: application/javascript\nmodule-type: route\n\nGET /favicon.ico\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.method = \"GET\";\n\nexports.path = /^\\/favicon.ico$/;\n\nexports.handler = function(request,response,state) {\n\tvar buffer = state.wiki.getTiddlerText(\"$:/favicon.ico\",\"\");\n\tstate.sendResponse(200,{\"Content-Type\": \"image/x-icon\"},buffer,\"base64\");\n};\n\n}());\n",
"type": "application/javascript",
"module-type": "route"
},
"$:/core/modules/server/routes/get-file.js": {
"title": "$:/core/modules/server/routes/get-file.js",
"text": "/*\\\ntitle: $:/core/modules/server/routes/get-file.js\ntype: application/javascript\nmodule-type: route\n\nGET /files/:filepath\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.method = \"GET\";\n\nexports.path = /^\\/files\\/(.+)$/;\n\nexports.handler = function(request,response,state) {\n\tvar path = require(\"path\"),\n\t\tfs = require(\"fs\"),\n\t\tutil = require(\"util\"),\n\t\tsuppliedFilename = decodeURIComponent(state.params[0]),\n\t\tfilename = path.resolve(state.boot.wikiPath,\"files\",suppliedFilename),\n\t\textension = path.extname(filename);\n\tfs.readFile(filename,function(err,content) {\n\t\tvar status,content,type = \"text/plain\";\n\t\tif(err) {\n\t\t\tconsole.log(\"Error accessing file \" + filename + \": \" + err.toString());\n\t\t\tstatus = 404;\n\t\t\tcontent = \"File '\" + suppliedFilename + \"' not found\";\n\t\t} else {\n\t\t\tstatus = 200;\n\t\t\tcontent = content;\n\t\t\ttype = ($tw.config.fileExtensionInfo[extension] ? $tw.config.fileExtensionInfo[extension].type : \"application/octet-stream\");\n\t\t}\n\t\tstate.sendResponse(status,{\"Content-Type\": type},content);\n\t});\n};\n\n}());\n",
"type": "application/javascript",
"module-type": "route"
},
"$:/core/modules/server/routes/get-index.js": {
"title": "$:/core/modules/server/routes/get-index.js",
"text": "/*\\\ntitle: $:/core/modules/server/routes/get-index.js\ntype: application/javascript\nmodule-type: route\n\nGET /\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.method = \"GET\";\n\nexports.path = /^\\/index.html$/;\n\nexports.handler = function(request,response,state) {\n\tvar text = state.wiki.renderTiddler(state.server.get(\"root-render-type\"),state.server.get(\"root-tiddler\")),\n\t\tresponseHeaders = {\n\t\t\"Content-Type\": state.server.get(\"root-serve-type\")\n\t};\n\tstate.sendResponse(200,responseHeaders,text);\n};\n\n}());\n",
"type": "application/javascript",
"module-type": "route"
},
"$:/core/modules/server/routes/get-login-basic.js": {
"title": "$:/core/modules/server/routes/get-login-basic.js",
"text": "/*\\\ntitle: $:/core/modules/server/routes/get-login-basic.js\ntype: application/javascript\nmodule-type: route\n\nGET /login-basic -- force a Basic Authentication challenge\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.method = \"GET\";\n\nexports.path = /^\\/login-basic$/;\n\nexports.handler = function(request,response,state) {\n\tif(!state.authenticatedUsername) {\n\t\t// Challenge if there's no username\n\t\tresponse.writeHead(401,{\n\t\t\t\"WWW-Authenticate\": 'Basic realm=\"Please provide your username and password to login to ' + state.server.servername + '\"'\n\t\t});\n\t\tresponse.end();\n\t} else {\n\t\t// Redirect to the root wiki if login worked\n\t\tvar location = ($tw.syncadaptor && $tw.syncadaptor.host)? $tw.syncadaptor.host: \"/\";\n\t\tresponse.writeHead(302,{\n\t\t\tLocation: location\n\t\t});\n\t\tresponse.end();\n\t}\n};\n\n}());\n",
"type": "application/javascript",
"module-type": "route"
},
"$:/core/modules/server/routes/get-status.js": {
"title": "$:/core/modules/server/routes/get-status.js",
"text": "/*\\\ntitle: $:/core/modules/server/routes/get-status.js\ntype: application/javascript\nmodule-type: route\n\nGET /status\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.method = \"GET\";\n\nexports.path = /^\\/status$/;\n\nexports.handler = function(request,response,state) {\n\tvar text = JSON.stringify({\n\t\tusername: state.authenticatedUsername || state.server.get(\"anon-username\") || \"\",\n\t\tanonymous: !state.authenticatedUsername,\n\t\tread_only: !state.server.isAuthorized(\"writers\",state.authenticatedUsername),\n\t\tsse_enabled: state.server.get(\"sse-enabled\") === \"yes\",\n\t\tspace: {\n\t\t\trecipe: \"default\"\n\t\t},\n\t\ttiddlywiki_version: $tw.version\n\t});\n\tstate.sendResponse(200,{\"Content-Type\": \"application/json\"},text,\"utf8\");\n};\n\n}());\n",
"type": "application/javascript",
"module-type": "route"
},
"$:/core/modules/server/routes/get-tiddler-html.js": {
"title": "$:/core/modules/server/routes/get-tiddler-html.js",
"text": "/*\\\ntitle: $:/core/modules/server/routes/get-tiddler-html.js\ntype: application/javascript\nmodule-type: route\n\nGET /:title\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.method = \"GET\";\n\nexports.path = /^\\/([^\\/]+)$/;\n\nexports.handler = function(request,response,state) {\n\tvar title = decodeURIComponent(state.params[0]),\n\t\ttiddler = state.wiki.getTiddler(title);\n\tif(tiddler) {\n\t\tvar renderType = tiddler.getFieldString(\"_render_type\"),\n\t\t\trenderTemplate = tiddler.getFieldString(\"_render_template\");\n\t\t// Tiddler fields '_render_type' and '_render_template' overwrite\n\t\t// system wide settings for render type and template\n\t\tif(state.wiki.isSystemTiddler(title)) {\n\t\t\trenderType = renderType || state.server.get(\"system-tiddler-render-type\");\n\t\t\trenderTemplate = renderTemplate || state.server.get(\"system-tiddler-render-template\");\n\t\t} else {\n\t\t\trenderType = renderType || state.server.get(\"tiddler-render-type\");\n\t\t\trenderTemplate = renderTemplate || state.server.get(\"tiddler-render-template\");\n\t\t}\n\t\tvar text = state.wiki.renderTiddler(renderType,renderTemplate,{parseAsInline: true, variables: {currentTiddler: title}});\n\n\t\t// Naughty not to set a content-type, but it's the easiest way to ensure the browser will see HTML pages as HTML, and accept plain text tiddlers as CSS or JS\n\t\tstate.sendResponse(200,{},text,\"utf8\");\n\t} else {\n\t\tresponse.writeHead(404);\n\t\tresponse.end();\n\t}\n};\n\n}());\n",
"type": "application/javascript",
"module-type": "route"
},
"$:/core/modules/server/routes/get-tiddler.js": {
"title": "$:/core/modules/server/routes/get-tiddler.js",
"text": "/*\\\ntitle: $:/core/modules/server/routes/get-tiddler.js\ntype: application/javascript\nmodule-type: route\n\nGET /recipes/default/tiddlers/:title\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.method = \"GET\";\n\nexports.path = /^\\/recipes\\/default\\/tiddlers\\/(.+)$/;\n\nexports.handler = function(request,response,state) {\n\tvar title = decodeURIComponent(state.params[0]),\n\t\ttiddler = state.wiki.getTiddler(title),\n\t\ttiddlerFields = {},\n\t\tknownFields = [\n\t\t\t\"bag\", \"created\", \"creator\", \"modified\", \"modifier\", \"permissions\", \"recipe\", \"revision\", \"tags\", \"text\", \"title\", \"type\", \"uri\"\n\t\t];\n\tif(tiddler) {\n\t\t$tw.utils.each(tiddler.fields,function(field,name) {\n\t\t\tvar value = tiddler.getFieldString(name);\n\t\t\tif(knownFields.indexOf(name) !== -1) {\n\t\t\t\ttiddlerFields[name] = value;\n\t\t\t} else {\n\t\t\t\ttiddlerFields.fields = tiddlerFields.fields || {};\n\t\t\t\ttiddlerFields.fields[name] = value;\n\t\t\t}\n\t\t});\n\t\ttiddlerFields.revision = state.wiki.getChangeCount(title);\n\t\ttiddlerFields.bag = \"default\";\n\t\ttiddlerFields.type = tiddlerFields.type || \"text/vnd.tiddlywiki\";\n\t\tstate.sendResponse(200,{\"Content-Type\": \"application/json\"},JSON.stringify(tiddlerFields),\"utf8\");\n\t} else {\n\t\tresponse.writeHead(404);\n\t\tresponse.end();\n\t}\n};\n\n}());\n",
"type": "application/javascript",
"module-type": "route"
},
"$:/core/modules/server/routes/get-tiddlers-json.js": {
"title": "$:/core/modules/server/routes/get-tiddlers-json.js",
"text": "/*\\\ntitle: $:/core/modules/server/routes/get-tiddlers-json.js\ntype: application/javascript\nmodule-type: route\n\nGET /recipes/default/tiddlers.json?filter=<filter>\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar DEFAULT_FILTER = \"[all[tiddlers]!is[system]sort[title]]\";\n\nexports.method = \"GET\";\n\nexports.path = /^\\/recipes\\/default\\/tiddlers.json$/;\n\nexports.handler = function(request,response,state) {\n\tvar filter = state.queryParameters.filter || DEFAULT_FILTER;\n\tif(state.wiki.getTiddlerText(\"$:/config/Server/AllowAllExternalFilters\") !== \"yes\") {\n\t\tif(state.wiki.getTiddlerText(\"$:/config/Server/ExternalFilters/\" + filter) !== \"yes\") {\n\t\t\tconsole.log(\"Blocked attempt to GET /recipes/default/tiddlers.json with filter: \" + filter);\n\t\t\tresponse.writeHead(403);\n\t\t\tresponse.end();\n\t\t\treturn;\n\t\t}\n\t}\n\tif(state.wiki.getTiddlerText(\"$:/config/SyncSystemTiddlersFromServer\") === \"no\") {\n\t\tfilter += \"+[!is[system]]\";\n\t}\n\tvar excludeFields = (state.queryParameters.exclude || \"text\").split(\",\"),\n\t\ttitles = state.wiki.filterTiddlers(filter);\n\tvar tiddlers = [];\n\t$tw.utils.each(titles,function(title) {\n\t\tvar tiddler = state.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tvar tiddlerFields = tiddler.getFieldStrings({exclude: excludeFields});\n\t\t\ttiddlerFields.revision = state.wiki.getChangeCount(title);\n\t\t\ttiddlerFields.type = tiddlerFields.type || \"text/vnd.tiddlywiki\";\n\t\t\ttiddlers.push(tiddlerFields);\n\t\t}\n\t});\n\tvar text = JSON.stringify(tiddlers);\n\tstate.sendResponse(200,{\"Content-Type\": \"application/json\"},text,\"utf8\");\n};\n\n}());\n",
"type": "application/javascript",
"module-type": "route"
},
"$:/core/modules/server/routes/put-tiddler.js": {
"title": "$:/core/modules/server/routes/put-tiddler.js",
"text": "/*\\\ntitle: $:/core/modules/server/routes/put-tiddler.js\ntype: application/javascript\nmodule-type: route\n\nPUT /recipes/default/tiddlers/:title\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.method = \"PUT\";\n\nexports.path = /^\\/recipes\\/default\\/tiddlers\\/(.+)$/;\n\nexports.handler = function(request,response,state) {\n\tvar title = decodeURIComponent(state.params[0]),\n\tfields = JSON.parse(state.data);\n\t// Pull up any subfields in the `fields` object\n\tif(fields.fields) {\n\t\t$tw.utils.each(fields.fields,function(field,name) {\n\t\t\tfields[name] = field;\n\t\t});\n\t\tdelete fields.fields;\n\t}\n\t// Remove any revision field\n\tif(fields.revision) {\n\t\tdelete fields.revision;\n\t}\n\tstate.wiki.addTiddler(new $tw.Tiddler(state.wiki.getCreationFields(),fields,{title: title},state.wiki.getModificationFields()));\n\tvar changeCount = state.wiki.getChangeCount(title).toString();\n\tresponse.writeHead(204, \"OK\",{\n\t\tEtag: \"\\\"default/\" + encodeURIComponent(title) + \"/\" + changeCount + \":\\\"\",\n\t\t\"Content-Type\": \"text/plain\"\n\t});\n\tresponse.end();\n};\n\n}());\n",
"type": "application/javascript",
"module-type": "route"
},
"$:/core/modules/server/server-sent-events.js": {
"title": "$:/core/modules/server/server-sent-events.js",
"text": "/*\\\ntitle: $:/core/modules/server/server-sent-events.js\ntype: application/javascript\nmodule-type: library\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nparameters:\n\t\tprefix - usually the plugin path, such as `plugins/tiddlywiki/tiddlyweb`. The\n\t\t\troute will match `/events/${prefix}` exactly.\n\n\t\thandler - a function that will be called each time a request comes in with the\n\t\t\trequest and state from the route and an emit function to call.\n*/\n\nvar ServerSentEvents = function ServerSentEvents(prefix, handler) {\n\tthis.handler = handler;\n\tthis.prefix = prefix;\n};\n\nServerSentEvents.prototype.getExports = function() {\n\treturn {\n\t\tbodyFormat: \"stream\",\n\t\tmethod: \"GET\",\n\t\tpath: new RegExp(\"^/events/\" + this.prefix + \"$\"),\n\t\thandler: this.handleEventRequest.bind(this)\n\t};\n};\n\nServerSentEvents.prototype.handleEventRequest = function(request,response,state) {\n\tif(ServerSentEvents.prototype.isEventStreamRequest(request)) {\n\t\tresponse.writeHead(200, {\n\t\t\t\"Content-Type\": \"text/event-stream\",\n\t\t\t\"Cache-Control\": \"no-cache\",\n\t\t\t\"Connection\": \"keep-alive\"\n\t\t});\n\t\tthis.handler(request,state,this.emit.bind(this,response),this.end.bind(this,response));\n\t} else {\n\t\tresponse.writeHead(406,\"Not Acceptable\",{});\n\t\tresponse.end();\n\t}\n};\n\nServerSentEvents.prototype.isEventStreamRequest = function(request) {\n\treturn request.headers.accept &&\n\t\trequest.headers.accept.match(/^text\\/event-stream/);\n};\n\nServerSentEvents.prototype.emit = function(response,event,data) {\n\tif(typeof event !== \"string\" || event.indexOf(\"\\n\") !== -1) {\n\t\tthrow new Error(\"Type must be a single-line string\");\n\t}\n\tif(typeof data !== \"string\" || data.indexOf(\"\\n\") !== -1) {\n\t\tthrow new Error(\"Data must be a single-line string\");\n\t}\n\tresponse.write(\"event: \" + event + \"\\ndata: \" + data + \"\\n\\n\", \"utf8\");\n};\n\nServerSentEvents.prototype.end = function(response) {\n\tresponse.end();\n};\n\nexports.ServerSentEvents = ServerSentEvents;\n\n})();\n",
"type": "application/javascript",
"module-type": "library"
},
"$:/core/modules/server/server.js": {
"title": "$:/core/modules/server/server.js",
"text": "/*\\\ntitle: $:/core/modules/server/server.js\ntype: application/javascript\nmodule-type: library\n\nServe tiddlers over http\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nif($tw.node) {\n\tvar util = require(\"util\"),\n\t\tfs = require(\"fs\"),\n\t\turl = require(\"url\"),\n\t\tpath = require(\"path\"),\n\t\tquerystring = require(\"querystring\"),\n\t\tcrypto = require(\"crypto\"),\n\t\tzlib = require(\"zlib\");\n}\n\n/*\nA simple HTTP server with regexp-based routes\noptions: variables - optional hashmap of variables to set (a misnomer - they are really constant parameters)\n\t\t routes - optional array of routes to use\n\t\t wiki - reference to wiki object\n*/\nfunction Server(options) {\n\tvar self = this;\n\tthis.routes = options.routes || [];\n\tthis.authenticators = options.authenticators || [];\n\tthis.wiki = options.wiki;\n\tthis.boot = options.boot || $tw.boot;\n\tthis.servername = $tw.utils.transliterateToSafeASCII(this.wiki.getTiddlerText(\"$:/SiteTitle\") || \"TiddlyWiki5\");\n\t// Initialise the variables\n\tthis.variables = $tw.utils.extend({},this.defaultVariables);\n\tif(options.variables) {\n\t\tfor(var variable in options.variables) {\n\t\t\tif(options.variables[variable]) {\n\t\t\t\tthis.variables[variable] = options.variables[variable];\n\t\t\t}\n\t\t}\n\t}\n\t$tw.utils.extend({},this.defaultVariables,options.variables);\n\t// Initialise CSRF\n\tthis.csrfDisable = this.get(\"csrf-disable\") === \"yes\";\n\t// Initialize Gzip compression\n\tthis.enableGzip = this.get(\"gzip\") === \"yes\";\n\t// Initialize browser-caching\n\tthis.enableBrowserCache = this.get(\"use-browser-cache\") === \"yes\";\n\t// Initialise authorization\n\tvar authorizedUserName = (this.get(\"username\") && this.get(\"password\")) ? this.get(\"username\") : \"(anon)\";\n\tthis.authorizationPrincipals = {\n\t\treaders: (this.get(\"readers\") || authorizedUserName).split(\",\").map($tw.utils.trim),\n\t\twriters: (this.get(\"writers\") || authorizedUserName).split(\",\").map($tw.utils.trim)\n\t}\n\t// Load and initialise authenticators\n\t$tw.modules.forEachModuleOfType(\"authenticator\", function(title,authenticatorDefinition) {\n\t\t// console.log(\"Loading server route \" + title);\n\t\tself.addAuthenticator(authenticatorDefinition.AuthenticatorClass);\n\t});\n\t// Load route handlers\n\tthis.addRouteHandlers();\n\t// Initialise the http vs https\n\tthis.listenOptions = null;\n\tthis.protocol = \"http\";\n\tvar tlsKeyFilepath = this.get(\"tls-key\"),\n\t\ttlsCertFilepath = this.get(\"tls-cert\");\n\tif(tlsCertFilepath && tlsKeyFilepath) {\n\t\tthis.listenOptions = {\n\t\t\tkey: fs.readFileSync(path.resolve(this.boot.wikiPath,tlsKeyFilepath),\"utf8\"),\n\t\t\tcert: fs.readFileSync(path.resolve(this.boot.wikiPath,tlsCertFilepath),\"utf8\")\n\t\t};\n\t\tthis.protocol = \"https\";\n\t}\n\tthis.transport = require(this.protocol);\n}\n\n/*\nSend a response to the client. This method checks if the response must be sent\nor if the client alrady has the data cached. If that's the case only a 304\nresponse will be transmitted and the browser will use the cached data.\nOnly requests with status code 200 are considdered for caching.\nrequest: request instance passed to the handler\nresponse: response instance passed to the handler\nstatusCode: stauts code to send to the browser\nheaders: response headers (they will be augmented with an `Etag` header)\ndata: the data to send (passed to the end method of the response instance)\nencoding: the encoding of the data to send (passed to the end method of the response instance)\n*/\nfunction sendResponse(request,response,statusCode,headers,data,encoding) {\n\tif(this.enableBrowserCache && (statusCode == 200)) {\n\t\tvar hash = crypto.createHash('md5');\n\t\t// Put everything into the hash that could change and invalidate the data that\n\t\t// the browser already stored. The headers the data and the encoding.\n\t\thash.update(data);\n\t\thash.update(JSON.stringify(headers));\n\t\tif(encoding) {\n\t\t\thash.update(encoding);\n\t\t}\n\t\tvar contentDigest = hash.digest(\"hex\");\n\t\t// RFC 7232 section 2.3 mandates for the etag to be enclosed in quotes\n\t\theaders[\"Etag\"] = '\"' + contentDigest + '\"';\n\t\theaders[\"Cache-Control\"] = \"max-age=0, must-revalidate\";\n\t\t// Check if any of the hashes contained within the if-none-match header\n\t\t// matches the current hash.\n\t\t// If one matches, do not send the data but tell the browser to use the\n\t\t// cached data.\n\t\t// We do not implement \"*\" as it makes no sense here.\n\t\tvar ifNoneMatch = request.headers[\"if-none-match\"];\n\t\tif(ifNoneMatch) {\n\t\t\tvar matchParts = ifNoneMatch.split(\",\").map(function(etag) {\n\t\t\t\treturn etag.replace(/^[ \"]+|[ \"]+$/g, \"\");\n\t\t\t});\n\t\t\tif(matchParts.indexOf(contentDigest) != -1) {\n\t\t\t\tresponse.writeHead(304,headers);\n\t\t\t\tresponse.end();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\t/*\n\tIf the gzip=yes is set, check if the user agent permits compression. If so,\n\tcompress our response if the raw data is bigger than 2k. Compressing less\n\tdata is inefficient. Note that we use the synchronous functions from zlib\n\tto stay in the imperative style. The current `Server` doesn't depend on\n\tthis, and we may just as well use the async versions.\n\t*/\n\tif(this.enableGzip && (data.length > 2048)) {\n\t\tvar acceptEncoding = request.headers[\"accept-encoding\"] || \"\";\n\t\tif(/\\bdeflate\\b/.test(acceptEncoding)) {\n\t\t\theaders[\"Content-Encoding\"] = \"deflate\";\n\t\t\tdata = zlib.deflateSync(data);\n\t\t} else if(/\\bgzip\\b/.test(acceptEncoding)) {\n\t\t\theaders[\"Content-Encoding\"] = \"gzip\";\n\t\t\tdata = zlib.gzipSync(data);\n\t\t}\n\t}\n\n\tresponse.writeHead(statusCode,headers);\n\tresponse.end(data,encoding);\n}\n\nServer.prototype.defaultVariables = {\n\tport: \"8080\",\n\thost: \"127.0.0.1\",\n\t\"root-tiddler\": \"$:/core/save/all\",\n\t\"root-render-type\": \"text/plain\",\n\t\"root-serve-type\": \"text/html\",\n\t\"tiddler-render-type\": \"text/html\",\n\t\"tiddler-render-template\": \"$:/core/templates/server/static.tiddler.html\",\n\t\"system-tiddler-render-type\": \"text/plain\",\n\t\"system-tiddler-render-template\": \"$:/core/templates/wikified-tiddler\",\n\t\"debug-level\": \"none\",\n\t\"gzip\": \"no\",\n\t\"use-browser-cache\": \"no\"\n};\n\nServer.prototype.get = function(name) {\n\treturn this.variables[name];\n};\n\nServer.prototype.addRoute = function(route) {\n\tthis.routes.push(route);\n};\n\nServer.prototype.addAuthenticator = function(AuthenticatorClass) {\n\t// Instantiate and initialise the authenticator\n\tvar authenticator = new AuthenticatorClass(this),\n\t\tresult = authenticator.init();\n\tif(typeof result === \"string\") {\n\t\t$tw.utils.error(\"Error: \" + result);\n\t} else if(result) {\n\t\t// Only use the authenticator if it initialised successfully\n\t\tthis.authenticators.push(authenticator);\n\t}\n};\n\nServer.prototype.addRouteHandlers = function() {\n\tvar self = this;\n\t// Load route handlers from sitemap if present, or just load all route modules\n\tif(this.variables.sitemap) {\n\t\tthis.sitemap = new $tw.Sitemap(this.variables.sitemap,{\n\t\t\twiki: this.wiki,\n\t\t\tvariables: {}\n\t\t});\n\t\tthis.sitemap.load();\n\t\t$tw.utils.each(this.sitemap.getServerRoutes(),function(routeInfo) {\n\t\t\tself.addRoute({\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tpath: routeInfo.regexp,\n\t\t\t\thandler: function(request,response,state) {\n\t\t\t\t\tvar fileDetails = routeInfo.handler(state.params);\n\t\t\t\t\tif(fileDetails) {\n\t\t\t\t\t\tresponse.writeHead(200, {\"Content-Type\": fileDetails.type});\n\t\t\t\t\t\tresponse.end(fileDetails.text,fileDetails.isBase64 ? \"base64\" : \"utf8\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresponse.writeHead(404);\n\t\t\t\t\t\tresponse.end();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t} else {\n\t\t$tw.modules.forEachModuleOfType(\"route\",function(title,routeDefinition) {\n\t\t\tself.addRoute(routeDefinition);\n\t\t});\n\t}\n};\n\nServer.prototype.findMatchingRoute = function(request,state,options) {\n\toptions = options || {};\n\tfor(var t=0; t<this.routes.length; t++) {\n\t\tvar potentialRoute = this.routes[t],\n\t\t\tpathname = options.pathname || state.urlInfo.pathname,\n\t\t\tmatch;\n\t\tif(state.pathPrefix) {\n\t\t\tif(pathname.substr(0,state.pathPrefix.length) === state.pathPrefix) {\n\t\t\t\tpathname = pathname.substr(state.pathPrefix.length) || \"/\";\n\t\t\t\tmatch = potentialRoute.path.exec(pathname);\n\t\t\t} else {\n\t\t\t\tmatch = false;\n\t\t\t}\n\t\t} else {\n\t\t\tmatch = potentialRoute.path.exec(pathname);\n\t\t}\n\t\tif(match && request.method === potentialRoute.method) {\n\t\t\tstate.params = [];\n\t\t\tfor(var p=1; p<match.length; p++) {\n\t\t\t\tstate.params.push(match[p]);\n\t\t\t}\n\t\t\treturn potentialRoute;\n\t\t}\n\t}\n\treturn null;\n};\n\nServer.prototype.methodMappings = {\n\t\"GET\": \"readers\",\n\t\"OPTIONS\": \"readers\",\n\t\"HEAD\": \"readers\",\n\t\"PUT\": \"writers\",\n\t\"POST\": \"writers\",\n\t\"DELETE\": \"writers\"\n};\n\n/*\nCheck whether a given user is authorized for the specified authorizationType (\"readers\" or \"writers\"). Pass null or undefined as the username to check for anonymous access\n*/\nServer.prototype.isAuthorized = function(authorizationType,username) {\n\tvar principals = this.authorizationPrincipals[authorizationType] || [];\n\treturn principals.indexOf(\"(anon)\") !== -1 || (username && (principals.indexOf(\"(authenticated)\") !== -1 || principals.indexOf(username) !== -1));\n}\n\nServer.prototype.requestHandler = function(request,response,options) {\n\toptions = options || {};\n\t// Compose the state object\n\tvar self = this;\n\tvar state = {};\n\tstate.wiki = options.wiki || self.wiki;\n\tstate.boot = options.boot || self.boot;\n\tstate.server = self;\n\tstate.urlInfo = url.parse(request.url);\n\tstate.queryParameters = querystring.parse(state.urlInfo.query);\n\tstate.pathPrefix = options.pathPrefix || this.get(\"path-prefix\") || \"\";\n\tstate.sendResponse = sendResponse.bind(self,request,response);\n\t// Get the principals authorized to access this resource\n\tvar authorizationType = this.methodMappings[request.method] || \"readers\";\n\t// Check for the CSRF header if this is a write\n\tif(!this.csrfDisable && authorizationType === \"writers\" && request.headers[\"x-requested-with\"] !== \"TiddlyWiki\") {\n\t\tresponse.writeHead(403,\"'X-Requested-With' header required to login to '\" + this.servername + \"'\");\n\t\tresponse.end();\n\t\treturn;\n\t}\n\t// Check whether anonymous access is granted\n\tstate.allowAnon = this.isAuthorized(authorizationType,null);\n\t// Authenticate with the first active authenticator\n\tif(this.authenticators.length > 0) {\n\t\tif(!this.authenticators[0].authenticateRequest(request,response,state)) {\n\t\t\t// Bail if we failed (the authenticator will have sent the response)\n\t\t\treturn;\n\t\t}\n\t}\n\t// Authorize with the authenticated username\n\tif(!this.isAuthorized(authorizationType,state.authenticatedUsername)) {\n\t\tresponse.writeHead(401,\"'\" + state.authenticatedUsername + \"' is not authorized to access '\" + this.servername + \"'\");\n\t\tresponse.end();\n\t\treturn;\n\t}\n\t// Find the route that matches this path\n\tvar route = self.findMatchingRoute(request,state);\n\tif(!route) {\n\t\t// Try with the default document\n\t\tvar defaultDocumentPathname = state.urlInfo.pathname;\n\t\tif(defaultDocumentPathname.substr(-1) !== \"/\") {\n\t\t\tdefaultDocumentPathname = defaultDocumentPathname + \"/\";\n\t\t}\n\t\tdefaultDocumentPathname = defaultDocumentPathname + \"index.html\";\n\t\troute = self.findMatchingRoute(request,state,{pathname: defaultDocumentPathname});\n\t}\n\t// Optionally output debug info\n\tif(self.get(\"debug-level\") !== \"none\") {\n\t\tconsole.log(\"Request path:\",JSON.stringify(state.urlInfo));\n\t\tconsole.log(\"Request headers:\",JSON.stringify(request.headers));\n\t\tconsole.log(\"authenticatedUsername:\",state.authenticatedUsername);\n\t}\n\t// Return a 404 if we didn't find a route\n\tif(!route) {\n\t\tresponse.writeHead(404);\n\t\tresponse.end();\n\t\treturn;\n\t}\n\t// Receive the request body if necessary and hand off to the route handler\n\tif(route.bodyFormat === \"stream\" || request.method === \"GET\" || request.method === \"HEAD\") {\n\t\t// Let the route handle the request stream itself\n\t\troute.handler(request,response,state);\n\t} else if(route.bodyFormat === \"string\" || !route.bodyFormat) {\n\t\t// Set the encoding for the incoming request\n\t\trequest.setEncoding(\"utf8\");\n\t\tvar data = \"\";\n\t\trequest.on(\"data\",function(chunk) {\n\t\t\tdata += chunk.toString();\n\t\t});\n\t\trequest.on(\"end\",function() {\n\t\t\tstate.data = data;\n\t\t\troute.handler(request,response,state);\n\t\t});\n\t} else if(route.bodyFormat === \"buffer\") {\n\t\tvar data = [];\n\t\trequest.on(\"data\",function(chunk) {\n\t\t\tdata.push(chunk);\n\t\t});\n\t\trequest.on(\"end\",function() {\n\t\t\tstate.data = Buffer.concat(data);\n\t\t\troute.handler(request,response,state);\n\t\t})\n\t} else {\n\t\tresponse.writeHead(400,\"Invalid bodyFormat \" + route.bodyFormat + \" in route \" + route.method + \" \" + route.path.source);\n\t\tresponse.end();\n\t}\n};\n\n/*\nListen for requests\nport: optional port number (falls back to value of \"port\" variable)\nhost: optional host address (falls back to value of \"host\" variable)\nprefix: optional prefix (falls back to value of \"path-prefix\" variable)\n*/\nServer.prototype.listen = function(port,host,prefix) {\n\tvar self = this;\n\t// Handle defaults for port and host\n\tport = port || this.get(\"port\");\n\thost = host || this.get(\"host\");\n\tprefix = prefix || this.get(\"path-prefix\") || \"\";\n\t// Check for the port being a string and look it up as an environment variable\n\tif(parseInt(port,10).toString() !== port) {\n\t\tport = process.env[port] || 8080;\n\t}\n\t// Warn if required plugins are missing\n\tif(!this.wiki.getTiddler(\"$:/plugins/tiddlywiki/tiddlyweb\") || !this.wiki.getTiddler(\"$:/plugins/tiddlywiki/filesystem\")) {\n\t\t$tw.utils.warning(\"Warning: Plugins required for client-server operation (\\\"tiddlywiki/filesystem\\\" and \\\"tiddlywiki/tiddlyweb\\\") are missing from tiddlywiki.info file\");\n\t}\n\t// Create the server\n\tvar server;\n\tif(this.listenOptions) {\n\t\tserver = this.transport.createServer(this.listenOptions,this.requestHandler.bind(this));\n\t} else {\n\t\tserver = this.transport.createServer(this.requestHandler.bind(this));\n\t}\n\t// Display the port number after we've started listening (the port number might have been specified as zero, in which case we will get an assigned port)\n\tserver.on(\"listening\",function() {\n\t\tvar address = server.address();\n\t\t$tw.utils.log(\"Serving on \" + self.protocol + \"://\" + address.address + \":\" + address.port + prefix,\"brown/orange\");\n\t\t$tw.utils.log(\"(press ctrl-C to exit)\",\"red\");\n\t});\n\t// Listen\n\treturn server.listen(port,host);\n};\n\nexports.Server = Server;\n\n})();\n",
"type": "application/javascript",
"module-type": "library"
},
"$:/core/modules/sitemap.js": {
"title": "$:/core/modules/sitemap.js",
"text": "/*\\\ntitle: $:/core/modules/sitemap.js\ntype: application/javascript\nmodule-type: global\n\nSitemaps are used for static publishing and web serving\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nfunction Sitemap(sitemapTitle,options) {\n options = options || {};\n this.sitemapTitle = sitemapTitle;\n this.wiki = options.wiki;\n this.routes = [];\n this.variables = $tw.utils.extend({},options.variables);\n}\n\nSitemap.prototype.load = function(sitemapTitle) {\n var self = this;\n // Get the sitemap\n var sitemapTiddler = this.wiki.getTiddler(this.sitemapTitle);\n if(sitemapTiddler) {\n // Collect each route\n $tw.utils.each(sitemapTiddler.fields.list,function(routeTitle) {\n var routeTiddler = self.wiki.getTiddler(routeTitle);\n if(routeTiddler) {\n // Convert the path into a regexp and an array of {field:,function:} for each capture group\n var regexpurgatedParameterisedPath = self.regexpurgateParameterisedPath(routeTiddler.fields[\"route-path\"]);\n self.routes.push({\n title: routeTitle,\n params: routeTiddler.getFieldStrings({prefix: \"route-\"}),\n variables: routeTiddler.getFieldStrings({prefix: \"var-\"}),\n regexp: regexpurgatedParameterisedPath.regexp,\n captureGroups: regexpurgatedParameterisedPath.captureGroups\n });\n }\n });\n }\n};\n\nSitemap.prototype.renderRoute = function(title,route) {\n var tiddler = this.wiki.getTiddler(title);\n switch(route.params.type) {\n case \"raw\":\n return {\n path: this.resolveParameterisedPath(route.params.path,title),\n text: tiddler.fields.text || \"\",\n type: tiddler.fields.type || \"\",\n isBase64: ($tw.config.contentTypeInfo[tiddler.fields.type] || {}).encoding === \"base64\"\n };\n break;\n case \"render\":\n var parser = {\n tree: [\n {\n \"type\": \"importvariables\",\n \"attributes\": {\n \"tiddler\": {\n \"name\": \"tiddler\",\n \"type\": \"string\",\n \"value\": this.sitemapTitle,\n }\n },\n \"tag\": \"$importvariables\",\n \"isBlock\": false,\n \"children\": [\n {\n \"type\": \"importvariables\",\n \"attributes\": {\n \"tiddler\": {\n \"name\": \"tiddler\",\n \"type\": \"string\",\n \"value\": route.title,\n }\n },\n \"tag\": \"$importvariables\",\n \"isBlock\": false,\n \"children\": this.wiki.parseTiddler(route.params.template,{parseAsInline: true}).tree\n }\n ]\n }\n ]\n },\n widgetNode = this.wiki.makeWidget(parser,{\n variables: $tw.utils.extend({},this.variables,{currentTiddler: title})\n }),\n container = $tw.fakeDocument.createElement(\"div\");\n widgetNode.render(container,null);\n return {\n path: this.resolveParameterisedPath(route.params.path,title),\n text: container.textContent,\n type: route.params[\"output-type\"] || \"text/html\"\n };\n break;\n }\n};\n\n/*\nReturns an array of functions that return {path:,text:,type:,isBase64:} for each path\n*/\nSitemap.prototype.getAllFileDetails = function(exportTiddlers) {\n var self = this,\n output = [];\n $tw.utils.each(this.routes,function(route) {\n var routeFilter = route.params[\"tiddler-filter\"] || \"DUMMY_RESULT\", // If no filter is provided, use a dummy filter that returns a single result\n routeTiddlers = self.wiki.filterTiddlers(routeFilter,null,self.wiki.makeTiddlerIterator(exportTiddlers));\n $tw.utils.each(routeTiddlers,function(title) {\n output.push(self.renderRoute.bind(self,title,route));\n });\n });\n return output;\n};\n\n\n/*\nReturns an array of server routes {regexp:, handler:}\n*/\nSitemap.prototype.getServerRoutes = function() {\n var self = this,\n output = [];\n $tw.utils.each(this.routes,function(route) {\n output.push({\n regexp: route.regexp,\n handler: function(params) {\n // Locate the tiddler identified by the capture groups, if any\n var title = null,\n nextParam = 0;\n $tw.utils.each(route.captureGroups,function(captureGroup) {\n var param = params[nextParam++];\n if(captureGroup.field === \"title\") {\n switch(captureGroup.function) {\n case \"slugify\":\n var titles = self.wiki.unslugify(param);\n if(titles && titles.length > 0) {\n title = titles[0];\n }\n break;\n }\n }\n })\n // Check that the tiddler passes the route filter\n if(route.params[\"tiddler-filter\"]) {\n if(!title) {\n return null;\n }\n var routeTiddlers = self.wiki.filterTiddlers(route.params[\"tiddler-filter\"],null,self.wiki.makeTiddlerIterator([title]));\n if(routeTiddlers.indexOf(title) === -1) {\n return null;\n }\n }\n // Return the rendering or raw tiddler\n return self.renderRoute(title,route);\n }\n });\n });\n return output;\n};\n\n/*\nApply a tiddler to a parameterised path to create a usable path\n*/\nSitemap.prototype.resolveParameterisedPath = function(parameterisedPath,title) {\n var self = this;\n // Split the path on $*_*$ markers\n var tiddler = this.wiki.getTiddler(title),\n output = [];\n $tw.utils.each(parameterisedPath.split(/(\\$[a-z_]+\\$)/),function(part) {\n var match = part.match(/\\$([a-z]+)_([a-z]+)\\$/);\n if(match) {\n var value;\n // Get the base value\n switch(match[1]) {\n case \"uri\":\n case \"title\":\n value = title;\n break;\n case \"type\":\n value = tiddler.fields.type || \"text/vnd.tiddlywiki\";\n break;\n }\n // Apply the encoding function\n switch(match[2]) {\n case \"encoded\":\n value = encodeURIComponent(value);\n break;\n case \"doubleencoded\":\n value = encodeURIComponent(encodeURIComponent(value));\n break;\n case \"slugify\":\n value = self.wiki.slugify(value);\n break;\n case \"extension\":\n value = ($tw.config.contentTypeInfo[value] || {extension: \".\"}).extension.slice(1);\n break;\n }\n output.push(value);\n } else {\n output.push(part);\n }\n });\n return output.join(\"\");\n};\n\n/*\n// Convert the path into a regexp and an array of {field:,function:} for each capture group\n*/\nSitemap.prototype.regexpurgateParameterisedPath = function(parameterisedPath) {\n var regexpParts = [\"\\\\/\"],\n captureGroups = [];\n $tw.utils.each(parameterisedPath.split(/(\\$[a-z_]+\\$)/),function(part) {\n var match = part.match(/\\$([a-z]+)_([a-z]+)\\$/);\n if(match) {\n regexpParts.push(\"(.+)\");\n captureGroups.push({\n field: match[1],\n function: match[2]\n });\n } else {\n regexpParts.push($tw.utils.escapeRegExp(part));\n }\n });\n return {\n regexp: new RegExp(\"^\" + regexpParts.join(\"\") + \"$\"),\n captureGroups: captureGroups\n };\n};\n\nexports.Sitemap = Sitemap;\n \n})();\n ",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/browser-messaging.js": {
"title": "$:/core/modules/browser-messaging.js",
"text": "/*\\\ntitle: $:/core/modules/browser-messaging.js\ntype: application/javascript\nmodule-type: startup\n\nBrowser message handling\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"browser-messaging\";\nexports.platforms = [\"browser\"];\nexports.after = [\"startup\"];\nexports.synchronous = true;\n\n/*\nLoad a specified url as an iframe and call the callback when it is loaded. If the url is already loaded then the existing iframe instance is used\n*/\nfunction loadIFrame(url,callback) {\n\t// Check if iframe already exists\n\tvar iframeInfo = $tw.browserMessaging.iframeInfoMap[url];\n\tif(iframeInfo) {\n\t\t// We've already got the iframe\n\t\tcallback(null,iframeInfo);\n\t} else {\n\t\t// Create the iframe and save it in the list\n\t\tvar iframe = document.createElement(\"iframe\");\n\t\tiframeInfo = {\n\t\t\turl: url,\n\t\t\tstatus: \"loading\",\n\t\t\tdomNode: iframe\n\t\t};\n\t\t$tw.browserMessaging.iframeInfoMap[url] = iframeInfo;\n\t\tsaveIFrameInfoTiddler(iframeInfo);\n\t\t// Add the iframe to the DOM and hide it\n\t\tiframe.style.display = \"none\";\n\t\tiframe.setAttribute(\"library\",\"true\");\n\t\tdocument.body.appendChild(iframe);\n\t\t// Set up onload\n\t\tiframe.onload = function() {\n\t\t\tiframeInfo.status = \"loaded\";\n\t\t\tsaveIFrameInfoTiddler(iframeInfo);\n\t\t\tcallback(null,iframeInfo);\n\t\t};\n\t\tiframe.onerror = function() {\n\t\t\tcallback(\"Cannot load iframe\");\n\t\t};\n\t\ttry {\n\t\t\tiframe.src = url;\n\t\t} catch(ex) {\n\t\t\tcallback(ex);\n\t\t}\n\t}\n}\n\n/*\nUnload library iframe for given url\n*/\nfunction unloadIFrame(url){\n\t$tw.utils.each(document.getElementsByTagName('iframe'), function(iframe) {\n\t\tif(iframe.getAttribute(\"library\") === \"true\" &&\n\t\t iframe.getAttribute(\"src\") === url) {\n\t\t\tiframe.parentNode.removeChild(iframe);\n\t\t}\n\t});\n}\n\nfunction saveIFrameInfoTiddler(iframeInfo) {\n\t$tw.wiki.addTiddler(new $tw.Tiddler($tw.wiki.getCreationFields(),{\n\t\ttitle: \"$:/temp/ServerConnection/\" + iframeInfo.url,\n\t\ttext: iframeInfo.status,\n\t\ttags: [\"$:/tags/ServerConnection\"],\n\t\turl: iframeInfo.url\n\t},$tw.wiki.getModificationFields()));\n}\n\nexports.startup = function() {\n\t// Initialise the store of iframes we've created\n\t$tw.browserMessaging = {\n\t\tiframeInfoMap: {} // Hashmap by URL of {url:,status:\"loading/loaded\",domNode:}\n\t};\n\t// Listen for widget messages to control loading the plugin library\n\t$tw.rootWidget.addEventListener(\"tm-load-plugin-library\",function(event) {\n\t\tvar paramObject = event.paramObject || {},\n\t\t\turl = paramObject.url;\n\t\tif(url) {\n\t\t\tloadIFrame(url,function(err,iframeInfo) {\n\t\t\t\tif(err) {\n\t\t\t\t\talert($tw.language.getString(\"Error/LoadingPluginLibrary\") + \": \" + url);\n\t\t\t\t} else {\n\t\t\t\t\tiframeInfo.domNode.contentWindow.postMessage({\n\t\t\t\t\t\tverb: \"GET\",\n\t\t\t\t\t\turl: \"recipes/library/tiddlers.json\",\n\t\t\t\t\t\tcookies: {\n\t\t\t\t\t\t\ttype: \"save-info\",\n\t\t\t\t\t\t\tinfoTitlePrefix: paramObject.infoTitlePrefix || \"$:/temp/RemoteAssetInfo/\",\n\t\t\t\t\t\t\turl: url\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});\n\t// Listen for widget messages to control unloading the plugin library\n\t$tw.rootWidget.addEventListener(\"tm-unload-plugin-library\",function(event) {\n\t\tvar paramObject = event.paramObject || {},\n\t\t\turl = paramObject.url;\n\t\t$tw.browserMessaging.iframeInfoMap[url] = undefined;\n\t\tif(url) {\n\t\t\tunloadIFrame(url);\n\t\t\t$tw.utils.each(\n\t\t\t\t$tw.wiki.filterTiddlers(\"[[$:/temp/ServerConnection/\" + url + \"]] [prefix[$:/temp/RemoteAssetInfo/\" + url + \"/]]\"),\n\t\t\t\tfunction(title) {\n\t\t\t\t\t$tw.wiki.deleteTiddler(title);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t});\n\t$tw.rootWidget.addEventListener(\"tm-load-plugin-from-library\",function(event) {\n\t\tvar paramObject = event.paramObject || {},\n\t\t\turl = paramObject.url,\n\t\t\ttitle = paramObject.title;\n\t\tif(url && title) {\n\t\t\tloadIFrame(url,function(err,iframeInfo) {\n\t\t\t\tif(err) {\n\t\t\t\t\talert($tw.language.getString(\"Error/LoadingPluginLibrary\") + \": \" + url);\n\t\t\t\t} else {\n\t\t\t\t\tiframeInfo.domNode.contentWindow.postMessage({\n\t\t\t\t\t\tverb: \"GET\",\n\t\t\t\t\t\turl: \"recipes/library/tiddlers/\" + encodeURIComponent(title) + \".json\",\n\t\t\t\t\t\tcookies: {\n\t\t\t\t\t\t\ttype: \"save-tiddler\",\n\t\t\t\t\t\t\turl: url\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});\n\t// Listen for window messages from other windows\n\twindow.addEventListener(\"message\",function listener(event){\n\t\t// console.log(\"browser-messaging: \",document.location.toString())\n\t\t// console.log(\"browser-messaging: Received message from\",event.origin);\n\t\t// console.log(\"browser-messaging: Message content\",event.data);\n\t\tswitch(event.data.verb) {\n\t\t\tcase \"GET-RESPONSE\":\n\t\t\t\tif(event.data.status.charAt(0) === \"2\") {\n\t\t\t\t\tif(event.data.cookies) {\n\t\t\t\t\t\tif(event.data.cookies.type === \"save-info\") {\n\t\t\t\t\t\t\tvar tiddlers = JSON.parse(event.data.body);\n\t\t\t\t\t\t\t$tw.utils.each(tiddlers,function(tiddler) {\n\t\t\t\t\t\t\t\t$tw.wiki.addTiddler(new $tw.Tiddler($tw.wiki.getCreationFields(),tiddler,{\n\t\t\t\t\t\t\t\t\ttitle: event.data.cookies.infoTitlePrefix + event.data.cookies.url + \"/\" + tiddler.title,\n\t\t\t\t\t\t\t\t\t\"original-title\": tiddler.title,\n\t\t\t\t\t\t\t\t\ttext: \"\",\n\t\t\t\t\t\t\t\t\ttype: \"text/vnd.tiddlywiki\",\n\t\t\t\t\t\t\t\t\t\"original-type\": tiddler.type,\n\t\t\t\t\t\t\t\t\t\"plugin-type\": undefined,\n\t\t\t\t\t\t\t\t\t\"original-plugin-type\": tiddler[\"plugin-type\"],\n\t\t\t\t\t\t\t\t\t\"module-type\": undefined,\n\t\t\t\t\t\t\t\t\t\"original-module-type\": tiddler[\"module-type\"],\n\t\t\t\t\t\t\t\t\ttags: [\"$:/tags/RemoteAssetInfo\"],\n\t\t\t\t\t\t\t\t\t\"original-tags\": $tw.utils.stringifyList(tiddler.tags || []),\n\t\t\t\t\t\t\t\t\t\"server-url\": event.data.cookies.url\n\t\t\t\t\t\t\t\t},$tw.wiki.getModificationFields()));\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else if(event.data.cookies.type === \"save-tiddler\") {\n\t\t\t\t\t\t\tvar tiddler = JSON.parse(event.data.body);\n\t\t\t\t\t\t\t$tw.wiki.addTiddler(new $tw.Tiddler(tiddler));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t},false);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/commands.js": {
"title": "$:/core/modules/startup/commands.js",
"text": "/*\\\ntitle: $:/core/modules/startup/commands.js\ntype: application/javascript\nmodule-type: startup\n\nCommand processing\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"commands\";\nexports.platforms = [\"node\"];\nexports.after = [\"story\"];\nexports.synchronous = false;\n\nexports.startup = function(callback) {\n\t// On the server, start a commander with the command line arguments\n\tvar commander = new $tw.Commander(\n\t\t$tw.boot.argv,\n\t\tfunction(err) {\n\t\t\tif(err) {\n\t\t\t\treturn $tw.utils.error(\"Error: \" + err);\n\t\t\t}\n\t\t\tcallback();\n\t\t},\n\t\t$tw.wiki,\n\t\t{output: process.stdout, error: process.stderr}\n\t);\n\tcommander.execute();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/favicon.js": {
"title": "$:/core/modules/startup/favicon.js",
"text": "/*\\\ntitle: $:/core/modules/startup/favicon.js\ntype: application/javascript\nmodule-type: startup\n\nFavicon handling\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"favicon\";\nexports.platforms = [\"browser\"];\nexports.after = [\"startup\"];\nexports.synchronous = true;\n\n// Favicon tiddler\nvar FAVICON_TITLE = \"$:/favicon.ico\";\n\nexports.startup = function() {\n\t// Set up the favicon\n\tsetFavicon();\n\t// Reset the favicon when the tiddler changes\n\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\tif($tw.utils.hop(changes,FAVICON_TITLE)) {\n\t\t\tsetFavicon();\n\t\t}\n\t});\n};\n\nfunction setFavicon() {\n\tvar tiddler = $tw.wiki.getTiddler(FAVICON_TITLE);\n\tif(tiddler) {\n\t\tvar faviconLink = document.getElementById(\"faviconLink\");\n\t\tfaviconLink.setAttribute(\"href\",$tw.utils.makeDataUri(tiddler.fields.text,tiddler.fields.type,tiddler.fields._canonical_uri));\n\t}\n}\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/info.js": {
"title": "$:/core/modules/startup/info.js",
"text": "/*\\\ntitle: $:/core/modules/startup/info.js\ntype: application/javascript\nmodule-type: startup\n\nInitialise $:/info tiddlers via $:/temp/info-plugin pseudo-plugin\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"info\";\nexports.before = [\"startup\"];\nexports.after = [\"load-modules\"];\nexports.synchronous = true;\n\nvar TITLE_INFO_PLUGIN = \"$:/temp/info-plugin\";\n\nexports.startup = function() {\n\t// Function to bake the info plugin with new tiddlers\n\tvar updateInfoPlugin = function(tiddlerFieldsArray) {\n\t\t// Get the existing tiddlers\n\t\tvar json = $tw.wiki.getTiddlerData(TITLE_INFO_PLUGIN,{tiddlers: {}});\n\t\t// Add the new ones\n\t\t$tw.utils.each(tiddlerFieldsArray,function(fields) {\n\t\t\tif(fields && fields.title) {\n\t\t\t\tjson.tiddlers[fields.title] = fields;\n\t\t\t}\n\t\t});\n\t\t// Bake the info tiddlers into a plugin. We use the non-standard plugin-type \"info\" because ordinary plugins are only registered asynchronously after being loaded dynamically\n\t\tvar fields = {\n\t\t\ttitle: TITLE_INFO_PLUGIN,\n\t\t\ttype: \"application/json\",\n\t\t\t\"plugin-type\": \"info\",\n\t\t\ttext: JSON.stringify(json,null,$tw.config.preferences.jsonSpaces)\n\t\t};\n\t\t$tw.wiki.addTiddler(new $tw.Tiddler(fields));\n\n\t};\n\t// Collect up the info tiddlers\n\tvar tiddlerFieldsArray = [];\n\t// Give each info module a chance to provide as many info tiddlers as they want as an array, and give them a callback for dynamically updating them\n\t$tw.modules.forEachModuleOfType(\"info\",function(title,moduleExports) {\n\t\tif(moduleExports && moduleExports.getInfoTiddlerFields) {\n\t\t\tArray.prototype.push.apply(tiddlerFieldsArray,moduleExports.getInfoTiddlerFields(updateInfoPlugin));\n\t\t}\n\t});\n\tupdateInfoPlugin(tiddlerFieldsArray);\n\tvar changes = $tw.wiki.readPluginInfo([TITLE_INFO_PLUGIN]);\n\t$tw.wiki.registerPluginTiddlers(\"info\",[TITLE_INFO_PLUGIN]);\n\t$tw.wiki.unpackPluginTiddlers();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/load-modules.js": {
"title": "$:/core/modules/startup/load-modules.js",
"text": "/*\\\ntitle: $:/core/modules/startup/load-modules.js\ntype: application/javascript\nmodule-type: startup\n\nLoad core modules\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"load-modules\";\nexports.synchronous = true;\n\nexports.startup = function() {\n\t// Load modules\n\t$tw.modules.applyMethods(\"utils\",$tw.utils);\n\tif($tw.node) {\n\t\t$tw.modules.applyMethods(\"utils-node\",$tw.utils);\n\t}\n\tif($tw.browser) {\n\t\t$tw.modules.applyMethods(\"utils-browser\",$tw.utils);\n\t}\n\t$tw.modules.applyMethods(\"global\",$tw);\n\t$tw.modules.applyMethods(\"config\",$tw.config);\n\t$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap(\"tiddlerfield\");\n\t$tw.modules.applyMethods(\"tiddlermethod\",$tw.Tiddler.prototype);\n\t$tw.modules.applyMethods(\"wikimethod\",$tw.Wiki.prototype);\n\t$tw.wiki.addIndexersToWiki();\n\t$tw.modules.applyMethods(\"tiddlerdeserializer\",$tw.Wiki.tiddlerDeserializerModules);\n\t$tw.macros = $tw.modules.getModulesByTypeAsHashmap(\"macro\");\n\t$tw.wiki.initParsers();\n\t$tw.Commander.initCommands();\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/password.js": {
"title": "$:/core/modules/startup/password.js",
"text": "/*\\\ntitle: $:/core/modules/startup/password.js\ntype: application/javascript\nmodule-type: startup\n\nPassword handling\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"password\";\nexports.platforms = [\"browser\"];\nexports.after = [\"startup\"];\nexports.synchronous = true;\n\nexports.startup = function() {\n\t$tw.rootWidget.addEventListener(\"tm-set-password\",function(event) {\n\t\t$tw.passwordPrompt.createPrompt({\n\t\t\tserviceName: $tw.language.getString(\"Encryption/PromptSetPassword\"),\n\t\t\tnoUserName: true,\n\t\t\tsubmitText: $tw.language.getString(\"Encryption/SetPassword\"),\n\t\t\tcanCancel: true,\n\t\t\trepeatPassword: true,\n\t\t\tcallback: function(data) {\n\t\t\t\tif(data) {\n\t\t\t\t\t$tw.crypto.setPassword(data.password);\n\t\t\t\t}\n\t\t\t\treturn true; // Get rid of the password prompt\n\t\t\t}\n\t\t});\n\t});\n\t$tw.rootWidget.addEventListener(\"tm-clear-password\",function(event) {\n\t\tif($tw.browser) {\n\t\t\tif(!confirm($tw.language.getString(\"Encryption/ConfirmClearPassword\"))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t$tw.crypto.setPassword(null);\n\t});\n\t// Ensure that $:/isEncrypted is maintained properly\n\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\tif($tw.utils.hop(changes,\"$:/isEncrypted\")) {\n\t\t\t$tw.crypto.updateCryptoStateTiddler();\n\t\t}\n\t});\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/plugins.js": {
"title": "$:/core/modules/startup/plugins.js",
"text": "/*\\\ntitle: $:/core/modules/startup/plugins.js\ntype: application/javascript\nmodule-type: startup\n\nStartup logic concerned with managing plugins\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"plugins\";\nexports.after = [\"load-modules\"];\nexports.synchronous = true;\n\nvar TITLE_REQUIRE_RELOAD_DUE_TO_PLUGIN_CHANGE = \"$:/status/RequireReloadDueToPluginChange\";\n\nvar PREFIX_CONFIG_REGISTER_PLUGIN_TYPE = \"$:/config/RegisterPluginType/\";\n\nexports.startup = function() {\n\t$tw.wiki.addTiddler({title: TITLE_REQUIRE_RELOAD_DUE_TO_PLUGIN_CHANGE,text: \"no\"});\n\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\t// Work out which of the changed tiddlers are plugins that we need to reregister\n\t\tvar changesToProcess = [],\n\t\t\trequireReloadDueToPluginChange = false;\n\t\t$tw.utils.each(Object.keys(changes),function(title) {\n\t\t\tvar tiddler = $tw.wiki.getTiddler(title),\n\t\t\t\trequiresReload = $tw.wiki.doesPluginRequireReload(title);\n\t\t\tif(requiresReload) {\n\t\t\t\trequireReloadDueToPluginChange = true;\n\t\t\t} else if(tiddler) {\n\t\t\t\tvar pluginType = tiddler.fields[\"plugin-type\"];\n\t\t\t\tif($tw.wiki.getTiddlerText(PREFIX_CONFIG_REGISTER_PLUGIN_TYPE + (tiddler.fields[\"plugin-type\"] || \"\"),\"no\") === \"yes\") {\n\t\t\t\t\tchangesToProcess.push(title);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t// Issue warning if any of the tiddlers require a reload\n\t\tif(requireReloadDueToPluginChange) {\n\t\t\t$tw.wiki.addTiddler({title: TITLE_REQUIRE_RELOAD_DUE_TO_PLUGIN_CHANGE,text: \"yes\"});\n\t\t}\n\t\t// Read or delete the plugin info of the changed tiddlers\n\t\tif(changesToProcess.length > 0) {\n\t\t\tvar changes = $tw.wiki.readPluginInfo(changesToProcess);\n\t\t\tif(changes.modifiedPlugins.length > 0 || changes.deletedPlugins.length > 0) {\n\t\t\t\tvar changedShadowTiddlers = {};\n\t\t\t\t// Collect the shadow tiddlers of any deleted plugins\n\t\t\t\t$tw.utils.each(changes.deletedPlugins,function(pluginTitle) {\n\t\t\t\t\tvar pluginInfo = $tw.wiki.getPluginInfo(pluginTitle);\n\t\t\t\t\tif(pluginInfo) {\n\t\t\t\t\t\t$tw.utils.each(Object.keys(pluginInfo.tiddlers),function(title) {\n\t\t\t\t\t\t\tchangedShadowTiddlers[title] = true;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t// Collect the shadow tiddlers of any modified plugins\n\t\t\t\t$tw.utils.each(changes.modifiedPlugins,function(pluginTitle) {\n\t\t\t\t\tvar pluginInfo = $tw.wiki.getPluginInfo(pluginTitle);\n\t\t\t\t\tif(pluginInfo) {\n\t\t\t\t\t\t$tw.utils.each(Object.keys(pluginInfo.tiddlers),function(title) {\n\t\t\t\t\t\t\tchangedShadowTiddlers[title] = false;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t// (Re-)register any modified plugins\n\t\t\t\t$tw.wiki.registerPluginTiddlers(null,changes.modifiedPlugins);\n\t\t\t\t// Unregister any deleted plugins\n\t\t\t\t$tw.wiki.unregisterPluginTiddlers(null,changes.deletedPlugins);\n\t\t\t\t// Unpack the shadow tiddlers\n\t\t\t\t$tw.wiki.unpackPluginTiddlers();\n\t\t\t\t// Queue change events for the changed shadow tiddlers\n\t\t\t\t$tw.utils.each(Object.keys(changedShadowTiddlers),function(title) {\n\t\t\t\t\t$tw.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title]);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/render.js": {
"title": "$:/core/modules/startup/render.js",
"text": "/*\\\ntitle: $:/core/modules/startup/render.js\ntype: application/javascript\nmodule-type: startup\n\nTitle, stylesheet and page rendering\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"render\";\nexports.platforms = [\"browser\"];\nexports.after = [\"story\"];\nexports.synchronous = true;\n\n// Default story and history lists\nvar PAGE_TITLE_TITLE = \"$:/core/wiki/title\";\nvar PAGE_STYLESHEET_TITLE = \"$:/core/ui/PageStylesheet\";\nvar PAGE_TEMPLATE_TITLE = \"$:/core/ui/RootTemplate\";\n\n// Time (in ms) that we defer refreshing changes to draft tiddlers\nvar DRAFT_TIDDLER_TIMEOUT_TITLE = \"$:/config/Drafts/TypingTimeout\";\nvar THROTTLE_REFRESH_TIMEOUT = 400;\n\nexports.startup = function() {\n\t// Set up the title\n\t$tw.titleWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TITLE_TITLE,{document: $tw.fakeDocument, parseAsInline: true});\n\t$tw.titleContainer = $tw.fakeDocument.createElement(\"div\");\n\t$tw.titleWidgetNode.render($tw.titleContainer,null);\n\tdocument.title = $tw.titleContainer.textContent;\n\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\tif($tw.titleWidgetNode.refresh(changes,$tw.titleContainer,null)) {\n\t\t\tdocument.title = $tw.titleContainer.textContent;\n\t\t}\n\t});\n\t// Set up the styles\n\t$tw.styleWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_STYLESHEET_TITLE,{document: $tw.fakeDocument});\n\t$tw.styleContainer = $tw.fakeDocument.createElement(\"style\");\n\t$tw.styleWidgetNode.render($tw.styleContainer,null);\n\t$tw.styleElement = document.createElement(\"style\");\n\t$tw.styleElement.innerHTML = $tw.styleContainer.textContent;\n\tdocument.head.insertBefore($tw.styleElement,document.head.firstChild);\n\t$tw.wiki.addEventListener(\"change\",$tw.perf.report(\"styleRefresh\",function(changes) {\n\t\tif($tw.styleWidgetNode.refresh(changes,$tw.styleContainer,null)) {\n\t\t\t$tw.styleElement.innerHTML = $tw.styleContainer.textContent;\n\t\t}\n\t}));\n\t// Display the $:/core/ui/PageTemplate tiddler to kick off the display\n\t$tw.perf.report(\"mainRender\",function() {\n\t\t$tw.pageWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TEMPLATE_TITLE,{document: document, parentWidget: $tw.rootWidget, recursionMarker: \"no\"});\n\t\t$tw.pageContainer = document.createElement(\"div\");\n\t\t$tw.utils.addClass($tw.pageContainer,\"tc-page-container-wrapper\");\n\t\tdocument.body.insertBefore($tw.pageContainer,document.body.firstChild);\n\t\t$tw.pageWidgetNode.render($tw.pageContainer,null);\n \t\t$tw.hooks.invokeHook(\"th-page-refreshed\");\n\t})();\n\t// Remove any splash screen elements\n\tvar removeList = document.querySelectorAll(\".tc-remove-when-wiki-loaded\");\n\t$tw.utils.each(removeList,function(removeItem) {\n\t\tif(removeItem.parentNode) {\n\t\t\tremoveItem.parentNode.removeChild(removeItem);\n\t\t}\n\t});\n\t// Prepare refresh mechanism\n\tvar deferredChanges = Object.create(null),\n\t\ttimerId;\n\tfunction refresh() {\n\t\t// Process the refresh\n\t\t$tw.hooks.invokeHook(\"th-page-refreshing\");\n\t\t$tw.pageWidgetNode.refresh(deferredChanges);\n\t\tdeferredChanges = Object.create(null);\n\t\t$tw.hooks.invokeHook(\"th-page-refreshed\");\n\t}\n\t// Add the change event handler\n\t$tw.wiki.addEventListener(\"change\",$tw.perf.report(\"mainRefresh\",function(changes) {\n\t\t// Check if only tiddlers that are throttled have changed\n\t\tvar onlyThrottledTiddlersHaveChanged = true;\n\t\tfor(var title in changes) {\n\t\t\tvar tiddler = $tw.wiki.getTiddler(title);\n\t\t\tif(!$tw.wiki.isVolatileTiddler(title) && (!tiddler || !(tiddler.hasField(\"draft.of\") || tiddler.hasField(\"throttle.refresh\")))) {\n\t\t\t\tonlyThrottledTiddlersHaveChanged = false;\n\t\t\t}\n\t\t}\n\t\t// Defer the change if only drafts have changed\n\t\tif(timerId) {\n\t\t\tclearTimeout(timerId);\n\t\t}\n\t\ttimerId = null;\n\t\tif(onlyThrottledTiddlersHaveChanged) {\n\t\t\tvar timeout = parseInt($tw.wiki.getTiddlerText(DRAFT_TIDDLER_TIMEOUT_TITLE,\"\"),10);\n\t\t\tif(isNaN(timeout)) {\n\t\t\t\ttimeout = THROTTLE_REFRESH_TIMEOUT;\n\t\t\t}\n\t\t\ttimerId = setTimeout(refresh,timeout);\n\t\t\t$tw.utils.extend(deferredChanges,changes);\n\t\t} else {\n\t\t\t$tw.utils.extend(deferredChanges,changes);\n\t\t\trefresh();\n\t\t}\n\t}));\n\t// Fix up the link between the root widget and the page container\n\t$tw.rootWidget.domNodes = [$tw.pageContainer];\n\t$tw.rootWidget.children = [$tw.pageWidgetNode];\n\t// Run any post-render startup actions\n\t$tw.rootWidget.invokeActionsByTag(\"$:/tags/StartupAction/PostRender\");\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/rootwidget.js": {
"title": "$:/core/modules/startup/rootwidget.js",
"text": "/*\\\ntitle: $:/core/modules/startup/rootwidget.js\ntype: application/javascript\nmodule-type: startup\n\nSetup the root widget and the core root widget handlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"rootwidget\";\nexports.platforms = [\"browser\"];\nexports.after = [\"startup\"];\nexports.before = [\"story\"];\nexports.synchronous = true;\n\nexports.startup = function() {\n\t// Install the modal message mechanism\n\t$tw.modal = new $tw.utils.Modal($tw.wiki);\n\t$tw.rootWidget.addEventListener(\"tm-modal\",function(event) {\n\t\t$tw.modal.display(event.param,{variables: event.paramObject, event: event});\n\t});\n\t$tw.rootWidget.addEventListener(\"tm-show-switcher\",function(event) {\n\t\t$tw.modal.display(\"$:/core/ui/SwitcherModal\",{variables: event.paramObject, event: event});\n\t});\n\t// Install the notification mechanism\n\t$tw.notifier = new $tw.utils.Notifier($tw.wiki);\n\t$tw.rootWidget.addEventListener(\"tm-notify\",function(event) {\n\t\t$tw.notifier.display(event.param,{variables: event.paramObject});\n\t});\n\t// Install the copy-to-clipboard mechanism\n\t$tw.rootWidget.addEventListener(\"tm-copy-to-clipboard\",function(event) {\n\t\t$tw.utils.copyToClipboard(event.param);\n\t});\n\t// Install the tm-focus-selector message\n\t$tw.rootWidget.addEventListener(\"tm-focus-selector\",function(event) {\n\t\tvar selector = event.param || \"\",\n\t\t\telement;\n\t\ttry {\n\t\t\telement = document.querySelector(selector);\n\t\t} catch(e) {\n\t\t\tconsole.log(\"Error in selector: \",selector)\n\t\t}\n\t\tif(element && element.focus) {\n\t\t\telement.focus(event.paramObject);\n\t\t}\n\t});\n\t// Install the scroller\n\t$tw.pageScroller = new $tw.utils.PageScroller();\n\t$tw.rootWidget.addEventListener(\"tm-scroll\",function(event) {\n\t\t$tw.pageScroller.handleEvent(event);\n\t});\n\tvar fullscreen = $tw.utils.getFullScreenApis();\n\tif(fullscreen) {\n\t\t$tw.rootWidget.addEventListener(\"tm-full-screen\",function(event) {\n\t\t\tvar fullScreenDocument = event.event ? event.event.target.ownerDocument : document;\n\t\t\tif(event.param === \"enter\") {\n\t\t\t\tfullScreenDocument.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);\n\t\t\t} else if(event.param === \"exit\") {\n\t\t\t\tfullScreenDocument[fullscreen._exitFullscreen]();\n\t\t\t} else {\n\t\t\t\tif(fullScreenDocument[fullscreen._fullscreenElement]) {\n\t\t\t\t\tfullScreenDocument[fullscreen._exitFullscreen]();\n\t\t\t\t} else {\n\t\t\t\t\tfullScreenDocument.documentElement[fullscreen._requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t// Hook up events for the publisher handler\n\t$tw.rootWidget.addEventListener(\"tm-publish\",function(event) {\n\t\t$tw.publisherHandler.publish(event.paramObject.job,function(err) {\n\t\t\tconsole.log(\"Finished publishing with result:\",err);\n\t\t});\n\t});\n\t// If we're being viewed on a data: URI then give instructions for how to save\n\tif(document.location.protocol === \"data:\") {\n\t\t$tw.rootWidget.dispatchEvent({\n\t\t\ttype: \"tm-modal\",\n\t\t\tparam: \"$:/language/Modals/SaveInstructions\"\n\t\t});\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup.js": {
"title": "$:/core/modules/startup.js",
"text": "/*\\\ntitle: $:/core/modules/startup.js\ntype: application/javascript\nmodule-type: startup\n\nMiscellaneous startup logic for both the client and server.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"startup\";\nexports.after = [\"load-modules\"];\nexports.synchronous = true;\n\n// Set to `true` to enable performance instrumentation\nvar PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE = \"$:/config/Performance/Instrumentation\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nexports.startup = function() {\n\t// Minimal browser detection\n\tif($tw.browser) {\n\t\t$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));\n\t\t$tw.browser.isFirefox = !!document.mozFullScreenEnabled;\n\t}\n\t// Platform detection\n\t$tw.platform = {};\n\tif($tw.browser) {\n\t\t$tw.platform.isMac = /Mac/.test(navigator.platform);\n\t\t$tw.platform.isWindows = /win/i.test(navigator.platform);\n\t\t$tw.platform.isLinux = /Linux/i.test(navigator.platform);\n\t} else {\n\t\tswitch(require(\"os\").platform()) {\n\t\t\tcase \"darwin\":\n\t\t\t\t$tw.platform.isMac = true;\n\t\t\t\tbreak;\n\t\t\tcase \"win32\":\n\t\t\t\t$tw.platform.isWindows = true;\n\t\t\t\tbreak;\n\t\t\tcase \"freebsd\":\n\t\t\t\t$tw.platform.isLinux = true;\n\t\t\t\tbreak;\n\t\t\tcase \"linux\":\n\t\t\t\t$tw.platform.isLinux = true;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t// Initialise version\n\t$tw.version = $tw.utils.extractVersionInfo();\n\t// Set up the performance framework\n\t$tw.perf = new $tw.Performance($tw.wiki.getTiddlerText(PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE,\"no\") === \"yes\");\n\t// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers\n\t$tw.rootWidget = new widget.widget({\n\t\ttype: \"widget\",\n\t\tchildren: []\n\t},{\n\t\twiki: $tw.wiki,\n\t\tdocument: $tw.browser ? document : $tw.fakeDocument\n\t});\n\t// Execute any startup actions\n\t$tw.rootWidget.invokeActionsByTag(\"$:/tags/StartupAction\");\n\tif($tw.browser) {\n\t\t$tw.rootWidget.invokeActionsByTag(\"$:/tags/StartupAction/Browser\");\n\t}\n\tif($tw.node) {\n\t\t$tw.rootWidget.invokeActionsByTag(\"$:/tags/StartupAction/Node\");\n\t}\n\t// Kick off the language manager and switcher\n\t$tw.language = new $tw.Language();\n\t$tw.languageSwitcher = new $tw.PluginSwitcher({\n\t\twiki: $tw.wiki,\n\t\tpluginType: \"language\",\n\t\tcontrollerTitle: \"$:/language\",\n\t\tdefaultPlugins: [\n\t\t\t\"$:/languages/en-GB\"\n\t\t],\n\t\tonSwitch: function(plugins) {\n\t\t\tif($tw.browser) {\n\t\t\t\tvar pluginTiddler = $tw.wiki.getTiddler(plugins[0]);\n\t\t\t\tif(pluginTiddler) {\n\t\t\t\t\tdocument.documentElement.setAttribute(\"dir\",pluginTiddler.getFieldString(\"text-direction\") || \"auto\");\n\t\t\t\t} else {\n\t\t\t\t\tdocument.documentElement.removeAttribute(\"dir\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\t// Kick off the theme manager\n\t$tw.themeManager = new $tw.PluginSwitcher({\n\t\twiki: $tw.wiki,\n\t\tpluginType: \"theme\",\n\t\tcontrollerTitle: \"$:/theme\",\n\t\tdefaultPlugins: [\n\t\t\t\"$:/themes/tiddlywiki/snowwhite\",\n\t\t\t\"$:/themes/tiddlywiki/vanilla\"\n\t\t]\n\t});\n\t// Kick off the keyboard manager\n\t$tw.keyboardManager = new $tw.KeyboardManager();\n\t// Listen for shortcuts\n\tif($tw.browser) {\n\t\t$tw.utils.addEventListeners(document,[{\n\t\t\tname: \"keydown\",\n\t\t\thandlerObject: $tw.keyboardManager,\n\t\t\thandlerMethod: \"handleKeydownEvent\"\n\t\t}]);\n\t}\n\t// Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup\n\t$tw.wiki.clearTiddlerEventQueue();\n\t// Find a working syncadaptor\n\t$tw.syncadaptor = undefined;\n\t$tw.modules.forEachModuleOfType(\"syncadaptor\",function(title,module) {\n\t\tif(!$tw.syncadaptor && module.adaptorClass) {\n\t\t\t$tw.syncadaptor = new module.adaptorClass({wiki: $tw.wiki});\n\t\t}\n\t});\n\t// Set up the syncer object if we've got a syncadaptor\n\tif($tw.syncadaptor) {\n\t\t$tw.syncer = new $tw.Syncer({wiki: $tw.wiki, syncadaptor: $tw.syncadaptor});\n\t}\n\t// Setup the saver handler\n\t$tw.saverHandler = new $tw.SaverHandler({\n\t\twiki: $tw.wiki,\n\t\tdirtyTracking: !$tw.syncadaptor,\n\t\tpreloadDirty: $tw.boot.preloadDirty || []\n\t});\n\t// Install the publisher handler\n\t$tw.publisherHandler = new $tw.PublisherHandler({\n\t\twiki: $tw.wiki\n\t});\n\t// Host-specific startup\n\tif($tw.browser) {\n\t\t// Install the popup manager\n\t\t$tw.popup = new $tw.utils.Popup();\n\t\t// Install the animator\n\t\t$tw.anim = new $tw.utils.Animator();\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/story.js": {
"title": "$:/core/modules/startup/story.js",
"text": "/*\\\ntitle: $:/core/modules/startup/story.js\ntype: application/javascript\nmodule-type: startup\n\nLoad core modules\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"story\";\nexports.after = [\"startup\"];\nexports.synchronous = true;\n\n// Default story and history lists\nvar DEFAULT_STORY_TITLE = \"$:/StoryList\";\nvar DEFAULT_HISTORY_TITLE = \"$:/HistoryList\";\n\n// Default tiddlers\nvar DEFAULT_TIDDLERS_TITLE = \"$:/DefaultTiddlers\";\n\n// Config\nvar CONFIG_UPDATE_ADDRESS_BAR = \"$:/config/Navigation/UpdateAddressBar\"; // Can be \"no\", \"permalink\", \"permaview\"\nvar CONFIG_UPDATE_HISTORY = \"$:/config/Navigation/UpdateHistory\"; // Can be \"yes\" or \"no\"\nvar CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD = \"$:/config/Navigation/Permalinkview/CopyToClipboard\"; // Can be \"yes\" (default) or \"no\"\nvar CONFIG_PERMALINKVIEW_UPDATE_ADDRESS_BAR = \"$:/config/Navigation/Permalinkview/UpdateAddressBar\"; // Can be \"yes\" (default) or \"no\"\n\n\n// Links to help, if there is no param\nvar HELP_OPEN_EXTERNAL_WINDOW = \"http://tiddlywiki.com/#WidgetMessage%3A%20tm-open-external-window\";\n\nexports.startup = function() {\n\t// Open startup tiddlers\n\topenStartupTiddlers({\n\t\tdisableHistory: $tw.boot.disableStartupNavigation\n\t});\n\tif($tw.browser) {\n\t\t// Set up location hash update\n\t\t$tw.wiki.addEventListener(\"change\",function(changes) {\n\t\t\tif($tw.utils.hop(changes,DEFAULT_STORY_TITLE) || $tw.utils.hop(changes,DEFAULT_HISTORY_TITLE)) {\n\t\t\t\tupdateLocationHash({\n\t\t\t\t\tupdateAddressBar: $tw.wiki.getTiddlerText(CONFIG_UPDATE_ADDRESS_BAR,\"permaview\").trim(),\n\t\t\t\t\tupdateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,\"no\").trim()\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t// Listen for changes to the browser location hash\n\t\twindow.addEventListener(\"hashchange\",function() {\n\t\t\tvar hash = $tw.utils.getLocationHash();\n\t\t\tif(hash !== $tw.locationHash) {\n\t\t\t\t$tw.locationHash = hash;\n\t\t\t\topenStartupTiddlers({defaultToCurrentStory: true});\n\t\t\t}\n\t\t},false);\n\t\t// Listen for the tm-browser-refresh message\n\t\t$tw.rootWidget.addEventListener(\"tm-browser-refresh\",function(event) {\n\t\t\twindow.location.reload(true);\n\t\t});\n\t\t// Listen for tm-open-external-window message\n\t\t$tw.rootWidget.addEventListener(\"tm-open-external-window\",function(event) {\n\t\t\tvar paramObject = event.paramObject || {},\n\t\t\t\tstrUrl = event.param || HELP_OPEN_EXTERNAL_WINDOW,\n\t\t\t\tstrWindowName = paramObject.windowName,\n\t\t\t\tstrWindowFeatures = paramObject.windowFeatures;\n\t\t\twindow.open(strUrl, strWindowName, strWindowFeatures);\n\t\t});\n\t\t// Listen for the tm-print message\n\t\t$tw.rootWidget.addEventListener(\"tm-print\",function(event) {\n\t\t\t(event.event.view || window).print();\n\t\t});\n\t\t// Listen for the tm-home message\n\t\t$tw.rootWidget.addEventListener(\"tm-home\",function(event) {\n\t\t\twindow.location.hash = \"\";\n\t\t\tvar storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE),\n\t\t\t\tstoryList = $tw.wiki.filterTiddlers(storyFilter);\n\t\t\t//invoke any hooks that might change the default story list\n\t\t\tstoryList = $tw.hooks.invokeHook(\"th-opening-default-tiddlers-list\",storyList);\n\t\t\t$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: \"\", list: storyList},$tw.wiki.getModificationFields());\n\t\t\tif(storyList[0]) {\n\t\t\t\t$tw.wiki.addToHistory(storyList[0]);\n\t\t\t}\n\t\t});\n\t\t// Listen for the tm-permalink message\n\t\t$tw.rootWidget.addEventListener(\"tm-permalink\",function(event) {\n\t\t\tupdateLocationHash({\n\t\t\t\tupdateAddressBar: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_UPDATE_ADDRESS_BAR,\"yes\").trim() === \"yes\" ? \"permalink\" : \"none\",\n\t\t\t\tupdateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,\"no\").trim(),\n\t\t\t\ttargetTiddler: event.param || event.tiddlerTitle,\n\t\t\t\tcopyToClipboard: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD,\"yes\").trim() === \"yes\" ? \"permalink\" : \"none\"\n\t\t\t});\n\t\t});\n\t\t// Listen for the tm-permaview message\n\t\t$tw.rootWidget.addEventListener(\"tm-permaview\",function(event) {\n\t\t\tupdateLocationHash({\n\t\t\t\tupdateAddressBar: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_UPDATE_ADDRESS_BAR,\"yes\").trim() === \"yes\" ? \"permaview\" : \"none\",\n\t\t\t\tupdateHistory: $tw.wiki.getTiddlerText(CONFIG_UPDATE_HISTORY,\"no\").trim(),\n\t\t\t\ttargetTiddler: event.param || event.tiddlerTitle,\n\t\t\t\tcopyToClipboard: $tw.wiki.getTiddlerText(CONFIG_PERMALINKVIEW_COPY_TO_CLIPBOARD,\"yes\").trim() === \"yes\" ? \"permaview\" : \"none\"\n\t\t\t});\n\t\t});\n\t}\n};\n\n/*\nProcess the location hash to open the specified tiddlers. Options:\ndisableHistory: if true $:/History is NOT updated\ndefaultToCurrentStory: If true, the current story is retained as the default, instead of opening the default tiddlers\n*/\nfunction openStartupTiddlers(options) {\n\toptions = options || {};\n\t// Work out the target tiddler and the story filter. \"null\" means \"unspecified\"\n\tvar target = null,\n\t\tstoryFilter = null;\n\tif($tw.locationHash.length > 1) {\n\t\tvar hash = $tw.locationHash.substr(1),\n\t\t\tsplit = hash.indexOf(\":\");\n\t\tif(split === -1) {\n\t\t\ttarget = decodeURIComponent(hash.trim());\n\t\t} else {\n\t\t\ttarget = decodeURIComponent(hash.substr(0,split).trim());\n\t\t\tstoryFilter = decodeURIComponent(hash.substr(split + 1).trim());\n\t\t}\n\t}\n\t// If the story wasn't specified use the current tiddlers or a blank story\n\tif(storyFilter === null) {\n\t\tif(options.defaultToCurrentStory) {\n\t\t\tvar currStoryList = $tw.wiki.getTiddlerList(DEFAULT_STORY_TITLE);\n\t\t\tstoryFilter = $tw.utils.stringifyList(currStoryList);\n\t\t} else {\n\t\t\tif(target && target !== \"\") {\n\t\t\t\tstoryFilter = \"\";\n\t\t\t} else {\n\t\t\t\tstoryFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE);\n\t\t\t}\n\t\t}\n\t}\n\t// Process the story filter to get the story list\n\tvar storyList = $tw.wiki.filterTiddlers(storyFilter);\n\t// Invoke any hooks that want to change the default story list\n\tstoryList = $tw.hooks.invokeHook(\"th-opening-default-tiddlers-list\",storyList);\n\t// If the target tiddler isn't included then splice it in at the top\n\tif(target && storyList.indexOf(target) === -1) {\n\t\tstoryList.unshift(target);\n\t}\n\t// Save the story list\n\t$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: \"\", list: storyList},$tw.wiki.getModificationFields());\n\t// Update history\n\tvar story = new $tw.Story({\n\t\twiki: $tw.wiki,\n\t\tstoryTitle: DEFAULT_STORY_TITLE,\n\t\thistoryTitle: DEFAULT_HISTORY_TITLE\n\t});\n\tif(!options.disableHistory) {\n\t\t// If a target tiddler was specified add it to the history stack\n\t\tif(target && target !== \"\") {\n\t\t\t// The target tiddler doesn't need double square brackets, but we'll silently remove them if they're present\n\t\t\tif(target.indexOf(\"[[\") === 0 && target.substr(-2) === \"]]\") {\n\t\t\t\ttarget = target.substr(2,target.length - 4);\n\t\t\t}\n\t\t\tstory.addToHistory(target);\n\t\t} else if(storyList.length > 0) {\n\t\t\tstory.addToHistory(storyList[0]);\n\t\t}\n\t}\n}\n\n/*\noptions: See below\noptions.updateAddressBar: \"permalink\", \"permaview\" or \"no\" (defaults to \"permaview\")\noptions.updateHistory: \"yes\" or \"no\" (defaults to \"no\")\noptions.copyToClipboard: \"permalink\", \"permaview\" or \"no\" (defaults to \"no\")\noptions.targetTiddler: optional title of target tiddler for permalink\n*/\nfunction updateLocationHash(options) {\n\t// Get the story and the history stack\n\tvar storyList = $tw.wiki.getTiddlerList(DEFAULT_STORY_TITLE),\n\t\thistoryList = $tw.wiki.getTiddlerData(DEFAULT_HISTORY_TITLE,[]),\n\t\ttargetTiddler = \"\";\n\tif(options.targetTiddler) {\n\t\ttargetTiddler = options.targetTiddler;\n\t} else {\n\t\t// The target tiddler is the one at the top of the stack\n\t\tif(historyList.length > 0) {\n\t\t\ttargetTiddler = historyList[historyList.length-1].title;\n\t\t}\n\t\t// Blank the target tiddler if it isn't present in the story\n\t\tif(storyList.indexOf(targetTiddler) === -1) {\n\t\t\ttargetTiddler = \"\";\n\t\t}\n\t}\n\t// Assemble the location hash\n\tswitch(options.updateAddressBar) {\n\t\tcase \"permalink\":\n\t\t\t$tw.locationHash = \"#\" + encodeURIComponent(targetTiddler);\n\t\t\tbreak;\n\t\tcase \"permaview\":\n\t\t\t$tw.locationHash = \"#\" + encodeURIComponent(targetTiddler) + \":\" + encodeURIComponent($tw.utils.stringifyList(storyList));\n\t\t\tbreak;\n\t}\n\t// Copy URL to the clipboard\n\tswitch(options.copyToClipboard) {\n\t\tcase \"permalink\":\n\t\t\t$tw.utils.copyToClipboard($tw.utils.getLocationPath() + \"#\" + encodeURIComponent(targetTiddler));\n\t\t\tbreak;\n\t\tcase \"permaview\":\n\t\t\t$tw.utils.copyToClipboard($tw.utils.getLocationPath() + \"#\" + encodeURIComponent(targetTiddler) + \":\" + encodeURIComponent($tw.utils.stringifyList(storyList)));\n\t\t\tbreak;\n\t}\n\t// Only change the location hash if we must, thus avoiding unnecessary onhashchange events\n\tif($tw.utils.getLocationHash() !== $tw.locationHash) {\n\t\tif(options.updateHistory === \"yes\") {\n\t\t\t// Assign the location hash so that history is updated\n\t\t\twindow.location.hash = $tw.locationHash;\n\t\t} else {\n\t\t\t// We use replace so that browser history isn't affected\n\t\t\twindow.location.replace(window.location.toString().split(\"#\")[0] + $tw.locationHash);\n\t\t}\n\t}\n}\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/startup/windows.js": {
"title": "$:/core/modules/startup/windows.js",
"text": "/*\\\ntitle: $:/core/modules/startup/windows.js\ntype: application/javascript\nmodule-type: startup\n\nSetup root widget handlers for the messages concerned with opening external browser windows\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"windows\";\nexports.platforms = [\"browser\"];\nexports.after = [\"startup\"];\nexports.synchronous = true;\n\n// Global to keep track of open windows (hashmap by title)\n$tw.windows = {};\n\nexports.startup = function() {\n\t// Handle open window message\n\t$tw.rootWidget.addEventListener(\"tm-open-window\",function(event) {\n\t\t// Get the parameters\n\t\tvar refreshHandler,\n\t\t\ttitle = event.param || event.tiddlerTitle,\n\t\t\tparamObject = event.paramObject || {},\n\t\t\twindowTitle = paramObject.windowTitle || title,\n\t\t\ttemplate = paramObject.template || \"$:/core/templates/single.tiddler.window\",\n\t\t\twidth = paramObject.width || \"700\",\n\t\t\theight = paramObject.height || \"600\",\n\t\t\tvariables = $tw.utils.extend({},paramObject,{currentTiddler: title});\n\t\t// Open the window\n\t\tvar srcWindow,\n\t\t srcDocument;\n\t\t// In case that popup blockers deny opening a new window\n\t\ttry {\n\t\t\tsrcWindow = window.open(\"\",\"external-\" + title,\"scrollbars,width=\" + width + \",height=\" + height),\n\t\t\tsrcDocument = srcWindow.document;\n\t\t}\n\t\tcatch(e) {\n\t\t\treturn;\n\t\t}\n\t\t$tw.windows[title] = srcWindow;\n\t\t// Check for reopening the same window\n\t\tif(srcWindow.haveInitialisedWindow) {\n\t\t\treturn;\n\t\t}\n\t\t// Initialise the document\n\t\tsrcDocument.write(\"<html><head></head><body class='tc-body tc-single-tiddler-window'></body></html>\");\n\t\tsrcDocument.close();\n\t\tsrcDocument.title = windowTitle;\n\t\tsrcWindow.addEventListener(\"beforeunload\",function(event) {\n\t\t\tdelete $tw.windows[title];\n\t\t\t$tw.wiki.removeEventListener(\"change\",refreshHandler);\n\t\t},false);\n\t\t// Set up the styles\n\t\tvar styleWidgetNode = $tw.wiki.makeTranscludeWidget(\"$:/core/ui/PageStylesheet\",{\n\t\t\t\tdocument: $tw.fakeDocument,\n\t\t\t\tvariables: variables,\n\t\t\t\timportPageMacros: true}),\n\t\t\tstyleContainer = $tw.fakeDocument.createElement(\"style\");\n\t\tstyleWidgetNode.render(styleContainer,null);\n\t\tvar styleElement = srcDocument.createElement(\"style\");\n\t\tstyleElement.innerHTML = styleContainer.textContent;\n\t\tsrcDocument.head.insertBefore(styleElement,srcDocument.head.firstChild);\n\t\t// Render the text of the tiddler\n\t\tvar parser = $tw.wiki.parseTiddler(template),\n\t\t\twidgetNode = $tw.wiki.makeWidget(parser,{document: srcDocument, parentWidget: $tw.rootWidget, variables: variables});\n\t\twidgetNode.render(srcDocument.body,srcDocument.body.firstChild);\n\t\t// Function to handle refreshes\n\t\trefreshHandler = function(changes) {\n\t\t\tif(styleWidgetNode.refresh(changes,styleContainer,null)) {\n\t\t\t\tstyleElement.innerHTML = styleContainer.textContent;\n\t\t\t}\n\t\t\twidgetNode.refresh(changes);\n\t\t};\n\t\t$tw.wiki.addEventListener(\"change\",refreshHandler);\n\t\t// Listen for keyboard shortcuts\n\t\t$tw.utils.addEventListeners(srcDocument,[{\n\t\t\tname: \"keydown\",\n\t\t\thandlerObject: $tw.keyboardManager,\n\t\t\thandlerMethod: \"handleKeydownEvent\"\n\t\t}]);\n\t\tsrcWindow.document.documentElement.addEventListener(\"click\",$tw.popup,true);\n\t\tsrcWindow.haveInitialisedWindow = true;\n\t});\n\t// Close open windows when unloading main window\n\t$tw.addUnloadTask(function() {\n\t\t$tw.utils.each($tw.windows,function(win) {\n\t\t\twin.close();\n\t\t});\n\t});\n\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/core/modules/story.js": {
"title": "$:/core/modules/story.js",
"text": "/*\\\ntitle: $:/core/modules/story.js\ntype: application/javascript\nmodule-type: global\n\nLightweight object for managing interactions with the story and history lists.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nConstruct Story object with options:\nwiki: reference to wiki object to use to resolve tiddler titles\nstoryTitle: title of story list tiddler\nhistoryTitle: title of history list tiddler\n*/\nfunction Story(options) {\n\toptions = options || {};\n\tthis.wiki = options.wiki || $tw.wiki;\n\tthis.storyTitle = options.storyTitle || \"$:/StoryList\";\n\tthis.historyTitle = options.historyTitle || \"$:/HistoryList\";\n};\n\nStory.prototype.navigateTiddler = function(navigateTo,navigateFromTitle,navigateFromClientRect) {\n\tthis.addToStory(navigateTo,navigateFromTitle);\n\tthis.addToHistory(navigateTo,navigateFromClientRect);\n};\n\nStory.prototype.getStoryList = function() {\n\treturn this.wiki.getTiddlerList(this.storyTitle) || [];\n};\n\nStory.prototype.addToStory = function(navigateTo,navigateFromTitle,options) {\n\toptions = options || {};\n\tvar storyList = this.getStoryList();\n\t// See if the tiddler is already there\n\tvar slot = storyList.indexOf(navigateTo);\n\t// Quit if it already exists in the story river\n\tif(slot >= 0) {\n\t\treturn;\n\t}\n\t// First we try to find the position of the story element we navigated from\n\tvar fromIndex = storyList.indexOf(navigateFromTitle);\n\tif(fromIndex >= 0) {\n\t\t// The tiddler is added from inside the river\n\t\t// Determine where to insert the tiddler; Fallback is \"below\"\n\t\tswitch(options.openLinkFromInsideRiver) {\n\t\t\tcase \"top\":\n\t\t\t\tslot = 0;\n\t\t\t\tbreak;\n\t\t\tcase \"bottom\":\n\t\t\t\tslot = storyList.length;\n\t\t\t\tbreak;\n\t\t\tcase \"above\":\n\t\t\t\tslot = fromIndex;\n\t\t\t\tbreak;\n\t\t\tcase \"below\": // Intentional fall-through\n\t\t\tdefault:\n\t\t\t\tslot = fromIndex + 1;\n\t\t\t\tbreak;\n\t\t}\n\t} else {\n\t\t// The tiddler is opened from outside the river. Determine where to insert the tiddler; default is \"top\"\n\t\tif(options.openLinkFromOutsideRiver === \"bottom\") {\n\t\t\t// Insert at bottom\n\t\t\tslot = storyList.length;\n\t\t} else {\n\t\t\t// Insert at top\n\t\t\tslot = 0;\n\t\t}\n\t}\n\t// Add the tiddler\n\tstoryList.splice(slot,0,navigateTo);\n\t// Save the story\n\tthis.saveStoryList(storyList);\n};\n\nStory.prototype.saveStoryList = function(storyList) {\n\tvar storyTiddler = this.wiki.getTiddler(this.storyTitle);\n\tthis.wiki.addTiddler(new $tw.Tiddler(\n\t\tthis.wiki.getCreationFields(),\n\t\t{title: this.storyTitle},\n\t\tstoryTiddler,\n\t\t{list: storyList},\n\t\tthis.wiki.getModificationFields()\n\t));\n};\n\nStory.prototype.addToHistory = function(navigateTo,navigateFromClientRect) {\n\tvar titles = $tw.utils.isArray(navigateTo) ? navigateTo : [navigateTo];\n\t// Add a new record to the top of the history stack\n\tvar historyList = this.wiki.getTiddlerData(this.historyTitle,[]);\n\t$tw.utils.each(titles,function(title) {\n\t\thistoryList.push({title: title, fromPageRect: navigateFromClientRect});\n\t});\n\tthis.wiki.setTiddlerData(this.historyTitle,historyList,{\"current-tiddler\": titles[titles.length-1]});\n};\n\nStory.prototype.storyCloseTiddler = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storyCloseAllTiddlers = function() {\n// TBD\n};\n\nStory.prototype.storyCloseOtherTiddlers = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storyEditTiddler = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storyDeleteTiddler = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storySaveTiddler = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storyCancelTiddler = function(targetTitle) {\n// TBD\n};\n\nStory.prototype.storyNewTiddler = function(targetTitle) {\n// TBD\n};\n\nexports.Story = Story;\n\n\n})();\n",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/storyviews/classic.js": {
"title": "$:/core/modules/storyviews/classic.js",
"text": "/*\\\ntitle: $:/core/modules/storyviews/classic.js\ntype: application/javascript\nmodule-type: storyview\n\nViews the story as a linear sequence\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar easing = \"cubic-bezier(0.645, 0.045, 0.355, 1)\"; // From http://easings.net/#easeInOutCubic\n\nvar ClassicStoryView = function(listWidget) {\n\tthis.listWidget = listWidget;\n};\n\nClassicStoryView.prototype.navigateTo = function(historyInfo) {\n\tvar duration = $tw.utils.getAnimationDuration()\n\tvar listElementIndex = this.listWidget.findListItem(0,historyInfo.title);\n\tif(listElementIndex === undefined) {\n\t\treturn;\n\t}\n\tvar listItemWidget = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listItemWidget.findFirstDomNode();\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\treturn;\n\t}\n\tif(duration) {\n\t\t// Scroll the node into view\n\t\tthis.listWidget.dispatchEvent({type: \"tm-scroll\", target: targetElement});\n\t} else {\n\t\ttargetElement.scrollIntoView();\n\t}\n};\n\nClassicStoryView.prototype.insert = function(widget) {\n\tvar duration = $tw.utils.getAnimationDuration();\n\tif(duration) {\n\t\tvar targetElement = widget.findFirstDomNode();\n\t\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\t\tif(!(targetElement instanceof Element)) {\n\t\t\treturn;\n\t\t}\n\t\t// Get the current height of the tiddler\n\t\tvar computedStyle = window.getComputedStyle(targetElement),\n\t\t\tcurrMarginBottom = parseInt(computedStyle.marginBottom,10),\n\t\t\tcurrMarginTop = parseInt(computedStyle.marginTop,10),\n\t\t\tcurrHeight = targetElement.offsetHeight + currMarginTop;\n\t\t// Reset the margin once the transition is over\n\t\tsetTimeout(function() {\n\t\t\t$tw.utils.setStyle(targetElement,[\n\t\t\t\t{transition: \"none\"},\n\t\t\t\t{marginBottom: \"\"}\n\t\t\t]);\n\t\t},duration);\n\t\t// Set up the initial position of the element\n\t\t$tw.utils.setStyle(targetElement,[\n\t\t\t{transition: \"none\"},\n\t\t\t{marginBottom: (-currHeight) + \"px\"},\n\t\t\t{opacity: \"0.0\"}\n\t\t]);\n\t\t$tw.utils.forceLayout(targetElement);\n\t\t// Transition to the final position\n\t\t$tw.utils.setStyle(targetElement,[\n\t\t\t{transition: \"opacity \" + duration + \"ms \" + easing + \", \" +\n\t\t\t\t\t\t\"margin-bottom \" + duration + \"ms \" + easing},\n\t\t\t{marginBottom: currMarginBottom + \"px\"},\n\t\t\t{opacity: \"1.0\"}\n\t]);\n\t}\n};\n\nClassicStoryView.prototype.remove = function(widget) {\n\tvar duration = $tw.utils.getAnimationDuration();\n\tif(duration) {\n\t\tvar targetElement = widget.findFirstDomNode(),\n\t\t\tremoveElement = function() {\n\t\t\t\twidget.removeChildDomNodes();\n\t\t\t};\n\t\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\t\tif(!(targetElement instanceof Element)) {\n\t\t\tremoveElement();\n\t\t\treturn;\n\t\t}\n\t\t// Get the current height of the tiddler\n\t\tvar currWidth = targetElement.offsetWidth,\n\t\t\tcomputedStyle = window.getComputedStyle(targetElement),\n\t\t\tcurrMarginBottom = parseInt(computedStyle.marginBottom,10),\n\t\t\tcurrMarginTop = parseInt(computedStyle.marginTop,10),\n\t\t\tcurrHeight = targetElement.offsetHeight + currMarginTop;\n\t\t// Remove the dom nodes of the widget at the end of the transition\n\t\tsetTimeout(removeElement,duration);\n\t\t// Animate the closure\n\t\t$tw.utils.setStyle(targetElement,[\n\t\t\t{transition: \"none\"},\n\t\t\t{transform: \"translateX(0px)\"},\n\t\t\t{marginBottom: currMarginBottom + \"px\"},\n\t\t\t{opacity: \"1.0\"}\n\t\t]);\n\t\t$tw.utils.forceLayout(targetElement);\n\t\t$tw.utils.setStyle(targetElement,[\n\t\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms \" + easing + \", \" +\n\t\t\t\t\t\t\"opacity \" + duration + \"ms \" + easing + \", \" +\n\t\t\t\t\t\t\"margin-bottom \" + duration + \"ms \" + easing},\n\t\t\t{transform: \"translateX(-\" + currWidth + \"px)\"},\n\t\t\t{marginBottom: (-currHeight) + \"px\"},\n\t\t\t{opacity: \"0.0\"}\n\t\t]);\n\t} else {\n\t\twidget.removeChildDomNodes();\n\t}\n};\n\nexports.classic = ClassicStoryView;\n\n})();",
"type": "application/javascript",
"module-type": "storyview"
},
"$:/core/modules/storyviews/pop.js": {
"title": "$:/core/modules/storyviews/pop.js",
"text": "/*\\\ntitle: $:/core/modules/storyviews/pop.js\ntype: application/javascript\nmodule-type: storyview\n\nAnimates list insertions and removals\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar PopStoryView = function(listWidget) {\n\tthis.listWidget = listWidget;\n};\n\nPopStoryView.prototype.navigateTo = function(historyInfo) {\n\tvar listElementIndex = this.listWidget.findListItem(0,historyInfo.title);\n\tif(listElementIndex === undefined) {\n\t\treturn;\n\t}\n\tvar listItemWidget = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listItemWidget.findFirstDomNode();\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\treturn;\n\t}\n\t// Scroll the node into view\n\tthis.listWidget.dispatchEvent({type: \"tm-scroll\", target: targetElement});\n};\n\nPopStoryView.prototype.insert = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration();\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\treturn;\n\t}\n\t// Reset once the transition is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(targetElement,[\n\t\t\t{transition: \"none\"},\n\t\t\t{transform: \"none\"}\n\t\t]);\n\t\t$tw.utils.setStyle(widget.document.body,[\n\t\t\t{\"overflow-x\": \"\"}\n\t\t]);\n\t},duration);\n\t// Prevent the page from overscrolling due to the zoom factor\n\t$tw.utils.setStyle(widget.document.body,[\n\t\t{\"overflow-x\": \"hidden\"}\n\t]);\n\t// Set up the initial position of the element\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"none\"},\n\t\t{transform: \"scale(2)\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t// Transition to the final position\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms ease-in-out\"},\n\t\t{transform: \"scale(1)\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n};\n\nPopStoryView.prototype.remove = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration(),\n\t\tremoveElement = function() {\n\t\t\tif(targetElement && targetElement.parentNode) {\n\t\t\t\twidget.removeChildDomNodes();\n\t\t\t}\n\t\t};\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\tremoveElement();\n\t\treturn;\n\t}\n\t// Remove the element at the end of the transition\n\tsetTimeout(removeElement,duration);\n\t// Animate the closure\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: \"none\"},\n\t\t{transform: \"scale(1)\"},\n\t\t{opacity: \"1.0\"}\n\t]);\n\t$tw.utils.forceLayout(targetElement);\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms ease-in-out\"},\n\t\t{transform: \"scale(0.1)\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n};\n\nexports.pop = PopStoryView;\n\n})();\n",
"type": "application/javascript",
"module-type": "storyview"
},
"$:/core/modules/storyviews/zoomin.js": {
"title": "$:/core/modules/storyviews/zoomin.js",
"text": "/*\\\ntitle: $:/core/modules/storyviews/zoomin.js\ntype: application/javascript\nmodule-type: storyview\n\nZooms between individual tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar easing = \"cubic-bezier(0.645, 0.045, 0.355, 1)\"; // From http://easings.net/#easeInOutCubic\n\nvar ZoominListView = function(listWidget) {\n\tvar self = this;\n\tthis.listWidget = listWidget;\n\t// Get the index of the tiddler that is at the top of the history\n\tvar history = this.listWidget.wiki.getTiddlerDataCached(this.listWidget.historyTitle,[]),\n\t\ttargetTiddler;\n\tif(history.length > 0) {\n\t\ttargetTiddler = history[history.length-1].title;\n\t}\n\t// Make all the tiddlers position absolute, and hide all but the top (or first) one\n\t$tw.utils.each(this.listWidget.children,function(itemWidget,index) {\n\t\tvar domNode = itemWidget.findFirstDomNode();\n\t\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\t\tif(!(domNode instanceof Element)) {\n\t\t\treturn;\n\t\t}\n\t\tif((targetTiddler && targetTiddler !== itemWidget.parseTreeNode.itemTitle) || (!targetTiddler && index)) {\n\t\t\tdomNode.style.display = \"none\";\n\t\t} else {\n\t\t\tself.currentTiddlerDomNode = domNode;\n\t\t}\n\t\t$tw.utils.addClass(domNode,\"tc-storyview-zoomin-tiddler\");\n\t});\n};\n\nZoominListView.prototype.navigateTo = function(historyInfo) {\n\tvar duration = $tw.utils.getAnimationDuration(),\n\t\tlistElementIndex = this.listWidget.findListItem(0,historyInfo.title);\n\tif(listElementIndex === undefined) {\n\t\treturn;\n\t}\n\tvar listItemWidget = this.listWidget.children[listElementIndex],\n\t\ttargetElement = listItemWidget.findFirstDomNode();\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\treturn;\n\t}\n\t// Make the new tiddler be position absolute and visible so that we can measure it\n\t$tw.utils.addClass(targetElement,\"tc-storyview-zoomin-tiddler\");\n\t$tw.utils.setStyle(targetElement,[\n\t\t{display: \"block\"},\n\t\t{transformOrigin: \"0 0\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t{transition: \"none\"},\n\t\t{opacity: \"0.0\"}\n\t]);\n\t// Get the position of the source node, or use the centre of the window as the source position\n\tvar sourceBounds = historyInfo.fromPageRect || {\n\t\t\tleft: window.innerWidth/2 - 2,\n\t\t\ttop: window.innerHeight/2 - 2,\n\t\t\twidth: window.innerWidth/8,\n\t\t\theight: window.innerHeight/8\n\t\t};\n\t// Try to find the title node in the target tiddler\n\tvar titleDomNode = findTitleDomNode(listItemWidget) || listItemWidget.findFirstDomNode(),\n\t\tzoomBounds = titleDomNode.getBoundingClientRect();\n\t// Compute the transform for the target tiddler to make the title lie over the source rectange\n\tvar targetBounds = targetElement.getBoundingClientRect(),\n\t\tscale = sourceBounds.width / zoomBounds.width,\n\t\tx = sourceBounds.left - targetBounds.left - (zoomBounds.left - targetBounds.left) * scale,\n\t\ty = sourceBounds.top - targetBounds.top - (zoomBounds.top - targetBounds.top) * scale;\n\t// Transform the target tiddler to its starting position\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transform: \"translateX(\" + x + \"px) translateY(\" + y + \"px) scale(\" + scale + \")\"}\n\t]);\n\t// Force layout\n\t$tw.utils.forceLayout(targetElement);\n\t// Apply the ending transitions with a timeout to ensure that the previously applied transformations are applied first\n\tvar self = this,\n\t\tprevCurrentTiddler = this.currentTiddlerDomNode;\n\tthis.currentTiddlerDomNode = targetElement;\n\t// Transform the target tiddler to its natural size\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms \" + easing + \", opacity \" + duration + \"ms \" + easing},\n\t\t{opacity: \"1.0\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t{zIndex: \"500\"},\n\t]);\n\t// Transform the previous tiddler out of the way and then hide it\n\tif(prevCurrentTiddler && prevCurrentTiddler !== targetElement) {\n\t\tscale = zoomBounds.width / sourceBounds.width;\n\t\tx = zoomBounds.left - targetBounds.left - (sourceBounds.left - targetBounds.left) * scale;\n\t\ty = zoomBounds.top - targetBounds.top - (sourceBounds.top - targetBounds.top) * scale;\n\t\t$tw.utils.setStyle(prevCurrentTiddler,[\n\t\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms \" + easing + \", opacity \" + duration + \"ms \" + easing},\n\t\t\t{opacity: \"0.0\"},\n\t\t\t{transformOrigin: \"0 0\"},\n\t\t\t{transform: \"translateX(\" + x + \"px) translateY(\" + y + \"px) scale(\" + scale + \")\"},\n\t\t\t{zIndex: \"0\"}\n\t\t]);\n\t\t// Hide the tiddler when the transition has finished\n\t\tsetTimeout(function() {\n\t\t\tif(self.currentTiddlerDomNode !== prevCurrentTiddler) {\n\t\t\t\tprevCurrentTiddler.style.display = \"none\";\n\t\t\t}\n\t\t},duration);\n\t}\n\t// Scroll the target into view\n//\t$tw.pageScroller.scrollIntoView(targetElement);\n};\n\n/*\nFind the first child DOM node of a widget that has the class \"tc-title\"\n*/\nfunction findTitleDomNode(widget,targetClass) {\n\ttargetClass = targetClass || \"tc-title\";\n\tvar domNode = widget.findFirstDomNode();\n\tif(domNode && domNode.querySelector) {\n\t\treturn domNode.querySelector(\".\" + targetClass);\n\t}\n\treturn null;\n}\n\nZoominListView.prototype.insert = function(widget) {\n\tvar targetElement = widget.findFirstDomNode();\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\treturn;\n\t}\n\t// Make the newly inserted node position absolute and hidden\n\t$tw.utils.addClass(targetElement,\"tc-storyview-zoomin-tiddler\");\n\t$tw.utils.setStyle(targetElement,[\n\t\t{display: \"none\"}\n\t]);\n};\n\nZoominListView.prototype.remove = function(widget) {\n\tvar targetElement = widget.findFirstDomNode(),\n\t\tduration = $tw.utils.getAnimationDuration(),\n\t\tremoveElement = function() {\n\t\t\twidget.removeChildDomNodes();\n\t\t};\n\t// Abandon if the list entry isn't a DOM element (it might be a text node)\n\tif(!(targetElement instanceof Element)) {\n\t\tremoveElement();\n\t\treturn;\n\t}\n\t// Abandon if hidden\n\tif(targetElement.style.display != \"block\" ) {\n\t\tremoveElement();\n\t\treturn;\n\t}\n\t// Set up the tiddler that is being closed\n\t$tw.utils.addClass(targetElement,\"tc-storyview-zoomin-tiddler\");\n\t$tw.utils.setStyle(targetElement,[\n\t\t{display: \"block\"},\n\t\t{transformOrigin: \"50% 50%\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t{transition: \"none\"},\n\t\t{zIndex: \"0\"}\n\t]);\n\t// We'll move back to the previous or next element in the story\n\tvar toWidget = widget.previousSibling();\n\tif(!toWidget) {\n\t\ttoWidget = widget.nextSibling();\n\t}\n\tvar toWidgetDomNode = toWidget && toWidget.findFirstDomNode();\n\t// Set up the tiddler we're moving back in\n\tif(toWidgetDomNode) {\n\t\t$tw.utils.addClass(toWidgetDomNode,\"tc-storyview-zoomin-tiddler\");\n\t\t$tw.utils.setStyle(toWidgetDomNode,[\n\t\t\t{display: \"block\"},\n\t\t\t{transformOrigin: \"50% 50%\"},\n\t\t\t{transform: \"translateX(0px) translateY(0px) scale(10)\"},\n\t\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms \" + easing + \", opacity \" + duration + \"ms \" + easing},\n\t\t\t{opacity: \"0\"},\n\t\t\t{zIndex: \"500\"}\n\t\t]);\n\t\tthis.currentTiddlerDomNode = toWidgetDomNode;\n\t}\n\t// Animate them both\n\t// Force layout\n\t$tw.utils.forceLayout(this.listWidget.parentDomNode);\n\t// First, the tiddler we're closing\n\t$tw.utils.setStyle(targetElement,[\n\t\t{transformOrigin: \"50% 50%\"},\n\t\t{transform: \"translateX(0px) translateY(0px) scale(0.1)\"},\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms \" + easing + \", opacity \" + duration + \"ms \" + easing},\n\t\t{opacity: \"0\"},\n\t\t{zIndex: \"0\"}\n\t]);\n\tsetTimeout(removeElement,duration);\n\t// Now the tiddler we're going back to\n\tif(toWidgetDomNode) {\n\t\t$tw.utils.setStyle(toWidgetDomNode,[\n\t\t\t{transform: \"translateX(0px) translateY(0px) scale(1)\"},\n\t\t\t{opacity: \"1\"}\n\t\t]);\n\t}\n\treturn true; // Indicate that we'll delete the DOM node\n};\n\nexports.zoomin = ZoominListView;\n\n})();\n",
"type": "application/javascript",
"module-type": "storyview"
},
"$:/core/modules/syncer.js": {
"title": "$:/core/modules/syncer.js",
"text": "/*\\\ntitle: $:/core/modules/syncer.js\ntype: application/javascript\nmodule-type: global\n\nThe syncer tracks changes to the store and synchronises them to a remote data store represented as a \"sync adaptor\"\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nDefaults\n*/\nSyncer.prototype.titleIsLoggedIn = \"$:/status/IsLoggedIn\";\nSyncer.prototype.titleIsAnonymous = \"$:/status/IsAnonymous\";\nSyncer.prototype.titleIsReadOnly = \"$:/status/IsReadOnly\";\nSyncer.prototype.titleUserName = \"$:/status/UserName\";\nSyncer.prototype.titleSyncFilter = \"$:/config/SyncFilter\";\nSyncer.prototype.titleSyncDisablePolling = \"$:/config/SyncDisablePolling\";\nSyncer.prototype.titleSyncPollingInterval = \"$:/config/SyncPollingInterval\";\nSyncer.prototype.titleSyncDisableLazyLoading = \"$:/config/SyncDisableLazyLoading\";\nSyncer.prototype.titleSavedNotification = \"$:/language/Notifications/Save/Done\";\nSyncer.prototype.titleSyncThrottleInterval = \"$:/config/SyncThrottleInterval\";\nSyncer.prototype.taskTimerInterval = 1 * 1000; // Interval for sync timer\nSyncer.prototype.throttleInterval = 1 * 1000; // Defer saving tiddlers if they've changed in the last 1s...\nSyncer.prototype.errorRetryInterval = 5 * 1000; // Interval to retry after an error\nSyncer.prototype.fallbackInterval = 10 * 1000; // Unless the task is older than 10s\nSyncer.prototype.pollTimerInterval = 60 * 1000; // Interval for polling for changes from the adaptor\n\n/*\nInstantiate the syncer with the following options:\nsyncadaptor: reference to syncadaptor to be used\nwiki: wiki to be synced\n*/\nfunction Syncer(options) {\n\tvar self = this;\n\tthis.wiki = options.wiki;\n\t// Save parameters\n\tthis.syncadaptor = options.syncadaptor;\n\tthis.disableUI = !!options.disableUI;\n\tthis.titleIsLoggedIn = options.titleIsLoggedIn || this.titleIsLoggedIn;\n\tthis.titleUserName = options.titleUserName || this.titleUserName;\n\tthis.titleSyncFilter = options.titleSyncFilter || this.titleSyncFilter;\n\tthis.titleSavedNotification = options.titleSavedNotification || this.titleSavedNotification;\n\tthis.taskTimerInterval = options.taskTimerInterval || this.taskTimerInterval;\n\tthis.throttleInterval = options.throttleInterval || parseInt(this.wiki.getTiddlerText(this.titleSyncThrottleInterval,\"\"),10) || this.throttleInterval;\n\tthis.errorRetryInterval = options.errorRetryInterval || this.errorRetryInterval;\n\tthis.fallbackInterval = options.fallbackInterval || this.fallbackInterval;\n\tthis.pollTimerInterval = options.pollTimerInterval || parseInt(this.wiki.getTiddlerText(this.titleSyncPollingInterval,\"\"),10) || this.pollTimerInterval;\n\tthis.logging = \"logging\" in options ? options.logging : true;\n\t// Make a logger\n\tthis.logger = new $tw.utils.Logger(\"syncer\" + ($tw.browser ? \"-browser\" : \"\") + ($tw.node ? \"-server\" : \"\") + (this.syncadaptor.name ? (\"-\" + this.syncadaptor.name) : \"\"),{\n\t\tcolour: \"cyan\",\n\t\tenable: this.logging,\n\t\tsaveHistory: true\n\t});\n\t// Make another logger for connection errors\n\tthis.loggerConnection = new $tw.utils.Logger(\"syncer\" + ($tw.browser ? \"-browser\" : \"\") + ($tw.node ? \"-server\" : \"\") + (this.syncadaptor.name ? (\"-\" + this.syncadaptor.name) : \"\") + \"-connection\",{\n\t\tcolour: \"cyan\",\n\t\tenable: this.logging\n\t});\n\t// Ask the syncadaptor to use the main logger\n\tif(this.syncadaptor.setLoggerSaveBuffer) {\n\t\tthis.syncadaptor.setLoggerSaveBuffer(this.logger);\n\t}\n\t// Compile the dirty tiddler filter\n\tthis.filterFn = this.wiki.compileFilter(this.wiki.getTiddlerText(this.titleSyncFilter));\n\t// Record information for known tiddlers\n\tthis.readTiddlerInfo();\n\tthis.titlesToBeLoaded = {}; // Hashmap of titles of tiddlers that need loading from the server\n\tthis.titlesHaveBeenLazyLoaded = {}; // Hashmap of titles of tiddlers that have already been lazily loaded from the server\n\t// Timers\n\tthis.taskTimerId = null; // Timer for task dispatch\n\tthis.pollTimerId = null; // Timer for polling server\n\t// Number of outstanding requests\n\tthis.numTasksInProgress = 0;\n\t// Listen out for changes to tiddlers\n\tthis.wiki.addEventListener(\"change\",function(changes) {\n\t\t// Filter the changes to just include ones that are being synced\n\t\tvar filteredChanges = self.getSyncedTiddlers(function(callback) {\n\t\t\t$tw.utils.each(changes,function(change,title) {\n\t\t\t\tvar tiddler = self.wiki.tiddlerExists(title) && self.wiki.getTiddler(title);\n\t\t\t\tcallback(tiddler,title);\n\t\t\t});\n\t\t});\n\t\tif(filteredChanges.length > 0) {\n\t\t\tself.processTaskQueue();\n\t\t} else {\n\t\t\t// Look for deletions of tiddlers we're already syncing\n\t\t\tvar outstandingDeletion = false\n\t\t\t$tw.utils.each(changes,function(change,title,object) {\n\t\t\t\tif(change.deleted && $tw.utils.hop(self.tiddlerInfo,title)) {\n\t\t\t\t\toutstandingDeletion = true;\n\t\t\t\t}\n\t\t\t});\n\t\t\tif(outstandingDeletion) {\n\t\t\t\tself.processTaskQueue();\n\t\t\t}\n\t\t}\n\t});\n\t// Browser event handlers\n\tif($tw.browser && !this.disableUI) {\n\t\t// Set up our beforeunload handler\n\t\t$tw.addUnloadTask(function(event) {\n\t\t\tvar confirmationMessage;\n\t\t\tif(self.isDirty()) {\n\t\t\t\tconfirmationMessage = $tw.language.getString(\"UnsavedChangesWarning\");\n\t\t\t\tevent.returnValue = confirmationMessage; // Gecko\n\t\t\t}\n\t\t\treturn confirmationMessage;\n\t\t});\n\t\t// Listen out for login/logout/refresh events in the browser\n\t\t$tw.rootWidget.addEventListener(\"tm-login\",function(event) {\n\t\t\tvar username = event && event.paramObject && event.paramObject.username,\n\t\t\t\tpassword = event && event.paramObject && event.paramObject.password;\n\t\t\tif(username && password) {\n\t\t\t\t// Login with username and password\n\t\t\t\tself.login(username,password,function() {});\n\t\t\t} else {\n\t\t\t\t// No username and password, so we display a prompt\n\t\t\t\tself.handleLoginEvent();\n\t\t\t}\n\t\t});\n\t\t$tw.rootWidget.addEventListener(\"tm-logout\",function() {\n\t\t\tself.handleLogoutEvent();\n\t\t});\n\t\t$tw.rootWidget.addEventListener(\"tm-server-refresh\",function() {\n\t\t\tself.handleRefreshEvent();\n\t\t});\n\t\t$tw.rootWidget.addEventListener(\"tm-copy-syncer-logs-to-clipboard\",function() {\n\t\t\t$tw.utils.copyToClipboard($tw.utils.getSystemInfo() + \"\\n\\nLog:\\n\" + self.logger.getBuffer());\n\t\t});\n\t}\n\t// Listen out for lazyLoad events\n\tif(!this.disableUI && this.wiki.getTiddlerText(this.titleSyncDisableLazyLoading) !== \"yes\") {\n\t\tthis.wiki.addEventListener(\"lazyLoad\",function(title) {\n\t\t\tself.handleLazyLoadEvent(title);\n\t\t});\n\t}\n\t// Get the login status\n\tthis.getStatus(function(err,isLoggedIn) {\n\t\t// Do a sync from the server\n\t\tself.syncFromServer();\n\t});\n}\n\n/*\nShow a generic network error alert\n*/\nSyncer.prototype.displayError = function(msg,err) {\n\tif(err === ($tw.language.getString(\"Error/XMLHttpRequest\") + \": 0\")) {\n\t\tthis.loggerConnection.alert($tw.language.getString(\"Error/NetworkErrorAlert\"));\n\t\tthis.logger.log(msg + \":\",err);\n\t} else {\n\t\tthis.logger.alert(msg + \":\",err);\n\t}\n};\n\n/*\nReturn an array of the tiddler titles that are subjected to syncing\n*/\nSyncer.prototype.getSyncedTiddlers = function(source) {\n\treturn this.filterFn.call(this.wiki,source);\n};\n\n/*\nReturn an array of the tiddler titles that are subjected to syncing\n*/\nSyncer.prototype.getTiddlerRevision = function(title) {\n\tif(this.syncadaptor && this.syncadaptor.getTiddlerRevision) {\n\t\treturn this.syncadaptor.getTiddlerRevision(title);\n\t} else {\n\t\treturn this.wiki.getTiddler(title).fields.revision;\n\t}\n};\n\n/*\nRead (or re-read) the latest tiddler info from the store\n*/\nSyncer.prototype.readTiddlerInfo = function() {\n\t// Hashmap by title of {revision:,changeCount:,adaptorInfo:}\n\t// \"revision\" is the revision of the tiddler last seen on the server, and \"changecount\" is the corresponding local changecount\n\tthis.tiddlerInfo = {};\n\t// Record information for known tiddlers\n\tvar self = this,\n\t\ttiddlers = this.getSyncedTiddlers();\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar tiddler = self.wiki.getTiddler(title);\n\t\tif(tiddler) {\n\t\t\tself.tiddlerInfo[title] = {\n\t\t\t\trevision: self.getTiddlerRevision(title),\n\t\t\t\tadaptorInfo: self.syncadaptor && self.syncadaptor.getTiddlerInfo(tiddler),\n\t\t\t\tchangeCount: self.wiki.getChangeCount(title)\n\t\t\t};\n\t\t}\n\t});\n};\n\n/*\nChecks whether the wiki is dirty (ie the window shouldn't be closed)\n*/\nSyncer.prototype.isDirty = function() {\n\tthis.logger.log(\"Checking dirty status\");\n\t// Check tiddlers that are in the store and included in the filter function\n\tvar titles = this.getSyncedTiddlers();\n\tfor(var index=0; index<titles.length; index++) {\n\t\tvar title = titles[index],\n\t\t\ttiddlerInfo = this.tiddlerInfo[title];\n\t\tif(this.wiki.tiddlerExists(title)) {\n\t\t\tif(tiddlerInfo) {\n\t\t\t\t// If the tiddler is known on the server and has been modified locally then it needs to be saved to the server\n\t\t\t\tif(this.wiki.getChangeCount(title) > tiddlerInfo.changeCount) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// If the tiddler isn't known on the server then it needs to be saved to the server\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\t// Check tiddlers that are known from the server but not currently in the store\n\ttitles = Object.keys(this.tiddlerInfo);\n\tfor(index=0; index<titles.length; index++) {\n\t\tif(!this.wiki.tiddlerExists(titles[index])) {\n\t\t\t// There must be a pending delete\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n\n/*\nUpdate the document body with the class \"tc-dirty\" if the wiki has unsaved/unsynced changes\n*/\nSyncer.prototype.updateDirtyStatus = function() {\n\tif($tw.browser && !this.disableUI) {\n\t\tvar dirty = this.isDirty();\n\t\t$tw.utils.toggleClass(document.body,\"tc-dirty\",dirty);\n\t\tif(!dirty) {\n\t\t\tthis.loggerConnection.clearAlerts();\n\t\t}\n\t}\n};\n\n/*\nSave an incoming tiddler in the store, and updates the associated tiddlerInfo\n*/\nSyncer.prototype.storeTiddler = function(tiddlerFields) {\n\t// Save the tiddler\n\tvar tiddler = new $tw.Tiddler(tiddlerFields);\n\tthis.wiki.addTiddler(tiddler);\n\t// Save the tiddler revision and changeCount details\n\tthis.tiddlerInfo[tiddlerFields.title] = {\n\t\trevision: this.getTiddlerRevision(tiddlerFields.title),\n\t\tadaptorInfo: this.syncadaptor.getTiddlerInfo(tiddler),\n\t\tchangeCount: this.wiki.getChangeCount(tiddlerFields.title)\n\t};\n};\n\nSyncer.prototype.getStatus = function(callback) {\n\tvar self = this;\n\t// Check if the adaptor supports getStatus()\n\tif(this.syncadaptor && this.syncadaptor.getStatus) {\n\t\t// Mark us as not logged in\n\t\tthis.wiki.addTiddler({title: this.titleIsLoggedIn,text: \"no\"});\n\t\t// Get login status\n\t\tthis.syncadaptor.getStatus(function(err,isLoggedIn,username,isReadOnly,isAnonymous,isPollingDisabled) {\n\t\t\tif(err) {\n\t\t\t\tself.logger.alert(err);\n\t\t\t} else {\n\t\t\t\t// Set the various status tiddlers\n\t\t\t\tself.wiki.addTiddler({title: self.titleIsReadOnly,text: isReadOnly ? \"yes\" : \"no\"});\n\t\t\t\tself.wiki.addTiddler({title: self.titleIsAnonymous,text: isAnonymous ? \"yes\" : \"no\"});\n\t\t\t\tself.wiki.addTiddler({title: self.titleIsLoggedIn,text: isLoggedIn ? \"yes\" : \"no\"});\n\t\t\t\tif(isLoggedIn) {\n\t\t\t\t\tself.wiki.addTiddler({title: self.titleUserName,text: username || \"\"});\n\t\t\t\t}\n\t\t\t\tif(isPollingDisabled) {\n\t\t\t\t\tself.wiki.addTiddler({title: self.titleSyncDisablePolling, text: \"yes\"});\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Invoke the callback\n\t\t\tif(callback) {\n\t\t\t\tcallback(err,isLoggedIn,username);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tcallback(null,true,\"UNAUTHENTICATED\");\n\t}\n};\n\n/*\nSynchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date\n*/\nSyncer.prototype.syncFromServer = function() {\n\tvar self = this,\n\t\tcancelNextSync = function() {\n\t\t\tif(self.pollTimerId) {\n\t\t\t\tclearTimeout(self.pollTimerId);\n\t\t\t\tself.pollTimerId = null;\n\t\t\t}\n\t\t},\n\t\ttriggerNextSync = function() {\n\t\t\tif(pollingEnabled) {\n\t\t\t\tself.pollTimerId = setTimeout(function() {\n\t\t\t\t\tself.pollTimerId = null;\n\t\t\t\t\tself.syncFromServer.call(self);\n\t\t\t\t},self.pollTimerInterval);\n\t\t\t}\n\t\t},\n\t\tsyncSystemFromServer = (self.wiki.getTiddlerText(\"$:/config/SyncSystemTiddlersFromServer\") === \"yes\"),\n\t\tpollingEnabled = (self.wiki.getTiddlerText(self.titleSyncDisablePolling) !== \"yes\");\n\tif(this.syncadaptor && this.syncadaptor.getUpdatedTiddlers) {\n\t\tthis.logger.log(\"Retrieving updated tiddler list\");\n\t\tcancelNextSync();\n\t\tthis.syncadaptor.getUpdatedTiddlers(self,function(err,updates) {\n\t\t\ttriggerNextSync();\n\t\t\tif(err) {\n\t\t\t\tself.displayError($tw.language.getString(\"Error/RetrievingSkinny\"),err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(updates) {\n\t\t\t\t$tw.utils.each(updates.modifications,function(title) {\n\t\t\t\t\tself.titlesToBeLoaded[title] = true;\n\t\t\t\t});\n\t\t\t\t$tw.utils.each(updates.deletions,function(title) {\n\t\t\t\t\tif(syncSystemFromServer || !self.wiki.isSystemTiddler(title)) {\n\t\t\t\t\t\tdelete self.tiddlerInfo[title];\n\t\t\t\t\t\tself.logger.log(\"Deleting tiddler missing from server:\",title);\n\t\t\t\t\t\tself.wiki.deleteTiddler(title);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif(updates.modifications.length > 0 || updates.deletions.length > 0) {\n\t\t\t\t\tself.processTaskQueue();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else if(this.syncadaptor && this.syncadaptor.getSkinnyTiddlers) {\n\t\tthis.logger.log(\"Retrieving skinny tiddler list\");\n\t\tcancelNextSync();\n\t\tthis.syncadaptor.getSkinnyTiddlers(function(err,tiddlers) {\n\t\t\ttriggerNextSync();\n\t\t\t// Check for errors\n\t\t\tif(err) {\n\t\t\t\tself.displayError($tw.language.getString(\"Error/RetrievingSkinny\"),err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Keep track of which tiddlers we already know about have been reported this time\n\t\t\tvar previousTitles = Object.keys(self.tiddlerInfo);\n\t\t\t// Process each incoming tiddler\n\t\t\tfor(var t=0; t<tiddlers.length; t++) {\n\t\t\t\t// Get the incoming tiddler fields, and the existing tiddler\n\t\t\t\tvar tiddlerFields = tiddlers[t],\n\t\t\t\t\tincomingRevision = tiddlerFields.revision + \"\",\n\t\t\t\t\ttiddler = self.wiki.tiddlerExists(tiddlerFields.title) && self.wiki.getTiddler(tiddlerFields.title),\n\t\t\t\t\ttiddlerInfo = self.tiddlerInfo[tiddlerFields.title],\n\t\t\t\t\tcurrRevision = tiddlerInfo ? tiddlerInfo.revision : null,\n\t\t\t\t\tindexInPreviousTitles = previousTitles.indexOf(tiddlerFields.title);\n\t\t\t\tif(indexInPreviousTitles !== -1) {\n\t\t\t\t\tpreviousTitles.splice(indexInPreviousTitles,1);\n\t\t\t\t}\n\t\t\t\t// Ignore the incoming tiddler if it's the same as the revision we've already got\n\t\t\t\tif(currRevision !== incomingRevision) {\n\t\t\t\t\t// Only load the skinny version if we don't already have a fat version of the tiddler\n\t\t\t\t\tif(!tiddler || tiddler.fields.text === undefined) {\n\t\t\t\t\t\tself.storeTiddler(tiddlerFields);\n\t\t\t\t\t}\n\t\t\t\t\t// Do a full load of this tiddler\n\t\t\t\t\tself.titlesToBeLoaded[tiddlerFields.title] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Delete any tiddlers that were previously reported but missing this time\n\t\t\t$tw.utils.each(previousTitles,function(title) {\n\t\t\t\tif(syncSystemFromServer || !self.wiki.isSystemTiddler(title)) {\n\t\t\t\t\tdelete self.tiddlerInfo[title];\n\t\t\t\t\tself.logger.log(\"Deleting tiddler missing from server:\",title);\n\t\t\t\t\tself.wiki.deleteTiddler(title);\n\t\t\t\t}\n\t\t\t});\n\t\t\tself.processTaskQueue();\n\t\t});\n\t}\n};\n\n/*\nForce load a tiddler from the server\n*/\nSyncer.prototype.enqueueLoadTiddler = function(title) {\n\tthis.titlesToBeLoaded[title] = true;\n\tthis.processTaskQueue();\n};\n\n/*\nLazily load a skinny tiddler if we can\n*/\nSyncer.prototype.handleLazyLoadEvent = function(title) {\n\t// Ignore if the syncadaptor doesn't handle it\n\tif(!this.syncadaptor.supportsLazyLoading) {\n\t\treturn;\n\t}\n\t// Don't lazy load the same tiddler twice\n\tif(!this.titlesHaveBeenLazyLoaded[title]) {\n\t\t// Don't lazy load if the tiddler isn't included in the sync filter\n\t\tif(this.getSyncedTiddlers().indexOf(title) !== -1) {\n\t\t\t// Mark the tiddler as needing loading, and having already been lazily loaded\n\t\t\tthis.titlesToBeLoaded[title] = true;\n\t\t\tthis.titlesHaveBeenLazyLoaded[title] = true;\n\t\t}\n\t}\n};\n\n/*\nDispay a password prompt and allow the user to login\n*/\nSyncer.prototype.handleLoginEvent = function() {\n\tvar self = this;\n\tthis.getStatus(function(err,isLoggedIn,username) {\n\t\tif(!err && !isLoggedIn) {\n\t\t\tif(self.syncadaptor && self.syncadaptor.displayLoginPrompt) {\n\t\t\t\tself.syncadaptor.displayLoginPrompt(self);\n\t\t\t} else {\n\t\t\t\tself.displayLoginPrompt();\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\nDispay a password prompt\n*/\nSyncer.prototype.displayLoginPrompt = function() {\n\tvar self = this;\n\tvar promptInfo = $tw.passwordPrompt.createPrompt({\n\t\tserviceName: $tw.language.getString(\"LoginToTiddlySpace\"),\n\t\tcallback: function(data) {\n\t\t\tself.login(data.username,data.password,function(err,isLoggedIn) {\n\t\t\t\tself.syncFromServer();\n\t\t\t});\n\t\t\treturn true; // Get rid of the password prompt\n\t\t}\n\t});\n};\n\n/*\nAttempt to login to TiddlyWeb.\n\tusername: username\n\tpassword: password\n\tcallback: invoked with arguments (err,isLoggedIn)\n*/\nSyncer.prototype.login = function(username,password,callback) {\n\tthis.logger.log(\"Attempting to login as\",username);\n\tvar self = this;\n\tif(this.syncadaptor.login) {\n\t\tthis.syncadaptor.login(username,password,function(err) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tself.getStatus(function(err,isLoggedIn,username) {\n\t\t\t\tif(callback) {\n\t\t\t\t\tcallback(err,isLoggedIn);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t} else {\n\t\tcallback(null,true);\n\t}\n};\n\n/*\nAttempt to log out of TiddlyWeb\n*/\nSyncer.prototype.handleLogoutEvent = function() {\n\tthis.logger.log(\"Attempting to logout\");\n\tvar self = this;\n\tif(this.syncadaptor.logout) {\n\t\tthis.syncadaptor.logout(function(err) {\n\t\t\tif(err) {\n\t\t\t\tself.logger.alert(err);\n\t\t\t} else {\n\t\t\t\tself.getStatus();\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\nImmediately refresh from the server\n*/\nSyncer.prototype.handleRefreshEvent = function() {\n\tthis.syncFromServer();\n};\n\n/*\nProcess the next task\n*/\nSyncer.prototype.processTaskQueue = function() {\n\tvar self = this;\n\t// Only process a task if the sync adaptor is fully initialised and we're not already performing\n\t// a task. If we are already performing a task then we'll dispatch the next one when it completes\n\tif((!this.syncadaptor.isReady || this.syncadaptor.isReady()) && this.numTasksInProgress === 0) {\n\t\t// Choose the next task to perform\n\t\tvar task = this.chooseNextTask();\n\t\t// Perform the task if we had one\n\t\tif(typeof task === \"object\" && task !== null) {\n\t\t\tthis.numTasksInProgress += 1;\n\t\t\ttask.run(function(err) {\n\t\t\t\tself.numTasksInProgress -= 1;\n\t\t\t\tif(err) {\n\t\t\t\t\tself.displayError(\"Sync error while processing \" + task.type + \" of '\" + task.title + \"'\",err);\n\t\t\t\t\tself.updateDirtyStatus();\n\t\t\t\t\tself.triggerTimeout(self.errorRetryInterval);\n\t\t\t\t} else {\n\t\t\t\t\tself.updateDirtyStatus();\n\t\t\t\t\t// Process the next task\n\t\t\t\t\tself.processTaskQueue.call(self);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\t// No task is ready so update the status\n\t\t\tthis.updateDirtyStatus();\n\t\t\t// And trigger a timeout if there is a pending task\n\t\t\tif(task === true) {\n\t\t\t\tthis.triggerTimeout();\n\t\t\t}\n\t\t}\n\t} else {\n\t\tthis.updateDirtyStatus();\n\t}\n};\n\nSyncer.prototype.triggerTimeout = function(interval) {\n\tvar self = this;\n\tif(!this.taskTimerId) {\n\t\tthis.taskTimerId = setTimeout(function() {\n\t\t\tself.taskTimerId = null;\n\t\t\tself.processTaskQueue.call(self);\n\t\t},interval || self.taskTimerInterval);\n\t}\n};\n\n/*\nChoose the next sync task. We prioritise saves, then deletes, then loads from the server\n\nReturns either a task object, null if there's no upcoming tasks, or the boolean true if there are pending tasks that aren't yet due\n*/\nSyncer.prototype.chooseNextTask = function() {\n\tvar thresholdLastSaved = (new Date()) - this.throttleInterval,\n\t\thavePending = null;\n\t// First we look for tiddlers that have been modified locally and need saving back to the server\n\tvar titles = this.getSyncedTiddlers();\n\tfor(var index=0; index<titles.length; index++) {\n\t\tvar title = titles[index],\n\t\t\ttiddler = this.wiki.tiddlerExists(title) && this.wiki.getTiddler(title),\n\t\t\ttiddlerInfo = this.tiddlerInfo[title];\n\t\tif(tiddler) {\n\t\t\t// If the tiddler is not known on the server, or has been modified locally no more recently than the threshold then it needs to be saved to the server\n\t\t\tvar hasChanged = !tiddlerInfo || this.wiki.getChangeCount(title) > tiddlerInfo.changeCount,\n\t\t\t\tisReadyToSave = !tiddlerInfo || !tiddlerInfo.timestampLastSaved || tiddlerInfo.timestampLastSaved < thresholdLastSaved;\n\t\t\tif(hasChanged) {\n\t\t\t\tif(isReadyToSave) {\n\t\t\t\t\treturn new SaveTiddlerTask(this,title);\n\t\t\t\t} else {\n\t\t\t\t\thavePending = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Second, we check tiddlers that are known from the server but not currently in the store, and so need deleting on the server\n\ttitles = Object.keys(this.tiddlerInfo);\n\tfor(index=0; index<titles.length; index++) {\n\t\ttitle = titles[index];\n\t\ttiddlerInfo = this.tiddlerInfo[title];\n\t\ttiddler = this.wiki.tiddlerExists(title) && this.wiki.getTiddler(title);\n\t\tif(!tiddler) {\n\t\t\treturn new DeleteTiddlerTask(this,title);\n\t\t}\n\t}\n\t// Check for tiddlers that need loading\n\ttitle = Object.keys(this.titlesToBeLoaded)[0];\n\tif(title) {\n\t\tdelete this.titlesToBeLoaded[title];\n\t\treturn new LoadTiddlerTask(this,title);\n\t}\n\t// No tasks are ready\n\treturn havePending;\n};\n\nfunction SaveTiddlerTask(syncer,title) {\n\tthis.syncer = syncer;\n\tthis.title = title;\n\tthis.type = \"save\";\n}\n\nSaveTiddlerTask.prototype.run = function(callback) {\n\tvar self = this,\n\t\tchangeCount = this.syncer.wiki.getChangeCount(this.title),\n\t\ttiddler = this.syncer.wiki.tiddlerExists(this.title) && this.syncer.wiki.getTiddler(this.title);\n\tthis.syncer.logger.log(\"Dispatching 'save' task:\",this.title);\n\tif(tiddler) {\n\t\tthis.syncer.syncadaptor.saveTiddler(tiddler,{\n\t\t\tchangeCount: changeCount,\n\t\t\ttiddlerInfo: self.syncer.tiddlerInfo[self.title]\n\t\t},function(err,adaptorInfo,revision) {\n\t\t\t// If there's an error, exit without changing any internal state\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\t// Adjust the info stored about this tiddler\n\t\t\tself.syncer.tiddlerInfo[self.title] = {\n\t\t\t\tchangeCount: changeCount,\n\t\t\t\tadaptorInfo: adaptorInfo,\n\t\t\t\trevision: revision,\n\t\t\t\ttimestampLastSaved: new Date()\n\t\t\t};\n\t\t\t// Invoke the callback\n\t\t\tcallback(null);\n\t\t});\n\t} else {\n\t\tthis.syncer.logger.log(\" Not Dispatching 'save' task:\",this.title,\"tiddler does not exist\");\n\t\t$tw.utils.nextTick(callback(null));\n\t}\n};\n\nfunction DeleteTiddlerTask(syncer,title) {\n\tthis.syncer = syncer;\n\tthis.title = title;\n\tthis.type = \"delete\";\n}\n\nDeleteTiddlerTask.prototype.run = function(callback) {\n\tvar self = this;\n\tthis.syncer.logger.log(\"Dispatching 'delete' task:\",this.title);\n\tthis.syncer.syncadaptor.deleteTiddler(this.title,{\n\t\ttiddlerInfo: self.syncer.tiddlerInfo[this.title]\n\t},function(err,adaptorInfo) {\n\t\t// If there's an error, exit without changing any internal state\n\t\tif(err) {\n\t\t\treturn callback(err);\n\t\t}\n\t\t// Remove the info stored about this tiddler\n\t\tdelete self.syncer.tiddlerInfo[self.title];\n\t\t// Invoke the callback\n\t\tcallback(null);\n\t});\n};\n\nfunction LoadTiddlerTask(syncer,title) {\n\tthis.syncer = syncer;\n\tthis.title = title;\n\tthis.type = \"load\";\n}\n\nLoadTiddlerTask.prototype.run = function(callback) {\n\tvar self = this;\n\tthis.syncer.logger.log(\"Dispatching 'load' task:\",this.title);\n\tthis.syncer.syncadaptor.loadTiddler(this.title,function(err,tiddlerFields) {\n\t\t// If there's an error, exit without changing any internal state\n\t\tif(err) {\n\t\t\treturn callback(err);\n\t\t}\n\t\t// Update the info stored about this tiddler\n\t\tif(tiddlerFields) {\n\t\t\tself.syncer.storeTiddler(tiddlerFields);\n\t\t}\n\t\t// Invoke the callback\n\t\tcallback(null);\n\t});\n};\n\nexports.Syncer = Syncer;\n\n})();\n",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/tiddler.js": {
"title": "$:/core/modules/tiddler.js",
"text": "/*\\\ntitle: $:/core/modules/tiddler.js\ntype: application/javascript\nmodule-type: tiddlermethod\n\nExtension methods for the $tw.Tiddler object (constructor and methods required at boot time are in boot/boot.js)\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.hasTag = function(tag) {\n\treturn this.fields.tags && this.fields.tags.indexOf(tag) !== -1;\n};\n\nexports.isPlugin = function() {\n\treturn this.fields.type === \"application/json\" && this.hasField(\"plugin-type\");\n};\n\nexports.isDraft = function() {\n\treturn this.hasField(\"draft.of\");\n};\n\nexports.getFieldString = function(field) {\n\tvar value = this.fields[field];\n\t// Check for a missing field\n\tif(value === undefined || value === null) {\n\t\treturn \"\";\n\t}\n\t// Parse the field with the associated module (if any)\n\tvar fieldModule = $tw.Tiddler.fieldModules[field];\n\tif(fieldModule && fieldModule.stringify) {\n\t\treturn fieldModule.stringify.call(this,value);\n\t} else {\n\t\treturn value.toString();\n\t}\n};\n\n/*\nGet the value of a field as a list\n*/\nexports.getFieldList = function(field) {\n\tvar value = this.fields[field];\n\t// Check for a missing field\n\tif(value === undefined || value === null) {\n\t\treturn [];\n\t}\n\treturn $tw.utils.parseStringArray(value);\n};\n\n/*\nGet all the fields as a hashmap of strings. Options:\n\texclude: an array of field names to exclude\n\tprefix: an optional field name prefix. Only fields with the prefix are included, and the prefix is stripped from the name\n*/\nexports.getFieldStrings = function(options) {\n\toptions = options || {};\n\tvar exclude = options.exclude || [],\n\t\tfields = {},\n\t\tfield;\n\tif(options.prefix) {\n\t\tfor(field in this.fields) {\n\t\t\tif($tw.utils.hop(this.fields,field)) {\n\t\t\t\tif(exclude.indexOf(field) === -1 && field.substring(0,options.prefix.length) === options.prefix) {\n\t\t\t\t\tfields[field.substring(options.prefix.length)] = this.getFieldString(field);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor(field in this.fields) {\n\t\t\tif($tw.utils.hop(this.fields,field)) {\n\t\t\t\tif(exclude.indexOf(field) === -1) {\n\t\t\t\t\tfields[field] = this.getFieldString(field);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn fields;\n};\n\n/*\nGet all the fields as a name:value block. Options:\n\texclude: an array of field names to exclude\n*/\nexports.getFieldStringBlock = function(options) {\n\toptions = options || {};\n\tvar exclude = options.exclude || [],\n\t\tfields = Object.keys(this.fields).sort(),\n\t\tresult = [];\n\tfor(var t=0; t<fields.length; t++) {\n\t\tvar field = fields[t];\n\t\tif(exclude.indexOf(field) === -1) {\n\t\t\tresult.push(field + \": \" + this.getFieldString(field));\n\t\t}\n\t}\n\treturn result.join(\"\\n\");\n};\n\nexports.getFieldDay = function(field) {\n\tif(this.cache && this.cache.day && $tw.utils.hop(this.cache.day,field) ) {\n\t\treturn this.cache.day[field];\n\t}\n\tvar day = \"\";\n\tif(this.fields[field]) {\n\t\tday = (new Date($tw.utils.parseDate(this.fields[field]))).setHours(0,0,0,0);\n\t}\n\tthis.cache.day = this.cache.day || {};\n\tthis.cache.day[field] = day;\n\treturn day;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "tiddlermethod"
},
"$:/core/modules/upgraders/plugins.js": {
"title": "$:/core/modules/upgraders/plugins.js",
"text": "/*\\\ntitle: $:/core/modules/upgraders/plugins.js\ntype: application/javascript\nmodule-type: upgrader\n\nUpgrader module that checks that plugins are newer than any already installed version\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar UPGRADE_LIBRARY_TITLE = \"$:/UpgradeLibrary\";\n\nvar BLOCKED_PLUGINS = {\n\t\"$:/themes/tiddlywiki/stickytitles\": {\n\t\tversions: [\"*\"]\n\t},\n\t\"$:/plugins/tiddlywiki/fullscreen\": {\n\t\tversions: [\"*\"]\n\t}\n};\n\nexports.upgrade = function(wiki,titles,tiddlers) {\n\tvar self = this,\n\t\tmessages = {},\n\t\tupgradeLibrary,\n\t\tgetLibraryTiddler = function(title) {\n\t\t\tif(!upgradeLibrary) {\n\t\t\t\tupgradeLibrary = wiki.getTiddlerData(UPGRADE_LIBRARY_TITLE,{});\n\t\t\t\tupgradeLibrary.tiddlers = upgradeLibrary.tiddlers || {};\n\t\t\t}\n\t\t\treturn upgradeLibrary.tiddlers[title];\n\t\t};\n\n\t// Go through all the incoming tiddlers\n\t$tw.utils.each(titles,function(title) {\n\t\tvar incomingTiddler = tiddlers[title];\n\t\t// Check if we're dealing with a plugin\n\t\tif(incomingTiddler && incomingTiddler[\"plugin-type\"]) {\n\t\t\t// Check whether the plugin contains JS modules\n\t\t\tvar requiresReload = wiki.doesPluginInfoRequireReload(JSON.parse(incomingTiddler.text)) ? (wiki.getTiddlerText(\"$:/language/ControlPanel/Plugins/PluginWillRequireReload\") + \" \") : \"\";\n\t\t\tmessages[title] = requiresReload;\n\t\t\tif(incomingTiddler.version) {\n\t\t\t\t// Upgrade the incoming plugin if it is in the upgrade library\n\t\t\t\tvar libraryTiddler = getLibraryTiddler(title);\n\t\t\t\tif(libraryTiddler && libraryTiddler[\"plugin-type\"] && libraryTiddler.version) {\n\t\t\t\t\ttiddlers[title] = libraryTiddler;\n\t\t\t\t\tmessages[title] = requiresReload + $tw.language.getString(\"Import/Upgrader/Plugins/Upgraded\",{variables: {incoming: incomingTiddler.version, upgraded: libraryTiddler.version}});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Suppress the incoming plugin if it is older than the currently installed one\n\t\t\t\tvar existingTiddler = wiki.getTiddler(title);\n\t\t\t\tif(existingTiddler && existingTiddler.hasField(\"plugin-type\") && existingTiddler.hasField(\"version\")) {\n\t\t\t\t\t// Reject the incoming plugin by blanking all its fields\n\t\t\t\t\tif($tw.utils.checkVersions(existingTiddler.fields.version,incomingTiddler.version)) {\n\t\t\t\t\t\ttiddlers[title] = Object.create(null);\n\t\t\t\t\t\tmessages[title] = $tw.language.getString(\"Import/Upgrader/Plugins/Suppressed/Version\",{variables: {incoming: incomingTiddler.version, existing: existingTiddler.fields.version}});\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Check whether the plugin is on the blocked list\n\t\t\tvar blockInfo = BLOCKED_PLUGINS[title];\n\t\t\tif(blockInfo) {\n\t\t\t\tif(blockInfo.versions.indexOf(\"*\") !== -1 || (incomingTiddler.version && blockInfo.versions.indexOf(incomingTiddler.version) !== -1)) {\n\t\t\t\t\ttiddlers[title] = Object.create(null);\n\t\t\t\t\tmessages[title] = $tw.language.getString(\"Import/Upgrader/Plugins/Suppressed/Incompatible\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\treturn messages;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "upgrader"
},
"$:/core/modules/upgraders/system.js": {
"title": "$:/core/modules/upgraders/system.js",
"text": "/*\\\ntitle: $:/core/modules/upgraders/system.js\ntype: application/javascript\nmodule-type: upgrader\n\nUpgrader module that suppresses certain system tiddlers that shouldn't be imported\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar DONT_IMPORT_LIST = [\"$:/Import\"],\n\tUNSELECT_PREFIX_LIST = [\"$:/temp/\",\"$:/state/\",\"$:/StoryList\",\"$:/HistoryList\"],\n\tWARN_IMPORT_PREFIX_LIST = [\"$:/core/modules/\"];\n\nexports.upgrade = function(wiki,titles,tiddlers) {\n\tvar self = this,\n\t\tmessages = {},\n\t\tshowAlert = false;\n\t// Check for tiddlers on our list\n\t$tw.utils.each(titles,function(title) {\n\t\tif(DONT_IMPORT_LIST.indexOf(title) !== -1) {\n\t\t\ttiddlers[title] = Object.create(null);\n\t\t\tmessages[title] = $tw.language.getString(\"Import/Upgrader/System/Suppressed\");\n\t\t} else {\n\t\t\tfor(var t=0; t<UNSELECT_PREFIX_LIST.length; t++) {\n\t\t\t\tvar prefix = UNSELECT_PREFIX_LIST[t];\n\t\t\t\tif(title.substr(0,prefix.length) === prefix) {\n\t\t\t\t\tmessages[title] = $tw.language.getString(\"Import/Upgrader/Tiddler/Unselected\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(var t=0; t<WARN_IMPORT_PREFIX_LIST.length; t++) {\n\t\t\t\tvar prefix = WARN_IMPORT_PREFIX_LIST[t];\n\t\t\t\tif(title.substr(0,prefix.length) === prefix && wiki.isShadowTiddler(title)) {\n\t\t\t\t\tshowAlert = true;\n\t\t\t\t\tmessages[title] = $tw.language.getString(\"Import/Upgrader/System/Warning\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\tif(showAlert) {\n\t\tvar logger = new $tw.utils.Logger(\"import\");\n\t\tlogger.alert($tw.language.getString(\"Import/Upgrader/System/Alert\"));\n\t}\n\treturn messages;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "upgrader"
},
"$:/core/modules/upgraders/themetweaks.js": {
"title": "$:/core/modules/upgraders/themetweaks.js",
"text": "/*\\\ntitle: $:/core/modules/upgraders/themetweaks.js\ntype: application/javascript\nmodule-type: upgrader\n\nUpgrader module that handles the change in theme tweak storage introduced in 5.0.14-beta.\n\nPreviously, theme tweaks were stored in two data tiddlers:\n\n* $:/themes/tiddlywiki/vanilla/metrics\n* $:/themes/tiddlywiki/vanilla/settings\n\nNow, each tweak is stored in its own separate tiddler.\n\nThis upgrader copies any values from the old format to the new. The old data tiddlers are not deleted in case they have been used to store additional indexes.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar MAPPINGS = {\n\t\"$:/themes/tiddlywiki/vanilla/metrics\": {\n\t\t\"fontsize\": \"$:/themes/tiddlywiki/vanilla/metrics/fontsize\",\n\t\t\"lineheight\": \"$:/themes/tiddlywiki/vanilla/metrics/lineheight\",\n\t\t\"storyleft\": \"$:/themes/tiddlywiki/vanilla/metrics/storyleft\",\n\t\t\"storytop\": \"$:/themes/tiddlywiki/vanilla/metrics/storytop\",\n\t\t\"storyright\": \"$:/themes/tiddlywiki/vanilla/metrics/storyright\",\n\t\t\"storywidth\": \"$:/themes/tiddlywiki/vanilla/metrics/storywidth\",\n\t\t\"tiddlerwidth\": \"$:/themes/tiddlywiki/vanilla/metrics/tiddlerwidth\"\n\t},\n\t\"$:/themes/tiddlywiki/vanilla/settings\": {\n\t\t\"fontfamily\": \"$:/themes/tiddlywiki/vanilla/settings/fontfamily\"\n\t}\n};\n\nexports.upgrade = function(wiki,titles,tiddlers) {\n\tvar self = this,\n\t\tmessages = {};\n\t// Check for tiddlers on our list\n\t$tw.utils.each(titles,function(title) {\n\t\tvar mapping = MAPPINGS[title];\n\t\tif(mapping) {\n\t\t\tvar tiddler = new $tw.Tiddler(tiddlers[title]),\n\t\t\t\ttiddlerData = wiki.getTiddlerDataCached(tiddler,{});\n\t\t\tfor(var index in mapping) {\n\t\t\t\tvar mappedTitle = mapping[index];\n\t\t\t\tif(!tiddlers[mappedTitle] || tiddlers[mappedTitle].title !== mappedTitle) {\n\t\t\t\t\ttiddlers[mappedTitle] = {\n\t\t\t\t\t\ttitle: mappedTitle,\n\t\t\t\t\t\ttext: tiddlerData[index]\n\t\t\t\t\t};\n\t\t\t\t\tmessages[mappedTitle] = $tw.language.getString(\"Import/Upgrader/ThemeTweaks/Created\",{variables: {\n\t\t\t\t\t\tfrom: title + \"##\" + index\n\t\t\t\t\t}});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\treturn messages;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "upgrader"
},
"$:/core/modules/utils/base64-utf8/base64-utf8.module.js": {
"text": "(function(){// From https://gist.github.com/Nijikokun/5192472\n//\n// UTF8 Module\n//\n// Cleaner and modularized utf-8 encoding and decoding library for javascript.\n//\n// copyright: MIT\n// author: Nijiko Yonskai, @nijikokun, nijikokun@gmail.com\n!function(r,e,o,t){void 0!==o.module&&o.module.exports?o.module.exports=e.apply(o):void 0!==o.define&&\"function\"===o.define&&o.define.amd?define(\"utf8\",[],e):o.utf8=e.apply(o)}(0,function(){return{encode:function(r){if(\"string\"!=typeof r)return r;r=r.replace(/\\r\\n/g,\"\\n\");for(var e,o=\"\",t=0;t<r.length;t++)if((e=r.charCodeAt(t))<128)o+=String.fromCharCode(e);else if(e>127&&e<2048)o+=String.fromCharCode(e>>6|192),o+=String.fromCharCode(63&e|128);else if(e>55295&&e<57344&&r.length>t+1){var i=e,n=r.charCodeAt(t+1);t++;var d=65536+(i-55296<<10|n-56320);o+=String.fromCharCode(d>>18|240),o+=String.fromCharCode(d>>12&63|128),o+=String.fromCharCode(d>>6&63|128),o+=String.fromCharCode(63&d|128)}else o+=String.fromCharCode(e>>12|224),o+=String.fromCharCode(e>>6&63|128),o+=String.fromCharCode(63&e|128);return o},decode:function(r){if(\"string\"!=typeof r)return r;for(var e=\"\",o=0,t=0;o<r.length;)if((t=r.charCodeAt(o))<128)e+=String.fromCharCode(t),o++;else if(t>191&&t<224)e+=String.fromCharCode((31&t)<<6|63&r.charCodeAt(o+1)),o+=2;else if(t>223&&t<240)e+=String.fromCharCode((15&t)<<12|(63&r.charCodeAt(o+1))<<6|63&r.charCodeAt(o+2)),o+=3;else{var i=(7&t)<<18|(63&r.charCodeAt(o+1))<<12|(63&r.charCodeAt(o+2))<<6|63&r.charCodeAt(o+3);e+=String.fromCharCode(55296+(i-65536>>10))+String.fromCharCode(56320+(i-65536&1023)),o+=4}return e}}},this),function(r,e,o,t){if(void 0!==o.module&&o.module.exports){if(t&&o.require)for(var i=0;i<t.length;i++)o[t[i]]=o.require(t[i]);o.module.exports=e.apply(o)}else void 0!==o.define&&\"function\"===o.define&&o.define.amd?define(\"base64\",t||[],e):o.base64=e.apply(o)}(0,function(r){var e=r||this.utf8,o=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";return{encode:function(r){if(void 0===e)throw{error:\"MissingMethod\",message:\"UTF8 Module is missing.\"};if(\"string\"!=typeof r)return r;r=e.encode(r);for(var t,i,n,d,f,a,h,C=\"\",c=0;c<r.length;)d=(t=r.charCodeAt(c++))>>2,f=(3&t)<<4|(i=r.charCodeAt(c++))>>4,a=(15&i)<<2|(n=r.charCodeAt(c++))>>6,h=63&n,isNaN(i)?a=h=64:isNaN(n)&&(h=64),C+=o.charAt(d)+o.charAt(f)+o.charAt(a)+o.charAt(h);return C},decode:function(r){if(void 0===e)throw{error:\"MissingMethod\",message:\"UTF8 Module is missing.\"};if(\"string\"!=typeof r)return r;r=r.replace(/[^A-Za-z0-9\\+\\/\\=]/g,\"\");for(var t,i,n,d,f,a,h=\"\",C=0;C<r.length;)t=o.indexOf(r.charAt(C++))<<2|(d=o.indexOf(r.charAt(C++)))>>4,i=(15&d)<<4|(f=o.indexOf(r.charAt(C++)))>>2,n=(3&f)<<6|(a=o.indexOf(r.charAt(C++))),h+=String.fromCharCode(t),64!=f&&(h+=String.fromCharCode(i)),64!=a&&(h+=String.fromCharCode(n));return e.decode(h)}}},this,[\"utf8\"]);}).call(exports);",
"type": "application/javascript",
"title": "$:/core/modules/utils/base64-utf8/base64-utf8.module.js",
"module-type": "library"
},
"$:/core/modules/utils/crypto.js": {
"title": "$:/core/modules/utils/crypto.js",
"text": "/*\\\ntitle: $:/core/modules/utils/crypto.js\ntype: application/javascript\nmodule-type: utils\n\nUtility functions related to crypto.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nLook for an encrypted store area in the text of a TiddlyWiki file\n*/\nexports.extractEncryptedStoreArea = function(text) {\n\tvar encryptedStoreAreaStartMarker = \"<pre id=\\\"encryptedStoreArea\\\" type=\\\"text/plain\\\" style=\\\"display:none;\\\">\",\n\t\tencryptedStoreAreaStart = text.indexOf(encryptedStoreAreaStartMarker);\n\tif(encryptedStoreAreaStart !== -1) {\n\t\tvar encryptedStoreAreaEnd = text.indexOf(\"</pre>\",encryptedStoreAreaStart);\n\t\tif(encryptedStoreAreaEnd !== -1) {\n\t\t\treturn $tw.utils.htmlDecode(text.substring(encryptedStoreAreaStart + encryptedStoreAreaStartMarker.length,encryptedStoreAreaEnd-1));\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nAttempt to extract the tiddlers from an encrypted store area using the current password. If the password is not provided then the password in the password store will be used\n*/\nexports.decryptStoreArea = function(encryptedStoreArea,password) {\n\tvar decryptedText = $tw.crypto.decrypt(encryptedStoreArea,password);\n\tif(decryptedText) {\n\t\tvar json = JSON.parse(decryptedText),\n\t\t\ttiddlers = [];\n\t\tfor(var title in json) {\n\t\t\tif(title !== \"$:/isEncrypted\") {\n\t\t\t\ttiddlers.push(json[title]);\n\t\t\t}\n\t\t}\n\t\treturn tiddlers;\n\t} else {\n\t\treturn null;\n\t}\n};\n\n\n/*\nAttempt to extract the tiddlers from an encrypted store area using the current password. If that fails, the user is prompted for a password.\nencryptedStoreArea: text of the TiddlyWiki encrypted store area\ncallback: function(tiddlers) called with the array of decrypted tiddlers\n\nThe following configuration settings are supported:\n\n$tw.config.usePasswordVault: causes any password entered by the user to also be put into the system password vault\n*/\nexports.decryptStoreAreaInteractive = function(encryptedStoreArea,callback,options) {\n\t// Try to decrypt with the current password\n\tvar tiddlers = $tw.utils.decryptStoreArea(encryptedStoreArea);\n\tif(tiddlers) {\n\t\tcallback(tiddlers);\n\t} else {\n\t\t// Prompt for a new password and keep trying\n\t\t$tw.passwordPrompt.createPrompt({\n\t\t\tserviceName: \"Enter a password to decrypt the imported TiddlyWiki\",\n\t\t\tnoUserName: true,\n\t\t\tcanCancel: true,\n\t\t\tsubmitText: \"Decrypt\",\n\t\t\tcallback: function(data) {\n\t\t\t\t// Exit if the user cancelled\n\t\t\t\tif(!data) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// Attempt to decrypt the tiddlers\n\t\t\t\tvar tiddlers = $tw.utils.decryptStoreArea(encryptedStoreArea,data.password);\n\t\t\t\tif(tiddlers) {\n\t\t\t\t\tif($tw.config.usePasswordVault) {\n\t\t\t\t\t\t$tw.crypto.setPassword(data.password);\n\t\t\t\t\t}\n\t\t\t\t\tcallback(tiddlers);\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}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/csv.js": {
"title": "$:/core/modules/utils/csv.js",
"text": "/*\\\ntitle: $:/core/modules/utils/csv.js\ntype: application/javascript\nmodule-type: utils\n\nA barebones CSV parser\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nParse a CSV string with a header row and return an array of hashmaps.\n*/\nexports.parseCsvStringWithHeader = function(text,options) {\n\toptions = options || {};\n\tvar separator = options.separator || \",\",\n\t\trows = text.split(/\\r?\\n/mg).map(function(row) {\n\t\t\treturn $tw.utils.trim(row);\n\t\t}).filter(function(row) {\n\t\t\treturn row !== \"\";\n\t\t});\n\tif(rows.length < 1) {\n\t\treturn \"Missing header row\";\n\t}\n\tvar headings = rows[0].split(separator),\n\t\tresults = [];\n\tfor(var row=1; row<rows.length; row++) {\n\t\tvar columns = rows[row].split(separator),\n\t\t\tcolumnResult = Object.create(null);\n\t\tif(columns.length !== headings.length) {\n\t\t\treturn \"Malformed CSV row '\" + rows[row] + \"'\";\n\t\t}\n\t\tfor(var column=0; column<columns.length; column++) {\n\t\t\tvar columnName = headings[column];\n\t\t\tcolumnResult[columnName] = $tw.utils.trim(columns[column] || \"\");\n\t\t}\n\t\tresults.push(columnResult);\n\t}\n\treturn results;\n}\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/diff-match-patch/diff_match_patch.js": {
"text": "(function(){function diff_match_patch(){this.Diff_Timeout=1;this.Diff_EditCost=4;this.Match_Threshold=.5;this.Match_Distance=1E3;this.Patch_DeleteThreshold=.5;this.Patch_Margin=4;this.Match_MaxBits=32}var DIFF_DELETE=-1,DIFF_INSERT=1,DIFF_EQUAL=0;\ndiff_match_patch.prototype.diff_main=function(a,b,c,d){\"undefined\"==typeof d&&(d=0>=this.Diff_Timeout?Number.MAX_VALUE:(new Date).getTime()+1E3*this.Diff_Timeout);if(null==a||null==b)throw Error(\"Null input. (diff_main)\");if(a==b)return a?[[DIFF_EQUAL,a]]:[];\"undefined\"==typeof c&&(c=!0);var e=c,f=this.diff_commonPrefix(a,b);c=a.substring(0,f);a=a.substring(f);b=b.substring(f);f=this.diff_commonSuffix(a,b);var g=a.substring(a.length-f);a=a.substring(0,a.length-f);b=b.substring(0,b.length-f);a=this.diff_compute_(a,\nb,e,d);c&&a.unshift([DIFF_EQUAL,c]);g&&a.push([DIFF_EQUAL,g]);this.diff_cleanupMerge(a);return a};\ndiff_match_patch.prototype.diff_compute_=function(a,b,c,d){if(!a)return[[DIFF_INSERT,b]];if(!b)return[[DIFF_DELETE,a]];var e=a.length>b.length?a:b,f=a.length>b.length?b:a,g=e.indexOf(f);return-1!=g?(c=[[DIFF_INSERT,e.substring(0,g)],[DIFF_EQUAL,f],[DIFF_INSERT,e.substring(g+f.length)]],a.length>b.length&&(c[0][0]=c[2][0]=DIFF_DELETE),c):1==f.length?[[DIFF_DELETE,a],[DIFF_INSERT,b]]:(e=this.diff_halfMatch_(a,b))?(b=e[1],f=e[3],a=e[4],e=this.diff_main(e[0],e[2],c,d),c=this.diff_main(b,f,c,d),e.concat([[DIFF_EQUAL,\na]],c)):c&&100<a.length&&100<b.length?this.diff_lineMode_(a,b,d):this.diff_bisect_(a,b,d)};\ndiff_match_patch.prototype.diff_lineMode_=function(a,b,c){var d=this.diff_linesToChars_(a,b);a=d.chars1;b=d.chars2;d=d.lineArray;a=this.diff_main(a,b,!1,c);this.diff_charsToLines_(a,d);this.diff_cleanupSemantic(a);a.push([DIFF_EQUAL,\"\"]);for(var e=d=b=0,f=\"\",g=\"\";b<a.length;){switch(a[b][0]){case DIFF_INSERT:e++;g+=a[b][1];break;case DIFF_DELETE:d++;f+=a[b][1];break;case DIFF_EQUAL:if(1<=d&&1<=e){a.splice(b-d-e,d+e);b=b-d-e;d=this.diff_main(f,g,!1,c);for(e=d.length-1;0<=e;e--)a.splice(b,0,d[e]);b+=\nd.length}d=e=0;g=f=\"\"}b++}a.pop();return a};\ndiff_match_patch.prototype.diff_bisect_=function(a,b,c){for(var d=a.length,e=b.length,f=Math.ceil((d+e)/2),g=2*f,h=Array(g),l=Array(g),k=0;k<g;k++)h[k]=-1,l[k]=-1;h[f+1]=0;l[f+1]=0;k=d-e;for(var m=0!=k%2,p=0,x=0,w=0,q=0,t=0;t<f&&!((new Date).getTime()>c);t++){for(var v=-t+p;v<=t-x;v+=2){var n=f+v;var r=v==-t||v!=t&&h[n-1]<h[n+1]?h[n+1]:h[n-1]+1;for(var y=r-v;r<d&&y<e&&a.charAt(r)==b.charAt(y);)r++,y++;h[n]=r;if(r>d)x+=2;else if(y>e)p+=2;else if(m&&(n=f+k-v,0<=n&&n<g&&-1!=l[n])){var u=d-l[n];if(r>=\nu)return this.diff_bisectSplit_(a,b,r,y,c)}}for(v=-t+w;v<=t-q;v+=2){n=f+v;u=v==-t||v!=t&&l[n-1]<l[n+1]?l[n+1]:l[n-1]+1;for(r=u-v;u<d&&r<e&&a.charAt(d-u-1)==b.charAt(e-r-1);)u++,r++;l[n]=u;if(u>d)q+=2;else if(r>e)w+=2;else if(!m&&(n=f+k-v,0<=n&&n<g&&-1!=h[n]&&(r=h[n],y=f+r-n,u=d-u,r>=u)))return this.diff_bisectSplit_(a,b,r,y,c)}}return[[DIFF_DELETE,a],[DIFF_INSERT,b]]};\ndiff_match_patch.prototype.diff_bisectSplit_=function(a,b,c,d,e){var f=a.substring(0,c),g=b.substring(0,d);a=a.substring(c);b=b.substring(d);f=this.diff_main(f,g,!1,e);e=this.diff_main(a,b,!1,e);return f.concat(e)};\ndiff_match_patch.prototype.diff_linesToChars_=function(a,b){function c(a){for(var b=\"\",c=0,f=-1,g=d.length;f<a.length-1;){f=a.indexOf(\"\\n\",c);-1==f&&(f=a.length-1);var h=a.substring(c,f+1);c=f+1;(e.hasOwnProperty?e.hasOwnProperty(h):void 0!==e[h])?b+=String.fromCharCode(e[h]):(b+=String.fromCharCode(g),e[h]=g,d[g++]=h)}return b}var d=[],e={};d[0]=\"\";var f=c(a),g=c(b);return{chars1:f,chars2:g,lineArray:d}};\ndiff_match_patch.prototype.diff_charsToLines_=function(a,b){for(var c=0;c<a.length;c++){for(var d=a[c][1],e=[],f=0;f<d.length;f++)e[f]=b[d.charCodeAt(f)];a[c][1]=e.join(\"\")}};diff_match_patch.prototype.diff_commonPrefix=function(a,b){if(!a||!b||a.charAt(0)!=b.charAt(0))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(f,e)==b.substring(f,e)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e};\ndiff_match_patch.prototype.diff_commonSuffix=function(a,b){if(!a||!b||a.charAt(a.length-1)!=b.charAt(b.length-1))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;c<e;)a.substring(a.length-e,a.length-f)==b.substring(b.length-e,b.length-f)?f=c=e:d=e,e=Math.floor((d-c)/2+c);return e};\ndiff_match_patch.prototype.diff_commonOverlap_=function(a,b){var c=a.length,d=b.length;if(0==c||0==d)return 0;c>d?a=a.substring(c-d):c<d&&(b=b.substring(0,c));c=Math.min(c,d);if(a==b)return c;d=0;for(var e=1;;){var f=a.substring(c-e);f=b.indexOf(f);if(-1==f)return d;e+=f;if(0==f||a.substring(c-e)==b.substring(0,e))d=e,e++}};\ndiff_match_patch.prototype.diff_halfMatch_=function(a,b){function c(a,b,c){for(var d=a.substring(c,c+Math.floor(a.length/4)),e=-1,g=\"\",h,k,l,m;-1!=(e=b.indexOf(d,e+1));){var p=f.diff_commonPrefix(a.substring(c),b.substring(e)),u=f.diff_commonSuffix(a.substring(0,c),b.substring(0,e));g.length<u+p&&(g=b.substring(e-u,e)+b.substring(e,e+p),h=a.substring(0,c-u),k=a.substring(c+p),l=b.substring(0,e-u),m=b.substring(e+p))}return 2*g.length>=a.length?[h,k,l,m,g]:null}if(0>=this.Diff_Timeout)return null;\nvar d=a.length>b.length?a:b,e=a.length>b.length?b:a;if(4>d.length||2*e.length<d.length)return null;var f=this,g=c(d,e,Math.ceil(d.length/4));d=c(d,e,Math.ceil(d.length/2));if(g||d)g=d?g?g[4].length>d[4].length?g:d:d:g;else return null;if(a.length>b.length){d=g[0];e=g[1];var h=g[2];var l=g[3]}else h=g[0],l=g[1],d=g[2],e=g[3];return[d,e,h,l,g[4]]};\ndiff_match_patch.prototype.diff_cleanupSemantic=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=0,h=0,l=0,k=0;f<a.length;)a[f][0]==DIFF_EQUAL?(c[d++]=f,g=l,h=k,k=l=0,e=a[f][1]):(a[f][0]==DIFF_INSERT?l+=a[f][1].length:k+=a[f][1].length,e&&e.length<=Math.max(g,h)&&e.length<=Math.max(l,k)&&(a.splice(c[d-1],0,[DIFF_DELETE,e]),a[c[d-1]+1][0]=DIFF_INSERT,d--,d--,f=0<d?c[d-1]:-1,k=l=h=g=0,e=null,b=!0)),f++;b&&this.diff_cleanupMerge(a);this.diff_cleanupSemanticLossless(a);for(f=1;f<a.length;){if(a[f-1][0]==\nDIFF_DELETE&&a[f][0]==DIFF_INSERT){b=a[f-1][1];c=a[f][1];d=this.diff_commonOverlap_(b,c);e=this.diff_commonOverlap_(c,b);if(d>=e){if(d>=b.length/2||d>=c.length/2)a.splice(f,0,[DIFF_EQUAL,c.substring(0,d)]),a[f-1][1]=b.substring(0,b.length-d),a[f+1][1]=c.substring(d),f++}else if(e>=b.length/2||e>=c.length/2)a.splice(f,0,[DIFF_EQUAL,b.substring(0,e)]),a[f-1][0]=DIFF_INSERT,a[f-1][1]=c.substring(0,c.length-e),a[f+1][0]=DIFF_DELETE,a[f+1][1]=b.substring(e),f++;f++}f++}};\ndiff_match_patch.prototype.diff_cleanupSemanticLossless=function(a){function b(a,b){if(!a||!b)return 6;var c=a.charAt(a.length-1),d=b.charAt(0),e=c.match(diff_match_patch.nonAlphaNumericRegex_),f=d.match(diff_match_patch.nonAlphaNumericRegex_),g=e&&c.match(diff_match_patch.whitespaceRegex_),h=f&&d.match(diff_match_patch.whitespaceRegex_);c=g&&c.match(diff_match_patch.linebreakRegex_);d=h&&d.match(diff_match_patch.linebreakRegex_);var k=c&&a.match(diff_match_patch.blanklineEndRegex_),l=d&&b.match(diff_match_patch.blanklineStartRegex_);\nreturn k||l?5:c||d?4:e&&!g&&h?3:g||h?2:e||f?1:0}for(var c=1;c<a.length-1;){if(a[c-1][0]==DIFF_EQUAL&&a[c+1][0]==DIFF_EQUAL){var d=a[c-1][1],e=a[c][1],f=a[c+1][1],g=this.diff_commonSuffix(d,e);if(g){var h=e.substring(e.length-g);d=d.substring(0,d.length-g);e=h+e.substring(0,e.length-g);f=h+f}g=d;h=e;for(var l=f,k=b(d,e)+b(e,f);e.charAt(0)===f.charAt(0);){d+=e.charAt(0);e=e.substring(1)+f.charAt(0);f=f.substring(1);var m=b(d,e)+b(e,f);m>=k&&(k=m,g=d,h=e,l=f)}a[c-1][1]!=g&&(g?a[c-1][1]=g:(a.splice(c-\n1,1),c--),a[c][1]=h,l?a[c+1][1]=l:(a.splice(c+1,1),c--))}c++}};diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;diff_match_patch.whitespaceRegex_=/\\s/;diff_match_patch.linebreakRegex_=/[\\r\\n]/;diff_match_patch.blanklineEndRegex_=/\\n\\r?\\n$/;diff_match_patch.blanklineStartRegex_=/^\\r?\\n\\r?\\n/;\ndiff_match_patch.prototype.diff_cleanupEfficiency=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=!1,h=!1,l=!1,k=!1;f<a.length;)a[f][0]==DIFF_EQUAL?(a[f][1].length<this.Diff_EditCost&&(l||k)?(c[d++]=f,g=l,h=k,e=a[f][1]):(d=0,e=null),l=k=!1):(a[f][0]==DIFF_DELETE?k=!0:l=!0,e&&(g&&h&&l&&k||e.length<this.Diff_EditCost/2&&3==g+h+l+k)&&(a.splice(c[d-1],0,[DIFF_DELETE,e]),a[c[d-1]+1][0]=DIFF_INSERT,d--,e=null,g&&h?(l=k=!0,d=0):(d--,f=0<d?c[d-1]:-1,l=k=!1),b=!0)),f++;b&&this.diff_cleanupMerge(a)};\ndiff_match_patch.prototype.diff_cleanupMerge=function(a){a.push([DIFF_EQUAL,\"\"]);for(var b=0,c=0,d=0,e=\"\",f=\"\",g;b<a.length;)switch(a[b][0]){case DIFF_INSERT:d++;f+=a[b][1];b++;break;case DIFF_DELETE:c++;e+=a[b][1];b++;break;case DIFF_EQUAL:1<c+d?(0!==c&&0!==d&&(g=this.diff_commonPrefix(f,e),0!==g&&(0<b-c-d&&a[b-c-d-1][0]==DIFF_EQUAL?a[b-c-d-1][1]+=f.substring(0,g):(a.splice(0,0,[DIFF_EQUAL,f.substring(0,g)]),b++),f=f.substring(g),e=e.substring(g)),g=this.diff_commonSuffix(f,e),0!==g&&(a[b][1]=f.substring(f.length-\ng)+a[b][1],f=f.substring(0,f.length-g),e=e.substring(0,e.length-g))),0===c?a.splice(b-d,c+d,[DIFF_INSERT,f]):0===d?a.splice(b-c,c+d,[DIFF_DELETE,e]):a.splice(b-c-d,c+d,[DIFF_DELETE,e],[DIFF_INSERT,f]),b=b-c-d+(c?1:0)+(d?1:0)+1):0!==b&&a[b-1][0]==DIFF_EQUAL?(a[b-1][1]+=a[b][1],a.splice(b,1)):b++,c=d=0,f=e=\"\"}\"\"===a[a.length-1][1]&&a.pop();c=!1;for(b=1;b<a.length-1;)a[b-1][0]==DIFF_EQUAL&&a[b+1][0]==DIFF_EQUAL&&(a[b][1].substring(a[b][1].length-a[b-1][1].length)==a[b-1][1]?(a[b][1]=a[b-1][1]+a[b][1].substring(0,\na[b][1].length-a[b-1][1].length),a[b+1][1]=a[b-1][1]+a[b+1][1],a.splice(b-1,1),c=!0):a[b][1].substring(0,a[b+1][1].length)==a[b+1][1]&&(a[b-1][1]+=a[b+1][1],a[b][1]=a[b][1].substring(a[b+1][1].length)+a[b+1][1],a.splice(b+1,1),c=!0)),b++;c&&this.diff_cleanupMerge(a)};\ndiff_match_patch.prototype.diff_xIndex=function(a,b){var c=0,d=0,e=0,f=0,g;for(g=0;g<a.length;g++){a[g][0]!==DIFF_INSERT&&(c+=a[g][1].length);a[g][0]!==DIFF_DELETE&&(d+=a[g][1].length);if(c>b)break;e=c;f=d}return a.length!=g&&a[g][0]===DIFF_DELETE?f:f+(b-e)};\ndiff_match_patch.prototype.diff_prettyHtml=function(a){for(var b=[],c=/&/g,d=/</g,e=/>/g,f=/\\n/g,g=0;g<a.length;g++){var h=a[g][0],l=a[g][1].replace(c,\"&\").replace(d,\"<\").replace(e,\">\").replace(f,\"¶<br>\");switch(h){case DIFF_INSERT:b[g]='<ins style=\"background:#e6ffe6;\">'+l+\"</ins>\";break;case DIFF_DELETE:b[g]='<del style=\"background:#ffe6e6;\">'+l+\"</del>\";break;case DIFF_EQUAL:b[g]=\"<span>\"+l+\"</span>\"}}return b.join(\"\")};\ndiff_match_patch.prototype.diff_text1=function(a){for(var b=[],c=0;c<a.length;c++)a[c][0]!==DIFF_INSERT&&(b[c]=a[c][1]);return b.join(\"\")};diff_match_patch.prototype.diff_text2=function(a){for(var b=[],c=0;c<a.length;c++)a[c][0]!==DIFF_DELETE&&(b[c]=a[c][1]);return b.join(\"\")};\ndiff_match_patch.prototype.diff_levenshtein=function(a){for(var b=0,c=0,d=0,e=0;e<a.length;e++){var f=a[e][1];switch(a[e][0]){case DIFF_INSERT:c+=f.length;break;case DIFF_DELETE:d+=f.length;break;case DIFF_EQUAL:b+=Math.max(c,d),d=c=0}}return b+=Math.max(c,d)};\ndiff_match_patch.prototype.diff_toDelta=function(a){for(var b=[],c=0;c<a.length;c++)switch(a[c][0]){case DIFF_INSERT:b[c]=\"+\"+encodeURI(a[c][1]);break;case DIFF_DELETE:b[c]=\"-\"+a[c][1].length;break;case DIFF_EQUAL:b[c]=\"=\"+a[c][1].length}return b.join(\"\\t\").replace(/%20/g,\" \")};\ndiff_match_patch.prototype.diff_fromDelta=function(a,b){for(var c=[],d=0,e=0,f=b.split(/\\t/g),g=0;g<f.length;g++){var h=f[g].substring(1);switch(f[g].charAt(0)){case \"+\":try{c[d++]=[DIFF_INSERT,decodeURI(h)]}catch(k){throw Error(\"Illegal escape in diff_fromDelta: \"+h);}break;case \"-\":case \"=\":var l=parseInt(h,10);if(isNaN(l)||0>l)throw Error(\"Invalid number in diff_fromDelta: \"+h);h=a.substring(e,e+=l);\"=\"==f[g].charAt(0)?c[d++]=[DIFF_EQUAL,h]:c[d++]=[DIFF_DELETE,h];break;default:if(f[g])throw Error(\"Invalid diff operation in diff_fromDelta: \"+\nf[g]);}}if(e!=a.length)throw Error(\"Delta length (\"+e+\") does not equal source text length (\"+a.length+\").\");return c};diff_match_patch.prototype.match_main=function(a,b,c){if(null==a||null==b||null==c)throw Error(\"Null input. (match_main)\");c=Math.max(0,Math.min(c,a.length));return a==b?0:a.length?a.substring(c,c+b.length)==b?c:this.match_bitap_(a,b,c):-1};\ndiff_match_patch.prototype.match_bitap_=function(a,b,c){function d(a,d){var e=a/b.length,g=Math.abs(c-d);return f.Match_Distance?e+g/f.Match_Distance:g?1:e}if(b.length>this.Match_MaxBits)throw Error(\"Pattern too long for this browser.\");var e=this.match_alphabet_(b),f=this,g=this.Match_Threshold,h=a.indexOf(b,c);-1!=h&&(g=Math.min(d(0,h),g),h=a.lastIndexOf(b,c+b.length),-1!=h&&(g=Math.min(d(0,h),g)));var l=1<<b.length-1;h=-1;for(var k,m,p=b.length+a.length,x,w=0;w<b.length;w++){k=0;for(m=p;k<m;)d(w,\nc+m)<=g?k=m:p=m,m=Math.floor((p-k)/2+k);p=m;k=Math.max(1,c-m+1);var q=Math.min(c+m,a.length)+b.length;m=Array(q+2);for(m[q+1]=(1<<w)-1;q>=k;q--){var t=e[a.charAt(q-1)];m[q]=0===w?(m[q+1]<<1|1)&t:(m[q+1]<<1|1)&t|(x[q+1]|x[q])<<1|1|x[q+1];if(m[q]&l&&(t=d(w,q-1),t<=g))if(g=t,h=q-1,h>c)k=Math.max(1,2*c-h);else break}if(d(w+1,c)>g)break;x=m}return h};\ndiff_match_patch.prototype.match_alphabet_=function(a){for(var b={},c=0;c<a.length;c++)b[a.charAt(c)]=0;for(c=0;c<a.length;c++)b[a.charAt(c)]|=1<<a.length-c-1;return b};\ndiff_match_patch.prototype.patch_addContext_=function(a,b){if(0!=b.length){for(var c=b.substring(a.start2,a.start2+a.length1),d=0;b.indexOf(c)!=b.lastIndexOf(c)&&c.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)d+=this.Patch_Margin,c=b.substring(a.start2-d,a.start2+a.length1+d);d+=this.Patch_Margin;(c=b.substring(a.start2-d,a.start2))&&a.diffs.unshift([DIFF_EQUAL,c]);(d=b.substring(a.start2+a.length1,a.start2+a.length1+d))&&a.diffs.push([DIFF_EQUAL,d]);a.start1-=c.length;a.start2-=\nc.length;a.length1+=c.length+d.length;a.length2+=c.length+d.length}};\ndiff_match_patch.prototype.patch_make=function(a,b,c){if(\"string\"==typeof a&&\"string\"==typeof b&&\"undefined\"==typeof c){var d=a;b=this.diff_main(d,b,!0);2<b.length&&(this.diff_cleanupSemantic(b),this.diff_cleanupEfficiency(b))}else if(a&&\"object\"==typeof a&&\"undefined\"==typeof b&&\"undefined\"==typeof c)b=a,d=this.diff_text1(b);else if(\"string\"==typeof a&&b&&\"object\"==typeof b&&\"undefined\"==typeof c)d=a;else if(\"string\"==typeof a&&\"string\"==typeof b&&c&&\"object\"==typeof c)d=a,b=c;else throw Error(\"Unknown call format to patch_make.\");\nif(0===b.length)return[];c=[];a=new diff_match_patch.patch_obj;for(var e=0,f=0,g=0,h=d,l=0;l<b.length;l++){var k=b[l][0],m=b[l][1];e||k===DIFF_EQUAL||(a.start1=f,a.start2=g);switch(k){case DIFF_INSERT:a.diffs[e++]=b[l];a.length2+=m.length;d=d.substring(0,g)+m+d.substring(g);break;case DIFF_DELETE:a.length1+=m.length;a.diffs[e++]=b[l];d=d.substring(0,g)+d.substring(g+m.length);break;case DIFF_EQUAL:m.length<=2*this.Patch_Margin&&e&&b.length!=l+1?(a.diffs[e++]=b[l],a.length1+=m.length,a.length2+=m.length):\nm.length>=2*this.Patch_Margin&&e&&(this.patch_addContext_(a,h),c.push(a),a=new diff_match_patch.patch_obj,e=0,h=d,f=g)}k!==DIFF_INSERT&&(f+=m.length);k!==DIFF_DELETE&&(g+=m.length)}e&&(this.patch_addContext_(a,h),c.push(a));return c};\ndiff_match_patch.prototype.patch_deepCopy=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c],e=new diff_match_patch.patch_obj;e.diffs=[];for(var f=0;f<d.diffs.length;f++)e.diffs[f]=d.diffs[f].slice();e.start1=d.start1;e.start2=d.start2;e.length1=d.length1;e.length2=d.length2;b[c]=e}return b};\ndiff_match_patch.prototype.patch_apply=function(a,b){if(0==a.length)return[b,[]];a=this.patch_deepCopy(a);var c=this.patch_addPadding(a);b=c+b+c;this.patch_splitMax(a);for(var d=0,e=[],f=0;f<a.length;f++){var g=a[f].start2+d,h=this.diff_text1(a[f].diffs),l=-1;if(h.length>this.Match_MaxBits){var k=this.match_main(b,h.substring(0,this.Match_MaxBits),g);-1!=k&&(l=this.match_main(b,h.substring(h.length-this.Match_MaxBits),g+h.length-this.Match_MaxBits),-1==l||k>=l)&&(k=-1)}else k=this.match_main(b,h,\ng);if(-1==k)e[f]=!1,d-=a[f].length2-a[f].length1;else if(e[f]=!0,d=k-g,g=-1==l?b.substring(k,k+h.length):b.substring(k,l+this.Match_MaxBits),h==g)b=b.substring(0,k)+this.diff_text2(a[f].diffs)+b.substring(k+h.length);else if(g=this.diff_main(h,g,!1),h.length>this.Match_MaxBits&&this.diff_levenshtein(g)/h.length>this.Patch_DeleteThreshold)e[f]=!1;else{this.diff_cleanupSemanticLossless(g);h=0;var m;for(l=0;l<a[f].diffs.length;l++){var p=a[f].diffs[l];p[0]!==DIFF_EQUAL&&(m=this.diff_xIndex(g,h));p[0]===\nDIFF_INSERT?b=b.substring(0,k+m)+p[1]+b.substring(k+m):p[0]===DIFF_DELETE&&(b=b.substring(0,k+m)+b.substring(k+this.diff_xIndex(g,h+p[1].length)));p[0]!==DIFF_DELETE&&(h+=p[1].length)}}}b=b.substring(c.length,b.length-c.length);return[b,e]};\ndiff_match_patch.prototype.patch_addPadding=function(a){for(var b=this.Patch_Margin,c=\"\",d=1;d<=b;d++)c+=String.fromCharCode(d);for(d=0;d<a.length;d++)a[d].start1+=b,a[d].start2+=b;d=a[0];var e=d.diffs;if(0==e.length||e[0][0]!=DIFF_EQUAL)e.unshift([DIFF_EQUAL,c]),d.start1-=b,d.start2-=b,d.length1+=b,d.length2+=b;else if(b>e[0][1].length){var f=b-e[0][1].length;e[0][1]=c.substring(e[0][1].length)+e[0][1];d.start1-=f;d.start2-=f;d.length1+=f;d.length2+=f}d=a[a.length-1];e=d.diffs;0==e.length||e[e.length-\n1][0]!=DIFF_EQUAL?(e.push([DIFF_EQUAL,c]),d.length1+=b,d.length2+=b):b>e[e.length-1][1].length&&(f=b-e[e.length-1][1].length,e[e.length-1][1]+=c.substring(0,f),d.length1+=f,d.length2+=f);return c};\ndiff_match_patch.prototype.patch_splitMax=function(a){for(var b=this.Match_MaxBits,c=0;c<a.length;c++)if(!(a[c].length1<=b)){var d=a[c];a.splice(c--,1);for(var e=d.start1,f=d.start2,g=\"\";0!==d.diffs.length;){var h=new diff_match_patch.patch_obj,l=!0;h.start1=e-g.length;h.start2=f-g.length;\"\"!==g&&(h.length1=h.length2=g.length,h.diffs.push([DIFF_EQUAL,g]));for(;0!==d.diffs.length&&h.length1<b-this.Patch_Margin;){g=d.diffs[0][0];var k=d.diffs[0][1];g===DIFF_INSERT?(h.length2+=k.length,f+=k.length,h.diffs.push(d.diffs.shift()),\nl=!1):g===DIFF_DELETE&&1==h.diffs.length&&h.diffs[0][0]==DIFF_EQUAL&&k.length>2*b?(h.length1+=k.length,e+=k.length,l=!1,h.diffs.push([g,k]),d.diffs.shift()):(k=k.substring(0,b-h.length1-this.Patch_Margin),h.length1+=k.length,e+=k.length,g===DIFF_EQUAL?(h.length2+=k.length,f+=k.length):l=!1,h.diffs.push([g,k]),k==d.diffs[0][1]?d.diffs.shift():d.diffs[0][1]=d.diffs[0][1].substring(k.length))}g=this.diff_text2(h.diffs);g=g.substring(g.length-this.Patch_Margin);k=this.diff_text1(d.diffs).substring(0,\nthis.Patch_Margin);\"\"!==k&&(h.length1+=k.length,h.length2+=k.length,0!==h.diffs.length&&h.diffs[h.diffs.length-1][0]===DIFF_EQUAL?h.diffs[h.diffs.length-1][1]+=k:h.diffs.push([DIFF_EQUAL,k]));l||a.splice(++c,0,h)}}};diff_match_patch.prototype.patch_toText=function(a){for(var b=[],c=0;c<a.length;c++)b[c]=a[c];return b.join(\"\")};\ndiff_match_patch.prototype.patch_fromText=function(a){var b=[];if(!a)return b;a=a.split(\"\\n\");for(var c=0,d=/^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$/;c<a.length;){var e=a[c].match(d);if(!e)throw Error(\"Invalid patch string: \"+a[c]);var f=new diff_match_patch.patch_obj;b.push(f);f.start1=parseInt(e[1],10);\"\"===e[2]?(f.start1--,f.length1=1):\"0\"==e[2]?f.length1=0:(f.start1--,f.length1=parseInt(e[2],10));f.start2=parseInt(e[3],10);\"\"===e[4]?(f.start2--,f.length2=1):\"0\"==e[4]?f.length2=0:(f.start2--,f.length2=\nparseInt(e[4],10));for(c++;c<a.length;){e=a[c].charAt(0);try{var g=decodeURI(a[c].substring(1))}catch(h){throw Error(\"Illegal escape in patch_fromText: \"+g);}if(\"-\"==e)f.diffs.push([DIFF_DELETE,g]);else if(\"+\"==e)f.diffs.push([DIFF_INSERT,g]);else if(\" \"==e)f.diffs.push([DIFF_EQUAL,g]);else if(\"@\"==e)break;else if(\"\"!==e)throw Error('Invalid patch mode \"'+e+'\" in: '+g);c++}}return b};diff_match_patch.patch_obj=function(){this.diffs=[];this.start2=this.start1=null;this.length2=this.length1=0};\ndiff_match_patch.patch_obj.prototype.toString=function(){for(var a=[\"@@ -\"+(0===this.length1?this.start1+\",0\":1==this.length1?this.start1+1:this.start1+1+\",\"+this.length1)+\" +\"+(0===this.length2?this.start2+\",0\":1==this.length2?this.start2+1:this.start2+1+\",\"+this.length2)+\" @@\\n\"],b,c=0;c<this.diffs.length;c++){switch(this.diffs[c][0]){case DIFF_INSERT:b=\"+\";break;case DIFF_DELETE:b=\"-\";break;case DIFF_EQUAL:b=\" \"}a[c+1]=b+encodeURI(this.diffs[c][1])+\"\\n\"}return a.join(\"\").replace(/%20/g,\" \")};\nthis.diff_match_patch=diff_match_patch;this.DIFF_DELETE=DIFF_DELETE;this.DIFF_INSERT=DIFF_INSERT;this.DIFF_EQUAL=DIFF_EQUAL;\n}).call(exports);",
"type": "application/javascript",
"title": "$:/core/modules/utils/diff-match-patch/diff_match_patch.js",
"module-type": "library"
},
"$:/core/modules/utils/dom/animations/slide.js": {
"title": "$:/core/modules/utils/dom/animations/slide.js",
"text": "/*\\\ntitle: $:/core/modules/utils/dom/animations/slide.js\ntype: application/javascript\nmodule-type: animation\n\nA simple slide animation that varies the height of the element\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nfunction slideOpen(domNode,options) {\n\toptions = options || {};\n\tvar duration = options.duration || $tw.utils.getAnimationDuration();\n\t// Get the current height of the domNode\n\tvar computedStyle = window.getComputedStyle(domNode),\n\t\tcurrMarginBottom = parseInt(computedStyle.marginBottom,10),\n\t\tcurrMarginTop = parseInt(computedStyle.marginTop,10),\n\t\tcurrPaddingBottom = parseInt(computedStyle.paddingBottom,10),\n\t\tcurrPaddingTop = parseInt(computedStyle.paddingTop,10),\n\t\tcurrHeight = domNode.offsetHeight;\n\t// Reset the margin once the transition is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(domNode,[\n\t\t\t{transition: \"none\"},\n\t\t\t{marginBottom: \"\"},\n\t\t\t{marginTop: \"\"},\n\t\t\t{paddingBottom: \"\"},\n\t\t\t{paddingTop: \"\"},\n\t\t\t{height: \"auto\"},\n\t\t\t{opacity: \"\"}\n\t\t]);\n\t\tif(options.callback) {\n\t\t\toptions.callback();\n\t\t}\n\t},duration);\n\t// Set up the initial position of the element\n\t$tw.utils.setStyle(domNode,[\n\t\t{transition: \"none\"},\n\t\t{marginTop: \"0px\"},\n\t\t{marginBottom: \"0px\"},\n\t\t{paddingTop: \"0px\"},\n\t\t{paddingBottom: \"0px\"},\n\t\t{height: \"0px\"},\n\t\t{opacity: \"0\"}\n\t]);\n\t$tw.utils.forceLayout(domNode);\n\t// Transition to the final position\n\t$tw.utils.setStyle(domNode,[\n\t\t{transition: \"margin-top \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-top \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"height \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms ease-in-out\"},\n\t\t{marginBottom: currMarginBottom + \"px\"},\n\t\t{marginTop: currMarginTop + \"px\"},\n\t\t{paddingBottom: currPaddingBottom + \"px\"},\n\t\t{paddingTop: currPaddingTop + \"px\"},\n\t\t{height: currHeight + \"px\"},\n\t\t{opacity: \"1\"}\n\t]);\n}\n\nfunction slideClosed(domNode,options) {\n\toptions = options || {};\n\tvar duration = options.duration || $tw.utils.getAnimationDuration(),\n\t\tcurrHeight = domNode.offsetHeight;\n\t// Clear the properties we've set when the animation is over\n\tsetTimeout(function() {\n\t\t$tw.utils.setStyle(domNode,[\n\t\t\t{transition: \"none\"},\n\t\t\t{marginBottom: \"\"},\n\t\t\t{marginTop: \"\"},\n\t\t\t{paddingBottom: \"\"},\n\t\t\t{paddingTop: \"\"},\n\t\t\t{height: \"auto\"},\n\t\t\t{opacity: \"\"}\n\t\t]);\n\t\tif(options.callback) {\n\t\t\toptions.callback();\n\t\t}\n\t},duration);\n\t// Set up the initial position of the element\n\t$tw.utils.setStyle(domNode,[\n\t\t{height: currHeight + \"px\"},\n\t\t{opacity: \"1\"}\n\t]);\n\t$tw.utils.forceLayout(domNode);\n\t// Transition to the final position\n\t$tw.utils.setStyle(domNode,[\n\t\t{transition: \"margin-top \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"margin-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-top \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"padding-bottom \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"height \" + duration + \"ms ease-in-out, \" +\n\t\t\t\t\t\"opacity \" + duration + \"ms ease-in-out\"},\n\t\t{marginTop: \"0px\"},\n\t\t{marginBottom: \"0px\"},\n\t\t{paddingTop: \"0px\"},\n\t\t{paddingBottom: \"0px\"},\n\t\t{height: \"0px\"},\n\t\t{opacity: \"0\"}\n\t]);\n}\n\nexports.slide = {\n\topen: slideOpen,\n\tclose: slideClosed\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "animation"
},
"$:/core/modules/utils/dom/animator.js": {
"title": "$:/core/modules/utils/dom/animator.js",
"text": "/*\\\ntitle: $:/core/modules/utils/dom/animator.js\ntype: application/javascript\nmodule-type: utils\n\nOrchestrates animations and transitions\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nfunction Animator() {\n\t// Get the registered animation modules\n\tthis.animations = {};\n\t$tw.modules.applyMethods(\"animation\",this.animations);\n}\n\nAnimator.prototype.perform = function(type,domNode,options) {\n\toptions = options || {};\n\t// Find an animation that can handle this type\n\tvar chosenAnimation;\n\t$tw.utils.each(this.animations,function(animation,name) {\n\t\tif($tw.utils.hop(animation,type)) {\n\t\t\tchosenAnimation = animation[type];\n\t\t}\n\t});\n\tif(!chosenAnimation) {\n\t\tchosenAnimation = function(domNode,options) {\n\t\t\tif(options.callback) {\n\t\t\t\toptions.callback();\n\t\t\t}\n\t\t};\n\t}\n\t// Call the animation\n\tchosenAnimation(domNode,options);\n};\n\nexports.Animator = Animator;\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/browser.js": {
"title": "$:/core/modules/utils/dom/browser.js",
"text": "/*\\\ntitle: $:/core/modules/utils/dom/browser.js\ntype: application/javascript\nmodule-type: utils\n\nBrowser feature detection\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nSet style properties of an element\n\telement: dom node\n\tstyles: ordered array of {name: value} pairs\n*/\nexports.setStyle = function(element,styles) {\n\tif(element.nodeType === 1) { // Element.ELEMENT_NODE\n\t\tfor(var t=0; t<styles.length; t++) {\n\t\t\tfor(var styleName in styles[t]) {\n\t\t\t\telement.style[$tw.utils.convertStyleNameToPropertyName(styleName)] = styles[t][styleName];\n\t\t\t}\n\t\t}\n\t}\n};\n\n/*\nConverts a standard CSS property name into the local browser-specific equivalent. For example:\n\t\"background-color\" --> \"backgroundColor\"\n\t\"transition\" --> \"webkitTransition\"\n*/\n\nvar styleNameCache = {}; // We'll cache the style name conversions\n\nexports.convertStyleNameToPropertyName = function(styleName) {\n\t// Return from the cache if we can\n\tif(styleNameCache[styleName]) {\n\t\treturn styleNameCache[styleName];\n\t}\n\t// Convert it by first removing any hyphens\n\tvar propertyName = $tw.utils.unHyphenateCss(styleName);\n\t// Then check if it needs a prefix\n\tif($tw.browser && document.body.style[propertyName] === undefined) {\n\t\tvar prefixes = [\"O\",\"MS\",\"Moz\",\"webkit\"];\n\t\tfor(var t=0; t<prefixes.length; t++) {\n\t\t\tvar prefixedName = prefixes[t] + propertyName.substr(0,1).toUpperCase() + propertyName.substr(1);\n\t\t\tif(document.body.style[prefixedName] !== undefined) {\n\t\t\t\tpropertyName = prefixedName;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// Put it in the cache too\n\tstyleNameCache[styleName] = propertyName;\n\treturn propertyName;\n};\n\n/*\nConverts a JS format CSS property name back into the dashed form used in CSS declarations. For example:\n\t\"backgroundColor\" --> \"background-color\"\n\t\"webkitTransform\" --> \"-webkit-transform\"\n*/\nexports.convertPropertyNameToStyleName = function(propertyName) {\n\t// Rehyphenate the name\n\tvar styleName = $tw.utils.hyphenateCss(propertyName);\n\t// If there's a webkit prefix, add a dash (other browsers have uppercase prefixes, and so get the dash automatically)\n\tif(styleName.indexOf(\"webkit\") === 0) {\n\t\tstyleName = \"-\" + styleName;\n\t} else if(styleName.indexOf(\"-m-s\") === 0) {\n\t\tstyleName = \"-ms\" + styleName.substr(4);\n\t}\n\treturn styleName;\n};\n\n/*\nRound trip a stylename to a property name and back again. For example:\n\t\"transform\" --> \"webkitTransform\" --> \"-webkit-transform\"\n*/\nexports.roundTripPropertyName = function(propertyName) {\n\treturn $tw.utils.convertPropertyNameToStyleName($tw.utils.convertStyleNameToPropertyName(propertyName));\n};\n\n/*\nConverts a standard event name into the local browser specific equivalent. For example:\n\t\"animationEnd\" --> \"webkitAnimationEnd\"\n*/\n\nvar eventNameCache = {}; // We'll cache the conversions\n\nvar eventNameMappings = {\n\t\"transitionEnd\": {\n\t\tcorrespondingCssProperty: \"transition\",\n\t\tmappings: {\n\t\t\ttransition: \"transitionend\",\n\t\t\tOTransition: \"oTransitionEnd\",\n\t\t\tMSTransition: \"msTransitionEnd\",\n\t\t\tMozTransition: \"transitionend\",\n\t\t\twebkitTransition: \"webkitTransitionEnd\"\n\t\t}\n\t},\n\t\"animationEnd\": {\n\t\tcorrespondingCssProperty: \"animation\",\n\t\tmappings: {\n\t\t\tanimation: \"animationend\",\n\t\t\tOAnimation: \"oAnimationEnd\",\n\t\t\tMSAnimation: \"msAnimationEnd\",\n\t\t\tMozAnimation: \"animationend\",\n\t\t\twebkitAnimation: \"webkitAnimationEnd\"\n\t\t}\n\t}\n};\n\nexports.convertEventName = function(eventName) {\n\tif(eventNameCache[eventName]) {\n\t\treturn eventNameCache[eventName];\n\t}\n\tvar newEventName = eventName,\n\t\tmappings = eventNameMappings[eventName];\n\tif(mappings) {\n\t\tvar convertedProperty = $tw.utils.convertStyleNameToPropertyName(mappings.correspondingCssProperty);\n\t\tif(mappings.mappings[convertedProperty]) {\n\t\t\tnewEventName = mappings.mappings[convertedProperty];\n\t\t}\n\t}\n\t// Put it in the cache too\n\teventNameCache[eventName] = newEventName;\n\treturn newEventName;\n};\n\n/*\nReturn the names of the fullscreen APIs\n*/\nexports.getFullScreenApis = function() {\n\tvar d = document,\n\t\tdb = d.body,\n\t\tresult = {\n\t\t\"_requestFullscreen\": db.webkitRequestFullscreen !== undefined ? \"webkitRequestFullscreen\" :\n\t\t\t\t\t\t\tdb.mozRequestFullScreen !== undefined ? \"mozRequestFullScreen\" :\n\t\t\t\t\t\t\tdb.msRequestFullscreen !== undefined ? \"msRequestFullscreen\" :\n\t\t\t\t\t\t\tdb.requestFullscreen !== undefined ? \"requestFullscreen\" : \"\",\n\t\t\"_exitFullscreen\": d.webkitExitFullscreen !== undefined ? \"webkitExitFullscreen\" :\n\t\t\t\t\t\t\td.mozCancelFullScreen !== undefined ? \"mozCancelFullScreen\" :\n\t\t\t\t\t\t\td.msExitFullscreen !== undefined ? \"msExitFullscreen\" :\n\t\t\t\t\t\t\td.exitFullscreen !== undefined ? \"exitFullscreen\" : \"\",\n\t\t\"_fullscreenElement\": d.webkitFullscreenElement !== undefined ? \"webkitFullscreenElement\" :\n\t\t\t\t\t\t\td.mozFullScreenElement !== undefined ? \"mozFullScreenElement\" :\n\t\t\t\t\t\t\td.msFullscreenElement !== undefined ? \"msFullscreenElement\" :\n\t\t\t\t\t\t\td.fullscreenElement !== undefined ? \"fullscreenElement\" : \"\",\n\t\t\"_fullscreenChange\": d.webkitFullscreenElement !== undefined ? \"webkitfullscreenchange\" :\n\t\t\t\t\t\t\td.mozFullScreenElement !== undefined ? \"mozfullscreenchange\" :\n\t\t\t\t\t\t\td.msFullscreenElement !== undefined ? \"MSFullscreenChange\" :\n\t\t\t\t\t\t\td.fullscreenElement !== undefined ? \"fullscreenchange\" : \"\"\n\t};\n\tif(!result._requestFullscreen || !result._exitFullscreen || !result._fullscreenElement || !result._fullscreenChange) {\n\t\treturn null;\n\t} else {\n\t\treturn result;\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/csscolorparser.js": {
"title": "$:/core/modules/utils/dom/csscolorparser.js",
"text": "// (c) Dean McNamee <dean@gmail.com>, 2012.\n//\n// https://github.com/deanm/css-color-parser-js\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n// IN THE SOFTWARE.\n\n// http://www.w3.org/TR/css3-color/\nvar kCSSColorTable = {\n \"transparent\": [0,0,0,0], \"aliceblue\": [240,248,255,1],\n \"antiquewhite\": [250,235,215,1], \"aqua\": [0,255,255,1],\n \"aquamarine\": [127,255,212,1], \"azure\": [240,255,255,1],\n \"beige\": [245,245,220,1], \"bisque\": [255,228,196,1],\n \"black\": [0,0,0,1], \"blanchedalmond\": [255,235,205,1],\n \"blue\": [0,0,255,1], \"blueviolet\": [138,43,226,1],\n \"brown\": [165,42,42,1], \"burlywood\": [222,184,135,1],\n \"cadetblue\": [95,158,160,1], \"chartreuse\": [127,255,0,1],\n \"chocolate\": [210,105,30,1], \"coral\": [255,127,80,1],\n \"cornflowerblue\": [100,149,237,1], \"cornsilk\": [255,248,220,1],\n \"crimson\": [220,20,60,1], \"cyan\": [0,255,255,1],\n \"darkblue\": [0,0,139,1], \"darkcyan\": [0,139,139,1],\n \"darkgoldenrod\": [184,134,11,1], \"darkgray\": [169,169,169,1],\n \"darkgreen\": [0,100,0,1], \"darkgrey\": [169,169,169,1],\n \"darkkhaki\": [189,183,107,1], \"darkmagenta\": [139,0,139,1],\n \"darkolivegreen\": [85,107,47,1], \"darkorange\": [255,140,0,1],\n \"darkorchid\": [153,50,204,1], \"darkred\": [139,0,0,1],\n \"darksalmon\": [233,150,122,1], \"darkseagreen\": [143,188,143,1],\n \"darkslateblue\": [72,61,139,1], \"darkslategray\": [47,79,79,1],\n \"darkslategrey\": [47,79,79,1], \"darkturquoise\": [0,206,209,1],\n \"darkviolet\": [148,0,211,1], \"deeppink\": [255,20,147,1],\n \"deepskyblue\": [0,191,255,1], \"dimgray\": [105,105,105,1],\n \"dimgrey\": [105,105,105,1], \"dodgerblue\": [30,144,255,1],\n \"firebrick\": [178,34,34,1], \"floralwhite\": [255,250,240,1],\n \"forestgreen\": [34,139,34,1], \"fuchsia\": [255,0,255,1],\n \"gainsboro\": [220,220,220,1], \"ghostwhite\": [248,248,255,1],\n \"gold\": [255,215,0,1], \"goldenrod\": [218,165,32,1],\n \"gray\": [128,128,128,1], \"green\": [0,128,0,1],\n \"greenyellow\": [173,255,47,1], \"grey\": [128,128,128,1],\n \"honeydew\": [240,255,240,1], \"hotpink\": [255,105,180,1],\n \"indianred\": [205,92,92,1], \"indigo\": [75,0,130,1],\n \"ivory\": [255,255,240,1], \"khaki\": [240,230,140,1],\n \"lavender\": [230,230,250,1], \"lavenderblush\": [255,240,245,1],\n \"lawngreen\": [124,252,0,1], \"lemonchiffon\": [255,250,205,1],\n \"lightblue\": [173,216,230,1], \"lightcoral\": [240,128,128,1],\n \"lightcyan\": [224,255,255,1], \"lightgoldenrodyellow\": [250,250,210,1],\n \"lightgray\": [211,211,211,1], \"lightgreen\": [144,238,144,1],\n \"lightgrey\": [211,211,211,1], \"lightpink\": [255,182,193,1],\n \"lightsalmon\": [255,160,122,1], \"lightseagreen\": [32,178,170,1],\n \"lightskyblue\": [135,206,250,1], \"lightslategray\": [119,136,153,1],\n \"lightslategrey\": [119,136,153,1], \"lightsteelblue\": [176,196,222,1],\n \"lightyellow\": [255,255,224,1], \"lime\": [0,255,0,1],\n \"limegreen\": [50,205,50,1], \"linen\": [250,240,230,1],\n \"magenta\": [255,0,255,1], \"maroon\": [128,0,0,1],\n \"mediumaquamarine\": [102,205,170,1], \"mediumblue\": [0,0,205,1],\n \"mediumorchid\": [186,85,211,1], \"mediumpurple\": [147,112,219,1],\n \"mediumseagreen\": [60,179,113,1], \"mediumslateblue\": [123,104,238,1],\n \"mediumspringgreen\": [0,250,154,1], \"mediumturquoise\": [72,209,204,1],\n \"mediumvioletred\": [199,21,133,1], \"midnightblue\": [25,25,112,1],\n \"mintcream\": [245,255,250,1], \"mistyrose\": [255,228,225,1],\n \"moccasin\": [255,228,181,1], \"navajowhite\": [255,222,173,1],\n \"navy\": [0,0,128,1], \"oldlace\": [253,245,230,1],\n \"olive\": [128,128,0,1], \"olivedrab\": [107,142,35,1],\n \"orange\": [255,165,0,1], \"orangered\": [255,69,0,1],\n \"orchid\": [218,112,214,1], \"palegoldenrod\": [238,232,170,1],\n \"palegreen\": [152,251,152,1], \"paleturquoise\": [175,238,238,1],\n \"palevioletred\": [219,112,147,1], \"papayawhip\": [255,239,213,1],\n \"peachpuff\": [255,218,185,1], \"peru\": [205,133,63,1],\n \"pink\": [255,192,203,1], \"plum\": [221,160,221,1],\n \"powderblue\": [176,224,230,1], \"purple\": [128,0,128,1],\n \"red\": [255,0,0,1], \"rosybrown\": [188,143,143,1],\n \"royalblue\": [65,105,225,1], \"saddlebrown\": [139,69,19,1],\n \"salmon\": [250,128,114,1], \"sandybrown\": [244,164,96,1],\n \"seagreen\": [46,139,87,1], \"seashell\": [255,245,238,1],\n \"sienna\": [160,82,45,1], \"silver\": [192,192,192,1],\n \"skyblue\": [135,206,235,1], \"slateblue\": [106,90,205,1],\n \"slategray\": [112,128,144,1], \"slategrey\": [112,128,144,1],\n \"snow\": [255,250,250,1], \"springgreen\": [0,255,127,1],\n \"steelblue\": [70,130,180,1], \"tan\": [210,180,140,1],\n \"teal\": [0,128,128,1], \"thistle\": [216,191,216,1],\n \"tomato\": [255,99,71,1], \"turquoise\": [64,224,208,1],\n \"violet\": [238,130,238,1], \"wheat\": [245,222,179,1],\n \"white\": [255,255,255,1], \"whitesmoke\": [245,245,245,1],\n \"yellow\": [255,255,0,1], \"yellowgreen\": [154,205,50,1]}\n\nfunction clamp_css_byte(i) { // Clamp to integer 0 .. 255.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 255 ? 255 : i;\n}\n\nfunction clamp_css_float(f) { // Clamp to float 0.0 .. 1.0.\n return f < 0 ? 0 : f > 1 ? 1 : f;\n}\n\nfunction parse_css_int(str) { // int or percentage.\n if (str[str.length - 1] === '%')\n return clamp_css_byte(parseFloat(str) / 100 * 255);\n return clamp_css_byte(parseInt(str));\n}\n\nfunction parse_css_float(str) { // float or percentage.\n if (str[str.length - 1] === '%')\n return clamp_css_float(parseFloat(str) / 100);\n return clamp_css_float(parseFloat(str));\n}\n\nfunction css_hue_to_rgb(m1, m2, h) {\n if (h < 0) h += 1;\n else if (h > 1) h -= 1;\n\n if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;\n if (h * 2 < 1) return m2;\n if (h * 3 < 2) return m1 + (m2 - m1) * (2/3 - h) * 6;\n return m1;\n}\n\nfunction parseCSSColor(css_str) {\n // Remove all whitespace, not compliant, but should just be more accepting.\n var str = css_str.replace(/ /g, '').toLowerCase();\n\n // Color keywords (and transparent) lookup.\n if (str in kCSSColorTable) return kCSSColorTable[str].slice(); // dup.\n\n // #abc and #abc123 syntax.\n if (str[0] === '#') {\n if (str.length === 4) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xfff)) return null; // Covers NaN.\n return [((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8),\n (iv & 0xf0) | ((iv & 0xf0) >> 4),\n (iv & 0xf) | ((iv & 0xf) << 4),\n 1];\n } else if (str.length === 7) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xffffff)) return null; // Covers NaN.\n return [(iv & 0xff0000) >> 16,\n (iv & 0xff00) >> 8,\n iv & 0xff,\n 1];\n }\n\n return null;\n }\n\n var op = str.indexOf('('), ep = str.indexOf(')');\n if (op !== -1 && ep + 1 === str.length) {\n var fname = str.substr(0, op);\n var params = str.substr(op+1, ep-(op+1)).split(',');\n var alpha = 1; // To allow case fallthrough.\n switch (fname) {\n case 'rgba':\n if (params.length !== 4) return null;\n alpha = parse_css_float(params.pop());\n // Fall through.\n case 'rgb':\n if (params.length !== 3) return null;\n return [parse_css_int(params[0]),\n parse_css_int(params[1]),\n parse_css_int(params[2]),\n alpha];\n case 'hsla':\n if (params.length !== 4) return null;\n alpha = parse_css_float(params.pop());\n // Fall through.\n case 'hsl':\n if (params.length !== 3) return null;\n var h = (((parseFloat(params[0]) % 360) + 360) % 360) / 360; // 0 .. 1\n // NOTE(deanm): According to the CSS spec s/l should only be\n // percentages, but we don't bother and let float or percentage.\n var s = parse_css_float(params[1]);\n var l = parse_css_float(params[2]);\n var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n var m1 = l * 2 - m2;\n return [clamp_css_byte(css_hue_to_rgb(m1, m2, h+1/3) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h-1/3) * 255),\n alpha];\n default:\n return null;\n }\n }\n\n return null;\n}\n\ntry { exports.parseCSSColor = parseCSSColor } catch(e) { }\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom.js": {
"title": "$:/core/modules/utils/dom.js",
"text": "/*\\\ntitle: $:/core/modules/utils/dom.js\ntype: application/javascript\nmodule-type: utils\n\nVarious static DOM-related utility functions.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nDetermines whether element 'a' contains element 'b'\nCode thanks to John Resig, http://ejohn.org/blog/comparing-document-position/\n*/\nexports.domContains = function(a,b) {\n\treturn a.contains ?\n\t\ta !== b && a.contains(b) :\n\t\t!!(a.compareDocumentPosition(b) & 16);\n};\n\nexports.domMatchesSelector = function(node,selector) {\n\treturn node.matches ? node.matches(selector) : node.msMatchesSelector(selector);\n};\n\nexports.removeChildren = function(node) {\n\twhile(node.hasChildNodes()) {\n\t\tnode.removeChild(node.firstChild);\n\t}\n};\n\nexports.hasClass = function(el,className) {\n\treturn el && el.hasAttribute && el.hasAttribute(\"class\") && el.getAttribute(\"class\").split(\" \").indexOf(className) !== -1;\n};\n\nexports.addClass = function(el,className) {\n\tvar c = (el.getAttribute(\"class\") || \"\").split(\" \");\n\tif(c.indexOf(className) === -1) {\n\t\tc.push(className);\n\t\tel.setAttribute(\"class\",c.join(\" \"));\n\t}\n};\n\nexports.removeClass = function(el,className) {\n\tvar c = (el.getAttribute(\"class\") || \"\").split(\" \"),\n\t\tp = c.indexOf(className);\n\tif(p !== -1) {\n\t\tc.splice(p,1);\n\t\tel.setAttribute(\"class\",c.join(\" \"));\n\t}\n};\n\nexports.toggleClass = function(el,className,status) {\n\tif(status === undefined) {\n\t\tstatus = !exports.hasClass(el,className);\n\t}\n\tif(status) {\n\t\texports.addClass(el,className);\n\t} else {\n\t\texports.removeClass(el,className);\n\t}\n};\n\n/*\nGet the first parent element that has scrollbars or use the body as fallback.\n*/\nexports.getScrollContainer = function(el) {\n\tvar doc = el.ownerDocument;\n\twhile(el.parentNode) {\n\t\tel = el.parentNode;\n\t\tif(el.scrollTop) {\n\t\t\treturn el;\n\t\t}\n\t}\n\treturn doc.body;\n};\n\n/*\nGet the scroll position of the viewport\nReturns:\n\t{\n\t\tx: horizontal scroll position in pixels,\n\t\ty: vertical scroll position in pixels\n\t}\n*/\nexports.getScrollPosition = function(srcWindow) {\n\tvar scrollWindow = srcWindow || window;\n\tif(\"scrollX\" in scrollWindow) {\n\t\treturn {x: scrollWindow.scrollX, y: scrollWindow.scrollY};\n\t} else {\n\t\treturn {x: scrollWindow.document.documentElement.scrollLeft, y: scrollWindow.document.documentElement.scrollTop};\n\t}\n};\n\n/*\nAdjust the height of a textarea to fit its content, preserving scroll position, and return the height\n*/\nexports.resizeTextAreaToFit = function(domNode,minHeight) {\n\t// Get the scroll container and register the current scroll position\n\tvar container = $tw.utils.getScrollContainer(domNode),\n\t\tscrollTop = container.scrollTop;\n // Measure the specified minimum height\n\tdomNode.style.height = minHeight;\n\tvar measuredHeight = domNode.offsetHeight || parseInt(minHeight,10);\n\t// Set its height to auto so that it snaps to the correct height\n\tdomNode.style.height = \"auto\";\n\t// Calculate the revised height\n\tvar newHeight = Math.max(domNode.scrollHeight + domNode.offsetHeight - domNode.clientHeight,measuredHeight);\n\t// Only try to change the height if it has changed\n\tif(newHeight !== domNode.offsetHeight) {\n\t\tdomNode.style.height = newHeight + \"px\";\n\t\t// Make sure that the dimensions of the textarea are recalculated\n\t\t$tw.utils.forceLayout(domNode);\n\t\t// Set the container to the position we registered at the beginning\n\t\tcontainer.scrollTop = scrollTop;\n\t}\n\treturn newHeight;\n};\n\n/*\nGets the bounding rectangle of an element in absolute page coordinates\n*/\nexports.getBoundingPageRect = function(element) {\n\tvar scrollPos = $tw.utils.getScrollPosition(element.ownerDocument.defaultView),\n\t\tclientRect = element.getBoundingClientRect();\n\treturn {\n\t\tleft: clientRect.left + scrollPos.x,\n\t\twidth: clientRect.width,\n\t\tright: clientRect.right + scrollPos.x,\n\t\ttop: clientRect.top + scrollPos.y,\n\t\theight: clientRect.height,\n\t\tbottom: clientRect.bottom + scrollPos.y\n\t};\n};\n\n/*\nSaves a named password in the browser\n*/\nexports.savePassword = function(name,password) {\n\tvar done = false;\n\ttry {\n\t\twindow.localStorage.setItem(\"tw5-password-\" + name,password);\n\t\tdone = true;\n\t} catch(e) {\n\t}\n\tif(!done) {\n\t\t$tw.savedPasswords = $tw.savedPasswords || Object.create(null);\n\t\t$tw.savedPasswords[name] = password;\n\t}\n};\n\n/*\nRetrieve a named password from the browser\n*/\nexports.getPassword = function(name) {\n\tvar value;\n\ttry {\n\t\tvalue = window.localStorage.getItem(\"tw5-password-\" + name);\n\t} catch(e) {\n\t}\n\tif(value !== undefined) {\n\t\treturn value;\n\t} else {\n\t\treturn ($tw.savedPasswords || Object.create(null))[name] || \"\";\n\t}\n};\n\n/*\nForce layout of a dom node and its descendents\n*/\nexports.forceLayout = function(element) {\n\tvar dummy = element.offsetWidth;\n};\n\n/*\nPulse an element for debugging purposes\n*/\nexports.pulseElement = function(element) {\n\t// Event handler to remove the class at the end\n\telement.addEventListener($tw.browser.animationEnd,function handler(event) {\n\t\telement.removeEventListener($tw.browser.animationEnd,handler,false);\n\t\t$tw.utils.removeClass(element,\"pulse\");\n\t},false);\n\t// Apply the pulse class\n\t$tw.utils.removeClass(element,\"pulse\");\n\t$tw.utils.forceLayout(element);\n\t$tw.utils.addClass(element,\"pulse\");\n};\n\n/*\nAttach specified event handlers to a DOM node\ndomNode: where to attach the event handlers\nevents: array of event handlers to be added (see below)\nEach entry in the events array is an object with these properties:\nhandlerFunction: optional event handler function\nhandlerObject: optional event handler object\nhandlerMethod: optionally specifies object handler method name (defaults to `handleEvent`)\n*/\nexports.addEventListeners = function(domNode,events) {\n\t$tw.utils.each(events,function(eventInfo) {\n\t\tvar handler;\n\t\tif(eventInfo.handlerFunction) {\n\t\t\thandler = eventInfo.handlerFunction;\n\t\t} else if(eventInfo.handlerObject) {\n\t\t\tif(eventInfo.handlerMethod) {\n\t\t\t\thandler = function(event) {\n\t\t\t\t\teventInfo.handlerObject[eventInfo.handlerMethod].call(eventInfo.handlerObject,event);\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\thandler = eventInfo.handlerObject;\n\t\t\t}\n\t\t}\n\t\tdomNode.addEventListener(eventInfo.name,handler,false);\n\t});\n};\n\n/*\nGet the computed styles applied to an element as an array of strings of individual CSS properties\n*/\nexports.getComputedStyles = function(domNode) {\n\tvar textAreaStyles = window.getComputedStyle(domNode,null),\n\t\tstyleDefs = [],\n\t\tname;\n\tfor(var t=0; t<textAreaStyles.length; t++) {\n\t\tname = textAreaStyles[t];\n\t\tstyleDefs.push(name + \": \" + textAreaStyles.getPropertyValue(name) + \";\");\n\t}\n\treturn styleDefs;\n};\n\n/*\nApply a set of styles passed as an array of strings of individual CSS properties\n*/\nexports.setStyles = function(domNode,styleDefs) {\n\tdomNode.style.cssText = styleDefs.join(\"\");\n};\n\n/*\nCopy the computed styles from a source element to a destination element\n*/\nexports.copyStyles = function(srcDomNode,dstDomNode) {\n\t$tw.utils.setStyles(dstDomNode,$tw.utils.getComputedStyles(srcDomNode));\n};\n\n/*\nCopy plain text to the clipboard on browsers that support it\n*/\nexports.copyToClipboard = function(text,options) {\n\toptions = options || {};\n\tvar textArea = document.createElement(\"textarea\");\n\ttextArea.style.position = \"fixed\";\n\ttextArea.style.top = 0;\n\ttextArea.style.left = 0;\n\ttextArea.style.fontSize = \"12pt\";\n\ttextArea.style.width = \"2em\";\n\ttextArea.style.height = \"2em\";\n\ttextArea.style.padding = 0;\n\ttextArea.style.border = \"none\";\n\ttextArea.style.outline = \"none\";\n\ttextArea.style.boxShadow = \"none\";\n\ttextArea.style.background = \"transparent\";\n\ttextArea.value = text;\n\tdocument.body.appendChild(textArea);\n\ttextArea.select();\n\ttextArea.setSelectionRange(0,text.length);\n\tvar succeeded = false;\n\ttry {\n\t\tsucceeded = document.execCommand(\"copy\");\n\t} catch (err) {\n\t}\n\tif(!options.doNotNotify) {\n\t\t$tw.notifier.display(succeeded ? \"$:/language/Notifications/CopiedToClipboard/Succeeded\" : \"$:/language/Notifications/CopiedToClipboard/Failed\");\n\t}\n\tdocument.body.removeChild(textArea);\n};\n\nexports.getLocationPath = function() {\n\treturn window.location.toString().split(\"#\")[0];\n};\n\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/dragndrop.js": {
"title": "$:/core/modules/utils/dom/dragndrop.js",
"text": "/*\\\ntitle: $:/core/modules/utils/dom/dragndrop.js\ntype: application/javascript\nmodule-type: utils\n\nBrowser data transfer utilities, used with the clipboard and drag and drop\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nOptions:\n\ndomNode: dom node to make draggable\ndragImageType: \"pill\" or \"dom\"\ndragTiddlerFn: optional function to retrieve the title of tiddler to drag\ndragFilterFn: optional function to retreive the filter defining a list of tiddlers to drag\nwidget: widget to use as the contect for the filter\n*/\nexports.makeDraggable = function(options) {\n\tvar dragImageType = options.dragImageType || \"dom\",\n\t\tdragImage,\n\t\tdomNode = options.domNode;\n\t// Make the dom node draggable (not necessary for anchor tags)\n\tif((domNode.tagName || \"\").toLowerCase() !== \"a\") {\n\t\tdomNode.setAttribute(\"draggable\",\"true\");\n\t}\n\t// Add event handlers\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"dragstart\", handlerFunction: function(event) {\n\t\t\tif(event.dataTransfer === undefined) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// Collect the tiddlers being dragged\n\t\t\tvar dragTiddler = options.dragTiddlerFn && options.dragTiddlerFn(),\n\t\t\t\tdragFilter = options.dragFilterFn && options.dragFilterFn(),\n\t\t\t\ttitles = dragTiddler ? [dragTiddler] : [],\n\t\t\t \tstartActions = options.startActions;\n\t\t\tif(dragFilter) {\n\t\t\t\ttitles.push.apply(titles,options.widget.wiki.filterTiddlers(dragFilter,options.widget));\n\t\t\t}\n\t\t\tvar titleString = $tw.utils.stringifyList(titles);\n\t\t\t// Check that we've something to drag\n\t\t\tif(titles.length > 0 && event.target === domNode) {\n\t\t\t\t// Mark the drag in progress\n\t\t\t\t$tw.dragInProgress = domNode;\n\t\t\t\t// Set the dragging class on the element being dragged\n\t\t\t\t$tw.utils.addClass(event.target,\"tc-dragging\");\n\t\t\t\t// Invoke drag-start actions if given\n\t\t\t\tif(startActions !== undefined) {\n\t\t\t\t\toptions.widget.invokeActionString(startActions,options.widget,event,{actionTiddler: titleString});\n\t\t\t\t}\n\t\t\t\t// Create the drag image elements\n\t\t\t\tdragImage = options.widget.document.createElement(\"div\");\n\t\t\t\tdragImage.className = \"tc-tiddler-dragger\";\n\t\t\t\tvar inner = options.widget.document.createElement(\"div\");\n\t\t\t\tinner.className = \"tc-tiddler-dragger-inner\";\n\t\t\t\tinner.appendChild(options.widget.document.createTextNode(\n\t\t\t\t\ttitles.length === 1 ? \n\t\t\t\t\t\ttitles[0] :\n\t\t\t\t\t\ttitles.length + \" tiddlers\"\n\t\t\t\t));\n\t\t\t\tdragImage.appendChild(inner);\n\t\t\t\toptions.widget.document.body.appendChild(dragImage);\n\t\t\t\t// Set the data transfer properties\n\t\t\t\tvar dataTransfer = event.dataTransfer;\n\t\t\t\t// Set up the image\n\t\t\t\tdataTransfer.effectAllowed = \"all\";\n\t\t\t\tif(dataTransfer.setDragImage) {\n\t\t\t\t\tif(dragImageType === \"pill\") {\n\t\t\t\t\t\tdataTransfer.setDragImage(dragImage.firstChild,-16,-16);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar r = domNode.getBoundingClientRect();\n\t\t\t\t\t\tdataTransfer.setDragImage(domNode,event.clientX-r.left,event.clientY-r.top);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Set up the data transfer\n\t\t\t\tif(dataTransfer.clearData) {\n\t\t\t\t\tdataTransfer.clearData();\n\t\t\t\t}\n\t\t\t\tvar jsonData = [];\n\t\t\t\tif(titles.length > 1) {\n\t\t\t\t\ttitles.forEach(function(title) {\n\t\t\t\t\t\tjsonData.push(options.widget.wiki.getTiddlerAsJson(title));\n\t\t\t\t\t});\n\t\t\t\t\tjsonData = \"[\" + jsonData.join(\",\") + \"]\";\n\t\t\t\t} else {\n\t\t\t\t\tjsonData = options.widget.wiki.getTiddlerAsJson(titles[0]);\n\t\t\t\t}\n\t\t\t\t// IE doesn't like these content types\n\t\t\t\tif(!$tw.browser.isIE) {\n\t\t\t\t\tdataTransfer.setData(\"text/vnd.tiddler\",jsonData);\n\t\t\t\t\tdataTransfer.setData(\"text/plain\",titleString);\n\t\t\t\t\tdataTransfer.setData(\"text/x-moz-url\",\"data:text/vnd.tiddler,\" + encodeURIComponent(jsonData));\n\t\t\t\t}\n\t\t\t\tdataTransfer.setData(\"URL\",\"data:text/vnd.tiddler,\" + encodeURIComponent(jsonData));\n\t\t\t\tdataTransfer.setData(\"Text\",titleString);\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t\treturn false;\n\t\t}},\n\t\t{name: \"dragend\", handlerFunction: function(event) {\n\t\t\tif(event.target === domNode) {\n\t\t\t\t// Collect the tiddlers being dragged\n\t\t\t\tvar dragTiddler = options.dragTiddlerFn && options.dragTiddlerFn(),\n\t\t\t\t\tdragFilter = options.dragFilterFn && options.dragFilterFn(),\n\t\t\t\t\ttitles = dragTiddler ? [dragTiddler] : [],\n\t\t\t \t\tendActions = options.endActions;\n\t\t\t\tif(dragFilter) {\n\t\t\t\t\ttitles.push.apply(titles,options.widget.wiki.filterTiddlers(dragFilter,options.widget));\n\t\t\t\t}\n\t\t\t\tvar titleString = $tw.utils.stringifyList(titles);\n\t\t\t\t$tw.dragInProgress = null;\n\t\t\t\t// Invoke drag-end actions if given\n\t\t\t\tif(endActions !== undefined) {\n\t\t\t\t\toptions.widget.invokeActionString(endActions,options.widget,event,{actionTiddler: titleString});\n\t\t\t\t}\n\t\t\t\t// Remove the dragging class on the element being dragged\n\t\t\t\t$tw.utils.removeClass(event.target,\"tc-dragging\");\n\t\t\t\t// Delete the drag image element\n\t\t\t\tif(dragImage) {\n\t\t\t\t\tdragImage.parentNode.removeChild(dragImage);\n\t\t\t\t\tdragImage = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}}\n\t]);\n};\n\nexports.importDataTransfer = function(dataTransfer,fallbackTitle,callback) {\n\t// Try each provided data type in turn\n\tif($tw.log.IMPORT) {\n\t\tconsole.log(\"Available data types:\");\n\t\tfor(var type=0; type<dataTransfer.types.length; type++) {\n\t\t\tconsole.log(\"type\",dataTransfer.types[type],dataTransfer.getData(dataTransfer.types[type]))\n\t\t}\n\t}\n\tfor(var t=0; t<importDataTypes.length; t++) {\n\t\tif(!$tw.browser.isIE || importDataTypes[t].IECompatible) {\n\t\t\t// Get the data\n\t\t\tvar dataType = importDataTypes[t];\n\t\t\t\tvar data = dataTransfer.getData(dataType.type);\n\t\t\t// Import the tiddlers in the data\n\t\t\tif(data !== \"\" && data !== null) {\n\t\t\t\tif($tw.log.IMPORT) {\n\t\t\t\t\tconsole.log(\"Importing data type '\" + dataType.type + \"', data: '\" + data + \"'\")\n\t\t\t\t}\n\t\t\t\tvar tiddlerFields = dataType.toTiddlerFieldsArray(data,fallbackTitle);\n\t\t\t\tcallback(tiddlerFields);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n};\n\nvar importDataTypes = [\n\t{type: \"text/vnd.tiddler\", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\treturn parseJSONTiddlers(data,fallbackTitle);\n\t}},\n\t{type: \"URL\", IECompatible: true, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\t// Check for tiddler data URI\n\t\tvar match = decodeURIComponent(data).match(/^data\\:text\\/vnd\\.tiddler,(.*)/i);\n\t\tif(match) {\n\t\t\treturn parseJSONTiddlers(match[1],fallbackTitle);\n\t\t} else {\n\t\t\treturn [{title: fallbackTitle, text: data}]; // As URL string\n\t\t}\n\t}},\n\t{type: \"text/x-moz-url\", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\t// Check for tiddler data URI\n\t\tvar match = decodeURIComponent(data).match(/^data\\:text\\/vnd\\.tiddler,(.*)/i);\n\t\tif(match) {\n\t\t\treturn parseJSONTiddlers(match[1],fallbackTitle);\n\t\t} else {\n\t\t\treturn [{title: fallbackTitle, text: data}]; // As URL string\n\t\t}\n\t}},\n\t{type: \"text/html\", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\treturn [{title: fallbackTitle, text: data}];\n\t}},\n\t{type: \"text/plain\", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\treturn [{title: fallbackTitle, text: data}];\n\t}},\n\t{type: \"Text\", IECompatible: true, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\treturn [{title: fallbackTitle, text: data}];\n\t}},\n\t{type: \"text/uri-list\", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {\n\t\treturn [{title: fallbackTitle, text: data}];\n\t}}\n];\n\nfunction parseJSONTiddlers(json,fallbackTitle) {\n\tvar data = JSON.parse(json);\n\tif(!$tw.utils.isArray(data)) {\n\t\tdata = [data];\n\t}\n\tdata.forEach(function(fields) {\n\t\tfields.title = fields.title || fallbackTitle;\n\t});\n\treturn data;\n};\n\nexports.dragEventContainsFiles = function(event) {\n\tif(event.dataTransfer.types) {\n\t\tfor(var i=0; i<event.dataTransfer.types.length; i++) {\n\t\t\tif(event.dataTransfer.types[i] === \"Files\") {\n\t\t\t\treturn true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/http.js": {
"title": "$:/core/modules/utils/dom/http.js",
"text": "/*\\\ntitle: $:/core/modules/utils/dom/http.js\ntype: application/javascript\nmodule-type: utils\n\nBrowser HTTP support\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nA quick and dirty HTTP function; to be refactored later. Options are:\n\turl: URL to retrieve\n\theaders: hashmap of headers to send\n\ttype: GET, PUT, POST etc\n\tcallback: function invoked with (err,data,xhr)\n\treturnProp: string name of the property to return as first argument of callback\n*/\nexports.httpRequest = function(options) {\n\tvar type = options.type || \"GET\",\n\t\turl = options.url,\n\t\theaders = options.headers || {accept: \"application/json\"},\n\t\thasHeader = function(targetHeader) {\n\t\t\ttargetHeader = targetHeader.toLowerCase();\n\t\t\tvar result = false;\n\t\t\t$tw.utils.each(headers,function(header,headerTitle,object) {\n\t\t\t\tif(headerTitle.toLowerCase() === targetHeader) {\n\t\t\t\t\tresult = true;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn result;\n\t\t},\n\t\treturnProp = options.returnProp || \"responseText\",\n\t\trequest = new XMLHttpRequest(),\n\t\tdata = \"\",\n\t\tf,results;\n\t// Massage the data hashmap into a string\n\tif(options.data) {\n\t\tif(typeof options.data === \"string\") { // Already a string\n\t\t\tdata = options.data;\n\t\t} else { // A hashmap of strings\n\t\t\tresults = [];\n\t\t\t$tw.utils.each(options.data,function(dataItem,dataItemTitle) {\n\t\t\t\tresults.push(dataItemTitle + \"=\" + encodeURIComponent(dataItem));\n\t\t\t});\n\t\t\tif(type === \"GET\" || type === \"HEAD\") {\n\t\t\t\turl += \"?\" + results.join(\"&\");\n\t\t\t} else {\n\t\t\t\tdata = results.join(\"&\");\n\t\t\t}\n\t\t}\n\t}\n\t// Set up the state change handler\n\trequest.onreadystatechange = function() {\n\t\tif(this.readyState === 4) {\n\t\t\tif(this.status === 200 || this.status === 201 || this.status === 204) {\n\t\t\t\t// Success!\n\t\t\t\toptions.callback(null,this[returnProp],this);\n\t\t\t\treturn;\n\t\t\t}\n\t\t// Something went wrong\n\t\toptions.callback($tw.language.getString(\"Error/XMLHttpRequest\") + \": \" + this.status,null,this);\n\t\t}\n\t};\n\t// Make the request\n\trequest.open(type,url,true);\n\tif(headers) {\n\t\t$tw.utils.each(headers,function(header,headerTitle,object) {\n\t\t\trequest.setRequestHeader(headerTitle,header);\n\t\t});\n\t}\n\tif(data && !hasHeader(\"Content-Type\")) {\n\t\trequest.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded; charset=UTF-8\");\n\t}\n\tif(!hasHeader(\"X-Requested-With\")) {\n\t\trequest.setRequestHeader(\"X-Requested-With\",\"TiddlyWiki\");\n\t}\n\ttry {\n\t\trequest.send(data);\n\t} catch(e) {\n\t\toptions.callback(e,null,this);\n\t}\n\treturn request;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/keyboard.js": {
"title": "$:/core/modules/utils/dom/keyboard.js",
"text": "/*\\\ntitle: $:/core/modules/utils/dom/keyboard.js\ntype: application/javascript\nmodule-type: utils\n\nKeyboard utilities; now deprecated. Instead, use $tw.keyboardManager\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n[\"parseKeyDescriptor\",\"checkKeyDescriptor\"].forEach(function(method) {\n\texports[method] = function() {\n\t\tif($tw.keyboardManager) {\n\t\t\treturn $tw.keyboardManager[method].apply($tw.keyboardManager,Array.prototype.slice.call(arguments,0));\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t};\n});\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/modal.js": {
"title": "$:/core/modules/utils/dom/modal.js",
"text": "/*\\\ntitle: $:/core/modules/utils/dom/modal.js\ntype: application/javascript\nmodule-type: utils\n\nModal message mechanism\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\"),\n\tnavigator = require(\"$:/core/modules/widgets/navigator.js\"),\n\tdm = $tw.utils.domMaker;\n\nvar Modal = function(wiki) {\n\tthis.wiki = wiki;\n\tthis.modalCount = 0;\n};\n\n/*\nDisplay a modal dialogue\n\ttitle: Title of tiddler to display\n\toptions: see below\nOptions include:\n\tdownloadLink: Text of a big download link to include\n\tvariables: variables to be passed to the modal\n\tevent: optional DOM event that initiated the modal\n\tprogress: set to true to add a progress bar\n\tonclose: callback for when the modal is closed\n*/\nModal.prototype.display = function(title,options) {\n\toptions = options || {};\n\tthis.srcDocument = options.variables && (options.variables.rootwindow === \"true\" ||\n\t\t\t\toptions.variables.rootwindow === \"yes\") ? document :\n\t\t\t\t(options.event && options.event.event && options.event.event.target ? options.event.event.target.ownerDocument : document);\n\tthis.srcWindow = this.srcDocument.defaultView;\n\tvar self = this,\n\t\trefreshHandler,\n\t\tduration = $tw.utils.getAnimationDuration(),\n\t\ttiddler = this.wiki.getTiddler(title);\n\t// Don't do anything if the tiddler doesn't exist\n\tif(!tiddler) {\n\t\treturn;\n\t}\n\t// Create the variables\n\tvar variables = $tw.utils.extend({\n\t\t\tcurrentTiddler: title,\n\t\t\t\"tv-story-list\": (options.event && options.event.widget ? options.event.widget.getVariable(\"tv-story-list\") : \"\"),\n\t\t\t\"tv-history-list\": (options.event && options.event.widget ? options.event.widget.getVariable(\"tv-history-list\") : \"\")\n\t\t},options.variables);\n\t// Create the wrapper divs\n\tvar wrapper = this.srcDocument.createElement(\"div\"),\n\t\tmodalBackdrop = this.srcDocument.createElement(\"div\"),\n\t\tmodalWrapper = this.srcDocument.createElement(\"div\"),\n\t\tmodalHeader = this.srcDocument.createElement(\"div\"),\n\t\theaderTitle = this.srcDocument.createElement(\"h3\"),\n\t\tmodalBody = this.srcDocument.createElement(\"div\"),\n\t\tmodalProgress = this.srcDocument.createElement(\"div\"),\n\t\tmodalLink = this.srcDocument.createElement(\"a\"),\n\t\tmodalFooter = this.srcDocument.createElement(\"div\"),\n\t\tmodalFooterHelp = this.srcDocument.createElement(\"span\"),\n\t\tmodalFooterButtons = this.srcDocument.createElement(\"span\");\n\t// Up the modal count and adjust the body class\n\tthis.modalCount++;\n\tthis.adjustPageClass();\n\t// Add classes\n\t$tw.utils.addClass(wrapper,\"tc-modal-wrapper\");\n\tif(tiddler.fields && tiddler.fields.class) {\n\t\t$tw.utils.addClass(wrapper,tiddler.fields.class);\n\t}\n\t$tw.utils.addClass(modalBackdrop,\"tc-modal-backdrop\");\n\t$tw.utils.addClass(modalWrapper,\"tc-modal\");\n\t$tw.utils.addClass(modalHeader,\"tc-modal-header\");\n\t$tw.utils.addClass(modalBody,\"tc-modal-body\");\n\t$tw.utils.addClass(modalProgress,\"tc-modal-progress\");\n\t$tw.utils.addClass(modalFooter,\"tc-modal-footer\");\n\t// Join them together\n\twrapper.appendChild(modalBackdrop);\n\twrapper.appendChild(modalWrapper);\n\tmodalHeader.appendChild(headerTitle);\n\tmodalWrapper.appendChild(modalHeader);\n\tmodalWrapper.appendChild(modalBody);\n\tif(options.progress) {\n\t\tvar modalProgressBar = this.srcDocument.createElement(\"div\");\n\t\tmodalProgressBar.className = \"tc-modal-progress-bar\";\n\t\tmodalProgress.appendChild(modalProgressBar);\n\t\tvar modalProgressPercent = this.srcDocument.createElement(\"div\");\n\t\tmodalProgressPercent.className = \"tc-modal-progress-percent\";\n\t\tmodalProgress.appendChild(modalProgressPercent);\n\t\tmodalWrapper.appendChild(modalProgress);\n\t}\n\tmodalFooter.appendChild(modalFooterHelp);\n\tmodalFooter.appendChild(modalFooterButtons);\n\tmodalWrapper.appendChild(modalFooter);\n\tvar navigatorTree = {\n\t\t\"type\": \"navigator\",\n\t\t\"attributes\": {\n\t\t\t\"story\": {\n\t\t\t\t\"name\": \"story\",\n\t\t\t\t\"type\": \"string\",\n\t\t\t\t\"value\": variables[\"tv-story-list\"]\n\t\t\t},\n\t\t\t\"history\": {\n\t\t\t\t\"name\": \"history\",\n\t\t\t\t\"type\": \"string\",\n\t\t\t\t\"value\": variables[\"tv-history-list\"]\n\t\t\t}\n\t\t},\n\t\t\"tag\": \"$navigator\",\n\t\t\"isBlock\": true,\n\t\t\"children\": []\n\t};\n\tvar navigatorWidgetNode = new navigator.navigator(navigatorTree, {\n\t\twiki: this.wiki,\n\t\tdocument : this.srcDocument,\n\t\tparentWidget: $tw.rootWidget\n\t});\n\tnavigatorWidgetNode.render(modalBody,null);\n\t// Render the title of the message\n\tvar headerWidgetNode = this.wiki.makeTranscludeWidget(title,{\n\t\tfield: \"subtitle\",\n\t\tmode: \"inline\",\n\t\tchildren: [{\n\t\t\ttype: \"text\",\n\t\t\tattributes: {\n\t\t\t\ttext: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalue: title\n\t\t}}}],\n\t\tparentWidget: navigatorWidgetNode,\n\t\tdocument: this.srcDocument,\n\t\tvariables: variables,\n\t\timportPageMacros: true\n\t});\n\theaderWidgetNode.render(headerTitle,null);\n\t// Render the body of the message\n\tvar bodyWidgetNode = this.wiki.makeTranscludeWidget(title,{\n\t\tparentWidget: navigatorWidgetNode,\n\t\tdocument: this.srcDocument,\n\t\tvariables: variables,\n\t\timportPageMacros: true\n\t});\n\n\tbodyWidgetNode.render(modalBody,null);\n\t// Setup the link if present\n\tif(options.downloadLink) {\n\t\tmodalLink.href = options.downloadLink;\n\t\tmodalLink.appendChild(this.srcDocument.createTextNode(\"Right-click to save changes\"));\n\t\tmodalBody.appendChild(modalLink);\n\t}\n\t// Render the footer of the message\n\tif(tiddler.fields && tiddler.fields.help) {\n\t\tvar link = this.srcDocument.createElement(\"a\");\n\t\tlink.setAttribute(\"href\",tiddler.fields.help);\n\t\tlink.setAttribute(\"target\",\"_blank\");\n\t\tlink.setAttribute(\"rel\",\"noopener noreferrer\");\n\t\tlink.appendChild(this.srcDocument.createTextNode(\"Help\"));\n\t\tmodalFooterHelp.appendChild(link);\n\t\tmodalFooterHelp.style.float = \"left\";\n\t}\n\tvar footerWidgetNode = this.wiki.makeTranscludeWidget(title,{\n\t\tfield: \"footer\",\n\t\tmode: \"inline\",\n\t\tchildren: [{\n\t\t\ttype: \"button\",\n\t\t\tattributes: {\n\t\t\t\tmessage: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalue: \"tm-close-tiddler\"\n\t\t\t\t}\n\t\t\t},\n\t\t\tchildren: [{\n\t\t\t\ttype: \"text\",\n\t\t\t\tattributes: {\n\t\t\t\t\ttext: {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tvalue: $tw.language.getString(\"Buttons/Close/Caption\")\n\t\t\t}}}\n\t\t]}],\n\t\tparentWidget: navigatorWidgetNode,\n\t\tdocument: this.srcDocument,\n\t\tvariables: variables,\n\t\timportPageMacros: true\n\t});\n\tfooterWidgetNode.render(modalFooterButtons,null);\n\t// Set up the refresh handler\n\trefreshHandler = function(changes) {\n\t\theaderWidgetNode.refresh(changes,modalHeader,null);\n\t\tbodyWidgetNode.refresh(changes,modalBody,null);\n\t\tfooterWidgetNode.refresh(changes,modalFooterButtons,null);\n\t};\n\tthis.wiki.addEventListener(\"change\",refreshHandler);\n\t// Add the close event handler\n\tvar closeHandler = function(event) {\n\t\t// Call the onclose handler\n\t\tif(options.onclose) {\n\t\t\toptions.onclose(event);\n\t\t}\n\t\t// Remove our refresh handler\n\t\tself.wiki.removeEventListener(\"change\",refreshHandler);\n\t\t// Decrease the modal count and adjust the body class\n\t\tself.modalCount--;\n\t\tself.adjustPageClass();\n\t\t// Force layout and animate the modal message away\n\t\t$tw.utils.forceLayout(modalBackdrop);\n\t\t$tw.utils.forceLayout(modalWrapper);\n\t\t$tw.utils.setStyle(modalBackdrop,[\n\t\t\t{opacity: \"0\"}\n\t\t]);\n\t\t$tw.utils.setStyle(modalWrapper,[\n\t\t\t{transform: \"translateY(\" + self.srcWindow.innerHeight + \"px)\"}\n\t\t]);\n\t\t// Set up an event for the transition end\n\t\tself.srcWindow.setTimeout(function() {\n\t\t\tif(wrapper.parentNode) {\n\t\t\t\t// Remove the modal message from the DOM\n\t\t\t\tself.srcDocument.body.removeChild(wrapper);\n\t\t\t}\n\t\t},duration);\n\t\t// Don't let anyone else handle the tm-close-tiddler message\n\t\treturn false;\n\t};\n\theaderWidgetNode.addEventListener(\"tm-close-tiddler\",closeHandler,false);\n\tbodyWidgetNode.addEventListener(\"tm-close-tiddler\",closeHandler,false);\n\tfooterWidgetNode.addEventListener(\"tm-close-tiddler\",closeHandler,false);\n\t// Set the initial styles for the message\n\t$tw.utils.setStyle(modalBackdrop,[\n\t\t{opacity: \"0\"}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transformOrigin: \"0% 0%\"},\n\t\t{transform: \"translateY(\" + (-this.srcWindow.innerHeight) + \"px)\"}\n\t]);\n\t// Put the message into the document\n\tthis.srcDocument.body.appendChild(wrapper);\n\t// Set up animation for the styles\n\t$tw.utils.setStyle(modalBackdrop,[\n\t\t{transition: \"opacity \" + duration + \"ms ease-out\"}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transition: $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in-out\"}\n\t]);\n\t// Force layout\n\t$tw.utils.forceLayout(modalBackdrop);\n\t$tw.utils.forceLayout(modalWrapper);\n\t// Set final animated styles\n\t$tw.utils.setStyle(modalBackdrop,[\n\t\t{opacity: \"0.7\"}\n\t]);\n\t$tw.utils.setStyle(modalWrapper,[\n\t\t{transform: \"translateY(0px)\"}\n\t]);\n\t// Return the wrapper node\n\treturn {\n\t\tdomNode: wrapper,\n\t\tcloseHandler: closeHandler,\n\t\tsetProgress: function(numerator,denominator) {\n\t\t\t// Remove old progress\n\t\t\twhile(modalProgressPercent.hasChildNodes()) {\n\t\t\t\tmodalProgressPercent.removeChild(modalProgressPercent.firstChild);\n\t\t\t}\n\t\t\t// Set new text\n\t\t\tvar percent = (numerator * 100 /denominator).toFixed(2) + \"%\";\n\t\t\tmodalProgressPercent.appendChild(self.srcDocument.createTextNode(percent));\n\t\t\t// Set bar width\n\t\t\tmodalProgressBar.style.width = percent;\n\t\t}\n\t};\n};\n\nModal.prototype.adjustPageClass = function() {\n\tvar windowContainer = $tw.pageContainer ? ($tw.pageContainer === this.srcDocument.body.firstChild ? $tw.pageContainer : this.srcDocument.body.firstChild) : null;\n\tif(windowContainer) {\n\t\t$tw.utils.toggleClass(windowContainer,\"tc-modal-displayed\",this.modalCount > 0);\n\t}\n};\n\nexports.Modal = Modal;\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/notifier.js": {
"title": "$:/core/modules/utils/dom/notifier.js",
"text": "/*\\\ntitle: $:/core/modules/utils/dom/notifier.js\ntype: application/javascript\nmodule-type: utils\n\nNotifier mechanism\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nvar Notifier = function(wiki) {\n\tthis.wiki = wiki;\n};\n\n/*\nDisplay a notification\n\ttitle: Title of tiddler containing the notification text\n\toptions: see below\nOptions include:\n*/\nNotifier.prototype.display = function(title,options) {\n\toptions = options || {};\n\t// Create the wrapper divs\n\tvar self = this,\n\t\tnotification = document.createElement(\"div\"),\n\t\ttiddler = this.wiki.getTiddler(title),\n\t\tduration = $tw.utils.getAnimationDuration(),\n\t\trefreshHandler;\n\t// Don't do anything if the tiddler doesn't exist\n\tif(!tiddler) {\n\t\treturn;\n\t}\n\t// Add classes\n\t$tw.utils.addClass(notification,\"tc-notification\");\n\t// Create the variables\n\tvar variables = $tw.utils.extend({currentTiddler: title},options.variables);\n\t// Render the body of the notification\n\tvar widgetNode = this.wiki.makeTranscludeWidget(title,{\n\t\tparentWidget: $tw.rootWidget,\n\t\tdocument: document,\n\t\tvariables: variables,\n\t\timportPageMacros: true});\n\twidgetNode.render(notification,null);\n\trefreshHandler = function(changes) {\n\t\twidgetNode.refresh(changes,notification,null);\n\t};\n\tthis.wiki.addEventListener(\"change\",refreshHandler);\n\t// Set the initial styles for the notification\n\t$tw.utils.setStyle(notification,[\n\t\t{opacity: \"0\"},\n\t\t{transformOrigin: \"0% 0%\"},\n\t\t{transform: \"translateY(\" + (-window.innerHeight) + \"px)\"},\n\t\t{transition: \"opacity \" + duration + \"ms ease-out, \" + $tw.utils.roundTripPropertyName(\"transform\") + \" \" + duration + \"ms ease-in-out\"}\n\t]);\n\t// Add the notification to the DOM\n\tdocument.body.appendChild(notification);\n\t// Force layout\n\t$tw.utils.forceLayout(notification);\n\t// Set final animated styles\n\t$tw.utils.setStyle(notification,[\n\t\t{opacity: \"1.0\"},\n\t\t{transform: \"translateY(0px)\"}\n\t]);\n\t// Set a timer to remove the notification\n\twindow.setTimeout(function() {\n\t\t// Remove our change event handler\n\t\tself.wiki.removeEventListener(\"change\",refreshHandler);\n\t\t// Force layout and animate the notification away\n\t\t$tw.utils.forceLayout(notification);\n\t\t$tw.utils.setStyle(notification,[\n\t\t\t{opacity: \"0.0\"},\n\t\t\t{transform: \"translateX(\" + (notification.offsetWidth) + \"px)\"}\n\t\t]);\n\t\t// Remove the modal message from the DOM once the transition ends\n\t\tsetTimeout(function() {\n\t\t\tif(notification.parentNode) {\n\t\t\t\tdocument.body.removeChild(notification);\n\t\t\t}\n\t\t},duration);\n\t},$tw.config.preferences.notificationDuration);\n};\n\nexports.Notifier = Notifier;\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/popup.js": {
"title": "$:/core/modules/utils/dom/popup.js",
"text": "/*\\\ntitle: $:/core/modules/utils/dom/popup.js\ntype: application/javascript\nmodule-type: utils\n\nModule that creates a $tw.utils.Popup object prototype that manages popups in the browser\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nCreates a Popup object with these options:\n\trootElement: the DOM element to which the popup zapper should be attached\n*/\nvar Popup = function(options) {\n\toptions = options || {};\n\tthis.rootElement = options.rootElement || document.documentElement;\n\tthis.popups = []; // Array of {title:,wiki:,domNode:} objects\n};\n\n/*\nTrigger a popup open or closed. Parameters are in a hashmap:\n\ttitle: title of the tiddler where the popup details are stored\n\tdomNode: dom node to which the popup will be positioned (one of domNode or domNodeRect is required)\n\tdomNodeRect: rectangle to which the popup will be positioned\n\twiki: wiki\n\tforce: if specified, forces the popup state to true or false (instead of toggling it)\n\tfloating: if true, skips registering the popup, meaning that it will need manually clearing\n*/\nPopup.prototype.triggerPopup = function(options) {\n\t// Check if this popup is already active\n\tvar index = this.findPopup(options.title);\n\t// Compute the new state\n\tvar state = index === -1;\n\tif(options.force !== undefined) {\n\t\tstate = options.force;\n\t}\n\t// Show or cancel the popup according to the new state\n\tif(state) {\n\t\tthis.show(options);\n\t} else {\n\t\tthis.cancel(index);\n\t}\n};\n\nPopup.prototype.findPopup = function(title) {\n\tvar index = -1;\n\tfor(var t=0; t<this.popups.length; t++) {\n\t\tif(this.popups[t].title === title) {\n\t\t\tindex = t;\n\t\t}\n\t}\n\treturn index;\n};\n\nPopup.prototype.handleEvent = function(event) {\n\tif(event.type === \"click\") {\n\t\t// Find out what was clicked on\n\t\tvar info = this.popupInfo(event.target),\n\t\t\tcancelLevel = info.popupLevel - 1;\n\t\t// Don't remove the level that was clicked on if we clicked on a handle\n\t\tif(info.isHandle) {\n\t\t\tcancelLevel++;\n\t\t}\n\t\t// Cancel\n\t\tthis.cancel(cancelLevel);\n\t}\n};\n\n/*\nFind the popup level containing a DOM node. Returns:\npopupLevel: count of the number of nested popups containing the specified element\nisHandle: true if the specified element is within a popup handle\n*/\nPopup.prototype.popupInfo = function(domNode) {\n\tvar isHandle = false,\n\t\tpopupCount = 0,\n\t\tnode = domNode;\n\t// First check ancestors to see if we're within a popup handle\n\twhile(node) {\n\t\tif($tw.utils.hasClass(node,\"tc-popup-handle\")) {\n\t\t\tisHandle = true;\n\t\t\tpopupCount++;\n\t\t}\n\t\tif($tw.utils.hasClass(node,\"tc-popup-keep\")) {\n\t\t\tisHandle = true;\n\t\t}\n\t\tnode = node.parentNode;\n\t}\n\t// Then count the number of ancestor popups\n\tnode = domNode;\n\twhile(node) {\n\t\tif($tw.utils.hasClass(node,\"tc-popup\")) {\n\t\t\tpopupCount++;\n\t\t}\n\t\tnode = node.parentNode;\n\t}\n\tvar info = {\n\t\tpopupLevel: popupCount,\n\t\tisHandle: isHandle\n\t};\n\treturn info;\n};\n\n/*\nDisplay a popup by adding it to the stack\n*/\nPopup.prototype.show = function(options) {\n\t// Find out what was clicked on\n\tvar info = this.popupInfo(options.domNode);\n\t// Cancel any higher level popups\n\tthis.cancel(info.popupLevel);\n\n\t// Store the popup details if not already there\n\tif(!options.floating && this.findPopup(options.title) === -1) {\n\t\tthis.popups.push({\n\t\t\ttitle: options.title,\n\t\t\twiki: options.wiki,\n\t\t\tdomNode: options.domNode,\n\t\t\tnoStateReference: options.noStateReference\n\t\t});\n\t}\n\t// Set the state tiddler\n\tvar rect;\n\tif(options.domNodeRect) {\n\t\trect = options.domNodeRect;\n\t} else {\n\t\trect = {\n\t\t\tleft: options.domNode.offsetLeft,\n\t\t\ttop: options.domNode.offsetTop,\n\t\t\twidth: options.domNode.offsetWidth,\n\t\t\theight: options.domNode.offsetHeight\n\t\t};\n\t}\n\tvar popupRect = \"(\" + rect.left + \",\" + rect.top + \",\" + \n\t\t\t\trect.width + \",\" + rect.height + \")\";\n\tif(options.noStateReference) {\n\t\toptions.wiki.setText(options.title,\"text\",undefined,popupRect);\n\t} else {\n\t\toptions.wiki.setTextReference(options.title,popupRect);\n\t}\n\t// Add the click handler if we have any popups\n\tif(this.popups.length > 0) {\n\t\tthis.rootElement.addEventListener(\"click\",this,true);\n\t}\n};\n\n/*\nCancel all popups at or above a specified level or DOM node\nlevel: popup level to cancel (0 cancels all popups)\n*/\nPopup.prototype.cancel = function(level) {\n\tvar numPopups = this.popups.length;\n\tlevel = Math.max(0,Math.min(level,numPopups));\n\tfor(var t=level; t<numPopups; t++) {\n\t\tvar popup = this.popups.pop();\n\t\tif(popup.title) {\n\t\t\tif(popup.noStateReference) {\n\t\t\t\tpopup.wiki.deleteTiddler(popup.title);\n\t\t\t} else {\n\t\t\t\tpopup.wiki.deleteTiddler($tw.utils.parseTextReference(popup.title).title);\n \t\t}\n\t\t}\n\t}\n\tif(this.popups.length === 0) {\n\t\tthis.rootElement.removeEventListener(\"click\",this,false);\n\t}\n};\n\n/*\nReturns true if the specified title and text identifies an active popup\n*/\nPopup.prototype.readPopupState = function(text) {\n\tvar popupLocationRegExp = /^\\((-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+)\\)$/;\n\treturn popupLocationRegExp.test(text);\n};\n\nexports.Popup = Popup;\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/dom/scroller.js": {
"title": "$:/core/modules/utils/dom/scroller.js",
"text": "/*\\\ntitle: $:/core/modules/utils/dom/scroller.js\ntype: application/javascript\nmodule-type: utils\n\nModule that creates a $tw.utils.Scroller object prototype that manages scrolling in the browser\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nEvent handler for when the `tm-scroll` event hits the document body\n*/\nvar PageScroller = function() {\n\tthis.idRequestFrame = null;\n\tthis.requestAnimationFrame = window.requestAnimationFrame ||\n\t\twindow.webkitRequestAnimationFrame ||\n\t\twindow.mozRequestAnimationFrame ||\n\t\tfunction(callback) {\n\t\t\treturn window.setTimeout(callback, 1000/60);\n\t\t};\n\tthis.cancelAnimationFrame = window.cancelAnimationFrame ||\n\t\twindow.webkitCancelAnimationFrame ||\n\t\twindow.webkitCancelRequestAnimationFrame ||\n\t\twindow.mozCancelAnimationFrame ||\n\t\twindow.mozCancelRequestAnimationFrame ||\n\t\tfunction(id) {\n\t\t\twindow.clearTimeout(id);\n\t\t};\n};\n\nPageScroller.prototype.isScrolling = function() {\n\treturn this.idRequestFrame !== null;\n}\n\nPageScroller.prototype.cancelScroll = function(srcWindow) {\n\tif(this.idRequestFrame) {\n\t\tthis.cancelAnimationFrame.call(srcWindow,this.idRequestFrame);\n\t\tthis.idRequestFrame = null;\n\t}\n};\n\n/*\nHandle an event\n*/\nPageScroller.prototype.handleEvent = function(event) {\n\tif(event.type === \"tm-scroll\") {\n\t\tif(event.paramObject && event.paramObject.selector) {\n\t\t\tthis.scrollSelectorIntoView(null,event.paramObject.selector);\n\t\t} else {\n\t\t\tthis.scrollIntoView(event.target);\n\t\t}\n\t\treturn false; // Event was handled\n\t}\n\treturn true;\n};\n\n/*\nHandle a scroll event hitting the page document\n*/\nPageScroller.prototype.scrollIntoView = function(element,callback) {\n\tvar self = this,\n\t\tduration = $tw.utils.getAnimationDuration(),\n\t srcWindow = element ? element.ownerDocument.defaultView : window;\n\t// Now get ready to scroll the body\n\tthis.cancelScroll(srcWindow);\n\tthis.startTime = Date.now();\n\t// Get the height of any position:fixed toolbars\n\tvar toolbar = srcWindow.document.querySelector(\".tc-adjust-top-of-scroll\"),\n\t\toffset = 0;\n\tif(toolbar) {\n\t\toffset = toolbar.offsetHeight;\n\t}\n\t// Get the client bounds of the element and adjust by the scroll position\n\tvar getBounds = function() {\n\t\t\tvar clientBounds = typeof callback === 'function' ? callback() : element.getBoundingClientRect(),\n\t\t\t\tscrollPosition = $tw.utils.getScrollPosition(srcWindow);\n\t\t\treturn {\n\t\t\t\tleft: clientBounds.left + scrollPosition.x,\n\t\t\t\ttop: clientBounds.top + scrollPosition.y - offset,\n\t\t\t\twidth: clientBounds.width,\n\t\t\t\theight: clientBounds.height\n\t\t\t};\n\t\t},\n\t\t// We'll consider the horizontal and vertical scroll directions separately via this function\n\t\t// targetPos/targetSize - position and size of the target element\n\t\t// currentPos/currentSize - position and size of the current scroll viewport\n\t\t// returns: new position of the scroll viewport\n\t\tgetEndPos = function(targetPos,targetSize,currentPos,currentSize) {\n\t\t\tvar newPos = targetPos;\n\t\t\t// If we are scrolling within 50 pixels of the top/left then snap to zero\n\t\t\tif(newPos < 50) {\n\t\t\t\tnewPos = 0;\n\t\t\t}\n\t\t\treturn newPos;\n\t\t},\n\t\tdrawFrame = function drawFrame() {\n\t\t\tvar t;\n\t\t\tif(duration <= 0) {\n\t\t\t\tt = 1;\n\t\t\t} else {\n\t\t\t\tt = ((Date.now()) - self.startTime) / duration;\n\t\t\t}\n\t\t\tif(t >= 1) {\n\t\t\t\tself.cancelScroll(srcWindow);\n\t\t\t\tt = 1;\n\t\t\t}\n\t\t\tt = $tw.utils.slowInSlowOut(t);\n\t\t\tvar scrollPosition = $tw.utils.getScrollPosition(srcWindow),\n\t\t\t\tbounds = getBounds(),\n\t\t\t\tendX = getEndPos(bounds.left,bounds.width,scrollPosition.x,srcWindow.innerWidth),\n\t\t\t\tendY = getEndPos(bounds.top,bounds.height,scrollPosition.y,srcWindow.innerHeight);\n\t\t\tsrcWindow.scrollTo(scrollPosition.x + (endX - scrollPosition.x) * t,scrollPosition.y + (endY - scrollPosition.y) * t);\n\t\t\tif(t < 1) {\n\t\t\t\tself.idRequestFrame = self.requestAnimationFrame.call(srcWindow,drawFrame);\n\t\t\t}\n\t\t};\n\tdrawFrame();\n};\n\nPageScroller.prototype.scrollSelectorIntoView = function(baseElement,selector,callback) {\n\tbaseElement = baseElement || document.body;\n\tvar element = baseElement.querySelector(selector);\n\tif(element) {\n\t\tthis.scrollIntoView(element,callback);\n\t}\n};\n\nexports.PageScroller = PageScroller;\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/edition-info.js": {
"title": "$:/core/modules/utils/edition-info.js",
"text": "/*\\\ntitle: $:/core/modules/utils/edition-info.js\ntype: application/javascript\nmodule-type: utils-node\n\nInformation about the available editions\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar fs = require(\"fs\"),\n\tpath = require(\"path\");\n\nvar editionInfo;\n\nexports.getEditionInfo = function() {\n\tif(!editionInfo) {\n\t\t// Enumerate the edition paths\n\t\tvar editionPaths = $tw.getLibraryItemSearchPaths($tw.config.editionsPath,$tw.config.editionsEnvVar);\n\t\teditionInfo = {};\n\t\tfor(var editionIndex=0; editionIndex<editionPaths.length; editionIndex++) {\n\t\t\tvar editionPath = editionPaths[editionIndex];\n\t\t\t// Enumerate the folders\n\t\t\tvar entries = fs.readdirSync(editionPath);\n\t\t\tfor(var entryIndex=0; entryIndex<entries.length; entryIndex++) {\n\t\t\t\tvar entry = entries[entryIndex];\n\t\t\t\t// Check if directories have a valid tiddlywiki.info\n\t\t\t\tif(!editionInfo[entry] && $tw.utils.isDirectory(path.resolve(editionPath,entry))) {\n\t\t\t\t\tvar info;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinfo = JSON.parse(fs.readFileSync(path.resolve(editionPath,entry,\"tiddlywiki.info\"),\"utf8\"));\n\t\t\t\t\t} catch(ex) {\n\t\t\t\t\t}\n\t\t\t\t\tif(info) {\n\t\t\t\t\t\teditionInfo[entry] = info;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn editionInfo;\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "utils-node"
},
"$:/core/modules/utils/escapecss.js": {
"title": "$:/core/modules/utils/escapecss.js",
"text": "/*\\\ntitle: $:/core/modules/utils/escapecss.js\ntype: application/javascript\nmodule-type: utils\n\nProvides CSS.escape() functionality.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false, window: false */\n\"use strict\";\n\nexports.escapeCSS = (function() {\n\t// use browser's native CSS.escape() function if available\n\tif ($tw.browser && window.CSS && window.CSS.escape) {\n\t\treturn window.CSS.escape;\n\t}\n\n\t// otherwise, a utility method is provided\n\t// see also https://drafts.csswg.org/cssom/#serialize-an-identifier\n\n\t/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */\n\treturn function(value) {\n\t\tif (arguments.length == 0) {\n\t\t\tthrow new TypeError('`CSS.escape` requires an argument.');\n\t\t}\n\t\tvar string = String(value);\n\t\tvar length = string.length;\n\t\tvar index = -1;\n\t\tvar codeUnit;\n\t\tvar result = '';\n\t\tvar firstCodeUnit = string.charCodeAt(0);\n\t\twhile (++index < length) {\n\t\t\tcodeUnit = string.charCodeAt(index);\n\t\t\t// Note: there’s no need to special-case astral symbols, surrogate\n\t\t\t// pairs, or lone surrogates.\n\n\t\t\t// If the character is NULL (U+0000), then the REPLACEMENT CHARACTER\n\t\t\t// (U+FFFD).\n\t\t\tif (codeUnit == 0x0000) {\n\t\t\t\tresult += '\\uFFFD';\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t// If the character is in the range [\\1-\\1F] (U+0001 to U+001F) or is\n\t\t\t\t// U+007F, […]\n\t\t\t\t(codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||\n\t\t\t\t// If the character is the first character and is in the range [0-9]\n\t\t\t\t// (U+0030 to U+0039), […]\n\t\t\t\t(index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||\n\t\t\t\t// If the character is the second character and is in the range [0-9]\n\t\t\t\t// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]\n\t\t\t\t(\n\t\t\t\t\tindex == 1 &&\n\t\t\t\t\tcodeUnit >= 0x0030 && codeUnit <= 0x0039 &&\n\t\t\t\t\tfirstCodeUnit == 0x002D\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// https://drafts.csswg.org/cssom/#escape-a-character-as-code-point\n\t\t\t\tresult += '\\\\' + codeUnit.toString(16) + ' ';\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t// If the character is the first character and is a `-` (U+002D), and\n\t\t\t\t// there is no second character, […]\n\t\t\t\tindex == 0 &&\n\t\t\t\tlength == 1 &&\n\t\t\t\tcodeUnit == 0x002D\n\t\t\t) {\n\t\t\t\tresult += '\\\\' + string.charAt(index);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// If the character is not handled by one of the above rules and is\n\t\t\t// greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or\n\t\t\t// is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to\n\t\t\t// U+005A), or [a-z] (U+0061 to U+007A), […]\n\t\t\tif (\n\t\t\t\tcodeUnit >= 0x0080 ||\n\t\t\t\tcodeUnit == 0x002D ||\n\t\t\t\tcodeUnit == 0x005F ||\n\t\t\t\tcodeUnit >= 0x0030 && codeUnit <= 0x0039 ||\n\t\t\t\tcodeUnit >= 0x0041 && codeUnit <= 0x005A ||\n\t\t\t\tcodeUnit >= 0x0061 && codeUnit <= 0x007A\n\t\t\t) {\n\t\t\t\t// the character itself\n\t\t\t\tresult += string.charAt(index);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Otherwise, the escaped character.\n\t\t\t// https://drafts.csswg.org/cssom/#escape-a-character\n\t\t\tresult += '\\\\' + string.charAt(index);\n\n\t\t}\n\t\treturn result;\n\t};\n})();\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/fakedom.js": {
"title": "$:/core/modules/utils/fakedom.js",
"text": "/*\\\ntitle: $:/core/modules/utils/fakedom.js\ntype: application/javascript\nmodule-type: global\n\nA barebones implementation of DOM interfaces needed by the rendering mechanism.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Sequence number used to enable us to track objects for testing\nvar sequenceNumber = null;\n\nvar bumpSequenceNumber = function(object) {\n\tif(sequenceNumber !== null) {\n\t\tobject.sequenceNumber = sequenceNumber++;\n\t}\n};\n\nvar TW_Node = function (){\n\tthrow TypeError(\"Illegal constructor\");\n};\n\nObject.defineProperty(TW_Node.prototype, 'ELEMENT_NODE', {\n\tget: function() {\n\t\treturn 1;\n\t}\n});\n\nObject.defineProperty(TW_Node.prototype, 'TEXT_NODE', {\n\tget: function() {\n\t\treturn 3;\n\t}\n});\n\nvar TW_TextNode = function(text) {\n\tbumpSequenceNumber(this);\n\tthis.textContent = text + \"\";\n};\n\nTW_TextNode.prototype = Object.create(TW_Node.prototype);\n\nObject.defineProperty(TW_TextNode.prototype, \"nodeType\", {\n\tget: function() {\n\t\treturn this.TEXT_NODE;\n\t}\n});\n\nObject.defineProperty(TW_TextNode.prototype, \"formattedTextContent\", {\n\tget: function() {\n\t\treturn this.textContent.replace(/(\\r?\\n)/g,\"\");\n\t}\n});\n\nvar TW_Element = function(tag,namespace) {\n\tbumpSequenceNumber(this);\n\tthis.isTiddlyWikiFakeDom = true;\n\tthis.tag = tag;\n\tthis.attributes = {};\n\tthis.isRaw = false;\n\tthis.children = [];\n\tthis._style = {};\n\tthis.namespaceURI = namespace || \"http://www.w3.org/1999/xhtml\";\n};\n\nTW_Element.prototype = Object.create(TW_Node.prototype);\n\nObject.defineProperty(TW_Element.prototype, \"style\", {\n\tget: function() {\n\t\treturn this._style;\n\t},\n\tset: function(str) {\n\t\tvar self = this;\n\t\tstr = str || \"\";\n\t\t$tw.utils.each(str.split(\";\"),function(declaration) {\n\t\t\tvar parts = declaration.split(\":\"),\n\t\t\t\tname = $tw.utils.trim(parts[0]),\n\t\t\t\tvalue = $tw.utils.trim(parts[1]);\n\t\t\tif(name && value) {\n\t\t\t\tself._style[$tw.utils.convertStyleNameToPropertyName(name)] = value;\n\t\t\t}\n\t\t});\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"nodeType\", {\n\tget: function() {\n\t\treturn this.ELEMENT_NODE;\n\t}\n});\n\nTW_Element.prototype.getAttribute = function(name) {\n\tif(this.isRaw) {\n\t\tthrow \"Cannot getAttribute on a raw TW_Element\";\n\t}\n\treturn this.attributes[name];\n};\n\nTW_Element.prototype.setAttribute = function(name,value) {\n\tif(this.isRaw) {\n\t\tthrow \"Cannot setAttribute on a raw TW_Element\";\n\t}\n\tthis.attributes[name] = value + \"\";\n};\n\nTW_Element.prototype.setAttributeNS = function(namespace,name,value) {\n\tthis.setAttribute(name,value);\n};\n\nTW_Element.prototype.removeAttribute = function(name) {\n\tif(this.isRaw) {\n\t\tthrow \"Cannot removeAttribute on a raw TW_Element\";\n\t}\n\tif($tw.utils.hop(this.attributes,name)) {\n\t\tdelete this.attributes[name];\n\t}\n};\n\nTW_Element.prototype.appendChild = function(node) {\n\tthis.children.push(node);\n\tnode.parentNode = this;\n};\n\nTW_Element.prototype.insertBefore = function(node,nextSibling) {\n\tif(nextSibling) {\n\t\tvar p = this.children.indexOf(nextSibling);\n\t\tif(p !== -1) {\n\t\t\tthis.children.splice(p,0,node);\n\t\t\tnode.parentNode = this;\n\t\t} else {\n\t\t\tthis.appendChild(node);\n\t\t}\n\t} else {\n\t\tthis.appendChild(node);\n\t}\n};\n\nTW_Element.prototype.removeChild = function(node) {\n\tvar p = this.children.indexOf(node);\n\tif(p !== -1) {\n\t\tthis.children.splice(p,1);\n\t}\n};\n\nTW_Element.prototype.hasChildNodes = function() {\n\treturn !!this.children.length;\n};\n\nObject.defineProperty(TW_Element.prototype, \"childNodes\", {\n\tget: function() {\n\t\treturn this.children;\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"firstChild\", {\n\tget: function() {\n\t\treturn this.children[0];\n\t}\n});\n\nTW_Element.prototype.addEventListener = function(type,listener,useCapture) {\n\t// Do nothing\n};\n\nObject.defineProperty(TW_Element.prototype, \"tagName\", {\n\tget: function() {\n\t\treturn this.tag || \"\";\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"className\", {\n\tget: function() {\n\t\treturn this.attributes[\"class\"] || \"\";\n\t},\n\tset: function(value) {\n\t\tthis.attributes[\"class\"] = value + \"\";\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"value\", {\n\tget: function() {\n\t\treturn this.attributes.value || \"\";\n\t},\n\tset: function(value) {\n\t\tthis.attributes.value = value + \"\";\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"outerHTML\", {\n\tget: function() {\n\t\tvar output = [],attr,a,v;\n\t\toutput.push(\"<\",this.tag);\n\t\tif(this.attributes) {\n\t\t\tattr = [];\n\t\t\tfor(a in this.attributes) {\n\t\t\t\tattr.push(a);\n\t\t\t}\n\t\t\tattr.sort();\n\t\t\tfor(a=0; a<attr.length; a++) {\n\t\t\t\tv = this.attributes[attr[a]];\n\t\t\t\tif(v !== undefined) {\n\t\t\t\t\toutput.push(\" \",attr[a],\"=\\\"\",$tw.utils.htmlEncode(v),\"\\\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(this._style) {\n\t\t\tvar style = [];\n\t\t\tfor(var s in this._style) {\n\t\t\t\tstyle.push($tw.utils.convertPropertyNameToStyleName(s) + \":\" + this._style[s] + \";\");\n\t\t\t}\n\t\t\tif(style.length > 0) {\n\t\t\t\toutput.push(\" style=\\\"\",style.join(\"\"),\"\\\"\");\n\t\t\t}\n\t\t}\n\t\toutput.push(\">\");\n\t\tif($tw.config.htmlVoidElements.indexOf(this.tag) === -1) {\n\t\t\toutput.push(this.innerHTML);\n\t\t\toutput.push(\"</\",this.tag,\">\");\n\t\t}\n\t\treturn output.join(\"\");\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"innerHTML\", {\n\tget: function() {\n\t\tif(this.isRaw) {\n\t\t\treturn this.rawHTML;\n\t\t} else {\n\t\t\tvar b = [];\n\t\t\t$tw.utils.each(this.children,function(node) {\n\t\t\t\tif(node instanceof TW_Element) {\n\t\t\t\t\tb.push(node.outerHTML);\n\t\t\t\t} else if(node instanceof TW_TextNode) {\n\t\t\t\t\tb.push($tw.utils.htmlEncode(node.textContent));\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn b.join(\"\");\n\t\t}\n\t},\n\tset: function(value) {\n\t\tthis.isRaw = true;\n\t\tthis.rawHTML = value;\n\t\tthis.rawTextContent = null;\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"textInnerHTML\", {\n\tset: function(value) {\n\t\tif(this.isRaw) {\n\t\t\tthis.rawTextContent = value;\n\t\t} else {\n\t\t\tthrow \"Cannot set textInnerHTML of a non-raw TW_Element\";\n\t\t}\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"textContent\", {\n\tget: function() {\n\t\tif(this.isRaw) {\n\t\t\tif(this.rawTextContent === null) {\n\t\t\t\treturn \"\";\n\t\t\t} else {\n\t\t\t\treturn this.rawTextContent;\n\t\t\t}\n\t\t} else {\n\t\t\tvar b = [];\n\t\t\t$tw.utils.each(this.children,function(node) {\n\t\t\t\tb.push(node.textContent);\n\t\t\t});\n\t\t\treturn b.join(\"\");\n\t\t}\n\t},\n\tset: function(value) {\n\t\tthis.children = [new TW_TextNode(value)];\n\t}\n});\n\nObject.defineProperty(TW_Element.prototype, \"formattedTextContent\", {\n\tget: function() {\n\t\tif(this.isRaw) {\n\t\t\treturn \"\";\n\t\t} else {\n\t\t\tvar b = [],\n\t\t\t\tisBlock = $tw.config.htmlBlockElements.indexOf(this.tag) !== -1;\n\t\t\tif(isBlock) {\n\t\t\t\tb.push(\"\\n\");\n\t\t\t}\n\t\t\tif(this.tag === \"li\") {\n\t\t\t\tb.push(\"* \");\n\t\t\t}\n\t\t\t$tw.utils.each(this.children,function(node) {\n\t\t\t\tb.push(node.formattedTextContent);\n\t\t\t});\n\t\t\tif(isBlock) {\n\t\t\t\tb.push(\"\\n\");\n\t\t\t}\n\t\t\treturn b.join(\"\");\n\t\t}\n\t}\n});\n\nvar document = {\n\tsetSequenceNumber: function(value) {\n\t\tsequenceNumber = value;\n\t},\n\tcreateElementNS: function(namespace,tag) {\n\t\treturn new TW_Element(tag,namespace);\n\t},\n\tcreateElement: function(tag) {\n\t\treturn new TW_Element(tag);\n\t},\n\tcreateTextNode: function(text) {\n\t\treturn new TW_TextNode(text);\n\t},\n\tcompatMode: \"CSS1Compat\", // For KaTeX to know that we're not a browser in quirks mode\n\tisTiddlyWikiFakeDom: true\n};\n\nexports.fakeDocument = document;\n\n})();\n",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/utils/filesystem.js": {
"title": "$:/core/modules/utils/filesystem.js",
"text": "/*\\\ntitle: $:/core/modules/utils/filesystem.js\ntype: application/javascript\nmodule-type: utils-node\n\nFile system utilities\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar fs = require(\"fs\"),\n\tpath = require(\"path\");\n\n/*\nReturn the subdirectories of a path\n*/\nexports.getSubdirectories = function(dirPath) {\n\tif(!$tw.utils.isDirectory(dirPath)) {\n\t\treturn null;\n\t}\n\tvar subdirs = [];\n\t$tw.utils.each(fs.readdirSync(dirPath),function(item) {\n\t\tif($tw.utils.isDirectory(path.resolve(dirPath,item))) {\n\t\t\tsubdirs.push(item);\n\t\t}\n\t});\n\treturn subdirs;\n}\n\n/*\nRecursively (and synchronously) copy a directory and all its content\n*/\nexports.copyDirectory = function(srcPath,dstPath) {\n\t// Remove any trailing path separators\n\tsrcPath = path.resolve($tw.utils.removeTrailingSeparator(srcPath));\n\tdstPath = path.resolve($tw.utils.removeTrailingSeparator(dstPath));\n\t// Check that neither director is within the other\n\tif(srcPath.substring(0,dstPath.length) === dstPath || dstPath.substring(0,srcPath.length) === srcPath) {\n\t\treturn \"Cannot copy nested directories\";\n\t}\n\t// Create the destination directory\n\tvar err = $tw.utils.createDirectory(dstPath);\n\tif(err) {\n\t\treturn err;\n\t}\n\t// Function to copy a folder full of files\n\tvar copy = function(srcPath,dstPath) {\n\t\tvar srcStats = fs.lstatSync(srcPath),\n\t\t\tdstExists = fs.existsSync(dstPath);\n\t\tif(srcStats.isFile()) {\n\t\t\t$tw.utils.copyFile(srcPath,dstPath);\n\t\t} else if(srcStats.isDirectory()) {\n\t\t\tvar items = fs.readdirSync(srcPath);\n\t\t\tfor(var t=0; t<items.length; t++) {\n\t\t\t\tvar item = items[t],\n\t\t\t\t\terr = copy(srcPath + path.sep + item,dstPath + path.sep + item);\n\t\t\t\tif(err) {\n\t\t\t\t\treturn err;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\tcopy(srcPath,dstPath);\n\treturn null;\n};\n\n/*\nCopy a file\n*/\nvar FILE_BUFFER_LENGTH = 64 * 1024,\n\tfileBuffer;\n\nexports.copyFile = function(srcPath,dstPath) {\n\t// Create buffer if required\n\tif(!fileBuffer) {\n\t\tfileBuffer = Buffer.alloc(FILE_BUFFER_LENGTH);\n\t}\n\t// Create any directories in the destination\n\t$tw.utils.createDirectory(path.dirname(dstPath));\n\t// Copy the file\n\tvar srcFile = fs.openSync(srcPath,\"r\"),\n\t\tdstFile = fs.openSync(dstPath,\"w\"),\n\t\tbytesRead = 1,\n\t\tpos = 0;\n\twhile (bytesRead > 0) {\n\t\tbytesRead = fs.readSync(srcFile,fileBuffer,0,FILE_BUFFER_LENGTH,pos);\n\t\tfs.writeSync(dstFile,fileBuffer,0,bytesRead);\n\t\tpos += bytesRead;\n\t}\n\tfs.closeSync(srcFile);\n\tfs.closeSync(dstFile);\n\treturn null;\n};\n\n/*\nRemove trailing path separator\n*/\nexports.removeTrailingSeparator = function(dirPath) {\n\tvar len = dirPath.length;\n\tif(dirPath.charAt(len-1) === path.sep) {\n\t\tdirPath = dirPath.substr(0,len-1);\n\t}\n\treturn dirPath;\n};\n\n/*\nRecursively create a directory\n*/\nexports.createDirectory = function(dirPath) {\n\tif(dirPath.substr(dirPath.length-1,1) !== path.sep) {\n\t\tdirPath = dirPath + path.sep;\n\t}\n\tvar pos = 1;\n\tpos = dirPath.indexOf(path.sep,pos);\n\twhile(pos !== -1) {\n\t\tvar subDirPath = dirPath.substr(0,pos);\n\t\tif(!$tw.utils.isDirectory(subDirPath)) {\n\t\t\ttry {\n\t\t\t\tfs.mkdirSync(subDirPath);\n\t\t\t} catch(e) {\n\t\t\t\treturn \"Error creating directory '\" + subDirPath + \"'\";\n\t\t\t}\n\t\t}\n\t\tpos = dirPath.indexOf(path.sep,pos + 1);\n\t}\n\treturn null;\n};\n\n/*\nRecursively create directories needed to contain a specified file\n*/\nexports.createFileDirectories = function(filePath) {\n\treturn $tw.utils.createDirectory(path.dirname(filePath));\n};\n\n/*\nRecursively delete a directory\n*/\nexports.deleteDirectory = function(dirPath) {\n\tif(fs.existsSync(dirPath)) {\n\t\tvar entries = fs.readdirSync(dirPath);\n\t\tfor(var entryIndex=0; entryIndex<entries.length; entryIndex++) {\n\t\t\tvar currPath = dirPath + path.sep + entries[entryIndex];\n\t\t\tif(fs.lstatSync(currPath).isDirectory()) {\n\t\t\t\t$tw.utils.deleteDirectory(currPath);\n\t\t\t} else {\n\t\t\t\tfs.unlinkSync(currPath);\n\t\t\t}\n\t\t}\n\tfs.rmdirSync(dirPath);\n\t}\n\treturn null;\n};\n\n/*\nCheck if a path identifies a directory\n*/\nexports.isDirectory = function(dirPath) {\n\treturn fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory();\n};\n\n/*\nCheck if a path identifies a directory that is empty\n*/\nexports.isDirectoryEmpty = function(dirPath) {\n\tif(!$tw.utils.isDirectory(dirPath)) {\n\t\treturn false;\n\t}\n\tvar files = fs.readdirSync(dirPath),\n\t\tempty = true;\n\t$tw.utils.each(files,function(file,index) {\n\t\tif(file.charAt(0) !== \".\") {\n\t\t\tempty = false;\n\t\t}\n\t});\n\treturn empty;\n};\n\n/*\nRecursively delete a tree of empty directories\n*/\nexports.deleteEmptyDirs = function(dirpath,callback) {\n\tvar self = this;\n\tfs.readdir(dirpath,function(err,files) {\n\t\tif(err) {\n\t\t\treturn callback(err);\n\t\t}\n\t\tif(files.length > 0) {\n\t\t\treturn callback(null);\n\t\t}\n\t\tfs.rmdir(dirpath,function(err) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tself.deleteEmptyDirs(path.dirname(dirpath),callback);\n\t\t});\n\t});\n};\n\n/*\nCreate a fileInfo object for saving a tiddler:\n\tfilepath: the absolute path to the file containing the tiddler\n\ttype: the type of the tiddler file on disk (NOT the type of the tiddler)\n\thasMetaFile: true if the file also has a companion .meta file\n\tisEditableFile: true if the tiddler was loaded via non-standard options & marked editable\nOptions include:\n\tdirectory: absolute path of root directory to which we are saving\n\tpathFilters: optional array of filters to be used to generate the base path\n\textFilters: optional array of filters to be used to generate the base path\n\twiki: optional wiki for evaluating the pathFilters,\n\tfileInfo: an existing fileInfo to check against\n*/\nexports.generateTiddlerFileInfo = function(tiddler,options) {\n\tvar fileInfo = {}, metaExt;\n\t// Propagate the isEditableFile flag\n\tif(options.fileInfo && !!options.fileInfo.isEditableFile) {\n\t\tfileInfo.isEditableFile = true;\n\t\tfileInfo.originalpath = options.fileInfo.originalpath;\n\t}\n\t// Check if the tiddler has any unsafe fields that can't be expressed in a .tid or .meta file: containing control characters, or leading/trailing whitespace\n\tvar hasUnsafeFields = false;\n\t$tw.utils.each(tiddler.getFieldStrings(),function(value,fieldName) {\n\t\tif(fieldName !== \"text\") {\n\t\t\thasUnsafeFields = hasUnsafeFields || /[\\x00-\\x1F]/mg.test(value);\n\t\t\thasUnsafeFields = hasUnsafeFields || ($tw.utils.trim(value) !== value);\n\t\t}\n\t});\n\t// Check for field values \n\tif(hasUnsafeFields) {\n\t\t// Save as a JSON file\n\t\tfileInfo.type = \"application/json\";\n\t\tfileInfo.hasMetaFile = false;\n\t} else {\n\t\t// Save as a .tid or a text/binary file plus a .meta file\n\t\tvar tiddlerType = tiddler.fields.type || \"text/vnd.tiddlywiki\";\n\t\tif(tiddlerType === \"text/vnd.tiddlywiki\") {\n\t\t\t// Save as a .tid file\n\t\t\tfileInfo.type = \"application/x-tiddler\";\n\t\t\tfileInfo.hasMetaFile = false;\n\t\t} else {\n\t\t\t// Save as a text/binary file and a .meta file\n\t\t\tfileInfo.type = tiddlerType;\n\t\t\tfileInfo.hasMetaFile = true;\n\t\t}\n\t\tif(options.extFilters) {\n\t\t\t// Check for extension overrides\n\t\t\tmetaExt = $tw.utils.generateTiddlerExtension(tiddler.fields.title,{\n\t\t\t\textFilters: options.extFilters,\n\t\t\t\twiki: options.wiki\n\t\t\t});\n\t\t\tif(metaExt) {\n\t\t\t\tif(metaExt === \".tid\") {\n\t\t\t\t\t// Overriding to the .tid extension needs special handling\n\t\t\t\t\tfileInfo.type = \"application/x-tiddler\";\n\t\t\t\t\tfileInfo.hasMetaFile = false;\n\t\t\t\t} else if (metaExt === \".json\") {\n\t\t\t\t\t// Overriding to the .json extension needs special handling\n\t\t\t\t\tfileInfo.type = \"application/json\";\n\t\t\t\t\tfileInfo.hasMetaFile = false;\n\t\t\t\t} else {\n\t\t\t\t\t//If the new type matches a known extention, use that MIME type's encoding\n\t\t\t\t\tvar extInfo = $tw.utils.getFileExtensionInfo(metaExt);\n\t\t\t\t\tfileInfo.type = extInfo ? extInfo.type : null;\n\t\t\t\t\tfileInfo.encoding = $tw.utils.getTypeEncoding(metaExt);\n\t\t\t\t\tfileInfo.hasMetaFile = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Take the file extension from the tiddler content type or metaExt\n\tvar contentTypeInfo = $tw.config.contentTypeInfo[fileInfo.type] || {extension: \"\"};\n\t// Generate the filepath\n\tfileInfo.filepath = $tw.utils.generateTiddlerFilepath(tiddler.fields.title,{\n\t\textension: metaExt || contentTypeInfo.extension,\n\t\tdirectory: options.directory,\n\t\tpathFilters: options.pathFilters,\n\t\twiki: options.wiki,\n\t\tfileInfo: options.fileInfo\n\t});\n\treturn fileInfo;\n};\n\n/*\nGenerate the file extension for saving a tiddler\nOptions include:\n\textFilters: optional array of filters to be used to generate the extention\n\twiki: optional wiki for evaluating the extFilters\n*/\nexports.generateTiddlerExtension = function(title,options) {\n\tvar extension;\n\t// Check if any of the extFilters applies\n\tif(options.extFilters && options.wiki) { \n\t\t$tw.utils.each(options.extFilters,function(filter) {\n\t\t\tif(!extension) {\n\t\t\t\tvar source = options.wiki.makeTiddlerIterator([title]),\n\t\t\t\t\tresult = options.wiki.filterTiddlers(filter,null,source);\n\t\t\t\tif(result.length > 0) {\n\t\t\t\t\textension = result[0];\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\treturn extension;\n};\n\n/*\nGenerate the filepath for saving a tiddler\nOptions include:\n\textension: file extension to be added the finished filepath\n\tdirectory: absolute path of root directory to which we are saving\n\tpathFilters: optional array of filters to be used to generate the base path\n\twiki: optional wiki for evaluating the pathFilters\n\tfileInfo: an existing fileInfo object to check against\n*/\nexports.generateTiddlerFilepath = function(title,options) {\n\tvar directory = options.directory || \"\",\n\t\textension = options.extension || \"\",\n\t\toriginalpath = (options.fileInfo && options.fileInfo.originalpath) ? options.fileInfo.originalpath : \"\",\n\t\tfilepath;\n\t// Check if any of the pathFilters applies\n\tif(options.pathFilters && options.wiki) {\n\t\t$tw.utils.each(options.pathFilters,function(filter) {\n\t\t\tif(!filepath) {\n\t\t\t\tvar source = options.wiki.makeTiddlerIterator([title]),\n\t\t\t\t\tresult = options.wiki.filterTiddlers(filter,null,source);\n\t\t\t\tif(result.length > 0) {\n\t\t\t\t\tfilepath = result[0];\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\tif(!filepath && !!originalpath) {\n\t\t//Use the originalpath without the extension\n\t\tvar ext = path.extname(originalpath);\n\t\tfilepath = originalpath.substring(0,originalpath.length - ext.length);\n\t} else if(!filepath) {\n\t\tfilepath = title;\n\t\t// Remove any forward or backward slashes so we don't create directories\n\t\tfilepath = filepath.replace(/\\/|\\\\/g,\"_\");\n\t}\n\t// Replace any Windows control codes\n\tfilepath = filepath.replace(/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i,\"_$1_\");\n\t// Replace any leading spaces with the same number of underscores\n\tfilepath = filepath.replace(/^ +/,function (u) { return u.replace(/ /g, \"_\")});\n\t//If the path does not start with \".\" or \"..\" && a path seperator, then\n\tif(!/^\\.{1,2}[/\\\\]/g.test(filepath)) {\n\t\t// Don't let the filename start with any dots because such files are invisible on *nix\n\t\tfilepath = filepath.replace(/^\\.+/g,function (u) { return u.replace(/\\./g, \"_\")});\n\t}\n\t// Replace any Unicode control codes\n\tfilepath = filepath.replace(/[\\x00-\\x1f\\x80-\\x9f]/g,\"_\");\n\t// Replace any characters that can't be used in cross-platform filenames\n\tfilepath = $tw.utils.transliterate(filepath.replace(/<|>|~|\\:|\\\"|\\||\\?|\\*|\\^/g,\"_\"));\n\t// Replace any dots or spaces at the end of the extension with the same number of underscores\n\textension = extension.replace(/[\\. ]+$/, function (u) { return u.replace(/[\\. ]/g, \"_\")});\n\t// Truncate the extension if it is too long\n\tif(extension.length > 32) {\n\t\textension = extension.substr(0,32);\n\t}\n\t// If the filepath already ends in the extension then remove it\n\tif(filepath.substring(filepath.length - extension.length) === extension) {\n\t\tfilepath = filepath.substring(0,filepath.length - extension.length);\n\t}\n\t// Truncate the filename if it is too long\n\tif(filepath.length > 200) {\n\t\tfilepath = filepath.substr(0,200);\n\t}\n\t// If the resulting filename is blank (eg because the title is just punctuation)\n\tif(!filepath || /^_+$/g.test(filepath)) {\n\t\t// ...then just use the character codes of the title\n\t\tfilepath = \"\";\n\t\t$tw.utils.each(title.split(\"\"),function(char) {\n\t\t\tif(filepath) {\n\t\t\t\tfilepath += \"-\";\n\t\t\t}\n\t\t\tfilepath += char.charCodeAt(0).toString();\n\t\t});\n\t}\n\t// Add a uniquifier if the file already exists\n\tvar fullPath, oldPath = (options.fileInfo) ? options.fileInfo.filepath : undefined,\n\t\tcount = 0;\n\tdo {\n\t\tfullPath = path.resolve(directory,filepath + (count ? \"_\" + count : \"\") + extension);\n\t\tif(oldPath && oldPath == fullPath) {\n\t\t\tbreak;\n\t\t}\n\t\tcount++;\n\t} while(fs.existsSync(fullPath));\n\t// If the last write failed with an error, or if path does not start with:\n\t//\tthe resolved options.directory, the resolved wikiPath directory, the wikiTiddlersPath directory, \n\t//\tor the 'originalpath' directory, then encodeURIComponent() and resolve to tiddler directory.\n\tvar writePath = $tw.hooks.invokeHook(\"th-make-tiddler-path\",fullPath,fullPath),\n\t\tencode = (options.fileInfo || {writeError: false}).writeError == true;\n\tif(!encode) {\n\t\tencode = !(writePath.indexOf($tw.boot.wikiTiddlersPath) == 0 ||\n\t\t\twritePath.indexOf(path.resolve(directory)) == 0 ||\n\t\t\twritePath.indexOf(path.resolve($tw.boot.wikiPath)) == 0 ||\n\t\t\twritePath.indexOf(path.resolve($tw.boot.wikiTiddlersPath,originalpath)) == 0 );\n\t\t}\n\tif(encode) {\n\t\twritePath = path.resolve(directory,encodeURIComponent(fullPath));\n\t}\n\t// Return the full path to the file\n\treturn writePath;\n};\n\n/*\nSave a tiddler to a file described by the fileInfo:\n\tfilepath: the absolute path to the file containing the tiddler\n\ttype: the type of the tiddler file (NOT the type of the tiddler)\n\thasMetaFile: true if the file also has a companion .meta file\n*/\nexports.saveTiddlerToFile = function(tiddler,fileInfo,callback) {\n\t$tw.utils.createDirectory(path.dirname(fileInfo.filepath));\n\tif(fileInfo.hasMetaFile) {\n\t\t// Save the tiddler as a separate body and meta file\n\t\tvar typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || \"text/plain\"] || {encoding: \"utf8\"};\n\t\tfs.writeFile(fileInfo.filepath,tiddler.fields.text || \"\",typeInfo.encoding,function(err) {\n\t\t\tif(err) {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t\tfs.writeFile(fileInfo.filepath + \".meta\",tiddler.getFieldStringBlock({exclude: [\"text\",\"bag\"]}),\"utf8\",function(err) {\n\t\t\t\tif(err) {\n\t\t\t\t\treturn callback(err);\n\t\t\t\t}\n\t\t\t\treturn callback(null,fileInfo);\n\t\t\t});\n\t\t});\n\t} else {\n\t\t// Save the tiddler as a self contained templated file\n\t\tif(fileInfo.type === \"application/x-tiddler\") {\n\t\t\tfs.writeFile(fileInfo.filepath,tiddler.getFieldStringBlock({exclude: [\"text\",\"bag\"]}) + (!!tiddler.fields.text ? \"\\n\\n\" + tiddler.fields.text : \"\"),\"utf8\",function(err) {\n\t\t\t\tif(err) {\n\t\t\t\t\treturn callback(err);\n\t\t\t\t}\n\t\t\t\treturn callback(null,fileInfo);\n\t\t\t});\n\t\t} else {\n\t\t\tfs.writeFile(fileInfo.filepath,JSON.stringify([tiddler.getFieldStrings({exclude: [\"bag\"]})],null,$tw.config.preferences.jsonSpaces),\"utf8\",function(err) {\n\t\t\t\tif(err) {\n\t\t\t\t\treturn callback(err);\n\t\t\t\t}\n\t\t\t\treturn callback(null,fileInfo);\n\t\t\t});\n\t\t}\n\t}\n};\n\n/*\nSave a tiddler to a file described by the fileInfo:\n\tfilepath: the absolute path to the file containing the tiddler\n\ttype: the type of the tiddler file (NOT the type of the tiddler)\n\thasMetaFile: true if the file also has a companion .meta file\n*/\nexports.saveTiddlerToFileSync = function(tiddler,fileInfo) {\n\t$tw.utils.createDirectory(path.dirname(fileInfo.filepath));\n\tif(fileInfo.hasMetaFile) {\n\t\t// Save the tiddler as a separate body and meta file\n\t\tvar typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || \"text/plain\"] || {encoding: \"utf8\"};\n\t\tfs.writeFileSync(fileInfo.filepath,tiddler.fields.text || \"\",typeInfo.encoding);\n\t\tfs.writeFileSync(fileInfo.filepath + \".meta\",tiddler.getFieldStringBlock({exclude: [\"text\",\"bag\"]}),\"utf8\");\n\t} else {\n\t\t// Save the tiddler as a self contained templated file\n\t\tif(fileInfo.type === \"application/x-tiddler\") {\n\t\t\tfs.writeFileSync(fileInfo.filepath,tiddler.getFieldStringBlock({exclude: [\"text\",\"bag\"]}) + (!!tiddler.fields.text ? \"\\n\\n\" + tiddler.fields.text : \"\"),\"utf8\");\n\t\t} else {\n\t\t\tfs.writeFileSync(fileInfo.filepath,JSON.stringify([tiddler.getFieldStrings({exclude: [\"bag\"]})],null,$tw.config.preferences.jsonSpaces),\"utf8\");\n\t\t}\n\t}\n\treturn fileInfo;\n};\n\n/*\nDelete a file described by the fileInfo if it exits\n*/\nexports.deleteTiddlerFile = function(fileInfo,callback) {\n\t//Only attempt to delete files that exist on disk\n\tif(!fileInfo.filepath || !fs.existsSync(fileInfo.filepath)) {\n\t\t//For some reason, the tiddler is only in memory or we can't modify the file at this path\n\t\t$tw.syncer.displayError(\"Server deleteTiddlerFile task failed for filepath: \"+fileInfo.filepath);\n\t\treturn callback(null,fileInfo);\n\t}\n\t// Delete the file\n\tfs.unlink(fileInfo.filepath,function(err) {\n\t\tif(err) {\n\t\t\treturn callback(err);\n\t\t}\n\t\t// Delete the metafile if present\n\t\tif(fileInfo.hasMetaFile && fs.existsSync(fileInfo.filepath + \".meta\")) {\n\t\t\tfs.unlink(fileInfo.filepath + \".meta\",function(err) {\n\t\t\t\tif(err) {\n\t\t\t\t\treturn callback(err);\n\t\t\t\t}\n\t\t\t\treturn $tw.utils.deleteEmptyDirs(path.dirname(fileInfo.filepath),function(err) {\n\t\t\t\t\tif(err) {\n\t\t\t\t\t\treturn callback(err);\n\t\t\t\t\t}\n\t\t\t\t\treturn callback(null,fileInfo);\n\t\t\t\t});\n\t\t\t});\n\t\t} else {\n\t\t\treturn $tw.utils.deleteEmptyDirs(path.dirname(fileInfo.filepath),function(err) {\n\t\t\t\tif(err) {\n\t\t\t\t\treturn callback(err);\n\t\t\t\t}\n\t\t\t\treturn callback(null,fileInfo);\n\t\t\t});\n\t\t}\n\t});\n};\n\n/*\nCleanup old files on disk, by comparing the options values:\n\tadaptorInfo from $tw.syncer.tiddlerInfo\n\tbootInfo from $tw.boot.files\n*/\nexports.cleanupTiddlerFiles = function(options,callback) {\n\tvar adaptorInfo = options.adaptorInfo || {},\n\tbootInfo = options.bootInfo || {},\n\ttitle = options.title || \"undefined\";\n\tif(adaptorInfo.filepath && bootInfo.filepath && adaptorInfo.filepath !== bootInfo.filepath) {\n\t\t$tw.utils.deleteTiddlerFile(adaptorInfo,function(err) {\n\t\t\tif(err) {\n\t\t\t\tif ((err.code == \"EPERM\" || err.code == \"EACCES\") && err.syscall == \"unlink\") {\n\t\t\t\t\t// Error deleting the previous file on disk, should fail gracefully\n\t\t\t\t\t$tw.syncer.displayError(\"Server desynchronized. Error cleaning up previous file for tiddler: \\\"\"+title+\"\\\"\",err);\n\t\t\t\t\treturn callback(null,bootInfo);\n\t\t\t\t} else {\n\t\t\t\t\treturn callback(err);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn callback(null,bootInfo);\n\t\t});\n\t} else {\n\t\treturn callback(null,bootInfo);\n\t}\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "utils-node"
},
"$:/core/modules/utils/linkedlist.js": {
"title": "$:/core/modules/utils/linkedlist.js",
"text": "/*\\\nmodule-type: utils\ntitle: $:/core/modules/utils/linkedlist.js\ntype: application/javascript\n\nThis is a doubly-linked indexed list intended for manipulation, particularly\npushTop, which it does with significantly better performance than an array.\n\n\\*/\n(function(){\n\nfunction LinkedList() {\n\tthis.clear();\n};\n\nLinkedList.prototype.clear = function() {\n\t// LinkedList performs the duty of both the head and tail node\n\tthis.next = Object.create(null);\n\tthis.prev = Object.create(null);\n\tthis.first = undefined;\n\tthis.last = undefined;\n\tthis.length = 0;\n};\n\nLinkedList.prototype.remove = function(value) {\n\tif($tw.utils.isArray(value)) {\n\t\tfor(var t=0; t<value.length; t++) {\n\t\t\t_assertString(value[t]);\n\t\t}\n\t\tfor(var t=0; t<value.length; t++) {\n\t\t\t_removeOne(this,value[t]);\n\t\t}\n\t} else {\n\t\t_assertString(value);\n\t\t_removeOne(this,value);\n\t}\n};\n\n/*\nPush behaves like array.push and accepts multiple string arguments. But it also\naccepts a single array argument too, to be consistent with its other methods.\n*/\nLinkedList.prototype.push = function(/* values */) {\n\tvar values = arguments;\n\tif($tw.utils.isArray(values[0])) {\n\t\tvalues = values[0];\n\t}\n\tfor(var i = 0; i < values.length; i++) {\n\t\t_assertString(values[i]);\n\t}\n\tfor(var i = 0; i < values.length; i++) {\n\t\t_linkToEnd(this,values[i]);\n\t}\n\treturn this.length;\n};\n\nLinkedList.prototype.pushTop = function(value) {\n\tif($tw.utils.isArray(value)) {\n\t\tfor (var t=0; t<value.length; t++) {\n\t\t\t_assertString(value[t]);\n\t\t}\n\t\tfor(var t=0; t<value.length; t++) {\n\t\t\t_removeOne(this,value[t]);\n\t\t}\n\t\tfor(var t=0; t<value.length; t++) {\n\t\t\t_linkToEnd(this,value[t]);\n\t\t}\n\t} else {\n\t\t_assertString(value);\n\t\t_removeOne(this,value);\n\t\t_linkToEnd(this,value);\n\t}\n};\n\nLinkedList.prototype.each = function(callback) {\n\tvar visits = Object.create(null),\n\t\tvalue = this.first;\n\twhile(value !== undefined) {\n\t\tcallback(value);\n\t\tvar next = this.next[value];\n\t\tif(typeof next === \"object\") {\n\t\t\tvar i = visits[value] || 0;\n\t\t\tvisits[value] = i+1;\n\t\t\tvalue = next[i];\n\t\t} else {\n\t\t\tvalue = next;\n\t\t}\n\t}\n};\n\nLinkedList.prototype.toArray = function() {\n\tvar output = new Array(this.length),\n\t\tindex = 0;\n\tthis.each(function(value) { output[index++] = value; });\n\treturn output;\n};\n\nfunction _removeOne(list,value) {\n\tvar prevEntry = list.prev[value],\n\t\tnextEntry = list.next[value],\n\t\tprev = prevEntry,\n\t\tnext = nextEntry;\n\tif(typeof nextEntry === \"object\") {\n\t\tnext = nextEntry[0];\n\t\tprev = prevEntry[0];\n\t}\n\t// Relink preceding element.\n\tif(list.first === value) {\n\t\tlist.first = next\n\t} else if(prev !== undefined) {\n\t\tif(typeof list.next[prev] === \"object\") {\n\t\t\tif(next === undefined) {\n\t\t\t\t// Must have been last, and 'i' would be last element.\n\t\t\t\tlist.next[prev].pop();\n\t\t\t} else {\n\t\t\t\tvar i = list.next[prev].indexOf(value);\n\t\t\t\tlist.next[prev][i] = next;\n\t\t\t}\n\t\t} else {\n\t\t\tlist.next[prev] = next;\n\t\t}\n\t} else {\n\t\treturn;\n\t}\n\t// Now relink following element\n\t// Check \"next !== undefined\" rather than \"list.last === value\" because\n\t// we need to know if the FIRST value is the last in the list, not the last.\n\tif(next !== undefined) {\n\t\tif(typeof list.prev[next] === \"object\") {\n\t\t\tif(prev === undefined) {\n\t\t\t\t// Must have been first, and 'i' would be 0.\n\t\t\t\tlist.prev[next].shift();\n\t\t\t} else {\n\t\t\t\tvar i = list.prev[next].indexOf(value);\n\t\t\t\tlist.prev[next][i] = prev;\n\t\t\t}\n\t\t} else {\n\t\t\tlist.prev[next] = prev;\n\t\t}\n\t} else {\n\t\tlist.last = prev;\n\t}\n\t// Delink actual value. If it uses arrays, just remove first entries.\n\tif(typeof nextEntry === \"object\") {\n\t\tnextEntry.shift();\n\t\tprevEntry.shift();\n\t} else {\n\t\tlist.next[value] = undefined;\n\t\tlist.prev[value] = undefined;\n\t}\n\tlist.length -= 1;\n};\n\n// Sticks the given node onto the end of the list.\nfunction _linkToEnd(list,value) {\n\tif(list.first === undefined) {\n\t\tlist.first = value;\n\t} else {\n\t\t// Does it already exists?\n\t\tif(list.first === value || list.prev[value] !== undefined) {\n\t\t\tif(typeof list.next[value] === \"string\") {\n\t\t\t\tlist.next[value] = [list.next[value]];\n\t\t\t\tlist.prev[value] = [list.prev[value]];\n\t\t\t} else if(typeof list.next[value] === \"undefined\") {\n\t\t\t\t// list.next[value] must be undefined.\n\t\t\t\t// Special case. List already has 1 value. It's at the end.\n\t\t\t\tlist.next[value] = [];\n\t\t\t\tlist.prev[value] = [list.prev[value]];\n\t\t\t}\n\t\t\tlist.prev[value].push(list.last);\n\t\t\t// We do NOT append a new value onto \"next\" list. Iteration will\n\t\t\t// figure out it must point to End-of-List on its own.\n\t\t} else {\n\t\t\tlist.prev[value] = list.last;\n\t\t}\n\t\t// Make the old last point to this new one.\n\t\tif(typeof list.next[list.last] === \"object\") {\n\t\t\tlist.next[list.last].push(value);\n\t\t} else {\n\t\t\tlist.next[list.last] = value;\n\t\t}\n\t}\n\tlist.last = value;\n\tlist.length += 1;\n};\n\nfunction _assertString(value) {\n\tif(typeof value !== \"string\") {\n\t\tthrow \"Linked List only accepts string values, not \" + value;\n\t}\n};\n\nexports.LinkedList = LinkedList;\n\n})();\n",
"module-type": "utils",
"type": "application/javascript"
},
"$:/core/modules/utils/logger.js": {
"title": "$:/core/modules/utils/logger.js",
"text": "/*\\\ntitle: $:/core/modules/utils/logger.js\ntype: application/javascript\nmodule-type: utils\n\nA basic logging implementation\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar ALERT_TAG = \"$:/tags/Alert\";\n\n/*\nMake a new logger\n*/\nfunction Logger(componentName,options) {\n\toptions = options || {};\n\tthis.componentName = componentName || \"\";\n\tthis.colour = options.colour || \"white\";\n\tthis.enable = \"enable\" in options ? options.enable : true;\n\tthis.save = \"save\" in options ? options.save : true;\n\tthis.saveLimit = options.saveLimit || 100 * 1024;\n\tthis.saveBufferLogger = this;\n\tthis.buffer = \"\";\n\tthis.alertCount = 0;\n}\n\nLogger.prototype.setSaveBuffer = function(logger) {\n\tthis.saveBufferLogger = logger;\n};\n\n/*\nLog a message\n*/\nLogger.prototype.log = function(/* args */) {\n\tvar self = this;\n\tif(this.enable) {\n\t\tif(this.saveBufferLogger.save) {\n\t\t\tthis.saveBufferLogger.buffer += $tw.utils.formatDateString(new Date(),\"YYYY MM DD 0hh:0mm:0ss.0XXX\") + \":\";\n\t\t\t$tw.utils.each(Array.prototype.slice.call(arguments,0),function(arg,index) {\n\t\t\t\tself.saveBufferLogger.buffer += \" \" + arg;\n\t\t\t});\n\t\t\tthis.saveBufferLogger.buffer += \"\\n\";\n\t\t\tthis.saveBufferLogger.buffer = this.saveBufferLogger.buffer.slice(-this.saveBufferLogger.saveLimit);\n\t\t}\n\t\tif(console !== undefined && console.log !== undefined) {\n\t\t\treturn Function.apply.call(console.log, console, [$tw.utils.terminalColour(this.colour),this.componentName + \":\"].concat(Array.prototype.slice.call(arguments,0)).concat($tw.utils.terminalColour()));\n\t\t}\n\t} \n};\n\n/*\nRead the message buffer\n*/\nLogger.prototype.getBuffer = function() {\n\treturn this.saveBufferLogger.buffer;\n};\n\n/*\nLog a structure as a table\n*/\nLogger.prototype.table = function(value) {\n\t(console.table || console.log)(value);\n};\n\n/*\nAlert a message\n*/\nLogger.prototype.alert = function(/* args */) {\n\tif(this.enable) {\n\t\t// Prepare the text of the alert\n\t\tvar text = Array.prototype.join.call(arguments,\" \");\n\t\t// Create alert tiddlers in the browser\n\t\tif($tw.browser) {\n\t\t\t// Check if there is an existing alert with the same text and the same component\n\t\t\tvar existingAlerts = $tw.wiki.getTiddlersWithTag(ALERT_TAG),\n\t\t\t\talertFields,\n\t\t\t\texistingCount,\n\t\t\t\tself = this;\n\t\t\t$tw.utils.each(existingAlerts,function(title) {\n\t\t\t\tvar tiddler = $tw.wiki.getTiddler(title);\n\t\t\t\tif(tiddler.fields.text === text && tiddler.fields.component === self.componentName && tiddler.fields.modified && (!alertFields || tiddler.fields.modified < alertFields.modified)) {\n\t\t\t\t\t\talertFields = $tw.utils.extend({},tiddler.fields);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif(alertFields) {\n\t\t\t\texistingCount = alertFields.count || 1;\n\t\t\t} else {\n\t\t\t\talertFields = {\n\t\t\t\t\ttitle: $tw.wiki.generateNewTitle(\"$:/temp/alerts/alert\",{prefix: \"\"}),\n\t\t\t\t\ttext: text,\n\t\t\t\t\ttags: [ALERT_TAG],\n\t\t\t\t\tcomponent: this.componentName\n\t\t\t\t};\n\t\t\t\texistingCount = 0;\n\t\t\t\tthis.alertCount += 1;\n\t\t\t}\n\t\t\talertFields.modified = new Date();\n\t\t\tif(++existingCount > 1) {\n\t\t\t\talertFields.count = existingCount;\n\t\t\t} else {\n\t\t\t\talertFields.count = undefined;\n\t\t\t}\n\t\t\t$tw.wiki.addTiddler(new $tw.Tiddler(alertFields));\n\t\t\t// Log the alert as well\n\t\t\tthis.log.apply(this,Array.prototype.slice.call(arguments,0));\n\t\t} else {\n\t\t\t// Print an orange message to the console if not in the browser\n\t\t\tconsole.error(\"\\x1b[1;33m\" + text + \"\\x1b[0m\");\n\t\t}\n\t}\n};\n\n/*\nClear outstanding alerts\n*/\nLogger.prototype.clearAlerts = function() {\n\tvar self = this;\n\tif($tw.browser && this.alertCount > 0) {\n\t\t$tw.utils.each($tw.wiki.getTiddlersWithTag(ALERT_TAG),function(title) {\n\t\t\tvar tiddler = $tw.wiki.getTiddler(title);\n\t\t\tif(tiddler.fields.component === self.componentName) {\n\t\t\t\t$tw.wiki.deleteTiddler(title);\n\t\t\t}\n\t\t});\n\t\tthis.alertCount = 0;\n\t}\n};\n\nexports.Logger = Logger;\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/parsetree.js": {
"title": "$:/core/modules/utils/parsetree.js",
"text": "/*\\\ntitle: $:/core/modules/utils/parsetree.js\ntype: application/javascript\nmodule-type: utils\n\nParse tree utility functions.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.addAttributeToParseTreeNode = function(node,name,value) {\n\tnode.attributes = node.attributes || {};\n\tnode.attributes[name] = {type: \"string\", value: value};\n};\n\nexports.getAttributeValueFromParseTreeNode = function(node,name,defaultValue) {\n\tif(node.attributes && node.attributes[name] && node.attributes[name].value !== undefined) {\n\t\treturn node.attributes[name].value;\n\t}\n\treturn defaultValue;\n};\n\nexports.addClassToParseTreeNode = function(node,classString) {\n\tvar classes = [];\n\tnode.attributes = node.attributes || {};\n\tnode.attributes[\"class\"] = node.attributes[\"class\"] || {type: \"string\", value: \"\"};\n\tif(node.attributes[\"class\"].type === \"string\") {\n\t\tif(node.attributes[\"class\"].value !== \"\") {\n\t\t\tclasses = node.attributes[\"class\"].value.split(\" \");\n\t\t}\n\t\tif(classString !== \"\") {\n\t\t\t$tw.utils.pushTop(classes,classString.split(\" \"));\n\t\t}\n\t\tnode.attributes[\"class\"].value = classes.join(\" \");\n\t}\n};\n\nexports.addStyleToParseTreeNode = function(node,name,value) {\n\t\tnode.attributes = node.attributes || {};\n\t\tnode.attributes.style = node.attributes.style || {type: \"string\", value: \"\"};\n\t\tif(node.attributes.style.type === \"string\") {\n\t\t\tnode.attributes.style.value += name + \":\" + value + \";\";\n\t\t}\n};\n\nexports.findParseTreeNode = function(nodeArray,search) {\n\tfor(var t=0; t<nodeArray.length; t++) {\n\t\tif(nodeArray[t].type === search.type && nodeArray[t].tag === search.tag) {\n\t\t\treturn nodeArray[t];\n\t\t}\n\t}\n\treturn undefined;\n};\n\n/*\nHelper to get the text of a parse tree node or array of nodes\n*/\nexports.getParseTreeText = function getParseTreeText(tree) {\n\tvar output = [];\n\tif($tw.utils.isArray(tree)) {\n\t\t$tw.utils.each(tree,function(node) {\n\t\t\toutput.push(getParseTreeText(node));\n\t\t});\n\t} else {\n\t\tif(tree.type === \"text\") {\n\t\t\toutput.push(tree.text);\n\t\t}\n\t\tif(tree.children) {\n\t\t\treturn getParseTreeText(tree.children);\n\t\t}\n\t}\n\treturn output.join(\"\");\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/performance.js": {
"title": "$:/core/modules/utils/performance.js",
"text": "/*\\\ntitle: $:/core/modules/utils/performance.js\ntype: application/javascript\nmodule-type: global\n\nPerformance measurement.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nfunction Performance(enabled) {\n\tthis.enabled = !!enabled;\n\tthis.measures = {}; // Hashmap by measurement name of {time:, invocations:}\n\tthis.logger = new $tw.utils.Logger(\"performance\");\n\tthis.showGreeting();\n}\n\nPerformance.prototype.showGreeting = function() {\n\tif($tw.browser) {\n\t\tthis.logger.log(\"Execute $tw.perf.log(); to see filter execution timings\");\n\t}\n};\n\n/*\nWrap performance reporting around a top level function\n*/\nPerformance.prototype.report = function(name,fn) {\n\tvar self = this;\n\tif(this.enabled) {\n\t\treturn function() {\n\t\t\tvar startTime = $tw.utils.timer(),\n\t\t\t\tresult = fn.apply(this,arguments);\n\t\t\tself.logger.log(name + \": \" + $tw.utils.timer(startTime).toFixed(2) + \"ms\");\n\t\t\treturn result;\n\t\t};\n\t} else {\n\t\treturn fn;\n\t}\n};\n\nPerformance.prototype.log = function() {\n\tvar self = this,\n\t\ttotalTime = 0,\n\t\torderedMeasures = Object.keys(this.measures).sort(function(a,b) {\n\t\t\tif(self.measures[a].time > self.measures[b].time) {\n\t\t\t\treturn -1;\n\t\t\t} else if (self.measures[a].time < self.measures[b].time) {\n\t\t\t\treturn + 1;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t});\n\t$tw.utils.each(orderedMeasures,function(name) {\n\t\ttotalTime += self.measures[name].time;\n\t});\n\tvar results = []\n\t$tw.utils.each(orderedMeasures,function(name) {\n\t\tvar measure = self.measures[name];\n\t\tresults.push({name: name,invocations: measure.invocations, avgTime: measure.time / measure.invocations, totalTime: measure.time, percentTime: (measure.time / totalTime) * 100})\n\t});\n\tself.logger.table(results);\n};\n\n/*\nWrap performance measurements around a subfunction\n*/\nPerformance.prototype.measure = function(name,fn) {\n\tvar self = this;\n\tif(this.enabled) {\n\t\treturn function() {\n\t\t\tvar startTime = $tw.utils.timer(),\n\t\t\t\tresult = fn.apply(this,arguments);\n\t\t\tif(!(name in self.measures)) {\n\t\t\t\tself.measures[name] = {time: 0, invocations: 0};\n\t\t\t}\n\t\t\tself.measures[name].time += $tw.utils.timer(startTime);\n\t\t\tself.measures[name].invocations++;\n\t\t\treturn result;\n\t\t};\n\t} else {\n\t\treturn fn;\n\t}\n};\n\nexports.Performance = Performance;\n\n})();\n",
"type": "application/javascript",
"module-type": "global"
},
"$:/core/modules/utils/pluginmaker.js": {
"title": "$:/core/modules/utils/pluginmaker.js",
"text": "/*\\\ntitle: $:/core/modules/utils/pluginmaker.js\ntype: application/javascript\nmodule-type: utils\n\nA quick and dirty way to pack up plugins within the browser.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nRepack a plugin, and then delete any non-shadow payload tiddlers\n*/\nexports.repackPlugin = function(title,additionalTiddlers,excludeTiddlers) {\n\tadditionalTiddlers = additionalTiddlers || [];\n\texcludeTiddlers = excludeTiddlers || [];\n\t// Get the plugin tiddler\n\tvar pluginTiddler = $tw.wiki.getTiddler(title);\n\tif(!pluginTiddler) {\n\t\tthrow \"No such tiddler as \" + title;\n\t}\n\t// Extract the JSON\n\tvar jsonPluginTiddler;\n\ttry {\n\t\tjsonPluginTiddler = JSON.parse(pluginTiddler.fields.text);\n\t} catch(e) {\n\t\tthrow \"Cannot parse plugin tiddler \" + title + \"\\n\" + $tw.language.getString(\"Error/Caption\") + \": \" + e;\n\t}\n\t// Get the list of tiddlers\n\tvar tiddlers = Object.keys(jsonPluginTiddler.tiddlers);\n\t// Add the additional tiddlers\n\t$tw.utils.pushTop(tiddlers,additionalTiddlers);\n\t// Remove any excluded tiddlers\n\tfor(var t=tiddlers.length-1; t>=0; t--) {\n\t\tif(excludeTiddlers.indexOf(tiddlers[t]) !== -1) {\n\t\t\ttiddlers.splice(t,1);\n\t\t}\n\t}\n\t// Pack up the tiddlers into a block of JSON\n\tvar plugins = {};\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar tiddler = $tw.wiki.getTiddler(title),\n\t\t\tfields = {};\n\t\t$tw.utils.each(tiddler.fields,function (value,name) {\n\t\t\tfields[name] = tiddler.getFieldString(name);\n\t\t});\n\t\tplugins[title] = fields;\n\t});\n\t// Retrieve and bump the version number\n\tvar pluginVersion = $tw.utils.parseVersion(pluginTiddler.getFieldString(\"version\") || \"0.0.0\") || {\n\t\t\tmajor: \"0\",\n\t\t\tminor: \"0\",\n\t\t\tpatch: \"0\"\n\t\t};\n\tpluginVersion.patch++;\n\tvar version = pluginVersion.major + \".\" + pluginVersion.minor + \".\" + pluginVersion.patch;\n\tif(pluginVersion.prerelease) {\n\t\tversion += \"-\" + pluginVersion.prerelease;\n\t}\n\tif(pluginVersion.build) {\n\t\tversion += \"+\" + pluginVersion.build;\n\t}\n\t// Save the tiddler\n\t$tw.wiki.addTiddler(new $tw.Tiddler(pluginTiddler,{text: JSON.stringify({tiddlers: plugins},null,4), version: version}));\n\t// Delete any non-shadow constituent tiddlers\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tif($tw.wiki.tiddlerExists(title)) {\n\t\t\t$tw.wiki.deleteTiddler(title);\n\t\t}\n\t});\n\t// Trigger an autosave\n\t$tw.rootWidget.dispatchEvent({type: \"tm-auto-save-wiki\"});\n\t// Return a heartwarming confirmation\n\treturn \"Plugin \" + title + \" successfully saved\";\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/transliterate.js": {
"title": "$:/core/modules/utils/transliterate.js",
"text": "/*\\\ntitle: $:/core/modules/utils/transliterate.js\ntype: application/javascript\nmodule-type: utils\n\nTransliteration static utility functions.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nTransliterate string to ASCII\n\n(Some pairs taken from http://semplicewebsites.com/removing-accents-javascript)\n*/\nexports.transliterationPairs = {\n\t\"Á\":\"A\",\n\t\"Ă\":\"A\",\n\t\"Ắ\":\"A\",\n\t\"Ặ\":\"A\",\n\t\"Ằ\":\"A\",\n\t\"Ẳ\":\"A\",\n\t\"Ẵ\":\"A\",\n\t\"Ǎ\":\"A\",\n\t\"Â\":\"A\",\n\t\"Ấ\":\"A\",\n\t\"Ậ\":\"A\",\n\t\"Ầ\":\"A\",\n\t\"Ẩ\":\"A\",\n\t\"Ẫ\":\"A\",\n\t\"Ä\":\"A\",\n\t\"Ǟ\":\"A\",\n\t\"Ȧ\":\"A\",\n\t\"Ǡ\":\"A\",\n\t\"Ạ\":\"A\",\n\t\"Ȁ\":\"A\",\n\t\"À\":\"A\",\n\t\"Ả\":\"A\",\n\t\"Ȃ\":\"A\",\n\t\"Ā\":\"A\",\n\t\"Ą\":\"A\",\n\t\"Å\":\"A\",\n\t\"Ǻ\":\"A\",\n\t\"Ḁ\":\"A\",\n\t\"Ⱥ\":\"A\",\n\t\"Ã\":\"A\",\n\t\"Ꜳ\":\"AA\",\n\t\"Æ\":\"AE\",\n\t\"Ǽ\":\"AE\",\n\t\"Ǣ\":\"AE\",\n\t\"Ꜵ\":\"AO\",\n\t\"Ꜷ\":\"AU\",\n\t\"Ꜹ\":\"AV\",\n\t\"Ꜻ\":\"AV\",\n\t\"Ꜽ\":\"AY\",\n\t\"Ḃ\":\"B\",\n\t\"Ḅ\":\"B\",\n\t\"Ɓ\":\"B\",\n\t\"Ḇ\":\"B\",\n\t\"Ƀ\":\"B\",\n\t\"Ƃ\":\"B\",\n\t\"Ć\":\"C\",\n\t\"Č\":\"C\",\n\t\"Ç\":\"C\",\n\t\"Ḉ\":\"C\",\n\t\"Ĉ\":\"C\",\n\t\"Ċ\":\"C\",\n\t\"Ƈ\":\"C\",\n\t\"Ȼ\":\"C\",\n\t\"Ď\":\"D\",\n\t\"Ḑ\":\"D\",\n\t\"Ḓ\":\"D\",\n\t\"Ḋ\":\"D\",\n\t\"Ḍ\":\"D\",\n\t\"Ɗ\":\"D\",\n\t\"Ḏ\":\"D\",\n\t\"Dz\":\"D\",\n\t\"Dž\":\"D\",\n\t\"Đ\":\"D\",\n\t\"Ƌ\":\"D\",\n\t\"DZ\":\"DZ\",\n\t\"DŽ\":\"DZ\",\n\t\"É\":\"E\",\n\t\"Ĕ\":\"E\",\n\t\"Ě\":\"E\",\n\t\"Ȩ\":\"E\",\n\t\"Ḝ\":\"E\",\n\t\"Ê\":\"E\",\n\t\"Ế\":\"E\",\n\t\"Ệ\":\"E\",\n\t\"Ề\":\"E\",\n\t\"Ể\":\"E\",\n\t\"Ễ\":\"E\",\n\t\"Ḙ\":\"E\",\n\t\"Ë\":\"E\",\n\t\"Ė\":\"E\",\n\t\"Ẹ\":\"E\",\n\t\"Ȅ\":\"E\",\n\t\"È\":\"E\",\n\t\"Ẻ\":\"E\",\n\t\"Ȇ\":\"E\",\n\t\"Ē\":\"E\",\n\t\"Ḗ\":\"E\",\n\t\"Ḕ\":\"E\",\n\t\"Ę\":\"E\",\n\t\"Ɇ\":\"E\",\n\t\"Ẽ\":\"E\",\n\t\"Ḛ\":\"E\",\n\t\"Ꝫ\":\"ET\",\n\t\"Ḟ\":\"F\",\n\t\"Ƒ\":\"F\",\n\t\"Ǵ\":\"G\",\n\t\"Ğ\":\"G\",\n\t\"Ǧ\":\"G\",\n\t\"Ģ\":\"G\",\n\t\"Ĝ\":\"G\",\n\t\"Ġ\":\"G\",\n\t\"Ɠ\":\"G\",\n\t\"Ḡ\":\"G\",\n\t\"Ǥ\":\"G\",\n\t\"Ḫ\":\"H\",\n\t\"Ȟ\":\"H\",\n\t\"Ḩ\":\"H\",\n\t\"Ĥ\":\"H\",\n\t\"Ⱨ\":\"H\",\n\t\"Ḧ\":\"H\",\n\t\"Ḣ\":\"H\",\n\t\"Ḥ\":\"H\",\n\t\"Ħ\":\"H\",\n\t\"Í\":\"I\",\n\t\"Ĭ\":\"I\",\n\t\"Ǐ\":\"I\",\n\t\"Î\":\"I\",\n\t\"Ï\":\"I\",\n\t\"Ḯ\":\"I\",\n\t\"İ\":\"I\",\n\t\"Ị\":\"I\",\n\t\"Ȉ\":\"I\",\n\t\"Ì\":\"I\",\n\t\"Ỉ\":\"I\",\n\t\"Ȋ\":\"I\",\n\t\"Ī\":\"I\",\n\t\"Į\":\"I\",\n\t\"Ɨ\":\"I\",\n\t\"Ĩ\":\"I\",\n\t\"Ḭ\":\"I\",\n\t\"Ꝺ\":\"D\",\n\t\"Ꝼ\":\"F\",\n\t\"Ᵹ\":\"G\",\n\t\"Ꞃ\":\"R\",\n\t\"Ꞅ\":\"S\",\n\t\"Ꞇ\":\"T\",\n\t\"Ꝭ\":\"IS\",\n\t\"Ĵ\":\"J\",\n\t\"Ɉ\":\"J\",\n\t\"Ḱ\":\"K\",\n\t\"Ǩ\":\"K\",\n\t\"Ķ\":\"K\",\n\t\"Ⱪ\":\"K\",\n\t\"Ꝃ\":\"K\",\n\t\"Ḳ\":\"K\",\n\t\"Ƙ\":\"K\",\n\t\"Ḵ\":\"K\",\n\t\"Ꝁ\":\"K\",\n\t\"Ꝅ\":\"K\",\n\t\"Ĺ\":\"L\",\n\t\"Ƚ\":\"L\",\n\t\"Ľ\":\"L\",\n\t\"Ļ\":\"L\",\n\t\"Ḽ\":\"L\",\n\t\"Ḷ\":\"L\",\n\t\"Ḹ\":\"L\",\n\t\"Ⱡ\":\"L\",\n\t\"Ꝉ\":\"L\",\n\t\"Ḻ\":\"L\",\n\t\"Ŀ\":\"L\",\n\t\"Ɫ\":\"L\",\n\t\"Lj\":\"L\",\n\t\"Ł\":\"L\",\n\t\"LJ\":\"LJ\",\n\t\"Ḿ\":\"M\",\n\t\"Ṁ\":\"M\",\n\t\"Ṃ\":\"M\",\n\t\"Ɱ\":\"M\",\n\t\"Ń\":\"N\",\n\t\"Ň\":\"N\",\n\t\"Ņ\":\"N\",\n\t\"Ṋ\":\"N\",\n\t\"Ṅ\":\"N\",\n\t\"Ṇ\":\"N\",\n\t\"Ǹ\":\"N\",\n\t\"Ɲ\":\"N\",\n\t\"Ṉ\":\"N\",\n\t\"Ƞ\":\"N\",\n\t\"Nj\":\"N\",\n\t\"Ñ\":\"N\",\n\t\"NJ\":\"NJ\",\n\t\"Ó\":\"O\",\n\t\"Ŏ\":\"O\",\n\t\"Ǒ\":\"O\",\n\t\"Ô\":\"O\",\n\t\"Ố\":\"O\",\n\t\"Ộ\":\"O\",\n\t\"Ồ\":\"O\",\n\t\"Ổ\":\"O\",\n\t\"Ỗ\":\"O\",\n\t\"Ö\":\"O\",\n\t\"Ȫ\":\"O\",\n\t\"Ȯ\":\"O\",\n\t\"Ȱ\":\"O\",\n\t\"Ọ\":\"O\",\n\t\"Ő\":\"O\",\n\t\"Ȍ\":\"O\",\n\t\"Ò\":\"O\",\n\t\"Ỏ\":\"O\",\n\t\"Ơ\":\"O\",\n\t\"Ớ\":\"O\",\n\t\"Ợ\":\"O\",\n\t\"Ờ\":\"O\",\n\t\"Ở\":\"O\",\n\t\"Ỡ\":\"O\",\n\t\"Ȏ\":\"O\",\n\t\"Ꝋ\":\"O\",\n\t\"Ꝍ\":\"O\",\n\t\"Ō\":\"O\",\n\t\"Ṓ\":\"O\",\n\t\"Ṑ\":\"O\",\n\t\"Ɵ\":\"O\",\n\t\"Ǫ\":\"O\",\n\t\"Ǭ\":\"O\",\n\t\"Ø\":\"O\",\n\t\"Ǿ\":\"O\",\n\t\"Õ\":\"O\",\n\t\"Ṍ\":\"O\",\n\t\"Ṏ\":\"O\",\n\t\"Ȭ\":\"O\",\n\t\"Ƣ\":\"OI\",\n\t\"Ꝏ\":\"OO\",\n\t\"Ɛ\":\"E\",\n\t\"Ɔ\":\"O\",\n\t\"Ȣ\":\"OU\",\n\t\"Ṕ\":\"P\",\n\t\"Ṗ\":\"P\",\n\t\"Ꝓ\":\"P\",\n\t\"Ƥ\":\"P\",\n\t\"Ꝕ\":\"P\",\n\t\"Ᵽ\":\"P\",\n\t\"Ꝑ\":\"P\",\n\t\"Ꝙ\":\"Q\",\n\t\"Ꝗ\":\"Q\",\n\t\"Ŕ\":\"R\",\n\t\"Ř\":\"R\",\n\t\"Ŗ\":\"R\",\n\t\"Ṙ\":\"R\",\n\t\"Ṛ\":\"R\",\n\t\"Ṝ\":\"R\",\n\t\"Ȑ\":\"R\",\n\t\"Ȓ\":\"R\",\n\t\"Ṟ\":\"R\",\n\t\"Ɍ\":\"R\",\n\t\"Ɽ\":\"R\",\n\t\"Ꜿ\":\"C\",\n\t\"Ǝ\":\"E\",\n\t\"Ś\":\"S\",\n\t\"Ṥ\":\"S\",\n\t\"Š\":\"S\",\n\t\"Ṧ\":\"S\",\n\t\"Ş\":\"S\",\n\t\"Ŝ\":\"S\",\n\t\"Ș\":\"S\",\n\t\"Ṡ\":\"S\",\n\t\"Ṣ\":\"S\",\n\t\"Ṩ\":\"S\",\n\t\"Ť\":\"T\",\n\t\"Ţ\":\"T\",\n\t\"Ṱ\":\"T\",\n\t\"Ț\":\"T\",\n\t\"Ⱦ\":\"T\",\n\t\"Ṫ\":\"T\",\n\t\"Ṭ\":\"T\",\n\t\"Ƭ\":\"T\",\n\t\"Ṯ\":\"T\",\n\t\"Ʈ\":\"T\",\n\t\"Ŧ\":\"T\",\n\t\"Ɐ\":\"A\",\n\t\"Ꞁ\":\"L\",\n\t\"Ɯ\":\"M\",\n\t\"Ʌ\":\"V\",\n\t\"Ꜩ\":\"TZ\",\n\t\"Ú\":\"U\",\n\t\"Ŭ\":\"U\",\n\t\"Ǔ\":\"U\",\n\t\"Û\":\"U\",\n\t\"Ṷ\":\"U\",\n\t\"Ü\":\"U\",\n\t\"Ǘ\":\"U\",\n\t\"Ǚ\":\"U\",\n\t\"Ǜ\":\"U\",\n\t\"Ǖ\":\"U\",\n\t\"Ṳ\":\"U\",\n\t\"Ụ\":\"U\",\n\t\"Ű\":\"U\",\n\t\"Ȕ\":\"U\",\n\t\"Ù\":\"U\",\n\t\"Ủ\":\"U\",\n\t\"Ư\":\"U\",\n\t\"Ứ\":\"U\",\n\t\"Ự\":\"U\",\n\t\"Ừ\":\"U\",\n\t\"Ử\":\"U\",\n\t\"Ữ\":\"U\",\n\t\"Ȗ\":\"U\",\n\t\"Ū\":\"U\",\n\t\"Ṻ\":\"U\",\n\t\"Ų\":\"U\",\n\t\"Ů\":\"U\",\n\t\"Ũ\":\"U\",\n\t\"Ṹ\":\"U\",\n\t\"Ṵ\":\"U\",\n\t\"Ꝟ\":\"V\",\n\t\"Ṿ\":\"V\",\n\t\"Ʋ\":\"V\",\n\t\"Ṽ\":\"V\",\n\t\"Ꝡ\":\"VY\",\n\t\"Ẃ\":\"W\",\n\t\"Ŵ\":\"W\",\n\t\"Ẅ\":\"W\",\n\t\"Ẇ\":\"W\",\n\t\"Ẉ\":\"W\",\n\t\"Ẁ\":\"W\",\n\t\"Ⱳ\":\"W\",\n\t\"Ẍ\":\"X\",\n\t\"Ẋ\":\"X\",\n\t\"Ý\":\"Y\",\n\t\"Ŷ\":\"Y\",\n\t\"Ÿ\":\"Y\",\n\t\"Ẏ\":\"Y\",\n\t\"Ỵ\":\"Y\",\n\t\"Ỳ\":\"Y\",\n\t\"Ƴ\":\"Y\",\n\t\"Ỷ\":\"Y\",\n\t\"Ỿ\":\"Y\",\n\t\"Ȳ\":\"Y\",\n\t\"Ɏ\":\"Y\",\n\t\"Ỹ\":\"Y\",\n\t\"Ź\":\"Z\",\n\t\"Ž\":\"Z\",\n\t\"Ẑ\":\"Z\",\n\t\"Ⱬ\":\"Z\",\n\t\"Ż\":\"Z\",\n\t\"Ẓ\":\"Z\",\n\t\"Ȥ\":\"Z\",\n\t\"Ẕ\":\"Z\",\n\t\"Ƶ\":\"Z\",\n\t\"IJ\":\"IJ\",\n\t\"Œ\":\"OE\",\n\t\"ᴀ\":\"A\",\n\t\"ᴁ\":\"AE\",\n\t\"ʙ\":\"B\",\n\t\"ᴃ\":\"B\",\n\t\"ᴄ\":\"C\",\n\t\"ᴅ\":\"D\",\n\t\"ᴇ\":\"E\",\n\t\"ꜰ\":\"F\",\n\t\"ɢ\":\"G\",\n\t\"ʛ\":\"G\",\n\t\"ʜ\":\"H\",\n\t\"ɪ\":\"I\",\n\t\"ʁ\":\"R\",\n\t\"ᴊ\":\"J\",\n\t\"ᴋ\":\"K\",\n\t\"ʟ\":\"L\",\n\t\"ᴌ\":\"L\",\n\t\"ᴍ\":\"M\",\n\t\"ɴ\":\"N\",\n\t\"ᴏ\":\"O\",\n\t\"ɶ\":\"OE\",\n\t\"ᴐ\":\"O\",\n\t\"ᴕ\":\"OU\",\n\t\"ᴘ\":\"P\",\n\t\"ʀ\":\"R\",\n\t\"ᴎ\":\"N\",\n\t\"ᴙ\":\"R\",\n\t\"ꜱ\":\"S\",\n\t\"ᴛ\":\"T\",\n\t\"ⱻ\":\"E\",\n\t\"ᴚ\":\"R\",\n\t\"ᴜ\":\"U\",\n\t\"ᴠ\":\"V\",\n\t\"ᴡ\":\"W\",\n\t\"ʏ\":\"Y\",\n\t\"ᴢ\":\"Z\",\n\t\"á\":\"a\",\n\t\"ă\":\"a\",\n\t\"ắ\":\"a\",\n\t\"ặ\":\"a\",\n\t\"ằ\":\"a\",\n\t\"ẳ\":\"a\",\n\t\"ẵ\":\"a\",\n\t\"ǎ\":\"a\",\n\t\"â\":\"a\",\n\t\"ấ\":\"a\",\n\t\"ậ\":\"a\",\n\t\"ầ\":\"a\",\n\t\"ẩ\":\"a\",\n\t\"ẫ\":\"a\",\n\t\"ä\":\"a\",\n\t\"ǟ\":\"a\",\n\t\"ȧ\":\"a\",\n\t\"ǡ\":\"a\",\n\t\"ạ\":\"a\",\n\t\"ȁ\":\"a\",\n\t\"à\":\"a\",\n\t\"ả\":\"a\",\n\t\"ȃ\":\"a\",\n\t\"ā\":\"a\",\n\t\"ą\":\"a\",\n\t\"ᶏ\":\"a\",\n\t\"ẚ\":\"a\",\n\t\"å\":\"a\",\n\t\"ǻ\":\"a\",\n\t\"ḁ\":\"a\",\n\t\"ⱥ\":\"a\",\n\t\"ã\":\"a\",\n\t\"ꜳ\":\"aa\",\n\t\"æ\":\"ae\",\n\t\"ǽ\":\"ae\",\n\t\"ǣ\":\"ae\",\n\t\"ꜵ\":\"ao\",\n\t\"ꜷ\":\"au\",\n\t\"ꜹ\":\"av\",\n\t\"ꜻ\":\"av\",\n\t\"ꜽ\":\"ay\",\n\t\"ḃ\":\"b\",\n\t\"ḅ\":\"b\",\n\t\"ɓ\":\"b\",\n\t\"ḇ\":\"b\",\n\t\"ᵬ\":\"b\",\n\t\"ᶀ\":\"b\",\n\t\"ƀ\":\"b\",\n\t\"ƃ\":\"b\",\n\t\"ɵ\":\"o\",\n\t\"ć\":\"c\",\n\t\"č\":\"c\",\n\t\"ç\":\"c\",\n\t\"ḉ\":\"c\",\n\t\"ĉ\":\"c\",\n\t\"ɕ\":\"c\",\n\t\"ċ\":\"c\",\n\t\"ƈ\":\"c\",\n\t\"ȼ\":\"c\",\n\t\"ď\":\"d\",\n\t\"ḑ\":\"d\",\n\t\"ḓ\":\"d\",\n\t\"ȡ\":\"d\",\n\t\"ḋ\":\"d\",\n\t\"ḍ\":\"d\",\n\t\"ɗ\":\"d\",\n\t\"ᶑ\":\"d\",\n\t\"ḏ\":\"d\",\n\t\"ᵭ\":\"d\",\n\t\"ᶁ\":\"d\",\n\t\"đ\":\"d\",\n\t\"ɖ\":\"d\",\n\t\"ƌ\":\"d\",\n\t\"ı\":\"i\",\n\t\"ȷ\":\"j\",\n\t\"ɟ\":\"j\",\n\t\"ʄ\":\"j\",\n\t\"dz\":\"dz\",\n\t\"dž\":\"dz\",\n\t\"é\":\"e\",\n\t\"ĕ\":\"e\",\n\t\"ě\":\"e\",\n\t\"ȩ\":\"e\",\n\t\"ḝ\":\"e\",\n\t\"ê\":\"e\",\n\t\"ế\":\"e\",\n\t\"ệ\":\"e\",\n\t\"ề\":\"e\",\n\t\"ể\":\"e\",\n\t\"ễ\":\"e\",\n\t\"ḙ\":\"e\",\n\t\"ë\":\"e\",\n\t\"ė\":\"e\",\n\t\"ẹ\":\"e\",\n\t\"ȅ\":\"e\",\n\t\"è\":\"e\",\n\t\"ẻ\":\"e\",\n\t\"ȇ\":\"e\",\n\t\"ē\":\"e\",\n\t\"ḗ\":\"e\",\n\t\"ḕ\":\"e\",\n\t\"ⱸ\":\"e\",\n\t\"ę\":\"e\",\n\t\"ᶒ\":\"e\",\n\t\"ɇ\":\"e\",\n\t\"ẽ\":\"e\",\n\t\"ḛ\":\"e\",\n\t\"ꝫ\":\"et\",\n\t\"ḟ\":\"f\",\n\t\"ƒ\":\"f\",\n\t\"ᵮ\":\"f\",\n\t\"ᶂ\":\"f\",\n\t\"ǵ\":\"g\",\n\t\"ğ\":\"g\",\n\t\"ǧ\":\"g\",\n\t\"ģ\":\"g\",\n\t\"ĝ\":\"g\",\n\t\"ġ\":\"g\",\n\t\"ɠ\":\"g\",\n\t\"ḡ\":\"g\",\n\t\"ᶃ\":\"g\",\n\t\"ǥ\":\"g\",\n\t\"ḫ\":\"h\",\n\t\"ȟ\":\"h\",\n\t\"ḩ\":\"h\",\n\t\"ĥ\":\"h\",\n\t\"ⱨ\":\"h\",\n\t\"ḧ\":\"h\",\n\t\"ḣ\":\"h\",\n\t\"ḥ\":\"h\",\n\t\"ɦ\":\"h\",\n\t\"ẖ\":\"h\",\n\t\"ħ\":\"h\",\n\t\"ƕ\":\"hv\",\n\t\"í\":\"i\",\n\t\"ĭ\":\"i\",\n\t\"ǐ\":\"i\",\n\t\"î\":\"i\",\n\t\"ï\":\"i\",\n\t\"ḯ\":\"i\",\n\t\"ị\":\"i\",\n\t\"ȉ\":\"i\",\n\t\"ì\":\"i\",\n\t\"ỉ\":\"i\",\n\t\"ȋ\":\"i\",\n\t\"ī\":\"i\",\n\t\"į\":\"i\",\n\t\"ᶖ\":\"i\",\n\t\"ɨ\":\"i\",\n\t\"ĩ\":\"i\",\n\t\"ḭ\":\"i\",\n\t\"ꝺ\":\"d\",\n\t\"ꝼ\":\"f\",\n\t\"ᵹ\":\"g\",\n\t\"ꞃ\":\"r\",\n\t\"ꞅ\":\"s\",\n\t\"ꞇ\":\"t\",\n\t\"ꝭ\":\"is\",\n\t\"ǰ\":\"j\",\n\t\"ĵ\":\"j\",\n\t\"ʝ\":\"j\",\n\t\"ɉ\":\"j\",\n\t\"ḱ\":\"k\",\n\t\"ǩ\":\"k\",\n\t\"ķ\":\"k\",\n\t\"ⱪ\":\"k\",\n\t\"ꝃ\":\"k\",\n\t\"ḳ\":\"k\",\n\t\"ƙ\":\"k\",\n\t\"ḵ\":\"k\",\n\t\"ᶄ\":\"k\",\n\t\"ꝁ\":\"k\",\n\t\"ꝅ\":\"k\",\n\t\"ĺ\":\"l\",\n\t\"ƚ\":\"l\",\n\t\"ɬ\":\"l\",\n\t\"ľ\":\"l\",\n\t\"ļ\":\"l\",\n\t\"ḽ\":\"l\",\n\t\"ȴ\":\"l\",\n\t\"ḷ\":\"l\",\n\t\"ḹ\":\"l\",\n\t\"ⱡ\":\"l\",\n\t\"ꝉ\":\"l\",\n\t\"ḻ\":\"l\",\n\t\"ŀ\":\"l\",\n\t\"ɫ\":\"l\",\n\t\"ᶅ\":\"l\",\n\t\"ɭ\":\"l\",\n\t\"ł\":\"l\",\n\t\"lj\":\"lj\",\n\t\"ſ\":\"s\",\n\t\"ẜ\":\"s\",\n\t\"ẛ\":\"s\",\n\t\"ẝ\":\"s\",\n\t\"ḿ\":\"m\",\n\t\"ṁ\":\"m\",\n\t\"ṃ\":\"m\",\n\t\"ɱ\":\"m\",\n\t\"ᵯ\":\"m\",\n\t\"ᶆ\":\"m\",\n\t\"ń\":\"n\",\n\t\"ň\":\"n\",\n\t\"ņ\":\"n\",\n\t\"ṋ\":\"n\",\n\t\"ȵ\":\"n\",\n\t\"ṅ\":\"n\",\n\t\"ṇ\":\"n\",\n\t\"ǹ\":\"n\",\n\t\"ɲ\":\"n\",\n\t\"ṉ\":\"n\",\n\t\"ƞ\":\"n\",\n\t\"ᵰ\":\"n\",\n\t\"ᶇ\":\"n\",\n\t\"ɳ\":\"n\",\n\t\"ñ\":\"n\",\n\t\"nj\":\"nj\",\n\t\"ó\":\"o\",\n\t\"ŏ\":\"o\",\n\t\"ǒ\":\"o\",\n\t\"ô\":\"o\",\n\t\"ố\":\"o\",\n\t\"ộ\":\"o\",\n\t\"ồ\":\"o\",\n\t\"ổ\":\"o\",\n\t\"ỗ\":\"o\",\n\t\"ö\":\"o\",\n\t\"ȫ\":\"o\",\n\t\"ȯ\":\"o\",\n\t\"ȱ\":\"o\",\n\t\"ọ\":\"o\",\n\t\"ő\":\"o\",\n\t\"ȍ\":\"o\",\n\t\"ò\":\"o\",\n\t\"ỏ\":\"o\",\n\t\"ơ\":\"o\",\n\t\"ớ\":\"o\",\n\t\"ợ\":\"o\",\n\t\"ờ\":\"o\",\n\t\"ở\":\"o\",\n\t\"ỡ\":\"o\",\n\t\"ȏ\":\"o\",\n\t\"ꝋ\":\"o\",\n\t\"ꝍ\":\"o\",\n\t\"ⱺ\":\"o\",\n\t\"ō\":\"o\",\n\t\"ṓ\":\"o\",\n\t\"ṑ\":\"o\",\n\t\"ǫ\":\"o\",\n\t\"ǭ\":\"o\",\n\t\"ø\":\"o\",\n\t\"ǿ\":\"o\",\n\t\"õ\":\"o\",\n\t\"ṍ\":\"o\",\n\t\"ṏ\":\"o\",\n\t\"ȭ\":\"o\",\n\t\"ƣ\":\"oi\",\n\t\"ꝏ\":\"oo\",\n\t\"ɛ\":\"e\",\n\t\"ᶓ\":\"e\",\n\t\"ɔ\":\"o\",\n\t\"ᶗ\":\"o\",\n\t\"ȣ\":\"ou\",\n\t\"ṕ\":\"p\",\n\t\"ṗ\":\"p\",\n\t\"ꝓ\":\"p\",\n\t\"ƥ\":\"p\",\n\t\"ᵱ\":\"p\",\n\t\"ᶈ\":\"p\",\n\t\"ꝕ\":\"p\",\n\t\"ᵽ\":\"p\",\n\t\"ꝑ\":\"p\",\n\t\"ꝙ\":\"q\",\n\t\"ʠ\":\"q\",\n\t\"ɋ\":\"q\",\n\t\"ꝗ\":\"q\",\n\t\"ŕ\":\"r\",\n\t\"ř\":\"r\",\n\t\"ŗ\":\"r\",\n\t\"ṙ\":\"r\",\n\t\"ṛ\":\"r\",\n\t\"ṝ\":\"r\",\n\t\"ȑ\":\"r\",\n\t\"ɾ\":\"r\",\n\t\"ᵳ\":\"r\",\n\t\"ȓ\":\"r\",\n\t\"ṟ\":\"r\",\n\t\"ɼ\":\"r\",\n\t\"ᵲ\":\"r\",\n\t\"ᶉ\":\"r\",\n\t\"ɍ\":\"r\",\n\t\"ɽ\":\"r\",\n\t\"ↄ\":\"c\",\n\t\"ꜿ\":\"c\",\n\t\"ɘ\":\"e\",\n\t\"ɿ\":\"r\",\n\t\"ś\":\"s\",\n\t\"ṥ\":\"s\",\n\t\"š\":\"s\",\n\t\"ṧ\":\"s\",\n\t\"ş\":\"s\",\n\t\"ŝ\":\"s\",\n\t\"ș\":\"s\",\n\t\"ṡ\":\"s\",\n\t\"ṣ\":\"s\",\n\t\"ṩ\":\"s\",\n\t\"ʂ\":\"s\",\n\t\"ᵴ\":\"s\",\n\t\"ᶊ\":\"s\",\n\t\"ȿ\":\"s\",\n\t\"ɡ\":\"g\",\n\t\"ᴑ\":\"o\",\n\t\"ᴓ\":\"o\",\n\t\"ᴝ\":\"u\",\n\t\"ť\":\"t\",\n\t\"ţ\":\"t\",\n\t\"ṱ\":\"t\",\n\t\"ț\":\"t\",\n\t\"ȶ\":\"t\",\n\t\"ẗ\":\"t\",\n\t\"ⱦ\":\"t\",\n\t\"ṫ\":\"t\",\n\t\"ṭ\":\"t\",\n\t\"ƭ\":\"t\",\n\t\"ṯ\":\"t\",\n\t\"ᵵ\":\"t\",\n\t\"ƫ\":\"t\",\n\t\"ʈ\":\"t\",\n\t\"ŧ\":\"t\",\n\t\"ᵺ\":\"th\",\n\t\"ɐ\":\"a\",\n\t\"ᴂ\":\"ae\",\n\t\"ǝ\":\"e\",\n\t\"ᵷ\":\"g\",\n\t\"ɥ\":\"h\",\n\t\"ʮ\":\"h\",\n\t\"ʯ\":\"h\",\n\t\"ᴉ\":\"i\",\n\t\"ʞ\":\"k\",\n\t\"ꞁ\":\"l\",\n\t\"ɯ\":\"m\",\n\t\"ɰ\":\"m\",\n\t\"ᴔ\":\"oe\",\n\t\"ɹ\":\"r\",\n\t\"ɻ\":\"r\",\n\t\"ɺ\":\"r\",\n\t\"ⱹ\":\"r\",\n\t\"ʇ\":\"t\",\n\t\"ʌ\":\"v\",\n\t\"ʍ\":\"w\",\n\t\"ʎ\":\"y\",\n\t\"ꜩ\":\"tz\",\n\t\"ú\":\"u\",\n\t\"ŭ\":\"u\",\n\t\"ǔ\":\"u\",\n\t\"û\":\"u\",\n\t\"ṷ\":\"u\",\n\t\"ü\":\"u\",\n\t\"ǘ\":\"u\",\n\t\"ǚ\":\"u\",\n\t\"ǜ\":\"u\",\n\t\"ǖ\":\"u\",\n\t\"ṳ\":\"u\",\n\t\"ụ\":\"u\",\n\t\"ű\":\"u\",\n\t\"ȕ\":\"u\",\n\t\"ù\":\"u\",\n\t\"ủ\":\"u\",\n\t\"ư\":\"u\",\n\t\"ứ\":\"u\",\n\t\"ự\":\"u\",\n\t\"ừ\":\"u\",\n\t\"ử\":\"u\",\n\t\"ữ\":\"u\",\n\t\"ȗ\":\"u\",\n\t\"ū\":\"u\",\n\t\"ṻ\":\"u\",\n\t\"ų\":\"u\",\n\t\"ᶙ\":\"u\",\n\t\"ů\":\"u\",\n\t\"ũ\":\"u\",\n\t\"ṹ\":\"u\",\n\t\"ṵ\":\"u\",\n\t\"ᵫ\":\"ue\",\n\t\"ꝸ\":\"um\",\n\t\"ⱴ\":\"v\",\n\t\"ꝟ\":\"v\",\n\t\"ṿ\":\"v\",\n\t\"ʋ\":\"v\",\n\t\"ᶌ\":\"v\",\n\t\"ⱱ\":\"v\",\n\t\"ṽ\":\"v\",\n\t\"ꝡ\":\"vy\",\n\t\"ẃ\":\"w\",\n\t\"ŵ\":\"w\",\n\t\"ẅ\":\"w\",\n\t\"ẇ\":\"w\",\n\t\"ẉ\":\"w\",\n\t\"ẁ\":\"w\",\n\t\"ⱳ\":\"w\",\n\t\"ẘ\":\"w\",\n\t\"ẍ\":\"x\",\n\t\"ẋ\":\"x\",\n\t\"ᶍ\":\"x\",\n\t\"ý\":\"y\",\n\t\"ŷ\":\"y\",\n\t\"ÿ\":\"y\",\n\t\"ẏ\":\"y\",\n\t\"ỵ\":\"y\",\n\t\"ỳ\":\"y\",\n\t\"ƴ\":\"y\",\n\t\"ỷ\":\"y\",\n\t\"ỿ\":\"y\",\n\t\"ȳ\":\"y\",\n\t\"ẙ\":\"y\",\n\t\"ɏ\":\"y\",\n\t\"ỹ\":\"y\",\n\t\"ź\":\"z\",\n\t\"ž\":\"z\",\n\t\"ẑ\":\"z\",\n\t\"ʑ\":\"z\",\n\t\"ⱬ\":\"z\",\n\t\"ż\":\"z\",\n\t\"ẓ\":\"z\",\n\t\"ȥ\":\"z\",\n\t\"ẕ\":\"z\",\n\t\"ᵶ\":\"z\",\n\t\"ᶎ\":\"z\",\n\t\"ʐ\":\"z\",\n\t\"ƶ\":\"z\",\n\t\"ɀ\":\"z\",\n\t\"ff\":\"ff\",\n\t\"ffi\":\"ffi\",\n\t\"ffl\":\"ffl\",\n\t\"fi\":\"fi\",\n\t\"fl\":\"fl\",\n\t\"ij\":\"ij\",\n\t\"œ\":\"oe\",\n\t\"st\":\"st\",\n\t\"ₐ\":\"a\",\n\t\"ₑ\":\"e\",\n\t\"ᵢ\":\"i\",\n\t\"ⱼ\":\"j\",\n\t\"ₒ\":\"o\",\n\t\"ᵣ\":\"r\",\n\t\"ᵤ\":\"u\",\n\t\"ᵥ\":\"v\",\n\t\"ₓ\":\"x\",\n\t\"Ё\":\"YO\",\n\t\"Й\":\"I\",\n\t\"Ц\":\"TS\",\n\t\"У\":\"U\",\n\t\"К\":\"K\",\n\t\"Е\":\"E\",\n\t\"Н\":\"N\",\n\t\"Г\":\"G\",\n\t\"Ш\":\"SH\",\n\t\"Щ\":\"SCH\",\n\t\"З\":\"Z\",\n\t\"Х\":\"H\",\n\t\"Ъ\":\"'\",\n\t\"ё\":\"yo\",\n\t\"й\":\"i\",\n\t\"ц\":\"ts\",\n\t\"у\":\"u\",\n\t\"к\":\"k\",\n\t\"е\":\"e\",\n\t\"н\":\"n\",\n\t\"г\":\"g\",\n\t\"ш\":\"sh\",\n\t\"щ\":\"sch\",\n\t\"з\":\"z\",\n\t\"х\":\"h\",\n\t\"ъ\":\"'\",\n\t\"Ф\":\"F\",\n\t\"Ы\":\"I\",\n\t\"В\":\"V\",\n\t\"А\":\"a\",\n\t\"П\":\"P\",\n\t\"Р\":\"R\",\n\t\"О\":\"O\",\n\t\"Л\":\"L\",\n\t\"Д\":\"D\",\n\t\"Ж\":\"ZH\",\n\t\"Э\":\"E\",\n\t\"ф\":\"f\",\n\t\"ы\":\"i\",\n\t\"в\":\"v\",\n\t\"а\":\"a\",\n\t\"п\":\"p\",\n\t\"р\":\"r\",\n\t\"о\":\"o\",\n\t\"л\":\"l\",\n\t\"д\":\"d\",\n\t\"ж\":\"zh\",\n\t\"э\":\"e\",\n\t\"Я\":\"Ya\",\n\t\"Ч\":\"CH\",\n\t\"С\":\"S\",\n\t\"М\":\"M\",\n\t\"И\":\"I\",\n\t\"Т\":\"T\",\n\t\"Ь\":\"'\",\n\t\"Б\":\"B\",\n\t\"Ю\":\"YU\",\n\t\"я\":\"ya\",\n\t\"ч\":\"ch\",\n\t\"с\":\"s\",\n\t\"м\":\"m\",\n\t\"и\":\"i\",\n\t\"т\":\"t\",\n\t\"ь\":\"'\",\n\t\"б\":\"b\",\n\t\"ю\":\"yu\"\n};\n\nexports.transliterate = function(str) {\n\treturn str.replace(/[^A-Za-z0-9\\[\\] ]/g,function(ch) {\n\t\treturn exports.transliterationPairs[ch] || ch\n\t});\n};\n\nexports.transliterateToSafeASCII = function(str) {\n\treturn str.replace(/[^\\x00-\\x7F]/g,function(ch) {\n\t\treturn exports.transliterationPairs[ch] || \"\"\n\t});\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/utils/utils.js": {
"title": "$:/core/modules/utils/utils.js",
"text": "/*\\\ntitle: $:/core/modules/utils/utils.js\ntype: application/javascript\nmodule-type: utils\n\nVarious static utility functions.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar base64utf8 = require(\"$:/core/modules/utils/base64-utf8/base64-utf8.module.js\");\n\n/*\nDisplay a message, in colour if we're on a terminal\n*/\nexports.log = function(text,colour) {\n\tconsole.log($tw.node ? exports.terminalColour(colour) + text + exports.terminalColour() : text);\n};\n\nexports.terminalColour = function(colour) {\n\tif(!$tw.browser && $tw.node && process.stdout.isTTY) {\n\t\tif(colour) {\n\t\t\tvar code = exports.terminalColourLookup[colour];\n\t\t\tif(code) {\n\t\t\t\treturn \"\\x1b[\" + code + \"m\";\n\t\t\t}\n\t\t} else {\n\t\t\treturn \"\\x1b[0m\"; // Cancel colour\n\t\t}\n\t}\n\treturn \"\";\n};\n\nexports.terminalColourLookup = {\n\t\"black\": \"0;30\",\n\t\"red\": \"0;31\",\n\t\"green\": \"0;32\",\n\t\"brown/orange\": \"0;33\",\n\t\"blue\": \"0;34\",\n\t\"purple\": \"0;35\",\n\t\"cyan\": \"0;36\",\n\t\"light gray\": \"0;37\"\n};\n\n/*\nDisplay a warning, in colour if we're on a terminal\n*/\nexports.warning = function(text) {\n\texports.log(text,\"brown/orange\");\n};\n\n/*\nLog a table of name: value pairs\n*/\nexports.logTable = function(data) {\n\tif(console.table) {\n\t\tconsole.table(data);\n\t} else {\n\t\t$tw.utils.each(data,function(value,name) {\n\t\t\tconsole.log(name + \": \" + value);\n\t\t});\n\t}\n}\n\n/*\nReturn the integer represented by the str (string).\nReturn the dflt (default) parameter if str is not a base-10 number.\n*/\nexports.getInt = function(str,deflt) {\n\tvar i = parseInt(str,10);\n\treturn isNaN(i) ? deflt : i;\n}\n\n/*\nRepeatedly replaces a substring within a string. Like String.prototype.replace, but without any of the default special handling of $ sequences in the replace string\n*/\nexports.replaceString = function(text,search,replace) {\n\treturn text.replace(search,function() {\n\t\treturn replace;\n\t});\n};\n\n/*\nRepeats a string\n*/\nexports.repeat = function(str,count) {\n\tvar result = \"\";\n\tfor(var t=0;t<count;t++) {\n\t\tresult += str;\n\t}\n\treturn result;\n};\n\n/*\nTrim whitespace from the start and end of a string\nThanks to Steven Levithan, http://blog.stevenlevithan.com/archives/faster-trim-javascript\n*/\nexports.trim = function(str) {\n\tif(typeof str === \"string\") {\n\t\treturn str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n\t} else {\n\t\treturn str;\n\t}\n};\n\nexports.trimPrefix = function(str,unwanted) {\n\tif(typeof str === \"string\" && typeof unwanted === \"string\") {\n\t\tif(unwanted === \"\") {\n\t\t\treturn str.replace(/^\\s\\s*/, '');\n\t\t} else {\n\t\t\t// Safely regexp-escape the unwanted text\n\t\t\tunwanted = unwanted.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n\t\t\tvar regex = new RegExp('^(' + unwanted + ')+');\n\t\t\treturn str.replace(regex, '');\n\t\t}\n\t} else {\n\t\treturn str;\n\t}\n};\n\nexports.trimSuffix = function(str,unwanted) {\n\tif(typeof str === \"string\" && typeof unwanted === \"string\") {\n\t\tif(unwanted === \"\") {\n\t\t\treturn str.replace(/\\s\\s*$/, '');\n\t\t} else {\n\t\t\t// Safely regexp-escape the unwanted text\n\t\t\tunwanted = unwanted.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n\t\t\tvar regex = new RegExp('(' + unwanted + ')+$');\n\t\t\treturn str.replace(regex, '');\n\t\t}\n\t} else {\n\t\treturn str;\n\t}\n};\n\n/*\nConvert a string to sentence case (ie capitalise first letter)\n*/\nexports.toSentenceCase = function(str) {\n\treturn (str || \"\").replace(/^\\S/, function(c) {return c.toUpperCase();});\n}\n\n/*\nConvert a string to title case (ie capitalise each initial letter)\n*/\nexports.toTitleCase = function(str) {\n\treturn (str || \"\").replace(/(^|\\s)\\S/g, function(c) {return c.toUpperCase();});\n}\n\n/*\nFind the line break preceding a given position in a string\nReturns position immediately after that line break, or the start of the string\n*/\nexports.findPrecedingLineBreak = function(text,pos) {\n\tvar result = text.lastIndexOf(\"\\n\",pos - 1);\n\tif(result === -1) {\n\t\tresult = 0;\n\t} else {\n\t\tresult++;\n\t\tif(text.charAt(result) === \"\\r\") {\n\t\t\tresult++;\n\t\t}\n\t}\n\treturn result;\n};\n\n/*\nFind the line break following a given position in a string\n*/\nexports.findFollowingLineBreak = function(text,pos) {\n\t// Cut to just past the following line break, or to the end of the text\n\tvar result = text.indexOf(\"\\n\",pos);\n\tif(result === -1) {\n\t\tresult = text.length;\n\t} else {\n\t\tif(text.charAt(result) === \"\\r\") {\n\t\t\tresult++;\n\t\t}\n\t}\n\treturn result;\n};\n\n/*\nReturn the number of keys in an object\n*/\nexports.count = function(object) {\n\treturn Object.keys(object || {}).length;\n};\n\n/*\nDetermine whether an array-item is an object-property\n*/\nexports.hopArray = function(object,array) {\n\tfor(var i=0; i<array.length; i++) {\n\t\tif($tw.utils.hop(object,array[i])) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n\n/*\nRemove entries from an array\n\tarray: array to modify\n\tvalue: a single value to remove, or an array of values to remove\n*/\nexports.removeArrayEntries = function(array,value) {\n\tvar t,p;\n\tif($tw.utils.isArray(value)) {\n\t\tfor(t=0; t<value.length; t++) {\n\t\t\tp = array.indexOf(value[t]);\n\t\t\tif(p !== -1) {\n\t\t\t\tarray.splice(p,1);\n\t\t\t}\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}\n};\n\n/*\nCheck whether any members of a hashmap are present in another hashmap\n*/\nexports.checkDependencies = function(dependencies,changes) {\n\tvar hit = false;\n\t$tw.utils.each(changes,function(change,title) {\n\t\tif($tw.utils.hop(dependencies,title)) {\n\t\t\thit = true;\n\t\t}\n\t});\n\treturn hit;\n};\n\nexports.extend = function(object /* [, src] */) {\n\t$tw.utils.each(Array.prototype.slice.call(arguments, 1), function(source) {\n\t\tif(source) {\n\t\t\tfor(var property in source) {\n\t\t\t\tobject[property] = source[property];\n\t\t\t}\n\t\t}\n\t});\n\treturn object;\n};\n\nexports.deepCopy = function(object) {\n\tvar result,t;\n\tif($tw.utils.isArray(object)) {\n\t\t// Copy arrays\n\t\tresult = object.slice(0);\n\t} else if(typeof object === \"object\") {\n\t\tresult = {};\n\t\tfor(t in object) {\n\t\t\tif(object[t] !== undefined) {\n\t\t\t\tresult[t] = $tw.utils.deepCopy(object[t]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tresult = object;\n\t}\n\treturn result;\n};\n\nexports.extendDeepCopy = function(object,extendedProperties) {\n\tvar result = $tw.utils.deepCopy(object),t;\n\tfor(t in extendedProperties) {\n\t\tif(extendedProperties[t] !== undefined) {\n\t\t\tresult[t] = $tw.utils.deepCopy(extendedProperties[t]);\n\t\t}\n\t}\n\treturn result;\n};\n\nexports.deepFreeze = function deepFreeze(object) {\n\tvar property, key;\n\tif(object) {\n\t\tObject.freeze(object);\n\t\tfor(key in object) {\n\t\t\tproperty = object[key];\n\t\t\tif($tw.utils.hop(object,key) && (typeof property === \"object\") && !Object.isFrozen(property)) {\n\t\t\t\tdeepFreeze(property);\n\t\t\t}\n\t\t}\n\t}\n};\n\nexports.slowInSlowOut = function(t) {\n\treturn (1 - ((Math.cos(t * Math.PI) + 1) / 2));\n};\n\nexports.formatTitleString = function(template,options) {\n\tvar base = options.base || \"\",\n\t\tseparator = options.separator || \"\",\n\t\tcounter = options.counter || \"\";\n\tvar result = \"\",\n\t\tt = template,\n\t\tmatches = [\n\t\t\t[/^\\$basename\\$/i, function() {\n\t\t\t\treturn base;\n\t\t\t}],\n\t\t\t[/^\\$count:(\\d+)\\$/i, function(match) {\n\t\t\t\treturn $tw.utils.pad(counter,match[1]);\n\t\t\t}],\n\t\t\t[/^\\$separator\\$/i, function() {\n\t\t\t\treturn separator;\n\t\t\t}],\n\t\t\t[/^\\$count\\$/i, function() {\n\t\t\t\treturn counter + \"\";\n\t\t\t}]\n\t\t];\n\twhile(t.length){\n\t\tvar matchString = \"\";\n\t\t$tw.utils.each(matches, function(m) {\n\t\t\tvar match = m[0].exec(t);\n\t\t\tif(match) {\n\t\t\t\tmatchString = m[1].call(null,match);\n\t\t\t\tt = t.substr(match[0].length);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\tif(matchString) {\n\t\t\tresult += matchString;\n\t\t} else {\n\t\t\tresult += t.charAt(0);\n\t\t\tt = t.substr(1);\n\t\t}\n\t}\n\tresult = result.replace(/\\\\(.)/g,\"$1\");\n\treturn result;\n};\n\nexports.formatDateString = function(date,template) {\n\tvar result = \"\",\n\t\tt = template,\n\t\tmatches = [\n\t\t\t[/^0hh12/, function() {\n\t\t\t\treturn $tw.utils.pad($tw.utils.getHours12(date));\n\t\t\t}],\n\t\t\t[/^wYYYY/, function() {\n\t\t\t\treturn $tw.utils.pad($tw.utils.getYearForWeekNo(date),4);\n\t\t\t}],\n\t\t\t[/^hh12/, function() {\n\t\t\t\treturn $tw.utils.getHours12(date);\n\t\t\t}],\n\t\t\t[/^DDth/, function() {\n\t\t\t\treturn date.getDate() + $tw.utils.getDaySuffix(date);\n\t\t\t}],\n\t\t\t[/^YYYY/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getFullYear(),4);\n\t\t\t}],\n\t\t\t[/^aYYYY/, function() {\n\t\t\t\treturn $tw.utils.pad(Math.abs(date.getFullYear()),4);\n\t\t\t}],\n\t\t\t[/^\\{era:([^,\\|}]*)\\|([^}\\|]*)\\|([^}]*)\\}/, function(match) {\n\t\t\t\tvar year = date.getFullYear();\n\t\t\t\treturn year === 0 ? match[2] : (year < 0 ? match[1] : match[3]);\n\t\t\t}],\n\t\t\t[/^0hh/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getHours());\n\t\t\t}],\n\t\t\t[/^0mm/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getMinutes());\n\t\t\t}],\n\t\t\t[/^0ss/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getSeconds());\n\t\t\t}],\n\t\t\t[/^0XXX/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getMilliseconds(),3);\n\t\t\t}],\n\t\t\t[/^0DD/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getDate());\n\t\t\t}],\n\t\t\t[/^0MM/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getMonth()+1);\n\t\t\t}],\n\t\t\t[/^0WW/, function() {\n\t\t\t\treturn $tw.utils.pad($tw.utils.getWeek(date));\n\t\t\t}],\n\t\t\t[/^ddd/, function() {\n\t\t\t\treturn $tw.language.getString(\"Date/Short/Day/\" + date.getDay());\n\t\t\t}],\n\t\t\t[/^mmm/, function() {\n\t\t\t\treturn $tw.language.getString(\"Date/Short/Month/\" + (date.getMonth() + 1));\n\t\t\t}],\n\t\t\t[/^DDD/, function() {\n\t\t\t\treturn $tw.language.getString(\"Date/Long/Day/\" + date.getDay());\n\t\t\t}],\n\t\t\t[/^MMM/, function() {\n\t\t\t\treturn $tw.language.getString(\"Date/Long/Month/\" + (date.getMonth() + 1));\n\t\t\t}],\n\t\t\t[/^TZD/, function() {\n\t\t\t\tvar tz = date.getTimezoneOffset(),\n\t\t\t\tatz = Math.abs(tz);\n\t\t\t\treturn (tz < 0 ? '+' : '-') + $tw.utils.pad(Math.floor(atz / 60)) + ':' + $tw.utils.pad(atz % 60);\n\t\t\t}],\n\t\t\t[/^wYY/, function() {\n\t\t\t\treturn $tw.utils.pad($tw.utils.getYearForWeekNo(date) - 2000);\n\t\t\t}],\n\t\t\t[/^[ap]m/, function() {\n\t\t\t\treturn $tw.utils.getAmPm(date).toLowerCase();\n\t\t\t}],\n\t\t\t[/^hh/, function() {\n\t\t\t\treturn date.getHours();\n\t\t\t}],\n\t\t\t[/^mm/, function() {\n\t\t\t\treturn date.getMinutes();\n\t\t\t}],\n\t\t\t[/^ss/, function() {\n\t\t\t\treturn date.getSeconds();\n\t\t\t}],\n\t\t\t[/^XXX/, function() {\n\t\t\t\treturn date.getMilliseconds();\n\t\t\t}],\n\t\t\t[/^[AP]M/, function() {\n\t\t\t\treturn $tw.utils.getAmPm(date).toUpperCase();\n\t\t\t}],\n\t\t\t[/^DD/, function() {\n\t\t\t\treturn date.getDate();\n\t\t\t}],\n\t\t\t[/^MM/, function() {\n\t\t\t\treturn date.getMonth() + 1;\n\t\t\t}],\n\t\t\t[/^WW/, function() {\n\t\t\t\treturn $tw.utils.getWeek(date);\n\t\t\t}],\n\t\t\t[/^YY/, function() {\n\t\t\t\treturn $tw.utils.pad(date.getFullYear() - 2000);\n\t\t\t}]\n\t\t];\n\t// If the user wants everything in UTC, shift the datestamp\n\t// Optimize for format string that essentially means\n\t// 'return raw UTC (tiddlywiki style) date string.'\n\tif(t.indexOf(\"[UTC]\") == 0 ) {\n\t\tif(t == \"[UTC]YYYY0MM0DD0hh0mm0ssXXX\")\n\t\t\treturn $tw.utils.stringifyDate(new Date());\n\t\tvar offset = date.getTimezoneOffset() ; // in minutes\n\t\tdate = new Date(date.getTime()+offset*60*1000) ;\n\t\tt = t.substr(5) ;\n\t}\n\twhile(t.length){\n\t\tvar matchString = \"\";\n\t\t$tw.utils.each(matches, function(m) {\n\t\t\tvar match = m[0].exec(t);\n\t\t\tif(match) {\n\t\t\t\tmatchString = m[1].call(null,match);\n\t\t\t\tt = t.substr(match[0].length);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\tif(matchString) {\n\t\t\tresult += matchString;\n\t\t} else {\n\t\t\tresult += t.charAt(0);\n\t\t\tt = t.substr(1);\n\t\t}\n\t}\n\tresult = result.replace(/\\\\(.)/g,\"$1\");\n\treturn result;\n};\n\nexports.getAmPm = function(date) {\n\treturn $tw.language.getString(\"Date/Period/\" + (date.getHours() >= 12 ? \"pm\" : \"am\"));\n};\n\nexports.getDaySuffix = function(date) {\n\treturn $tw.language.getString(\"Date/DaySuffix/\" + date.getDate());\n};\n\nexports.getWeek = function(date) {\n\tvar dt = new Date(date.getTime());\n\tvar d = dt.getDay();\n\tif(d === 0) {\n\t\td = 7; // JavaScript Sun=0, ISO Sun=7\n\t}\n\tdt.setTime(dt.getTime() + (4 - d) * 86400000);// shift day to Thurs of same week to calculate weekNo\n\tvar x = new Date(dt.getFullYear(),0,1);\n\tvar n = Math.floor((dt.getTime() - x.getTime()) / 86400000);\n\treturn Math.floor(n / 7) + 1;\n};\n\nexports.getYearForWeekNo = function(date) {\n\tvar dt = new Date(date.getTime());\n\tvar d = dt.getDay();\n\tif(d === 0) {\n\t\td = 7; // JavaScript Sun=0, ISO Sun=7\n\t}\n\tdt.setTime(dt.getTime() + (4 - d) * 86400000);// shift day to Thurs of same week\n\treturn dt.getFullYear();\n};\n\nexports.getHours12 = function(date) {\n\tvar h = date.getHours();\n\treturn h > 12 ? h-12 : ( h > 0 ? h : 12 );\n};\n\n/*\nConvert a date delta in milliseconds into a string representation of \"23 seconds ago\", \"27 minutes ago\" etc.\n\tdelta: delta in milliseconds\nReturns an object with these members:\n\tdescription: string describing the delta period\n\tupdatePeriod: time in millisecond until the string will be inaccurate\n*/\nexports.getRelativeDate = function(delta) {\n\tvar futurep = false;\n\tif(delta < 0) {\n\t\tdelta = -1 * delta;\n\t\tfuturep = true;\n\t}\n\tvar units = [\n\t\t{name: \"Years\", duration: 365 * 24 * 60 * 60 * 1000},\n\t\t{name: \"Months\", duration: (365/12) * 24 * 60 * 60 * 1000},\n\t\t{name: \"Days\", duration: 24 * 60 * 60 * 1000},\n\t\t{name: \"Hours\", duration: 60 * 60 * 1000},\n\t\t{name: \"Minutes\", duration: 60 * 1000},\n\t\t{name: \"Seconds\", duration: 1000}\n\t];\n\tfor(var t=0; t<units.length; t++) {\n\t\tvar result = Math.floor(delta / units[t].duration);\n\t\tif(result >= 2) {\n\t\t\treturn {\n\t\t\t\tdelta: delta,\n\t\t\t\tdescription: $tw.language.getString(\n\t\t\t\t\t\"RelativeDate/\" + (futurep ? \"Future\" : \"Past\") + \"/\" + units[t].name,\n\t\t\t\t\t{variables:\n\t\t\t\t\t\t{period: result.toString()}\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t\tupdatePeriod: units[t].duration\n\t\t\t};\n\t\t}\n\t}\n\treturn {\n\t\tdelta: delta,\n\t\tdescription: $tw.language.getString(\n\t\t\t\"RelativeDate/\" + (futurep ? \"Future\" : \"Past\") + \"/Second\",\n\t\t\t{variables:\n\t\t\t\t{period: \"1\"}\n\t\t\t}\n\t\t),\n\t\tupdatePeriod: 1000\n\t};\n};\n\n// Convert & to \"&\", < to \"<\", > to \">\", \" to \""\"\nexports.htmlEncode = function(s) {\n\tif(s) {\n\t\treturn s.toString().replace(/&/mg,\"&\").replace(/</mg,\"<\").replace(/>/mg,\">\").replace(/\\\"/mg,\""\");\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\n// Converts like htmlEncode, but forgets the double quote for brevity\nexports.htmlTextEncode = function(s) {\n\tif(s) {\n\t\treturn s.toString().replace(/&/mg,\"&\").replace(/</mg,\"<\").replace(/>/mg,\">\");\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\n// Converts all HTML entities to their character equivalents\nexports.entityDecode = function(s) {\n\tvar converter = String.fromCodePoint || String.fromCharCode,\n\t\te = s.substr(1,s.length-2), // Strip the & and the ;\n\t\tc;\n\tif(e.charAt(0) === \"#\") {\n\t\tif(e.charAt(1) === \"x\" || e.charAt(1) === \"X\") {\n\t\t\tc = parseInt(e.substr(2),16);\n\t\t} else {\n\t\t\tc = parseInt(e.substr(1),10);\n\t\t}\n\t\tif(isNaN(c)) {\n\t\t\treturn s;\n\t\t} else {\n\t\t\treturn converter(c);\n\t\t}\n\t} else {\n\t\tc = $tw.config.htmlEntities[e];\n\t\tif(c) {\n\t\t\treturn converter(c);\n\t\t} else {\n\t\t\treturn s; // Couldn't convert it as an entity, just return it raw\n\t\t}\n\t}\n};\n\nexports.unescapeLineBreaks = function(s) {\n\treturn s.replace(/\\\\n/mg,\"\\n\").replace(/\\\\b/mg,\" \").replace(/\\\\s/mg,\"\\\\\").replace(/\\r/mg,\"\");\n};\n\n/*\n * Returns an escape sequence for given character. Uses \\x for characters <=\n * 0xFF to save space, \\u for the rest.\n *\n * The code needs to be in sync with th code template in the compilation\n * function for \"action\" nodes.\n */\n// Copied from peg.js, thanks to David Majda\nexports.escape = function(ch) {\n\tvar charCode = ch.charCodeAt(0);\n\tif(charCode <= 0xFF) {\n\t\treturn '\\\\x' + $tw.utils.pad(charCode.toString(16).toUpperCase());\n\t} else {\n\t\treturn '\\\\u' + $tw.utils.pad(charCode.toString(16).toUpperCase(),4);\n\t}\n};\n\n// Turns a string into a legal JavaScript string\n// Copied from peg.js, thanks to David Majda\nexports.stringify = function(s, rawUnicode) {\n\t/*\n\t* ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a string\n\t* literal except for the closing quote character, backslash, carriage return,\n\t* line separator, paragraph separator, and line feed. Any character may\n\t* appear in the form of an escape sequence.\n\t*\n\t* For portability, we also escape all non-ASCII characters.\n\t*/\n\tvar regex = rawUnicode ? /[\\x00-\\x1f]/g : /[\\x00-\\x1f\\x80-\\uFFFF]/g;\n\treturn (s || \"\")\n\t\t.replace(/\\\\/g, '\\\\\\\\') // backslash\n\t\t.replace(/\"/g, '\\\\\"') // double quote character\n\t\t.replace(/'/g, \"\\\\'\") // single quote character\n\t\t.replace(/\\r/g, '\\\\r') // carriage return\n\t\t.replace(/\\n/g, '\\\\n') // line feed\n\t\t.replace(regex, exports.escape); // non-ASCII characters\n};\n\n// Turns a string into a legal JSON string\n// Derived from peg.js, thanks to David Majda\nexports.jsonStringify = function(s, rawUnicode) {\n\t// See http://www.json.org/\n\tvar regex = rawUnicode ? /[\\x00-\\x1f]/g : /[\\x00-\\x1f\\x80-\\uFFFF]/g;\n\treturn (s || \"\")\n\t\t.replace(/\\\\/g, '\\\\\\\\') // backslash\n\t\t.replace(/\"/g, '\\\\\"') // double quote character\n\t\t.replace(/\\r/g, '\\\\r') // carriage return\n\t\t.replace(/\\n/g, '\\\\n') // line feed\n\t\t.replace(/\\x08/g, '\\\\b') // backspace\n\t\t.replace(/\\x0c/g, '\\\\f') // formfeed\n\t\t.replace(/\\t/g, '\\\\t') // tab\n\t\t.replace(regex,function(s) {\n\t\t\treturn '\\\\u' + $tw.utils.pad(s.charCodeAt(0).toString(16).toUpperCase(),4);\n\t\t}); // non-ASCII characters\n};\n\n/*\nEscape the RegExp special characters with a preceding backslash\n*/\nexports.escapeRegExp = function(s) {\n return s.replace(/[\\-\\/\\\\\\^\\$\\*\\+\\?\\.\\(\\)\\|\\[\\]\\{\\}]/g, '\\\\$&');\n};\n\n// Checks whether a link target is external, i.e. not a tiddler title\nexports.isLinkExternal = function(to) {\n\tvar externalRegExp = /^(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\\s<>{}\\[\\]`|\"\\\\^]+(?:\\/|\\b)/i;\n\treturn externalRegExp.test(to);\n};\n\nexports.nextTick = function(fn) {\n/*global window: false */\n\tif(typeof process === \"undefined\") {\n\t\t// Apparently it would be faster to use postMessage - http://dbaron.org/log/20100309-faster-timeouts\n\t\twindow.setTimeout(fn,0);\n\t} else {\n\t\tprocess.nextTick(fn);\n\t}\n};\n\n/*\nConvert a hyphenated CSS property name into a camel case one\n*/\nexports.unHyphenateCss = function(propName) {\n\treturn propName.replace(/-([a-z])/gi, function(match0,match1) {\n\t\treturn match1.toUpperCase();\n\t});\n};\n\n/*\nConvert a camelcase CSS property name into a dashed one (\"backgroundColor\" --> \"background-color\")\n*/\nexports.hyphenateCss = function(propName) {\n\treturn propName.replace(/([A-Z])/g, function(match0,match1) {\n\t\treturn \"-\" + match1.toLowerCase();\n\t});\n};\n\n/*\nParse a text reference of one of these forms:\n* title\n* !!field\n* title!!field\n* title##index\n* etc\nReturns an object with the following fields, all optional:\n* title: tiddler title\n* field: tiddler field name\n* index: JSON property index\n*/\nexports.parseTextReference = function(textRef) {\n\t// Separate out the title, field name and/or JSON indices\n\tvar reTextRef = /(?:(.*?)!!(.+))|(?:(.*?)##(.+))|(.*)/mg,\n\t\tmatch = reTextRef.exec(textRef),\n\t\tresult = {};\n\tif(match && reTextRef.lastIndex === textRef.length) {\n\t\t// Return the parts\n\t\tif(match[1]) {\n\t\t\tresult.title = match[1];\n\t\t}\n\t\tif(match[2]) {\n\t\t\tresult.field = match[2];\n\t\t}\n\t\tif(match[3]) {\n\t\t\tresult.title = match[3];\n\t\t}\n\t\tif(match[4]) {\n\t\t\tresult.index = match[4];\n\t\t}\n\t\tif(match[5]) {\n\t\t\tresult.title = match[5];\n\t\t}\n\t} else {\n\t\t// If we couldn't parse it\n\t\tresult.title = textRef\n\t}\n\treturn result;\n};\n\n/*\nChecks whether a string is a valid fieldname\n*/\nexports.isValidFieldName = function(name) {\n\tif(!name || typeof name !== \"string\") {\n\t\treturn false;\n\t}\n\tname = name.toLowerCase().trim();\n\tvar fieldValidatorRegEx = /^[a-z0-9\\-\\._]+$/mg;\n\treturn fieldValidatorRegEx.test(name);\n};\n\n/*\nExtract the version number from the meta tag or from the boot file\n*/\n\n// Browser version\nexports.extractVersionInfo = function() {\n\tif($tw.packageInfo) {\n\t\treturn $tw.packageInfo.version;\n\t} else {\n\t\tvar metatags = document.getElementsByTagName(\"meta\");\n\t\tfor(var t=0; t<metatags.length; t++) {\n\t\t\tvar m = metatags[t];\n\t\t\tif(m.name === \"tiddlywiki-version\") {\n\t\t\t\treturn m.content;\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nGet the animation duration in ms\n*/\nexports.getAnimationDuration = function() {\n\treturn parseInt($tw.wiki.getTiddlerText(\"$:/config/AnimationDuration\",\"400\"),10) || 0;\n};\n\n/*\nHash a string to a number\nDerived from http://stackoverflow.com/a/15710692\n*/\nexports.hashString = function(str) {\n\treturn str.split(\"\").reduce(function(a,b) {\n\t\ta = ((a << 5) - a) + b.charCodeAt(0);\n\t\treturn a & a;\n\t},0);\n};\n\n/*\nDecode a base64 string\n*/\nexports.base64Decode = function(string64) {\n\treturn base64utf8.base64.decode.call(base64utf8,string64);\n};\n\n/*\nEncode a string to base64\n*/\nexports.base64Encode = function(string64) {\n\treturn base64utf8.base64.encode.call(base64utf8,string64);\n};\n\n/*\nConvert a hashmap into a tiddler dictionary format sequence of name:value pairs\n*/\nexports.makeTiddlerDictionary = function(data) {\n\tvar output = [];\n\tfor(var name in data) {\n\t\toutput.push(name + \": \" + data[name]);\n\t}\n\treturn output.join(\"\\n\");\n};\n\n/*\nHigh resolution microsecond timer for profiling\n*/\nexports.timer = function(base) {\n\tvar m;\n\tif($tw.node) {\n\t\tvar r = process.hrtime();\n\t\tm = r[0] * 1e3 + (r[1] / 1e6);\n\t} else if(window.performance) {\n\t\tm = performance.now();\n\t} else {\n\t\tm = Date.now();\n\t}\n\tif(typeof base !== \"undefined\") {\n\t\tm = m - base;\n\t}\n\treturn m;\n};\n\n/*\nConvert text and content type to a data URI\n*/\nexports.makeDataUri = function(text,type,_canonical_uri) {\n\ttype = type || \"text/vnd.tiddlywiki\";\n\tvar typeInfo = $tw.config.contentTypeInfo[type] || $tw.config.contentTypeInfo[\"text/plain\"],\n\t\tisBase64 = typeInfo.encoding === \"base64\",\n\t\tparts = [];\n\tif(_canonical_uri) {\n\t\tparts.push(_canonical_uri);\n\t} else {\n\t\tparts.push(\"data:\");\n\t\tparts.push(type);\n\t\tparts.push(isBase64 ? \";base64\" : \"\");\n\t\tparts.push(\",\");\n\t\tparts.push(isBase64 ? text : encodeURIComponent(text));\n\t}\n\treturn parts.join(\"\");\n};\n\n/*\nUseful for finding out the fully escaped CSS selector equivalent to a given tag. For example:\n\n$tw.utils.tagToCssSelector(\"$:/tags/Stylesheet\") --> tc-tagged-\\%24\\%3A\\%2Ftags\\%2FStylesheet\n*/\nexports.tagToCssSelector = function(tagName) {\n\treturn \"tc-tagged-\" + encodeURIComponent(tagName).replace(/[!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^`{\\|}~,]/mg,function(c) {\n\t\treturn \"\\\\\" + c;\n\t});\n};\n\n/*\nIE does not have sign function\n*/\nexports.sign = Math.sign || function(x) {\n\tx = +x; // convert to a number\n\tif (x === 0 || isNaN(x)) {\n\t\treturn x;\n\t}\n\treturn x > 0 ? 1 : -1;\n};\n\n/*\nIE does not have an endsWith function\n*/\nexports.strEndsWith = function(str,ending,position) {\n\tif(str.endsWith) {\n\t\treturn str.endsWith(ending,position);\n\t} else {\n\t\tif (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > str.length) {\n\t\t\tposition = str.length;\n\t\t}\n\t\tposition -= ending.length;\n\t\tvar lastIndex = str.indexOf(ending, position);\n\t\treturn lastIndex !== -1 && lastIndex === position;\n\t}\n};\n\n/*\nReturn system information useful for debugging\n*/\nexports.getSystemInfo = function(str,ending,position) {\n\tvar results = [],\n\t\tsave = function(desc,value) {\n\t\t\tresults.push(desc + \": \" + value);\n\t\t};\n\tif($tw.browser) {\n\t\tsave(\"User Agent\",navigator.userAgent);\n\t\tsave(\"Online Status\",window.navigator.onLine);\n\t}\n\tif($tw.node) {\n\t\tsave(\"Node Version\",process.version);\n\t}\n\treturn results.join(\"\\n\");\n};\n\nexports.parseNumber = function(str) {\n\treturn parseFloat(str) || 0;\n};\n\nexports.parseInt = function(str) {\n\treturn parseInt(str,10) || 0;\n};\n\nexports.stringifyNumber = function(num) {\n\treturn num + \"\";\n};\n\nexports.makeCompareFunction = function(type,options) {\n\toptions = options || {};\n\t// set isCaseSensitive to true if not defined in options\n\tvar isCaseSensitive = (options.isCaseSensitive === false) ? false : true,\n\t\tgt = options.invert ? -1 : +1,\n\t\tlt = options.invert ? +1 : -1,\n\t\tcompare = function(a,b) {\n\t\t\tif(a > b) {\n\t\t\t\treturn gt ;\n\t\t\t} else if(a < b) {\n\t\t\t\treturn lt;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t},\n\t\ttypes = {\n\t\t\t\"number\": function(a,b) {\n\t\t\t\treturn compare($tw.utils.parseNumber(a),$tw.utils.parseNumber(b));\n\t\t\t},\n\t\t\t\"integer\": function(a,b) {\n\t\t\t\treturn compare($tw.utils.parseInt(a),$tw.utils.parseInt(b));\n\t\t\t},\n\t\t\t\"string\": function(a,b) {\n\t\t\t\tif(!isCaseSensitive) {\n\t\t\t\t\ta = a.toLowerCase();\n\t\t\t\t\tb = b.toLowerCase();\n\t\t\t\t}\n\t\t\t\treturn compare(\"\" + a,\"\" + b);\n\t\t\t},\n\t\t\t\"date\": function(a,b) {\n\t\t\t\tvar dateA = $tw.utils.parseDate(a),\n\t\t\t\t\tdateB = $tw.utils.parseDate(b);\n\t\t\t\tif(!isFinite(dateA)) {\n\t\t\t\t\tdateA = new Date(0);\n\t\t\t\t}\n\t\t\t\tif(!isFinite(dateB)) {\n\t\t\t\t\tdateB = new Date(0);\n\t\t\t\t}\n\t\t\t\treturn compare(dateA,dateB);\n\t\t\t},\n\t\t\t\"version\": function(a,b) {\n\t\t\t\treturn $tw.utils.compareVersions(a,b);\n\t\t\t},\n\t\t\t\"alphanumeric\": function(a,b) {\n\t\t\t\tif(!isCaseSensitive) {\n\t\t\t\t\ta = a.toLowerCase();\n\t\t\t\t\tb = b.toLowerCase();\n\t\t\t\t}\n\t\t\t\treturn options.invert ? b.localeCompare(a,undefined,{numeric: true,sensitivity: \"base\"}) : a.localeCompare(b,undefined,{numeric: true,sensitivity: \"base\"});\n\t\t\t}\n\t\t};\n\treturn (types[type] || types[options.defaultType] || types.number);\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "utils"
},
"$:/core/modules/widgets/action-confirm.js": {
"title": "$:/core/modules/widgets/action-confirm.js",
"text": "/*\\\n\ntitle: $:/core/modules/widgets/action-confirm.js\ntype: application/javascript\nmodule-type: widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ConfirmWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nConfirmWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nConfirmWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.parentDomNode = parent;\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nConfirmWidget.prototype.execute = function() {\n\tthis.message = this.getAttribute(\"$message\",$tw.language.getString(\"ConfirmAction\"));\n\tthis.prompt = (this.getAttribute(\"$prompt\",\"yes\") == \"no\" ? false : true);\n\tthis.makeChildWidgets();\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nConfirmWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"$message\"] || changedAttributes[\"$prompt\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nConfirmWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tvar invokeActions = true,\n\t\thandled = true;\n\tif(this.prompt) {\n\t\tinvokeActions = confirm(this.message);\n\t}\n\tif(invokeActions) {\n\t\thandled = this.invokeActions(triggeringWidget,event);\n\t}\n\treturn handled;\n};\n\nConfirmWidget.prototype.allowActionPropagation = function() {\n\treturn false;\n};\n\nexports[\"action-confirm\"] = ConfirmWidget;\n\n})();",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-createtiddler.js": {
"title": "$:/core/modules/widgets/action-createtiddler.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/action-createtiddler.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to create a new tiddler with a unique name and specified fields.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw:false, require:false, exports:false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar CreateTiddlerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nCreateTiddlerWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nCreateTiddlerWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Render children\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nCreateTiddlerWidget.prototype.execute = function() {\n\tthis.actionBaseTitle = this.getAttribute(\"$basetitle\");\n\tthis.hasBase = !!this.actionBaseTitle;\n\tthis.actionSaveTitle = this.getAttribute(\"$savetitle\");\n\tthis.actionSaveDraftTitle = this.getAttribute(\"$savedrafttitle\");\n\tthis.actionTimestamp = this.getAttribute(\"$timestamp\",\"yes\") === \"yes\";\n\t//Following params are new since 5.1.22\n\tthis.actionTemplate = this.getAttribute(\"$template\");\n\tthis.useTemplate = !!this.actionTemplate;\n\tthis.actionOverwrite = this.getAttribute(\"$overwrite\",\"no\");\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nCreateTiddlerWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif($tw.utils.count(changedAttributes) > 0) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nCreateTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tvar title = this.wiki.getTiddlerText(\"$:/language/DefaultNewTiddlerTitle\"), // Get the initial new-tiddler title\n\t\tfields = {},\n\t\tcreationFields,\n\t\tmodificationFields;\n\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\tif(name.charAt(0) !== \"$\") {\n\t\t\tfields[name] = attribute;\n\t\t}\n\t});\n\tif(this.actionTimestamp) {\n\t\tcreationFields = this.wiki.getCreationFields();\n\t\tmodificationFields = this.wiki.getModificationFields();\n\t}\n\tif(this.hasBase && this.actionOverwrite === \"no\") {\n\t\ttitle = this.wiki.generateNewTitle(this.actionBaseTitle);\n\t} else if (this.hasBase && this.actionOverwrite === \"yes\") {\n\t\ttitle = this.actionBaseTitle\n\t}\n\t// NO $basetitle BUT $template parameter is available\n\t// the title MUST be unique, otherwise the template would be overwritten\n\tif (!this.hasBase && this.useTemplate) {\n\t\ttitle = this.wiki.generateNewTitle(this.actionTemplate);\n\t} else if (!this.hasBase && !this.useTemplate) {\n\t\t// If no $basetitle and no $template then use initial title\n\t\ttitle = this.wiki.generateNewTitle(title);\n\t}\n\tvar templateTiddler = this.wiki.getTiddler(this.actionTemplate) || {};\n\tthis.wiki.addTiddler(new $tw.Tiddler(templateTiddler.fields,creationFields,fields,modificationFields,{title: title}));\n\tvar draftTitle = this.wiki.generateDraftTitle(title);\n\tif(this.actionSaveTitle) {\n\t\tthis.wiki.setTextReference(this.actionSaveTitle,title,this.getVariable(\"currentTiddler\"));\n\t}\n\tif(this.actionSaveDraftTitle) {\n\t\tthis.wiki.setTextReference(this.actionSaveDraftTitle,draftTitle,this.getVariable(\"currentTiddler\"));\n\t}\n\tthis.setVariable(\"createTiddler-title\",title);\n\tthis.setVariable(\"createTiddler-draftTitle\",draftTitle);\n\treturn true; // Action was invoked\n};\n\nexports[\"action-createtiddler\"] = CreateTiddlerWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-deletefield.js": {
"title": "$:/core/modules/widgets/action-deletefield.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/action-deletefield.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to delete fields of a tiddler.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar DeleteFieldWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDeleteFieldWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nDeleteFieldWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nDeleteFieldWidget.prototype.execute = function() {\n\tthis.actionTiddler = this.getAttribute(\"$tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.actionField = this.getAttribute(\"$field\");\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nDeleteFieldWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"$tiddler\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nDeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tvar self = this,\n\t\ttiddler = this.wiki.getTiddler(self.actionTiddler),\n\t\tremoveFields = {},\n\t\thasChanged = false;\n\tif(this.actionField && tiddler) {\n\t\tremoveFields[this.actionField] = undefined;\n\t\tif(this.actionField in tiddler.fields) {\n\t\t\thasChanged = true;\n\t\t}\n\t}\n\tif(tiddler) {\n\t\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\t\tif(name.charAt(0) !== \"$\" && name !== \"title\") {\n\t\t\t\tremoveFields[name] = undefined;\n\t\t\t\thasChanged = true;\n\t\t\t}\n\t\t});\n\t\tif(hasChanged) {\n\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,removeFields,this.wiki.getModificationFields()));\n\t\t}\n\t}\n\treturn true; // Action was invoked\n};\n\nexports[\"action-deletefield\"] = DeleteFieldWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-deletetiddler.js": {
"title": "$:/core/modules/widgets/action-deletetiddler.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/action-deletetiddler.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to delete a tiddler.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar DeleteTiddlerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDeleteTiddlerWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nDeleteTiddlerWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nDeleteTiddlerWidget.prototype.execute = function() {\n\tthis.actionFilter = this.getAttribute(\"$filter\");\n\tthis.actionTiddler = this.getAttribute(\"$tiddler\");\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nDeleteTiddlerWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"$filter\"] || changedAttributes[\"$tiddler\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nDeleteTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tvar tiddlers = [];\n\tif(this.actionFilter) {\n\t\ttiddlers = this.wiki.filterTiddlers(this.actionFilter,this);\n\t}\n\tif(this.actionTiddler) {\n\t\ttiddlers.push(this.actionTiddler);\n\t}\n\tfor(var t=0; t<tiddlers.length; t++) {\n\t\tthis.wiki.deleteTiddler(tiddlers[t]);\n\t}\n\treturn true; // Action was invoked\n};\n\nexports[\"action-deletetiddler\"] = DeleteTiddlerWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-listops.js": {
"title": "$:/core/modules/widgets/action-listops.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/action-listops.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to apply list operations to any tiddler field (defaults to the 'list' field of the current tiddler)\n\n\\*/\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\nvar ActionListopsWidget = function(parseTreeNode, options) {\n\tthis.initialise(parseTreeNode, options);\n};\n/**\n * Inherit from the base widget class\n */\nActionListopsWidget.prototype = new Widget();\n/**\n * Render this widget into the DOM\n */\nActionListopsWidget.prototype.render = function(parent, nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n/**\n * Compute the internal state of the widget\n */\nActionListopsWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.target = this.getAttribute(\"$tiddler\", this.getVariable(\n\t\t\"currentTiddler\"));\n\tthis.filter = this.getAttribute(\"$filter\");\n\tthis.subfilter = this.getAttribute(\"$subfilter\");\n\tthis.listField = this.getAttribute(\"$field\", \"list\");\n\tthis.listIndex = this.getAttribute(\"$index\");\n\tthis.filtertags = this.getAttribute(\"$tags\");\n};\n/**\n * \tRefresh the widget by ensuring our attributes are up to date\n */\nActionListopsWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif($tw.utils.count(changedAttributes) > 0) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n/**\n * \tInvoke the action associated with this widget\n */\nActionListopsWidget.prototype.invokeAction = function(triggeringWidget,\n\tevent) {\n\t//Apply the specified filters to the lists\n\tvar field = this.listField,\n\t\tindex,\n\t\tlist = this.listField;\n\tif(this.listIndex) {\n\t\tfield = undefined;\n\t\tindex = this.listIndex;\n\t\tlist = this.listIndex;\n\t}\n\tif(this.filter) {\n\t\tthis.wiki.setText(this.target, field, index, $tw.utils.stringifyList(\n\t\t\tthis.wiki\n\t\t\t.filterTiddlers(this.filter, this)));\n\t}\n\tif(this.subfilter) {\n\t\tvar inputList = this.wiki.getTiddlerList(this.target,field,index),\n\t\t\tsubfilter = $tw.utils.stringifyList(inputList) + \" \" + this.subfilter;\n\t\tthis.wiki.setText(this.target, field, index, $tw.utils.stringifyList(this.wiki.filterTiddlers(subfilter,this)));\n\t}\n\tif(this.filtertags) {\n\t\tvar tiddler = this.wiki.getTiddler(this.target),\n\t\t\toldtags = tiddler ? (tiddler.fields.tags || []).slice(0) : [],\n\t\t\ttagfilter = $tw.utils.stringifyList(oldtags) + \" \" + this.filtertags,\n\t\t\tnewtags = this.wiki.filterTiddlers(tagfilter,this);\n\t\tif($tw.utils.stringifyList(oldtags.sort()) !== $tw.utils.stringifyList(newtags.sort())) {\n\t\t\tthis.wiki.setText(this.target,\"tags\",undefined,$tw.utils.stringifyList(newtags));\n\t\t}\n\t}\n\treturn true; // Action was invoked\n};\n\nexports[\"action-listops\"] = ActionListopsWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-log.js": {
"title": "$:/core/modules/widgets/action-log.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/action-log.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to log debug messages\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar LogWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nLogWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nLogWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\nLogWidget.prototype.execute = function(){\n\tthis.message = this.getAttribute(\"$$message\",\"debug\");\n\tthis.logAll = this.getAttribute(\"$$all\",\"no\") === \"yes\" ? true : false;\n\tthis.filter = this.getAttribute(\"$$filter\");\n}\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nLogWidget.prototype.refresh = function(changedTiddlers) {\n\tthis.refreshSelf();\n\treturn true;\n};\n\n/*\nInvoke the action associated with this widget\n*/\nLogWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tthis.log();\n\treturn true; // Action was invoked\n};\n\nLogWidget.prototype.log = function() {\n\tvar data = {},\n\t\tdataCount,\n\t\tallVars = {},\n\t\tfilteredVars;\n\n\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\tif(name.substring(0,2) !== \"$$\") {\n\t\t\tdata[name] = attribute;\n\t\t}\n\t});\n\n\tfor(var v in this.variables) {\n\t\tallVars[v] = this.getVariable(v,{defaultValue:\"\"});\n\t}\n\tif(this.filter) {\n\t\tfilteredVars = this.wiki.compileFilter(this.filter).call(this.wiki,this.wiki.makeTiddlerIterator(allVars));\n\t\t$tw.utils.each(filteredVars,function(name) {\n\t\t\tdata[name] = allVars[name];\n\t\t});\n\t}\n\tdataCount = $tw.utils.count(data);\n\n\tconsole.group(this.message);\n\tif(dataCount > 0) {\n\t\t$tw.utils.logTable(data);\n\t}\n\tif(this.logAll || !dataCount) {\n\t\tconsole.groupCollapsed(\"All variables\");\n\t\t$tw.utils.logTable(allVars);\n\t\tconsole.groupEnd();\n\t}\n\tconsole.groupEnd();\n}\n\nexports[\"action-log\"] = LogWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-navigate.js": {
"title": "$:/core/modules/widgets/action-navigate.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/action-navigate.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to navigate to a tiddler\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar NavigateWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nNavigateWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nNavigateWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nNavigateWidget.prototype.execute = function() {\n\tthis.actionTo = this.getAttribute(\"$to\");\n\tthis.actionScroll = this.getAttribute(\"$scroll\");\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nNavigateWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"$to\"] || changedAttributes[\"$scroll\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nNavigateWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tevent = event || {};\n\tvar bounds = triggeringWidget && triggeringWidget.getBoundingClientRect && triggeringWidget.getBoundingClientRect(),\n\t\tsuppressNavigation = event.metaKey || event.ctrlKey || (event.button === 1);\n\tif(this.actionScroll === \"yes\") {\n\t\tsuppressNavigation = false;\n\t} else if(this.actionScroll === \"no\") {\n\t\tsuppressNavigation = true;\n\t}\n\tthis.dispatchEvent({\n\t\ttype: \"tm-navigate\",\n\t\tnavigateTo: this.actionTo === undefined ? this.getVariable(\"currentTiddler\") : this.actionTo,\n\t\tnavigateFromTitle: this.getVariable(\"storyTiddler\"),\n\t\tnavigateFromNode: triggeringWidget,\n\t\tnavigateFromClientRect: bounds && { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height\n\t\t},\n\t\tnavigateSuppressNavigation: suppressNavigation\n\t});\n\treturn true; // Action was invoked\n};\n\nexports[\"action-navigate\"] = NavigateWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-popup.js": {
"title": "$:/core/modules/widgets/action-popup.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/action-popup.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to trigger a popup.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ActionPopupWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nActionPopupWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nActionPopupWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nActionPopupWidget.prototype.execute = function() {\n\tthis.actionState = this.getAttribute(\"$state\");\n\tthis.actionCoords = this.getAttribute(\"$coords\");\n\tthis.floating = this.getAttribute(\"$floating\",\"no\") === \"yes\";\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nActionPopupWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"$state\"] || changedAttributes[\"$coords\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nActionPopupWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\t// Trigger the popup\n\tvar popupLocationRegExp = /^\\((-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+)\\)$/,\n\t\tmatch = popupLocationRegExp.exec(this.actionCoords || \"\");\n\tif(match) {\n\t\t$tw.popup.triggerPopup({\n\t\t\tdomNode: null,\n\t\t\tdomNodeRect: {\n\t\t\t\tleft: parseFloat(match[1]),\n\t\t\t\ttop: parseFloat(match[2]),\n\t\t\t\twidth: parseFloat(match[3]),\n\t\t\t\theight: parseFloat(match[4])\n\t\t\t},\n\t\t\ttitle: this.actionState,\n\t\t\twiki: this.wiki,\n\t\t\tfloating: this.floating\n\t\t});\n\t} else {\n\t\t$tw.popup.cancel(0);\n\t}\n\treturn true; // Action was invoked\n};\n\nexports[\"action-popup\"] = ActionPopupWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-sendmessage.js": {
"title": "$:/core/modules/widgets/action-sendmessage.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/action-sendmessage.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to send a message\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar SendMessageWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nSendMessageWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nSendMessageWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nSendMessageWidget.prototype.execute = function() {\n\tthis.actionMessage = this.getAttribute(\"$message\");\n\tthis.actionParam = this.getAttribute(\"$param\");\n\tthis.actionName = this.getAttribute(\"$name\");\n\tthis.actionValue = this.getAttribute(\"$value\",\"\");\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nSendMessageWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(Object.keys(changedAttributes).length) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nSendMessageWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\t// Get the string parameter\n\tvar param = this.actionParam;\n\t// Assemble the attributes as a hashmap\n\tvar paramObject = Object.create(null);\n\tvar count = 0;\n\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\tif(name.charAt(0) !== \"$\") {\n\t\t\tparamObject[name] = attribute;\n\t\t\tcount++;\n\t\t}\n\t});\n\t// Add name/value pair if present\n\tif(this.actionName) {\n\t\tparamObject[this.actionName] = this.actionValue;\n\t}\n\t// Dispatch the message\n\tthis.dispatchEvent({\n\t\ttype: this.actionMessage,\n\t\tparam: param,\n\t\tparamObject: paramObject,\n\t\ttiddlerTitle: this.getVariable(\"currentTiddler\"),\n\t\tnavigateFromTitle: this.getVariable(\"storyTiddler\"),\n\t\tevent: event\n\t});\n\treturn true; // Action was invoked\n};\n\nexports[\"action-sendmessage\"] = SendMessageWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/action-setfield.js": {
"title": "$:/core/modules/widgets/action-setfield.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/action-setfield.js\ntype: application/javascript\nmodule-type: widget\n\nAction widget to set a single field or index on a tiddler.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar SetFieldWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nSetFieldWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nSetFieldWidget.prototype.render = function(parent,nextSibling) {\n\tthis.computeAttributes();\n\tthis.execute();\n};\n\n/*\nCompute the internal state of the widget\n*/\nSetFieldWidget.prototype.execute = function() {\n\tthis.actionTiddler = this.getAttribute(\"$tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.actionField = this.getAttribute(\"$field\");\n\tthis.actionIndex = this.getAttribute(\"$index\");\n\tthis.actionValue = this.getAttribute(\"$value\");\n\tthis.actionTimestamp = this.getAttribute(\"$timestamp\",\"yes\") === \"yes\";\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nSetFieldWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"$tiddler\"] || changedAttributes[\"$field\"] || changedAttributes[\"$index\"] || changedAttributes[\"$value\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nInvoke the action associated with this widget\n*/\nSetFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {\n\tvar self = this,\n\t\toptions = {};\n\toptions.suppressTimestamp = !this.actionTimestamp;\n\tif((typeof this.actionField == \"string\") || (typeof this.actionIndex == \"string\") || (typeof this.actionValue == \"string\")) {\n\t\tthis.wiki.setText(this.actionTiddler,this.actionField,this.actionIndex,this.actionValue,options);\n\t}\n\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\tif(name.charAt(0) !== \"$\") {\n\t\t\tself.wiki.setText(self.actionTiddler,name,undefined,attribute,options);\n\t\t}\n\t});\n\treturn true; // Action was invoked\n};\n\nexports[\"action-setfield\"] = SetFieldWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/browse.js": {
"title": "$:/core/modules/widgets/browse.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/browse.js\ntype: application/javascript\nmodule-type: widget\n\nBrowse widget for browsing for files to import\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar BrowseWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nBrowseWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nBrowseWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\tvar domNode = this.document.createElement(\"input\");\n\tdomNode.setAttribute(\"type\",\"file\");\n\tif(this.browseMultiple) {\n\t\tdomNode.setAttribute(\"multiple\",\"multiple\");\n\t}\n\tif(this.tooltip) {\n\t\tdomNode.setAttribute(\"title\",this.tooltip);\n\t}\n\t// Nw.js supports \"nwsaveas\" to force a \"save as\" dialogue that allows a new or existing file to be selected\n\tif(this.nwsaveas) {\n\t\tdomNode.setAttribute(\"nwsaveas\",this.nwsaveas);\n\t}\n\tif(this.accept) {\n\t\tdomNode.setAttribute(\"accept\",this.accept);\n\t}\n\t// Nw.js supports \"webkitdirectory\" and \"nwdirectory\" to allow a directory to be selected\n\tif(this.webkitdirectory) {\n\t\tdomNode.setAttribute(\"webkitdirectory\",this.webkitdirectory);\n\t}\n\tif(this.nwdirectory) {\n\t\tdomNode.setAttribute(\"nwdirectory\",this.nwdirectory);\n\t}\n\t// Add a click event handler\n\tdomNode.addEventListener(\"change\",function (event) {\n\t\tif(self.message) {\n\t\t\tself.dispatchEvent({type: self.message, param: self.param, files: event.target.files});\n\t\t} else {\n\t\t\tself.wiki.readFiles(event.target.files,{\n\t\t\t\tcallback: function(tiddlerFieldsArray) {\n\t\t\t\t\tself.dispatchEvent({type: \"tm-import-tiddlers\", param: JSON.stringify(tiddlerFieldsArray)});\n\t\t\t\t},\n\t\t\t\tdeserializer: self.deserializer\n\t\t\t});\n\t\t}\n\t\treturn false;\n\t},false);\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nBrowseWidget.prototype.execute = function() {\n\tthis.browseMultiple = this.getAttribute(\"multiple\");\n\tthis.deserializer = this.getAttribute(\"deserializer\");\n\tthis.message = this.getAttribute(\"message\");\n\tthis.param = this.getAttribute(\"param\");\n\tthis.tooltip = this.getAttribute(\"tooltip\");\n\tthis.nwsaveas = this.getAttribute(\"nwsaveas\");\n\tthis.accept = this.getAttribute(\"accept\");\n\tthis.webkitdirectory = this.getAttribute(\"webkitdirectory\");\n\tthis.nwdirectory = this.getAttribute(\"nwdirectory\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nBrowseWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\n};\n\nexports.browse = BrowseWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/button.js": {
"title": "$:/core/modules/widgets/button.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/button.js\ntype: application/javascript\nmodule-type: widget\n\nButton widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ButtonWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nButtonWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nButtonWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this,\n\t\ttag = \"button\",\n\t\tdomNode;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\tif(this.buttonTag && $tw.config.htmlUnsafeElements.indexOf(this.buttonTag) === -1) {\n\t\ttag = this.buttonTag;\n\t}\n\tdomNode = this.document.createElement(tag);\n\tthis.domNode = domNode;\n\t// Assign classes\n\tvar classes = this[\"class\"].split(\" \") || [],\n\t\tisPoppedUp = (this.popup || this.popupTitle) && this.isPoppedUp();\n\tif(this.selectedClass) {\n\t\tif((this.set || this.setTitle) && this.setTo && this.isSelected()) {\n\t\t\t$tw.utils.pushTop(classes,this.selectedClass.split(\" \"));\n\t\t}\n\t\tif(isPoppedUp) {\n\t\t\t$tw.utils.pushTop(classes,this.selectedClass.split(\" \"));\n\t\t}\n\t}\n\tif(isPoppedUp) {\n\t\t$tw.utils.pushTop(classes,\"tc-popup-handle\");\n\t}\n\tdomNode.className = classes.join(\" \");\n\t// Assign other attributes\n\tif(this.style) {\n\t\tdomNode.setAttribute(\"style\",this.style);\n\t}\n\tif(this.tooltip) {\n\t\tdomNode.setAttribute(\"title\",this.tooltip);\n\t}\n\tif(this[\"aria-label\"]) {\n\t\tdomNode.setAttribute(\"aria-label\",this[\"aria-label\"]);\n\t}\n\tif(this.popup || this.popupTitle) {\n\t\tdomNode.setAttribute(\"aria-expanded\",isPoppedUp ? \"true\" : \"false\");\n\t}\n\t// Set the tabindex\n\tif(this.tabIndex) {\n\t\tdomNode.setAttribute(\"tabindex\",this.tabIndex);\n\t}\n\tif(this.isDisabled === \"yes\") {\n\t\tdomNode.setAttribute(\"disabled\",true);\n\t}\n\t// Add a click event handler\n\tdomNode.addEventListener(\"click\",function (event) {\n\t\tvar handled = false;\n\t\tif(self.invokeActions(self,event)) {\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.to) {\n\t\t\tself.navigateTo(event);\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.message) {\n\t\t\tself.dispatchMessage(event);\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.popup || self.popupTitle) {\n\t\t\tself.triggerPopup(event);\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.set || self.setTitle) {\n\t\t\tself.setTiddler();\n\t\t\thandled = true;\n\t\t}\n\t\tif(self.actions) {\n\t\t\tvar modifierKey = $tw.keyboardManager.getEventModifierKeyDescriptor(event);\n\t\t\tself.invokeActionString(self.actions,self,event,{modifier: modifierKey});\n\t\t}\n\t\tif(handled) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t}\n\t\treturn handled;\n\t},false);\n\t// Make it draggable if required\n\tif(this.dragTiddler || this.dragFilter) {\n\t\t$tw.utils.makeDraggable({\n\t\t\tdomNode: domNode,\n\t\t\tdragTiddlerFn: function() {return self.dragTiddler;},\n\t\t\tdragFilterFn: function() {return self.dragFilter;},\n\t\t\twidget: this\n\t\t});\n\t}\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nWe don't allow actions to propagate because we trigger actions ourselves\n*/\nButtonWidget.prototype.allowActionPropagation = function() {\n\treturn false;\n};\n\nButtonWidget.prototype.getBoundingClientRect = function() {\n\treturn this.domNodes[0].getBoundingClientRect();\n};\n\nButtonWidget.prototype.isSelected = function() {\n return this.setTitle ? (this.setField ? this.wiki.getTiddler(this.setTitle).getFieldString(this.setField) === this.setTo :\n\t\t(this.setIndex ? this.wiki.extractTiddlerDataItem(this.setTitle,this.setIndex) === this.setTo :\n\t\t\tthis.wiki.getTiddlerText(this.setTitle))) || this.defaultSetValue || this.getVariable(\"currentTiddler\") :\n\t\tthis.wiki.getTextReference(this.set,this.defaultSetValue,this.getVariable(\"currentTiddler\")) === this.setTo;\n};\n\nButtonWidget.prototype.isPoppedUp = function() {\n\tvar tiddler = this.popupTitle ? this.wiki.getTiddler(this.popupTitle) : this.wiki.getTiddler(this.popup);\n\tvar result = tiddler && tiddler.fields.text ? $tw.popup.readPopupState(tiddler.fields.text) : false;\n\treturn result;\n};\n\nButtonWidget.prototype.navigateTo = function(event) {\n\tvar bounds = this.getBoundingClientRect();\n\tthis.dispatchEvent({\n\t\ttype: \"tm-navigate\",\n\t\tnavigateTo: this.to,\n\t\tnavigateFromTitle: this.getVariable(\"storyTiddler\"),\n\t\tnavigateFromNode: this,\n\t\tnavigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height\n\t\t},\n\t\tnavigateSuppressNavigation: event.metaKey || event.ctrlKey || (event.button === 1),\n\t\tevent: event\n\t});\n};\n\nButtonWidget.prototype.dispatchMessage = function(event) {\n\tthis.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable(\"currentTiddler\"), event: event});\n};\n\nButtonWidget.prototype.triggerPopup = function(event) {\n\tif(this.popupTitle) {\n\t\t$tw.popup.triggerPopup({\n\t\t\tdomNode: this.domNodes[0],\n\t\t\ttitle: this.popupTitle,\n\t\t\twiki: this.wiki,\n\t\t\tnoStateReference: true\n\t\t});\n\t} else {\n\t\t$tw.popup.triggerPopup({\n\t\t\tdomNode: this.domNodes[0],\n\t\t\ttitle: this.popup,\n\t\t\twiki: this.wiki\n\t\t});\n\t}\n};\n\nButtonWidget.prototype.setTiddler = function() {\n\tif(this.setTitle) {\n\t\tthis.setField ? this.wiki.setText(this.setTitle,this.setField,undefined,this.setTo) :\n\t\t\t\t(this.setIndex ? this.wiki.setText(this.setTitle,undefined,this.setIndex,this.setTo) :\n\t\t\t\tthis.wiki.setText(this.setTitle,\"text\",undefined,this.setTo));\n\t} else {\n\t\tthis.wiki.setTextReference(this.set,this.setTo,this.getVariable(\"currentTiddler\"));\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nButtonWidget.prototype.execute = function() {\n\t// Get attributes\n\tthis.actions = this.getAttribute(\"actions\");\n\tthis.to = this.getAttribute(\"to\");\n\tthis.message = this.getAttribute(\"message\");\n\tthis.param = this.getAttribute(\"param\");\n\tthis.set = this.getAttribute(\"set\");\n\tthis.setTo = this.getAttribute(\"setTo\");\n\tthis.popup = this.getAttribute(\"popup\");\n\tthis.hover = this.getAttribute(\"hover\");\n\tthis[\"aria-label\"] = this.getAttribute(\"aria-label\");\n\tthis.tooltip = this.getAttribute(\"tooltip\");\n\tthis.style = this.getAttribute(\"style\");\n\tthis[\"class\"] = this.getAttribute(\"class\",\"\");\n\tthis.selectedClass = this.getAttribute(\"selectedClass\");\n\tthis.defaultSetValue = this.getAttribute(\"default\",\"\");\n\tthis.buttonTag = this.getAttribute(\"tag\");\n\tthis.dragTiddler = this.getAttribute(\"dragTiddler\");\n\tthis.dragFilter = this.getAttribute(\"dragFilter\");\n\tthis.setTitle = this.getAttribute(\"setTitle\");\n\tthis.setField = this.getAttribute(\"setField\");\n\tthis.setIndex = this.getAttribute(\"setIndex\");\n\tthis.popupTitle = this.getAttribute(\"popupTitle\");\n\tthis.tabIndex = this.getAttribute(\"tabindex\");\n\tthis.isDisabled = this.getAttribute(\"disabled\",\"no\");\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\nButtonWidget.prototype.updateDomNodeClasses = function() {\n\tvar domNodeClasses = this.domNode.className.split(\" \"),\n\t\toldClasses = this.class.split(\" \"),\n\t\tnewClasses;\n\tthis[\"class\"] = this.getAttribute(\"class\",\"\");\n\tnewClasses = this.class.split(\" \");\n\t//Remove classes assigned from the old value of class attribute\n\t$tw.utils.each(oldClasses,function(oldClass){\n\t\tvar i = domNodeClasses.indexOf(oldClass);\n\t\tif(i !== -1) {\n\t\t\tdomNodeClasses.splice(i,1);\n\t\t}\n\t});\n\t//Add new classes from updated class attribute.\n\t$tw.utils.pushTop(domNodeClasses,newClasses);\n\tthis.domNode.className = domNodeClasses.join(\" \");\n}\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nButtonWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.actions || changedAttributes.to || changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.selectedClass || changedAttributes.style || changedAttributes.dragFilter || changedAttributes.dragTiddler || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup]) || (this.popupTitle && changedTiddlers[this.popupTitle]) || changedAttributes.setTitle || changedAttributes.setField || changedAttributes.setIndex || changedAttributes.popupTitle || changedAttributes.disabled) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else if(changedAttributes[\"class\"]) {\n\t\tthis.updateDomNodeClasses();\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.button = ButtonWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/checkbox.js": {
"title": "$:/core/modules/widgets/checkbox.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/checkbox.js\ntype: application/javascript\nmodule-type: widget\n\nCheckbox widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar CheckboxWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nCheckboxWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nCheckboxWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Create our elements\n\tthis.labelDomNode = this.document.createElement(\"label\");\n\tthis.labelDomNode.setAttribute(\"class\",this.checkboxClass);\n\tthis.inputDomNode = this.document.createElement(\"input\");\n\tthis.inputDomNode.setAttribute(\"type\",\"checkbox\");\n\tif(this.getValue()) {\n\t\tthis.inputDomNode.setAttribute(\"checked\",\"true\");\n\t}\n\tif(this.isDisabled === \"yes\") {\n\t\tthis.inputDomNode.setAttribute(\"disabled\",true);\n\t}\n\tthis.labelDomNode.appendChild(this.inputDomNode);\n\tthis.spanDomNode = this.document.createElement(\"span\");\n\tthis.labelDomNode.appendChild(this.spanDomNode);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(this.inputDomNode,[\n\t\t{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n\t// Insert the label into the DOM and render any children\n\tparent.insertBefore(this.labelDomNode,nextSibling);\n\tthis.renderChildren(this.spanDomNode,null);\n\tthis.domNodes.push(this.labelDomNode);\n};\n\nCheckboxWidget.prototype.getValue = function() {\n\tvar tiddler = this.wiki.getTiddler(this.checkboxTitle);\n\tif(tiddler) {\n\t\tif(this.checkboxTag) {\n\t\t\tif(this.checkboxInvertTag) {\n\t\t\t\treturn !tiddler.hasTag(this.checkboxTag);\n\t\t\t} else {\n\t\t\t\treturn tiddler.hasTag(this.checkboxTag);\n\t\t\t}\n\t\t}\n\t\tif(this.checkboxField) {\n\t\t\tvar value;\n\t\t\tif($tw.utils.hop(tiddler.fields,this.checkboxField)) {\n\t\t\t\tvalue = tiddler.fields[this.checkboxField] || \"\";\n\t\t\t} else {\n\t\t\t\tvalue = this.checkboxDefault || \"\";\n\t\t\t}\n\t\t\tif(value === this.checkboxChecked) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(value === this.checkboxUnchecked) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif(this.checkboxIndex) {\n\t\t\tvar value = this.wiki.extractTiddlerDataItem(tiddler,this.checkboxIndex,this.checkboxDefault || \"\");\n\t\t\tif(value === this.checkboxChecked) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(value === this.checkboxUnchecked) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif(this.checkboxTag) {\n\t\t\treturn false;\n\t\t}\n\t\tif(this.checkboxField) {\n\t\t\tif(this.checkboxDefault === this.checkboxChecked) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(this.checkboxDefault === this.checkboxUnchecked) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\nCheckboxWidget.prototype.handleChangeEvent = function(event) {\n\tvar checked = this.inputDomNode.checked,\n\t\ttiddler = this.wiki.getTiddler(this.checkboxTitle),\n\t\tfallbackFields = {text: \"\"},\n\t\tnewFields = {title: this.checkboxTitle},\n\t\thasChanged = false,\n\t\ttagCheck = false,\n\t\thasTag = tiddler && tiddler.hasTag(this.checkboxTag),\n\t\tvalue = checked ? this.checkboxChecked : this.checkboxUnchecked;\n\tif(this.checkboxTag && this.checkboxInvertTag === \"yes\") {\n\t\ttagCheck = hasTag === checked;\n\t} else {\n\t\ttagCheck = hasTag !== checked;\n\t}\n\t// Set the tag if specified\n\tif(this.checkboxTag && (!tiddler || tagCheck)) {\n\t\tnewFields.tags = tiddler ? (tiddler.fields.tags || []).slice(0) : [];\n\t\tvar pos = newFields.tags.indexOf(this.checkboxTag);\n\t\tif(pos !== -1) {\n\t\t\tnewFields.tags.splice(pos,1);\n\t\t}\n\t\tif(this.checkboxInvertTag === \"yes\" && !checked) {\n\t\t\tnewFields.tags.push(this.checkboxTag);\n\t\t} else if(this.checkboxInvertTag !== \"yes\" && checked) {\n\t\t\tnewFields.tags.push(this.checkboxTag);\n\t\t}\n\t\thasChanged = true;\n\t}\n\t// Set the field if specified\n\tif(this.checkboxField) {\n\t\tif(!tiddler || tiddler.fields[this.checkboxField] !== value) {\n\t\t\tnewFields[this.checkboxField] = value;\n\t\t\thasChanged = true;\n\t\t}\n\t}\n\t// Set the index if specified\n\tif(this.checkboxIndex) {\n\t\tvar indexValue = this.wiki.extractTiddlerDataItem(this.checkboxTitle,this.checkboxIndex);\n\t\tif(!tiddler || indexValue !== value) {\n\t\t\thasChanged = true;\n\t\t}\n\t}\n\tif(hasChanged) {\n\t\tif(this.checkboxIndex) {\n\t\t\tthis.wiki.setText(this.checkboxTitle,\"\",this.checkboxIndex,value);\n\t\t} else {\n\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),fallbackFields,tiddler,newFields,this.wiki.getModificationFields()));\n\t\t}\n\t}\n\t// Trigger actions\n\tif(this.checkboxActions) {\n\t\tthis.invokeActionString(this.checkboxActions,this,event);\n\t}\n\tif(this.checkboxCheckActions && checked) {\n\t\tthis.invokeActionString(this.checkboxCheckActions,this,event);\n\t}\n\tif(this.checkboxUncheckActions && !checked) {\n\t\tthis.invokeActionString(this.checkboxUncheckActions,this,event);\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nCheckboxWidget.prototype.execute = function() {\n\t// Get the parameters from the attributes\n\tthis.checkboxActions = this.getAttribute(\"actions\");\n\tthis.checkboxCheckActions = this.getAttribute(\"checkactions\");\n\tthis.checkboxUncheckActions = this.getAttribute(\"uncheckactions\");\n\tthis.checkboxTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.checkboxTag = this.getAttribute(\"tag\");\n\tthis.checkboxField = this.getAttribute(\"field\");\n\tthis.checkboxIndex = this.getAttribute(\"index\");\n\tthis.checkboxChecked = this.getAttribute(\"checked\");\n\tthis.checkboxUnchecked = this.getAttribute(\"unchecked\");\n\tthis.checkboxDefault = this.getAttribute(\"default\");\n\tthis.checkboxClass = this.getAttribute(\"class\",\"\");\n\tthis.checkboxInvertTag = this.getAttribute(\"invertTag\",\"\");\n\tthis.isDisabled = this.getAttribute(\"disabled\",\"no\");\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nCheckboxWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.tag || changedAttributes.invertTag || changedAttributes.field || changedAttributes.index || changedAttributes.checked || changedAttributes.unchecked || changedAttributes[\"default\"] || changedAttributes[\"class\"] || changedAttributes.disabled) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\tvar refreshed = false;\n\t\tif(changedTiddlers[this.checkboxTitle]) {\n\t\t\tthis.inputDomNode.checked = this.getValue();\n\t\t\trefreshed = true;\n\t\t}\n\t\treturn this.refreshChildren(changedTiddlers) || refreshed;\n\t}\n};\n\nexports.checkbox = CheckboxWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/codeblock.js": {
"title": "$:/core/modules/widgets/codeblock.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/codeblock.js\ntype: application/javascript\nmodule-type: widget\n\nCode block node widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar CodeBlockWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nCodeBlockWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nCodeBlockWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar codeNode = this.document.createElement(\"code\"),\n\t\tdomNode = this.document.createElement(\"pre\");\n\tcodeNode.appendChild(this.document.createTextNode(this.getAttribute(\"code\")));\n\tdomNode.appendChild(codeNode);\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.domNodes.push(domNode);\n\tif(this.postRender) {\n\t\tthis.postRender();\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nCodeBlockWidget.prototype.execute = function() {\n\tthis.language = this.getAttribute(\"language\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nCodeBlockWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\n};\n\nexports.codeblock = CodeBlockWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/count.js": {
"title": "$:/core/modules/widgets/count.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/count.js\ntype: application/javascript\nmodule-type: widget\n\nCount widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar CountWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nCountWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nCountWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar textNode = this.document.createTextNode(this.currentCount);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nCountWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.filter = this.getAttribute(\"filter\");\n\t// Execute the filter\n\tif(this.filter) {\n\t\tthis.currentCount = this.wiki.filterTiddlers(this.filter,this).length;\n\t} else {\n\t\tthis.currentCount = \"0\";\n\t}\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nCountWidget.prototype.refresh = function(changedTiddlers) {\n\t// Re-execute the filter to get the count\n\tthis.computeAttributes();\n\tvar oldCount = this.currentCount;\n\tthis.execute();\n\tif(this.currentCount !== oldCount) {\n\t\t// Regenerate and rerender the widget and replace the existing DOM node\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n\n};\n\nexports.count = CountWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/diff-text.js": {
"title": "$:/core/modules/widgets/diff-text.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/diff-text.js\ntype: application/javascript\nmodule-type: widget\n\nWidget to display a diff between two texts\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget,\n\tdmp = require(\"$:/core/modules/utils/diff-match-patch/diff_match_patch.js\");\n\nvar DiffTextWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDiffTextWidget.prototype = new Widget();\n\nDiffTextWidget.prototype.invisibleCharacters = {\n\t\"\\n\": \"↩︎\\n\",\n\t\"\\r\": \"⇠\",\n\t\"\\t\": \"⇥\\t\"\n};\n\n/*\nRender this widget into the DOM\n*/\nDiffTextWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create the diff\n\tvar dmpObject = new dmp.diff_match_patch(),\n\t\tdiffs = dmpObject.diff_main(this.getAttribute(\"source\"),this.getAttribute(\"dest\"));\n\t// Apply required cleanup\n\tswitch(this.getAttribute(\"cleanup\",\"semantic\")) {\n\t\tcase \"none\":\n\t\t\t// No cleanup\n\t\t\tbreak;\n\t\tcase \"efficiency\":\n\t\t\tdmpObject.diff_cleanupEfficiency(diffs);\n\t\t\tbreak;\n\t\tdefault: // case \"semantic\"\n\t\t\tdmpObject.diff_cleanupSemantic(diffs);\n\t\t\tbreak;\n\t}\n\t// Create the elements\n\tvar domContainer = this.document.createElement(\"div\"), \n\t\tdomDiff = this.createDiffDom(diffs);\n\tparent.insertBefore(domContainer,nextSibling);\n\t// Set variables\n\tthis.setVariable(\"diff-count\",diffs.reduce(function(acc,diff) {\n\t\tif(diff[0] !== dmp.DIFF_EQUAL) {\n\t\t\tacc++;\n\t\t}\n\t\treturn acc;\n\t},0).toString());\n\t// Render child widgets\n\tthis.renderChildren(domContainer,null);\n\t// Render the diff\n\tdomContainer.appendChild(domDiff);\n\t// Save our container\n\tthis.domNodes.push(domContainer);\n};\n\n/*\nCreate DOM elements representing a list of diffs\n*/\nDiffTextWidget.prototype.createDiffDom = function(diffs) {\n\tvar self = this;\n\t// Create the element and assign the attributes\n\tvar domPre = this.document.createElement(\"pre\"),\n\t\tdomCode = this.document.createElement(\"code\");\n\t$tw.utils.each(diffs,function(diff) {\n\t\tvar tag = diff[0] === dmp.DIFF_INSERT ? \"ins\" : (diff[0] === dmp.DIFF_DELETE ? \"del\" : \"span\"),\n\t\t\tclassName = diff[0] === dmp.DIFF_INSERT ? \"tc-diff-insert\" : (diff[0] === dmp.DIFF_DELETE ? \"tc-diff-delete\" : \"tc-diff-equal\"),\n\t\t\tdom = self.document.createElement(tag),\n\t\t\ttext = diff[1],\n\t\t\tcurrPos = 0,\n\t\t\tre = /([\\x00-\\x1F])/mg,\n\t\t\tmatch = re.exec(text),\n\t\t\tspan,\n\t\t\tprintable;\n\t\tdom.className = className;\n\t\twhile(match) {\n\t\t\tif(currPos < match.index) {\n\t\t\t\tdom.appendChild(self.document.createTextNode(text.slice(currPos,match.index)));\n\t\t\t}\n\t\t\tspan = self.document.createElement(\"span\");\n\t\t\tspan.className = \"tc-diff-invisible\";\n\t\t\tprintable = self.invisibleCharacters[match[0]] || (\"[0x\" + match[0].charCodeAt(0).toString(16) + \"]\");\n\t\t\tspan.appendChild(self.document.createTextNode(printable));\n\t\t\tdom.appendChild(span);\n\t\t\tcurrPos = match.index + match[0].length;\n\t\t\tmatch = re.exec(text);\n\t\t}\n\t\tif(currPos < text.length) {\n\t\t\tdom.appendChild(self.document.createTextNode(text.slice(currPos)));\n\t\t}\n\t\tdomCode.appendChild(dom);\n\t});\n\tdomPre.appendChild(domCode);\n\treturn domPre;\n};\n\n/*\nCompute the internal state of the widget\n*/\nDiffTextWidget.prototype.execute = function() {\n\t// Make child widgets\n\tvar parseTreeNodes;\n\tif(this.parseTreeNode && this.parseTreeNode.children && this.parseTreeNode.children.length > 0) {\n\t\tparseTreeNodes = this.parseTreeNode.children;\n\t} else {\n\t\tparseTreeNodes = [{\n\t\t\ttype: \"transclude\",\n\t\t\tattributes: {\n\t\t\t\ttiddler: {type: \"string\", value: \"$:/language/Diffs/CountMessage\"}\n\t\t\t}\n\t\t}];\n\t}\n\tthis.makeChildWidgets(parseTreeNodes);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nDiffTextWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.source || changedAttributes.dest || changedAttributes.cleanup) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports[\"diff-text\"] = DiffTextWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/draggable.js": {
"title": "$:/core/modules/widgets/draggable.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/draggable.js\ntype: application/javascript\nmodule-type: widget\n\nDraggable widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar DraggableWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDraggableWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nDraggableWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Sanitise the specified tag\n\tvar tag = this.draggableTag;\n\tif($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {\n\t\ttag = \"div\";\n\t}\n\t// Create our element\n\tvar domNode = this.document.createElement(tag);\n\t// Assign classes\n\tvar classes = [\"tc-draggable\"];\n\tif(this.draggableClasses) {\n\t\tclasses.push(this.draggableClasses);\n\t}\n\tdomNode.setAttribute(\"class\",classes.join(\" \"));\n\t// Add event handlers\n\t$tw.utils.makeDraggable({\n\t\tdomNode: domNode,\n\t\tdragTiddlerFn: function() {return self.getAttribute(\"tiddler\");},\n\t\tdragFilterFn: function() {return self.getAttribute(\"filter\");},\n\t\tstartActions: self.startActions,\n\t\tendActions: self.endActions,\n\t\twidget: this\n\t});\n\t// Insert the link into the DOM and render any children\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nDraggableWidget.prototype.execute = function() {\n\t// Pick up our attributes\n\tthis.draggableTag = this.getAttribute(\"tag\",\"div\");\n\tthis.draggableClasses = this.getAttribute(\"class\");\n\tthis.startActions = this.getAttribute(\"startactions\");\n\tthis.endActions = this.getAttribute(\"endactions\");\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nDraggableWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tag || changedAttributes[\"class\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.draggable = DraggableWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/droppable.js": {
"title": "$:/core/modules/widgets/droppable.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/droppable.js\ntype: application/javascript\nmodule-type: widget\n\nDroppable widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar DroppableWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDroppableWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nDroppableWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this,\n\t\ttag = this.parseTreeNode.isBlock ? \"div\" : \"span\",\n\t\tdomNode;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\tif(this.droppableTag && $tw.config.htmlUnsafeElements.indexOf(this.droppableTag) === -1) {\n\t\ttag = this.droppableTag;\n\t}\n\t// Create element and assign classes\n\tdomNode = this.document.createElement(tag);\n\tthis.domNode = domNode;\n\tthis.assignDomNodeClasses();\n\t// Add event handlers\n\tif(this.droppableEnable) {\n\t\t$tw.utils.addEventListeners(domNode,[\n\t\t\t{name: \"dragenter\", handlerObject: this, handlerMethod: \"handleDragEnterEvent\"},\n\t\t\t{name: \"dragover\", handlerObject: this, handlerMethod: \"handleDragOverEvent\"},\n\t\t\t{name: \"dragleave\", handlerObject: this, handlerMethod: \"handleDragLeaveEvent\"},\n\t\t\t{name: \"drop\", handlerObject: this, handlerMethod: \"handleDropEvent\"}\n\t\t]);\n\t} else {\n\t\t$tw.utils.addClass(this.domNode,this.disabledClass);\n\t}\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n\t// Stack of outstanding enter/leave events\n\tthis.currentlyEntered = [];\n};\n\nDroppableWidget.prototype.enterDrag = function(event) {\n\tif(this.currentlyEntered.indexOf(event.target) === -1) {\n\t\tthis.currentlyEntered.push(event.target);\n\t}\n\t// If we're entering for the first time we need to apply highlighting\n\t$tw.utils.addClass(this.domNodes[0],\"tc-dragover\");\n};\n\nDroppableWidget.prototype.leaveDrag = function(event) {\n\tvar pos = this.currentlyEntered.indexOf(event.target);\n\tif(pos !== -1) {\n\t\tthis.currentlyEntered.splice(pos,1);\n\t}\n\t// Remove highlighting if we're leaving externally. The hacky second condition is to resolve a problem with Firefox whereby there is an erroneous dragenter event if the node being dragged is within the dropzone\n\tif(this.currentlyEntered.length === 0 || (this.currentlyEntered.length === 1 && this.currentlyEntered[0] === $tw.dragInProgress)) {\n\t\tthis.currentlyEntered = [];\n\t\tif(this.domNodes[0]) {\n\t\t\t$tw.utils.removeClass(this.domNodes[0],\"tc-dragover\");\n\t\t}\n\t}\n};\n\nDroppableWidget.prototype.handleDragEnterEvent = function(event) {\n\tthis.enterDrag(event);\n\t// Tell the browser that we're ready to handle the drop\n\tevent.preventDefault();\n\t// Tell the browser not to ripple the drag up to any parent drop handlers\n\tevent.stopPropagation();\n\treturn false;\n};\n\nDroppableWidget.prototype.handleDragOverEvent = function(event) {\n\t// Check for being over a TEXTAREA or INPUT\n\tif([\"TEXTAREA\",\"INPUT\"].indexOf(event.target.tagName) !== -1) {\n\t\treturn false;\n\t}\n\t// Tell the browser that we're still interested in the drop\n\tevent.preventDefault();\n\t// Set the drop effect\n\tevent.dataTransfer.dropEffect = this.droppableEffect;\n\treturn false;\n};\n\nDroppableWidget.prototype.handleDragLeaveEvent = function(event) {\n\tthis.leaveDrag(event);\n\treturn false;\n};\n\nDroppableWidget.prototype.handleDropEvent = function(event) {\n\tvar self = this;\n\tthis.leaveDrag(event);\n\t// Check for being over a TEXTAREA or INPUT\n\tif([\"TEXTAREA\",\"INPUT\"].indexOf(event.target.tagName) !== -1) {\n\t\treturn false;\n\t}\n\tvar dataTransfer = event.dataTransfer;\n\t// Remove highlighting\n\t$tw.utils.removeClass(this.domNodes[0],\"tc-dragover\");\n\t// Try to import the various data types we understand\n\t$tw.utils.importDataTransfer(dataTransfer,null,function(fieldsArray) {\n\t\tfieldsArray.forEach(function(fields) {\n\t\t\tself.performActions(fields.title || fields.text,event);\n\t\t});\n\t});\n\t// Tell the browser that we handled the drop\n\tevent.preventDefault();\n\t// Stop the drop ripple up to any parent handlers\n\tevent.stopPropagation();\n\treturn false;\n};\n\nDroppableWidget.prototype.performActions = function(title,event) {\n\tif(this.droppableActions) {\n\t\tvar modifierKey = $tw.keyboardManager.getEventModifierKeyDescriptor(event);\n\t\tthis.invokeActionString(this.droppableActions,this,event,{actionTiddler: title, modifier: modifierKey});\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nDroppableWidget.prototype.execute = function() {\n\tthis.droppableActions = this.getAttribute(\"actions\");\n\tthis.droppableEffect = this.getAttribute(\"effect\",\"copy\");\n\tthis.droppableTag = this.getAttribute(\"tag\");\n\tthis.droppableEnable = (this.getAttribute(\"enable\") || \"yes\") === \"yes\";\n\tthis.disabledClass = this.getAttribute(\"disabledClass\",\"\");\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\nDroppableWidget.prototype.assignDomNodeClasses = function() {\n\tvar classes = this.getAttribute(\"class\",\"\").split(\" \");\n\tclasses.push(\"tc-droppable\");\n\tthis.domNode.className = classes.join(\" \");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nDroppableWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tag || changedAttributes.enable || changedAttributes.disabledClass || changedAttributes.actions || changedAttributes.effect) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else if(changedAttributes[\"class\"]) {\n\t\tthis.assignDomNodeClasses();\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.droppable = DroppableWidget;\n\n})();",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/dropzone.js": {
"title": "$:/core/modules/widgets/dropzone.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/dropzone.js\ntype: application/javascript\nmodule-type: widget\n\nDropzone widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar IMPORT_TITLE = \"$:/Import\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar DropZoneWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nDropZoneWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nDropZoneWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\tvar domNode = this.document.createElement(\"div\");\n\tthis.domNode = domNode;\n\tdomNode.className = this.dropzoneClass || \"tc-dropzone\";\n\t// Add event handlers\n\tif(this.dropzoneEnable) {\n\t\t$tw.utils.addEventListeners(domNode,[\n\t\t\t{name: \"dragenter\", handlerObject: this, handlerMethod: \"handleDragEnterEvent\"},\n\t\t\t{name: \"dragover\", handlerObject: this, handlerMethod: \"handleDragOverEvent\"},\n\t\t\t{name: \"dragleave\", handlerObject: this, handlerMethod: \"handleDragLeaveEvent\"},\n\t\t\t{name: \"drop\", handlerObject: this, handlerMethod: \"handleDropEvent\"},\n\t\t\t{name: \"paste\", handlerObject: this, handlerMethod: \"handlePasteEvent\"},\n\t\t\t{name: \"dragend\", handlerObject: this, handlerMethod: \"handleDragEndEvent\"}\n\t\t]);\n\t}\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n\t// Stack of outstanding enter/leave events\n\tthis.currentlyEntered = [];\n};\n\n// Handler for transient event listeners added when the dropzone has an active drag in progress\nDropZoneWidget.prototype.handleEvent = function(event) {\n\tif(event.type === \"click\") {\n\t\tif(this.currentlyEntered.length) {\n\t\t\tthis.resetState();\n\t\t}\n\t} else if(event.type === \"dragenter\") {\n\t\tif(event.target && event.target !== this.domNode && !$tw.utils.domContains(this.domNode,event.target)) {\n\t\t\tthis.resetState();\n\t\t}\n\t} else if(event.type === \"dragleave\") {\n\t\t// Check if drag left the window\n\t\tif(event.relatedTarget === null || (event.relatedTarget && event.relatedTarget.nodeName === \"HTML\")) {\n\t\t\tthis.resetState();\n\t\t}\n\t}\n};\n\n// Reset the state of the dropzone after a drag has ended\nDropZoneWidget.prototype.resetState = function() {\n\t$tw.utils.removeClass(this.domNode,\"tc-dragover\");\n\tthis.currentlyEntered = [];\n\tthis.document.body.removeEventListener(\"click\",this,true);\n\tthis.document.body.removeEventListener(\"dragenter\",this,true);\n\tthis.document.body.removeEventListener(\"dragleave\",this,true);\n\tthis.dragInProgress = false;\n};\n\nDropZoneWidget.prototype.enterDrag = function(event) {\n\tif(this.currentlyEntered.indexOf(event.target) === -1) {\n\t\tthis.currentlyEntered.push(event.target);\n\t}\n\tif(!this.dragInProgress) {\n\t\tthis.dragInProgress = true;\n\t\t// If we're entering for the first time we need to apply highlighting\n\t\t$tw.utils.addClass(this.domNodes[0],\"tc-dragover\");\n\t\tthis.document.body.addEventListener(\"click\",this,true);\n\t\tthis.document.body.addEventListener(\"dragenter\",this,true);\n\t\tthis.document.body.addEventListener(\"dragleave\",this,true);\n\t}\n};\n\nDropZoneWidget.prototype.leaveDrag = function(event) {\n\tvar pos = this.currentlyEntered.indexOf(event.target);\n\tif(pos !== -1) {\n\t\tthis.currentlyEntered.splice(pos,1);\n\t}\n\t// Remove highlighting if we're leaving externally\n\tif(this.currentlyEntered.length === 0) {\n\t\tthis.resetState();\n\t}\n};\n\nDropZoneWidget.prototype.handleDragEnterEvent = function(event) {\n\tif($tw.dragInProgress) {\n\t\treturn false;\n\t}\n\tif(this.filesOnly && !$tw.utils.dragEventContainsFiles(event)) {\n\t\treturn false;\n\t}\n\tthis.enterDrag(event);\n\t// Tell the browser that we're ready to handle the drop\n\tevent.preventDefault();\n\t// Tell the browser not to ripple the drag up to any parent drop handlers\n\tevent.stopPropagation();\n};\n\nDropZoneWidget.prototype.handleDragOverEvent = function(event) {\n\t// Check for being over a TEXTAREA or INPUT\n\tif([\"TEXTAREA\",\"INPUT\"].indexOf(event.target.tagName) !== -1) {\n\t\treturn false;\n\t}\n\t// Check for this window being the source of the drag\n\tif($tw.dragInProgress) {\n\t\treturn false;\n\t}\n\t// Tell the browser that we're still interested in the drop\n\tevent.preventDefault();\n\t// Check if this is a synthetic event, IE does not allow accessing dropEffect outside of original event handler\n\tif(event.isTrusted) {\n\t\tevent.dataTransfer.dropEffect = \"copy\"; // Explicitly show this is a copy\n\t}\n};\n\nDropZoneWidget.prototype.handleDragLeaveEvent = function(event) {\n\tthis.leaveDrag(event);\n};\n\nDropZoneWidget.prototype.handleDragEndEvent = function(event) {\n\tthis.resetState();\n};\n\nDropZoneWidget.prototype.filterByContentTypes = function(tiddlerFieldsArray) {\n\tvar filteredTypes,\n\t\tfiltered = [],\n\t\ttypes = [];\n\t$tw.utils.each(tiddlerFieldsArray,function(tiddlerFields) {\n\t\ttypes.push(tiddlerFields.type || \"\");\n\t});\n\tfilteredTypes = this.wiki.filterTiddlers(this.contentTypesFilter,this,this.wiki.makeTiddlerIterator(types));\n\t$tw.utils.each(tiddlerFieldsArray,function(tiddlerFields) {\n\t\tif(filteredTypes.indexOf(tiddlerFields.type) !== -1) {\n\t\t\tfiltered.push(tiddlerFields);\n\t\t}\n\t});\n\treturn filtered;\n};\n\nDropZoneWidget.prototype.readFileCallback = function(tiddlerFieldsArray) {\n\tif(this.contentTypesFilter) {\n\t\ttiddlerFieldsArray = this.filterByContentTypes(tiddlerFieldsArray);\n\t}\n\tif(tiddlerFieldsArray.length) {\n\t\tthis.dispatchEvent({type: \"tm-import-tiddlers\", param: JSON.stringify(tiddlerFieldsArray), autoOpenOnImport: this.autoOpenOnImport, importTitle: this.importTitle});\n\t\tif(this.actions) {\n\t\t\tthis.invokeActionString(this.actions,this,event,{importTitle: this.importTitle});\n\t\t}\n\t}\n};\n\nDropZoneWidget.prototype.handleDropEvent = function(event) {\n\tvar self = this,\n\t\treadFileCallback = function(tiddlerFieldsArray) {\n\t\t\tself.readFileCallback(tiddlerFieldsArray);\n\t\t};\n\tthis.leaveDrag(event);\n\t// Check for being over a TEXTAREA or INPUT\n\tif([\"TEXTAREA\",\"INPUT\"].indexOf(event.target.tagName) !== -1) {\n\t\treturn false;\n\t}\n\t// Check for this window being the source of the drag\n\tif($tw.dragInProgress) {\n\t\treturn false;\n\t}\n\tvar self = this,\n\t\tdataTransfer = event.dataTransfer;\n\t// Remove highlighting\n\tthis.resetState();\n\t// Import any files in the drop\n\tvar numFiles = 0;\n\tif(dataTransfer.files) {\n\t\tnumFiles = this.wiki.readFiles(dataTransfer.files,{\n\t\t\tcallback: readFileCallback,\n\t\t\tdeserializer: this.dropzoneDeserializer\n\t\t});\n\t}\n\t// Try to import the various data types we understand\n\tif(numFiles === 0) {\n\t\tvar fallbackTitle = self.wiki.generateNewTitle(\"Untitled\");\n\t\t//Use the deserializer specified if any\n\t\tif(this.dropzoneDeserializer) {\n\t\t\tfor(var t= 0; t<dataTransfer.items.length; t++) {\n\t\t\t\tvar item = dataTransfer.items[t];\n\t\t\t\tif(item.kind === \"string\") {\n\t\t\t\t\titem.getAsString(function(str){\n\t\t\t\t\t\tvar tiddlerFields = self.wiki.deserializeTiddlers(null,str,{title: fallbackTitle},{deserializer:self.dropzoneDeserializer});\n\t\t\t\t\t\tif(tiddlerFields && tiddlerFields.length) {\n\t\t\t\t\t\t\treadFileCallback(tiddlerFields);\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} else {\n\t\t\t$tw.utils.importDataTransfer(dataTransfer,fallbackTitle,readFileCallback);\n\t\t}\n\t}\n\t// Tell the browser that we handled the drop\n\tevent.preventDefault();\n\t// Stop the drop ripple up to any parent handlers\n\tevent.stopPropagation();\n};\n\nDropZoneWidget.prototype.handlePasteEvent = function(event) {\n\tvar self = this,\n\t\treadFileCallback = function(tiddlerFieldsArray) {\n\t\t\tself.readFileCallback(tiddlerFieldsArray);\n\t\t};\n\t// Let the browser handle it if we're in a textarea or input box\n\tif([\"TEXTAREA\",\"INPUT\"].indexOf(event.target.tagName) == -1 && !event.target.isContentEditable) {\n\t\tvar self = this,\n\t\t\titems = event.clipboardData.items;\n\t\t// Enumerate the clipboard items\n\t\tfor(var t = 0; t<items.length; t++) {\n\t\t\tvar item = items[t];\n\t\t\tif(item.kind === \"file\") {\n\t\t\t\t// Import any files\n\t\t\t\tthis.wiki.readFile(item.getAsFile(),{\n\t\t\t\t\tcallback: readFileCallback,\n\t\t\t\t\tdeserializer: this.dropzoneDeserializer\n\t\t\t\t});\n\t\t\t} else if(item.kind === \"string\") {\n\t\t\t\t// Create tiddlers from string items\n\t\t\t\tvar tiddlerFields,\n\t\t\t\t\ttype = item.type;\n\t\t\t\titem.getAsString(function(str) {\n\t\t\t\t\t// Use the deserializer specified if any\n\t\t\t\t\tif(self.dropzoneDeserializer) {\n\t\t\t\t\t\ttiddlerFields = self.wiki.deserializeTiddlers(null,str,{title: self.wiki.generateNewTitle(\"Untitled\")},{deserializer:self.dropzoneDeserializer});\n\t\t\t\t\t\tif(tiddlerFields && tiddlerFields.length) {\n\t\t\t\t\t\t\treadFileCallback(tiddlerFields);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttiddlerFields = {\n\t\t\t\t\t\t\ttitle: self.wiki.generateNewTitle(\"Untitled\"),\n\t\t\t\t\t\t\ttext: str,\n\t\t\t\t\t\t\ttype: type\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif($tw.log.IMPORT) {\n\t\t\t\t\t\t\tconsole.log(\"Importing string '\" + str + \"', type: '\" + type + \"'\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\treadFileCallback([tiddlerFields]);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t// Tell the browser that we've handled the paste\n\t\tevent.stopPropagation();\n\t\tevent.preventDefault();\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nDropZoneWidget.prototype.execute = function() {\n\tthis.dropzoneClass = this.getAttribute(\"class\");\n\tthis.dropzoneDeserializer = this.getAttribute(\"deserializer\");\n\tthis.dropzoneEnable = (this.getAttribute(\"enable\") || \"yes\") === \"yes\";\n\tthis.autoOpenOnImport = this.getAttribute(\"autoOpenOnImport\");\n\tthis.importTitle = this.getAttribute(\"importTitle\",IMPORT_TITLE);\n\tthis.actions = this.getAttribute(\"actions\");\n\tthis.contentTypesFilter = this.getAttribute(\"contentTypesFilter\");\n\tthis.filesOnly = this.getAttribute(\"filesOnly\",\"no\") === \"yes\";\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nDropZoneWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif($tw.utils.count(changedAttributes) > 0) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.dropzone = DropZoneWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit-binary.js": {
"title": "$:/core/modules/widgets/edit-binary.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/edit-binary.js\ntype: application/javascript\nmodule-type: widget\n\nEdit-binary widget; placeholder for editing binary tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar BINARY_WARNING_MESSAGE = \"$:/core/ui/BinaryWarning\";\nvar EXPORT_BUTTON_IMAGE = \"$:/core/images/export-button\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EditBinaryWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditBinaryWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditBinaryWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nEditBinaryWidget.prototype.execute = function() {\n\t// Get our parameters\n\tvar editTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tvar tiddler = this.wiki.getTiddler(editTitle);\n\tvar type = tiddler.fields.type;\n\tvar text = tiddler.fields.text;\n\t// Transclude the binary data tiddler warning message\n\tvar warn = {\n\t\ttype: \"element\",\n\t\ttag: \"p\",\n\t\tchildren: [{\n\t\t\ttype: \"transclude\",\n\t\t\tattributes: {\n\t\t\t\ttiddler: {type: \"string\", value: BINARY_WARNING_MESSAGE}\n\t\t\t}\n\t\t}]\n\t};\n\t// Create download link based on draft tiddler title\n\tvar link = {\n\t\ttype: \"element\",\n\t\ttag: \"a\",\n\t\tattributes: {\n\t\t\ttitle: {type: \"indirect\", textReference: \"!!draft.title\"},\n\t\t\tdownload: {type: \"indirect\", textReference: \"!!draft.title\"}\n\t\t},\n\t\tchildren: [{\n\t\ttype: \"transclude\",\n\t\t\tattributes: {\n\t\t\t\ttiddler: {type: \"string\", value: EXPORT_BUTTON_IMAGE}\n\t\t\t}\n\t\t}]\n\t};\n\t// Set the link href to internal data URI (no external)\n\tif(text) {\n\t\tlink.attributes.href = {\n\t\t\ttype: \"string\", \n\t\t\tvalue: \"data:\" + type + \";base64,\" + text\n\t\t};\n\t}\n\t// Combine warning message and download link in a div\n\tvar element = {\n\t\ttype: \"element\",\n\t\ttag: \"div\",\n\t\tattributes: {\n\t\t\tclass: {type: \"string\", value: \"tc-binary-warning\"}\n\t\t},\n\t\tchildren: [warn, link]\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets([element]);\n};\n\n/*\nRefresh by refreshing our child widget\n*/\nEditBinaryWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports[\"edit-binary\"] = EditBinaryWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit-bitmap.js": {
"title": "$:/core/modules/widgets/edit-bitmap.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/edit-bitmap.js\ntype: application/javascript\nmodule-type: widget\n\nEdit-bitmap widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Default image sizes\nvar DEFAULT_IMAGE_WIDTH = 600,\n\tDEFAULT_IMAGE_HEIGHT = 370,\n\tDEFAULT_IMAGE_TYPE = \"image/png\";\n\n// Configuration tiddlers\nvar LINE_WIDTH_TITLE = \"$:/config/BitmapEditor/LineWidth\",\n\tLINE_COLOUR_TITLE = \"$:/config/BitmapEditor/Colour\",\n\tLINE_OPACITY_TITLE = \"$:/config/BitmapEditor/Opacity\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EditBitmapWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditBitmapWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditBitmapWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Initialise the editor operations if they've not been done already\n\tif(!this.editorOperations) {\n\t\tEditBitmapWidget.prototype.editorOperations = {};\n\t\t$tw.modules.applyMethods(\"bitmapeditoroperation\",this.editorOperations);\n\t}\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Create the wrapper for the toolbar and render its content\n\tthis.toolbarNode = this.document.createElement(\"div\");\n\tthis.toolbarNode.className = \"tc-editor-toolbar\";\n\tparent.insertBefore(this.toolbarNode,nextSibling);\n\tthis.domNodes.push(this.toolbarNode);\n\t// Create the on-screen canvas\n\tthis.canvasDomNode = $tw.utils.domMaker(\"canvas\",{\n\t\tdocument: this.document,\n\t\t\"class\":\"tc-edit-bitmapeditor\",\n\t\teventListeners: [{\n\t\t\tname: \"touchstart\", handlerObject: this, handlerMethod: \"handleTouchStartEvent\"\n\t\t},{\n\t\t\tname: \"touchmove\", handlerObject: this, handlerMethod: \"handleTouchMoveEvent\"\n\t\t},{\n\t\t\tname: \"touchend\", handlerObject: this, handlerMethod: \"handleTouchEndEvent\"\n\t\t},{\n\t\t\tname: \"mousedown\", handlerObject: this, handlerMethod: \"handleMouseDownEvent\"\n\t\t},{\n\t\t\tname: \"mousemove\", handlerObject: this, handlerMethod: \"handleMouseMoveEvent\"\n\t\t},{\n\t\t\tname: \"mouseup\", handlerObject: this, handlerMethod: \"handleMouseUpEvent\"\n\t\t}]\n\t});\n\t// Set the width and height variables\n\tthis.setVariable(\"tv-bitmap-editor-width\",this.canvasDomNode.width + \"px\");\n\tthis.setVariable(\"tv-bitmap-editor-height\",this.canvasDomNode.height + \"px\");\n\t// Render toolbar child widgets\n\tthis.renderChildren(this.toolbarNode,null);\n\t// // Insert the elements into the DOM\n\tparent.insertBefore(this.canvasDomNode,nextSibling);\n\tthis.domNodes.push(this.canvasDomNode);\n\t// Load the image into the canvas\n\tif($tw.browser) {\n\t\tthis.loadCanvas();\n\t}\n\t// Add widget message listeners\n\tthis.addEventListeners([\n\t\t{type: \"tm-edit-bitmap-operation\", handler: \"handleEditBitmapOperationMessage\"}\n\t]);\n};\n\n/*\nHandle an edit bitmap operation message from the toolbar\n*/\nEditBitmapWidget.prototype.handleEditBitmapOperationMessage = function(event) {\n\t// Invoke the handler\n\tvar handler = this.editorOperations[event.param];\n\tif(handler) {\n\t\thandler.call(this,event);\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nEditBitmapWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.editTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nJust refresh the toolbar\n*/\nEditBitmapWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nSet the bitmap size variables and refresh the toolbar\n*/\nEditBitmapWidget.prototype.refreshToolbar = function() {\n\t// Set the width and height variables\n\tthis.setVariable(\"tv-bitmap-editor-width\",this.canvasDomNode.width + \"px\");\n\tthis.setVariable(\"tv-bitmap-editor-height\",this.canvasDomNode.height + \"px\");\n\t// Refresh each of our child widgets\n\t$tw.utils.each(this.children,function(childWidget) {\n\t\tchildWidget.refreshSelf();\n\t});\n};\n\nEditBitmapWidget.prototype.loadCanvas = function() {\n\tvar tiddler = this.wiki.getTiddler(this.editTitle),\n\t\tcurrImage = new Image();\n\t// Set up event handlers for loading the image\n\tvar self = this;\n\tcurrImage.onload = function() {\n\t\t// Copy the image to the on-screen canvas\n\t\tself.initCanvas(self.canvasDomNode,currImage.width,currImage.height,currImage);\n\t\t// And also copy the current bitmap to the off-screen canvas\n\t\tself.currCanvas = self.document.createElement(\"canvas\");\n\t\tself.initCanvas(self.currCanvas,currImage.width,currImage.height,currImage);\n\t\t// Set the width and height input boxes\n\t\tself.refreshToolbar();\n\t};\n\tcurrImage.onerror = function() {\n\t\t// Set the on-screen canvas size and clear it\n\t\tself.initCanvas(self.canvasDomNode,DEFAULT_IMAGE_WIDTH,DEFAULT_IMAGE_HEIGHT);\n\t\t// Set the off-screen canvas size and clear it\n\t\tself.currCanvas = self.document.createElement(\"canvas\");\n\t\tself.initCanvas(self.currCanvas,DEFAULT_IMAGE_WIDTH,DEFAULT_IMAGE_HEIGHT);\n\t\t// Set the width and height input boxes\n\t\tself.refreshToolbar();\n\t};\n\t// Get the current bitmap into an image object\n\tif(tiddler && tiddler.fields.type && tiddler.fields.text) {\n\t\tcurrImage.src = \"data:\" + tiddler.fields.type + \";base64,\" + tiddler.fields.text;\n\t} else {\n\t\tcurrImage.width = DEFAULT_IMAGE_WIDTH;\n\t\tcurrImage.height = DEFAULT_IMAGE_HEIGHT;\n\t\tcurrImage.onerror();\n\t}\n};\n\nEditBitmapWidget.prototype.initCanvas = function(canvas,width,height,image) {\n\tcanvas.width = width;\n\tcanvas.height = height;\n\tvar ctx = canvas.getContext(\"2d\");\n\tif(image) {\n\t\tctx.drawImage(image,0,0);\n\t} else {\n\t\tctx.fillStyle = \"#fff\";\n\t\tctx.fillRect(0,0,canvas.width,canvas.height);\n\t}\n};\n\n/*\n** Change the size of the canvas, preserving the current image\n*/\nEditBitmapWidget.prototype.changeCanvasSize = function(newWidth,newHeight) {\n\t// Create and size a new canvas\n\tvar newCanvas = this.document.createElement(\"canvas\");\n\tthis.initCanvas(newCanvas,newWidth,newHeight);\n\t// Copy the old image\n\tvar ctx = newCanvas.getContext(\"2d\");\n\tctx.drawImage(this.currCanvas,0,0);\n\t// Set the new canvas as the current one\n\tthis.currCanvas = newCanvas;\n\t// Set the size of the onscreen canvas\n\tthis.canvasDomNode.width = newWidth;\n\tthis.canvasDomNode.height = newHeight;\n\t// Paint the onscreen canvas with the offscreen canvas\n\tctx = this.canvasDomNode.getContext(\"2d\");\n\tctx.drawImage(this.currCanvas,0,0);\n};\n\n/*\n** Rotate the canvas left by 90 degrees\n*/\nEditBitmapWidget.prototype.rotateCanvasLeft = function() {\n\t// Get the current size of the image\n\tvar origWidth = this.currCanvas.width,\n\t\torigHeight = this.currCanvas.height;\n\t// Create and size a new canvas\n\tvar newCanvas = this.document.createElement(\"canvas\"),\n\t\tnewWidth = origHeight,\n\t\tnewHeight = origWidth;\n\tthis.initCanvas(newCanvas,newWidth,newHeight);\n\t// Copy the old image\n\tvar ctx = newCanvas.getContext(\"2d\");\n\tctx.save();\n\tctx.translate(newWidth / 2,newHeight / 2);\n\tctx.rotate(-Math.PI / 2);\n\tctx.drawImage(this.currCanvas,-origWidth / 2,-origHeight / 2);\n\tctx.restore();\n\t// Set the new canvas as the current one\n\tthis.currCanvas = newCanvas;\n\t// Set the size of the onscreen canvas\n\tthis.canvasDomNode.width = newWidth;\n\tthis.canvasDomNode.height = newHeight;\n\t// Paint the onscreen canvas with the offscreen canvas\n\tctx = this.canvasDomNode.getContext(\"2d\");\n\tctx.drawImage(this.currCanvas,0,0);\n};\n\nEditBitmapWidget.prototype.handleTouchStartEvent = function(event) {\n\tthis.brushDown = true;\n\tthis.strokeStart(event.touches[0].clientX,event.touches[0].clientY);\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nEditBitmapWidget.prototype.handleTouchMoveEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.strokeMove(event.touches[0].clientX,event.touches[0].clientY);\n\t}\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nEditBitmapWidget.prototype.handleTouchEndEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.brushDown = false;\n\t\tthis.strokeEnd();\n\t}\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nEditBitmapWidget.prototype.handleMouseDownEvent = function(event) {\n\tthis.strokeStart(event.clientX,event.clientY);\n\tthis.brushDown = true;\n\tevent.preventDefault();\n\tevent.stopPropagation();\n\treturn false;\n};\n\nEditBitmapWidget.prototype.handleMouseMoveEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.strokeMove(event.clientX,event.clientY);\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\treturn false;\n\t}\n\treturn true;\n};\n\nEditBitmapWidget.prototype.handleMouseUpEvent = function(event) {\n\tif(this.brushDown) {\n\t\tthis.brushDown = false;\n\t\tthis.strokeEnd();\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\treturn false;\n\t}\n\treturn true;\n};\n\nEditBitmapWidget.prototype.adjustCoordinates = function(x,y) {\n\tvar canvasRect = this.canvasDomNode.getBoundingClientRect(),\n\t\tscale = this.canvasDomNode.width/canvasRect.width;\n\treturn {x: (x - canvasRect.left) * scale, y: (y - canvasRect.top) * scale};\n};\n\nEditBitmapWidget.prototype.strokeStart = function(x,y) {\n\t// Start off a new stroke\n\tthis.stroke = [this.adjustCoordinates(x,y)];\n};\n\nEditBitmapWidget.prototype.strokeMove = function(x,y) {\n\tvar ctx = this.canvasDomNode.getContext(\"2d\"),\n\t\tt;\n\t// Add the new position to the end of the stroke\n\tthis.stroke.push(this.adjustCoordinates(x,y));\n\t// Redraw the previous image\n\tctx.drawImage(this.currCanvas,0,0);\n\t// Render the stroke\n\tctx.globalAlpha = parseFloat(this.wiki.getTiddlerText(LINE_OPACITY_TITLE,\"1.0\"));\n\tctx.strokeStyle = this.wiki.getTiddlerText(LINE_COLOUR_TITLE,\"#ff0\");\n\tctx.lineWidth = parseFloat(this.wiki.getTiddlerText(LINE_WIDTH_TITLE,\"3\"));\n\tctx.lineCap = \"round\";\n\tctx.lineJoin = \"round\";\n\tctx.beginPath();\n\tctx.moveTo(this.stroke[0].x,this.stroke[0].y);\n\tfor(t=1; t<this.stroke.length-1; t++) {\n\t\tvar s1 = this.stroke[t],\n\t\t\ts2 = this.stroke[t-1],\n\t\t\ttx = (s1.x + s2.x)/2,\n\t\t\tty = (s1.y + s2.y)/2;\n\t\tctx.quadraticCurveTo(s2.x,s2.y,tx,ty);\n\t}\n\tctx.stroke();\n};\n\nEditBitmapWidget.prototype.strokeEnd = function() {\n\t// Copy the bitmap to the off-screen canvas\n\tvar ctx = this.currCanvas.getContext(\"2d\");\n\tctx.drawImage(this.canvasDomNode,0,0);\n\t// Save the image into the tiddler\n\tthis.saveChanges();\n};\n\nEditBitmapWidget.prototype.saveChanges = function() {\n\tvar tiddler = this.wiki.getTiddler(this.editTitle) || new $tw.Tiddler({title: this.editTitle,type: DEFAULT_IMAGE_TYPE});\n\t// data URIs look like \"data:<type>;base64,<text>\"\n\tvar dataURL = this.canvasDomNode.toDataURL(tiddler.fields.type),\n\t\tposColon = dataURL.indexOf(\":\"),\n\t\tposSemiColon = dataURL.indexOf(\";\"),\n\t\tposComma = dataURL.indexOf(\",\"),\n\t\ttype = dataURL.substring(posColon+1,posSemiColon),\n\t\ttext = dataURL.substring(posComma+1);\n\tvar update = {type: type, text: text};\n\tthis.wiki.addTiddler(new $tw.Tiddler(this.wiki.getModificationFields(),tiddler,update,this.wiki.getCreationFields()));\n};\n\nexports[\"edit-bitmap\"] = EditBitmapWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit-shortcut.js": {
"title": "$:/core/modules/widgets/edit-shortcut.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/edit-shortcut.js\ntype: application/javascript\nmodule-type: widget\n\nWidget to display an editable keyboard shortcut\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EditShortcutWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditShortcutWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditShortcutWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.inputNode = this.document.createElement(\"input\");\n\t// Assign classes\n\tif(this.shortcutClass) {\n\t\tthis.inputNode.className = this.shortcutClass;\n\t}\n\t// Assign other attributes\n\tif(this.shortcutStyle) {\n\t\tthis.inputNode.setAttribute(\"style\",this.shortcutStyle);\n\t}\n\tif(this.shortcutTooltip) {\n\t\tthis.inputNode.setAttribute(\"title\",this.shortcutTooltip);\n\t}\n\tif(this.shortcutPlaceholder) {\n\t\tthis.inputNode.setAttribute(\"placeholder\",this.shortcutPlaceholder);\n\t}\n\tif(this.shortcutAriaLabel) {\n\t\tthis.inputNode.setAttribute(\"aria-label\",this.shortcutAriaLabel);\n\t}\n\t// Assign the current shortcut\n\tthis.updateInputNode();\n\t// Add event handlers\n\t$tw.utils.addEventListeners(this.inputNode,[\n\t\t{name: \"keydown\", handlerObject: this, handlerMethod: \"handleKeydownEvent\"}\n\t]);\n\t// Link into the DOM\n\tparent.insertBefore(this.inputNode,nextSibling);\n\tthis.domNodes.push(this.inputNode);\n\t// Focus the input Node if focus === \"yes\" or focus === \"true\"\n\tif(this.shortcutFocus === \"yes\" || this.shortcutFocus === \"true\") {\n\t\tthis.focus();\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nEditShortcutWidget.prototype.execute = function() {\n\tthis.shortcutTiddler = this.getAttribute(\"tiddler\");\n\tthis.shortcutField = this.getAttribute(\"field\");\n\tthis.shortcutIndex = this.getAttribute(\"index\");\n\tthis.shortcutPlaceholder = this.getAttribute(\"placeholder\");\n\tthis.shortcutDefault = this.getAttribute(\"default\",\"\");\n\tthis.shortcutClass = this.getAttribute(\"class\");\n\tthis.shortcutStyle = this.getAttribute(\"style\");\n\tthis.shortcutTooltip = this.getAttribute(\"tooltip\");\n\tthis.shortcutAriaLabel = this.getAttribute(\"aria-label\");\n\tthis.shortcutFocus = this.getAttribute(\"focus\");\n};\n\n/*\nUpdate the value of the input node\n*/\nEditShortcutWidget.prototype.updateInputNode = function() {\n\tif(this.shortcutField) {\n\t\tvar tiddler = this.wiki.getTiddler(this.shortcutTiddler);\n\t\tif(tiddler && $tw.utils.hop(tiddler.fields,this.shortcutField)) {\n\t\t\tthis.inputNode.value = tiddler.getFieldString(this.shortcutField);\n\t\t} else {\n\t\t\tthis.inputNode.value = this.shortcutDefault;\n\t\t}\n\t} else if(this.shortcutIndex) {\n\t\tthis.inputNode.value = this.wiki.extractTiddlerDataItem(this.shortcutTiddler,this.shortcutIndex,this.shortcutDefault);\n\t} else {\n\t\tthis.inputNode.value = this.wiki.getTiddlerText(this.shortcutTiddler,this.shortcutDefault);\n\t}\n};\n\n/*\nHandle a dom \"keydown\" event\n*/\nEditShortcutWidget.prototype.handleKeydownEvent = function(event) {\n\t// Ignore shift, ctrl, meta, alt\n\tif(event.keyCode && $tw.keyboardManager.getModifierKeys().indexOf(event.keyCode) === -1) {\n\t\t// Get the shortcut text representation\n\t\tvar value = $tw.keyboardManager.getPrintableShortcuts([{\n\t\t\tctrlKey: event.ctrlKey,\n\t\t\tshiftKey: event.shiftKey,\n\t\t\taltKey: event.altKey,\n\t\t\tmetaKey: event.metaKey,\n\t\t\tkeyCode: event.keyCode\n\t\t}]);\n\t\tif(value.length > 0) {\n\t\t\tthis.wiki.setText(this.shortcutTiddler,this.shortcutField,this.shortcutIndex,value[0]);\n\t\t}\n\t\t// Ignore the keydown if it was already handled\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\n/*\nfocus the input node\n*/\nEditShortcutWidget.prototype.focus = function() {\n\tif(this.inputNode.focus && this.inputNode.select) {\n\t\tthis.inputNode.focus();\n\t\tthis.inputNode.select();\n\t}\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget needed re-rendering\n*/\nEditShortcutWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.placeholder || changedAttributes[\"default\"] || changedAttributes[\"class\"] || changedAttributes.style || changedAttributes.tooltip || changedAttributes[\"aria-label\"] || changedAttributes.focus) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else if(changedTiddlers[this.shortcutTiddler]) {\n\t\tthis.updateInputNode();\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\nexports[\"edit-shortcut\"] = EditShortcutWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit-text.js": {
"title": "$:/core/modules/widgets/edit-text.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/edit-text.js\ntype: application/javascript\nmodule-type: widget\n\nEdit-text widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar editTextWidgetFactory = require(\"$:/core/modules/editor/factory.js\").editTextWidgetFactory,\n\tFramedEngine = require(\"$:/core/modules/editor/engines/framed.js\").FramedEngine,\n\tSimpleEngine = require(\"$:/core/modules/editor/engines/simple.js\").SimpleEngine;\n\nexports[\"edit-text\"] = editTextWidgetFactory(FramedEngine,SimpleEngine);\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/edit.js": {
"title": "$:/core/modules/widgets/edit.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/edit.js\ntype: application/javascript\nmodule-type: widget\n\nEdit widget is a meta-widget chooses the appropriate actual editting widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EditWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEditWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEditWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n// Mappings from content type to editor type are stored in tiddlers with this prefix\nvar EDITOR_MAPPING_PREFIX = \"$:/config/EditorTypeMappings/\";\n\n/*\nCompute the internal state of the widget\n*/\nEditWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.editTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.editField = this.getAttribute(\"field\",\"text\");\n\tthis.editIndex = this.getAttribute(\"index\");\n\tthis.editClass = this.getAttribute(\"class\");\n\tthis.editPlaceholder = this.getAttribute(\"placeholder\");\n\tthis.editTabIndex = this.getAttribute(\"tabindex\");\n\tthis.editFocus = this.getAttribute(\"focus\",\"\");\n\tthis.editCancelPopups = this.getAttribute(\"cancelPopups\",\"\");\n\tthis.editInputActions = this.getAttribute(\"inputActions\");\n\tthis.editRefreshTitle = this.getAttribute(\"refreshTitle\");\n\tthis.editAutoComplete = this.getAttribute(\"autocomplete\");\n\t// Choose the appropriate edit widget\n\tthis.editorType = this.getEditorType();\n\t// Make the child widgets\n\tthis.makeChildWidgets([{\n\t\ttype: \"edit-\" + this.editorType,\n\t\tattributes: this.parseTreeNode.attributes,\n\t\tchildren: this.parseTreeNode.children\n\t}]);\n};\n\nEditWidget.prototype.getEditorType = function() {\n\t// Get the content type of the thing we're editing\n\tvar type;\n\tif(this.editField === \"text\") {\n\t\tvar tiddler = this.wiki.getTiddler(this.editTitle);\n\t\tif(tiddler) {\n\t\t\ttype = tiddler.fields.type;\n\t\t}\n\t}\n\ttype = type || \"text/vnd.tiddlywiki\";\n\tvar editorType = this.wiki.getTiddlerText(EDITOR_MAPPING_PREFIX + type);\n\tif(!editorType) {\n\t\tvar typeInfo = $tw.config.contentTypeInfo[type];\n\t\tif(typeInfo && typeInfo.encoding === \"base64\") {\n\t\t\teditorType = \"binary\";\n\t\t} else {\n\t\t\teditorType = \"text\";\n\t\t}\n\t}\n\treturn editorType;\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEditWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\t// Refresh if an attribute has changed, or the type associated with the target tiddler has changed\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.edit = EditWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/element.js": {
"title": "$:/core/modules/widgets/element.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/element.js\ntype: application/javascript\nmodule-type: widget\n\nElement widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ElementWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nElementWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nElementWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\t// Neuter blacklisted elements\n\tthis.tag = this.parseTreeNode.tag;\n\tif($tw.config.htmlUnsafeElements.indexOf(this.tag) !== -1) {\n\t\tthis.tag = \"safe-\" + this.tag;\n\t}\n\t// Adjust headings by the current base level\n\tvar headingLevel = [\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"].indexOf(this.tag);\n\tif(headingLevel !== -1) {\n\t\tvar baseLevel = parseInt(this.getVariable(\"tv-adjust-heading-level\",\"0\"),10) || 0;\n\t\theadingLevel = Math.min(Math.max(headingLevel + 1 + baseLevel,1),6);\n\t\tthis.tag = \"h\" + headingLevel;\n\t}\n\t// Select the namespace for the tag\n\tvar tagNamespaces = {\n\t\t\tsvg: \"http://www.w3.org/2000/svg\",\n\t\t\tmath: \"http://www.w3.org/1998/Math/MathML\",\n\t\t\tbody: \"http://www.w3.org/1999/xhtml\"\n\t\t};\n\tthis.namespace = tagNamespaces[this.tag];\n\tif(this.namespace) {\n\t\tthis.setVariable(\"namespace\",this.namespace);\n\t} else {\n\t\tthis.namespace = this.getVariable(\"namespace\",{defaultValue: \"http://www.w3.org/1999/xhtml\"});\n\t}\n\t// Invoke the th-rendering-element hook\n\tvar parseTreeNodes = $tw.hooks.invokeHook(\"th-rendering-element\",null,this);\n\tthis.isReplaced = !!parseTreeNodes;\n\tif(parseTreeNodes) {\n\t\t// Use the parse tree nodes provided by the hook\n\t\tthis.makeChildWidgets(parseTreeNodes);\n\t\tthis.renderChildren(this.parentDomNode,null);\n\t\treturn;\n\t}\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n\t// Create the DOM node and render children\n\tvar domNode = this.document.createElementNS(this.namespace,this.tag);\n\tthis.assignAttributes(domNode,{excludeEventAttributes: true});\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nElementWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes(),\n\t\thasChangedAttributes = $tw.utils.count(changedAttributes) > 0;\n\tif(hasChangedAttributes) {\n\t\tif(!this.isReplaced) {\n\t\t\t// Update our attributes\n\t\t\tthis.assignAttributes(this.domNodes[0],{excludeEventAttributes: true});\n\t\t} else {\n\t\t\t// If we were replaced then completely refresh ourselves\n\t\t\treturn this.refreshSelf();\n\t\t}\n\t}\n\treturn this.refreshChildren(changedTiddlers) || hasChangedAttributes;\n};\n\nexports.element = ElementWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/encrypt.js": {
"title": "$:/core/modules/widgets/encrypt.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/encrypt.js\ntype: application/javascript\nmodule-type: widget\n\nEncrypt widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EncryptWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEncryptWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEncryptWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar textNode = this.document.createTextNode(this.encryptedText);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nEncryptWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.filter = this.getAttribute(\"filter\",\"[!is[system]]\");\n\t// Encrypt the filtered tiddlers\n\tvar tiddlers = this.wiki.filterTiddlers(this.filter),\n\t\tjson = {},\n\t\tself = this;\n\t$tw.utils.each(tiddlers,function(title) {\n\t\tvar tiddler = self.wiki.getTiddler(title),\n\t\t\tjsonTiddler = {};\n\t\tfor(var f in tiddler.fields) {\n\t\t\tjsonTiddler[f] = tiddler.getFieldString(f);\n\t\t}\n\t\tjson[title] = jsonTiddler;\n\t});\n\tthis.encryptedText = $tw.utils.htmlEncode($tw.crypto.encrypt(JSON.stringify(json)));\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEncryptWidget.prototype.refresh = function(changedTiddlers) {\n\t// We don't need to worry about refreshing because the encrypt widget isn't for interactive use\n\treturn false;\n};\n\nexports.encrypt = EncryptWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/entity.js": {
"title": "$:/core/modules/widgets/entity.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/entity.js\ntype: application/javascript\nmodule-type: widget\n\nHTML entity widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EntityWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEntityWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEntityWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar entityString = this.getAttribute(\"entity\",this.parseTreeNode.entity || \"\"),\n\t\ttextNode = this.document.createTextNode($tw.utils.entityDecode(entityString));\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nEntityWidget.prototype.execute = function() {\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEntityWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.entity) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\nexports.entity = EntityWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/eventcatcher.js": {
"title": "$:/core/modules/widgets/eventcatcher.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/eventcatcher.js\ntype: application/javascript\nmodule-type: widget\n\nEvent handler widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar EventWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nEventWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nEventWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\tvar tag = this.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tif(this.elementTag && $tw.config.htmlUnsafeElements.indexOf(this.elementTag) === -1) {\n\t\ttag = this.elementTag;\n\t}\n\tvar domNode = this.document.createElement(tag);\n\tthis.domNode = domNode;\n\t// Assign classes\n\tthis.assignDomNodeClasses();\n\t// Add our event handler\n\t$tw.utils.each(this.types,function(type) {\n\t\tdomNode.addEventListener(type,function(event) {\n\t\t\tvar selector = self.getAttribute(\"selector\"),\n\t\t\t\tactions = self.getAttribute(\"actions-\"+type),\n\t\t\t\tstopPropagation = self.getAttribute(\"stopPropagation\",\"onaction\"),\n\t\t\t\tselectedNode = event.target,\n\t\t\t\tselectedNodeRect,\n\t\t\t\tcatcherNodeRect,\n\t\t\t\tvariables = {};\n\t\t\t// Firefox can fire dragover and dragenter events on text nodes instead of their parents\n\t\t\tif(selectedNode.nodeType === 3) {\n\t\t\t\tselectedNode = selectedNode.parentNode;\n\t\t\t}\n\t\t\tif(selector) {\n\t\t\t\t// Search ancestors for a node that matches the selector\n\t\t\t\twhile(!$tw.utils.domMatchesSelector(selectedNode,selector) && selectedNode !== domNode) {\n\t\t\t\t\tselectedNode = selectedNode.parentNode;\n\t\t\t\t}\n\t\t\t\t// If we found one, copy the attributes as variables, otherwise exit\n\t\t\t\tif($tw.utils.domMatchesSelector(selectedNode,selector)) {\n\t\t\t\t\t// Only set up variables if we have actions to invoke\n\t\t\t\t\tif(actions) {\n\t\t\t\t\t\t$tw.utils.each(selectedNode.attributes,function(attribute) {\n\t\t\t\t\t\t\tvariables[\"dom-\" + attribute.name] = attribute.value.toString();\n\t\t\t\t\t\t});\n\t\t\t\t\t\t//Add a variable with a popup coordinate string for the selected node\n\t\t\t\t\t\tvariables[\"tv-popup-coords\"] = \"(\" + selectedNode.offsetLeft + \",\" + selectedNode.offsetTop +\",\" + selectedNode.offsetWidth + \",\" + selectedNode.offsetHeight + \")\";\n\n\t\t\t\t\t\t//Add variables for offset of selected node\n\t\t\t\t\t\tvariables[\"tv-selectednode-posx\"] = selectedNode.offsetLeft.toString();\n\t\t\t\t\t\tvariables[\"tv-selectednode-posy\"] = selectedNode.offsetTop.toString();\n\t\t\t\t\t\tvariables[\"tv-selectednode-width\"] = selectedNode.offsetWidth.toString();\n\t\t\t\t\t\tvariables[\"tv-selectednode-height\"] = selectedNode.offsetHeight.toString();\n\n\t\t\t\t\t\t//Add variables for event X and Y position relative to selected node\n\t\t\t\t\t\tselectedNodeRect = selectedNode.getBoundingClientRect();\n\t\t\t\t\t\tvariables[\"event-fromselected-posx\"] = (event.clientX - selectedNodeRect.left).toString();\n\t\t\t\t\t\tvariables[\"event-fromselected-posy\"] = (event.clientY - selectedNodeRect.top).toString();\n\n\t\t\t\t\t\t//Add variables for event X and Y position relative to event catcher node\n\t\t\t\t\t\tcatcherNodeRect = self.domNode.getBoundingClientRect();\n\t\t\t\t\t\tvariables[\"event-fromcatcher-posx\"] = (event.clientX - catcherNodeRect.left).toString();\n\t\t\t\t\t\tvariables[\"event-fromcatcher-posy\"] = (event.clientY - catcherNodeRect.top).toString();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Execute our actions with the variables\n\t\t\tif(actions) {\n\t\t\t\t// Add a variable for the modifier key\n\t\t\t\tvariables.modifier = $tw.keyboardManager.getEventModifierKeyDescriptor(event);\n\t\t\t\t// Add a variable for the mouse button\n\t\t\t\tif(\"button\" in event) {\n\t\t\t\t\tif(event.button === 0) {\n\t\t\t\t\t\tvariables[\"event-mousebutton\"] = \"left\";\n\t\t\t\t\t} else if(event.button === 1) {\n\t\t\t\t\t\tvariables[\"event-mousebutton\"] = \"middle\";\n\t\t\t\t\t} else if(event.button === 2) {\n\t\t\t\t\t\tvariables[\"event-mousebutton\"] = \"right\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvariables[\"event-type\"] = event.type.toString();\n\t\t\t\tif(typeof event.detail === \"object\" && !!event.detail) {\n\t\t\t\t\t$tw.utils.each(event.detail,function(detailValue,detail) {\n\t\t\t\t\t\tvariables[\"event-detail-\" + detail] = detailValue.toString();\n\t\t\t\t\t});\n\t\t\t\t} else if(!!event.detail) {\n\t\t\t\t\tvariables[\"event-detail\"] = event.detail.toString();\n\t\t\t\t}\n\t\t\t\tself.invokeActionString(actions,self,event,variables);\n\t\t\t}\n\t\t\tif((actions && stopPropagation === \"onaction\") || stopPropagation === \"always\") {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t},false);\n\t});\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nEventWidget.prototype.execute = function() {\n\tvar self = this;\n\t// Get attributes that require a refresh on change\n\tthis.types = this.getAttribute(\"events\",\"\").split(\" \");\n\tthis.elementTag = this.getAttribute(\"tag\");\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\nEventWidget.prototype.assignDomNodeClasses = function() {\n\tvar classes = this.getAttribute(\"class\",\"\").split(\" \");\n\tclasses.push(\"tc-eventcatcher\");\n\tthis.domNode.className = classes.join(\" \");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nEventWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"events\"] || changedAttributes[\"tag\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else if(changedAttributes[\"class\"]) {\n\t\tthis.assignDomNodeClasses();\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.eventcatcher = EventWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/fieldmangler.js": {
"title": "$:/core/modules/widgets/fieldmangler.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/fieldmangler.js\ntype: application/javascript\nmodule-type: widget\n\nField mangler widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar FieldManglerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nFieldManglerWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nFieldManglerWidget.prototype.render = function(parent,nextSibling) {\n\tthis.addEventListeners([\n\t\t{type: \"tm-remove-field\", handler: \"handleRemoveFieldEvent\"},\n\t\t{type: \"tm-add-field\", handler: \"handleAddFieldEvent\"},\n\t\t{type: \"tm-remove-tag\", handler: \"handleRemoveTagEvent\"},\n\t\t{type: \"tm-add-tag\", handler: \"handleAddTagEvent\"}\n\t]);\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nFieldManglerWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.mangleTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nFieldManglerWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nFieldManglerWidget.prototype.handleRemoveFieldEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle),\n\t\tdeletion = {};\n\tdeletion[event.param] = undefined;\n\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,deletion));\n\treturn false;\n};\n\nFieldManglerWidget.prototype.handleAddFieldEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle),\n\t\taddition = this.wiki.getModificationFields(),\n\t\thadInvalidFieldName = false,\n\t\taddField = function(name,value) {\n\t\t\tvar trimmedName = name.toLowerCase().trim();\n\t\t\tif(!$tw.utils.isValidFieldName(trimmedName)) {\n\t\t\t\tif(!hadInvalidFieldName) {\n\t\t\t\t\talert($tw.language.getString(\n\t\t\t\t\t\t\"InvalidFieldName\",\n\t\t\t\t\t\t{variables:\n\t\t\t\t\t\t\t{fieldName: trimmedName}\n\t\t\t\t\t\t}\n\t\t\t\t\t));\n\t\t\t\t\thadInvalidFieldName = true;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif(!value && tiddler) {\n\t\t\t\t\tvalue = tiddler.fields[trimmedName];\n\t\t\t\t}\n\t\t\t\taddition[trimmedName] = value || \"\";\n\t\t\t}\n\t\t\treturn;\n\t\t};\n\taddition.title = this.mangleTitle;\n\tif(typeof event.param === \"string\") {\n\t\taddField(event.param,\"\");\n\t}\n\tif(typeof event.paramObject === \"object\") {\n\t\tfor(var name in event.paramObject) {\n\t\t\taddField(name,event.paramObject[name]);\n\t\t}\n\t}\n\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,addition));\n\treturn false;\n};\n\nFieldManglerWidget.prototype.handleRemoveTagEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle),\n\t\tmodification = this.wiki.getModificationFields();\n\tif(tiddler && tiddler.fields.tags) {\n\t\tvar p = tiddler.fields.tags.indexOf(event.param);\n\t\tif(p !== -1) {\n\t\t\tmodification.tags = (tiddler.fields.tags || []).slice(0);\n\t\t\tmodification.tags.splice(p,1);\n\t\t\tif(modification.tags.length === 0) {\n\t\t\t\tmodification.tags = undefined;\n\t\t\t}\n\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));\n\t\t}\n\t}\n\treturn false;\n};\n\nFieldManglerWidget.prototype.handleAddTagEvent = function(event) {\n\tvar tiddler = this.wiki.getTiddler(this.mangleTitle),\n\t\tmodification = this.wiki.getModificationFields();\n\tif(tiddler && typeof event.param === \"string\") {\n\t\tvar tag = event.param.trim();\n\t\tif(tag !== \"\") {\n\t\t\tmodification.tags = (tiddler.fields.tags || []).slice(0);\n\t\t\t$tw.utils.pushTop(modification.tags,tag);\n\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));\n\t\t}\n\t} else if(typeof event.param === \"string\" && event.param.trim() !== \"\" && this.mangleTitle.trim() !== \"\") {\n\t\tvar tag = [];\n\t\ttag.push(event.param.trim());\n\t\tthis.wiki.addTiddler(new $tw.Tiddler({title: this.mangleTitle, tags: tag},modification));\n\t}\n\treturn false;\n};\n\nexports.fieldmangler = FieldManglerWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/fields.js": {
"title": "$:/core/modules/widgets/fields.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/fields.js\ntype: application/javascript\nmodule-type: widget\n\nFields widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar FieldsWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nFieldsWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nFieldsWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar textNode = this.document.createTextNode(this.text);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nFieldsWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.tiddlerTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.template = this.getAttribute(\"template\");\n\tthis.sort = this.getAttribute(\"sort\",\"yes\") === \"yes\";\n\tthis.sortReverse = this.getAttribute(\"sortReverse\",\"no\") === \"yes\";\n\tthis.exclude = this.getAttribute(\"exclude\");\n\tthis.include = this.getAttribute(\"include\",null);\n\tthis.stripTitlePrefix = this.getAttribute(\"stripTitlePrefix\",\"no\") === \"yes\";\n\t// Get the value to display\n\tvar tiddler = this.wiki.getTiddler(this.tiddlerTitle);\n\n\t// Get the inclusion and exclusion list\n\tvar excludeArr = (this.exclude) ? this.exclude.split(\" \") : [\"text\"];\n\t// Include takes precedence\n\tvar includeArr = (this.include) ? this.include.split(\" \") : null;\n\n\t// Compose the template\n\tvar text = [];\n\tif(this.template && tiddler) {\n\t\tvar fields = [];\n\t\tif (includeArr) { // Include takes precedence\n\t\t\tfor(var i=0; i<includeArr.length; i++) {\n\t\t\t\tif(tiddler.fields[includeArr[i]]) {\n\t\t\t\t\tfields.push(includeArr[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor(var fieldName in tiddler.fields) {\n\t\t\t\tif(excludeArr.indexOf(fieldName) === -1) {\n\t\t\t\t\tfields.push(fieldName);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (this.sort) fields.sort();\n\t\tif (this.sortReverse) fields.reverse();\n\t\tfor(var f=0, fmax=fields.length; f<fmax; f++) {\n\t\t\tfieldName = fields[f];\n\t\t\tvar row = this.template,\n\t\t\t\tvalue = tiddler.getFieldString(fieldName);\n\t\t\tif(this.stripTitlePrefix && fieldName === \"title\") {\n\t\t\t\tvar reStrip = /^\\{[^\\}]+\\}(.+)/mg,\n\t\t\t\t\treMatch = reStrip.exec(value);\n\t\t\t\tif(reMatch) {\n\t\t\t\t\tvalue = reMatch[1];\n\t\t\t\t}\n\t\t\t}\n\t\t\trow = $tw.utils.replaceString(row,\"$name$\",fieldName);\n\t\t\trow = $tw.utils.replaceString(row,\"$value$\",value);\n\t\t\trow = $tw.utils.replaceString(row,\"$encoded_value$\",$tw.utils.htmlEncode(value));\n\t\t\ttext.push(row);\n\t\t}\n\t}\n\tthis.text = text.join(\"\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nFieldsWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif( changedAttributes.tiddler || changedAttributes.template || changedAttributes.exclude ||\n\t\tchangedAttributes.include || changedAttributes.sort || changedAttributes.sortReverse ||\n\t\tchangedTiddlers[this.tiddlerTitle] || changedAttributes.stripTitlePrefix) {\n\t\t\tthis.refreshSelf();\n\t\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\nexports.fields = FieldsWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/image.js": {
"title": "$:/core/modules/widgets/image.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/image.js\ntype: application/javascript\nmodule-type: widget\n\nThe image widget displays an image referenced with an external URI or with a local tiddler title.\n\n```\n<$image src=\"TiddlerTitle\" width=\"320\" height=\"400\" class=\"classnames\">\n```\n\nThe image source can be the title of an existing tiddler or the URL of an external image.\n\nExternal images always generate an HTML `<img>` tag.\n\nTiddlers that have a _canonical_uri field generate an HTML `<img>` tag with the src attribute containing the URI.\n\nTiddlers that contain image data generate an HTML `<img>` tag with the src attribute containing a base64 representation of the image.\n\nTiddlers that contain wikitext could be rendered to a DIV of the usual size of a tiddler, and then transformed to the size requested.\n\nThe width and height attributes are interpreted as a number of pixels, and do not need to include the \"px\" suffix.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ImageWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nImageWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nImageWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create element\n\t// Determine what type of image it is\n\tvar tag = \"img\", src = \"\",\n\t\ttiddler = this.wiki.getTiddler(this.imageSource);\n\tif(!tiddler) {\n\t\t// The source isn't the title of a tiddler, so we'll assume it's a URL\n\t\tsrc = this.getVariable(\"tv-get-export-image-link\",{params: [{name: \"src\",value: this.imageSource}],defaultValue: this.imageSource});\n\t} else {\n\t\t// Check if it is an image tiddler\n\t\tif(this.wiki.isImageTiddler(this.imageSource)) {\n\t\t\tvar type = tiddler.fields.type,\n\t\t\t\ttext = tiddler.fields.text,\n\t\t\t\t_canonical_uri = tiddler.fields._canonical_uri;\n\t\t\t// If the tiddler has body text then it doesn't need to be lazily loaded\n\t\t\tif(text) {\n\t\t\t\t// Render the appropriate element for the image type\n\t\t\t\tswitch(type) {\n\t\t\t\t\tcase \"application/pdf\":\n\t\t\t\t\t\ttag = \"embed\";\n\t\t\t\t\t\tsrc = \"data:application/pdf;base64,\" + text;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/svg+xml\":\n\t\t\t\t\t\tsrc = \"data:image/svg+xml,\" + encodeURIComponent(text);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tsrc = \"data:\" + type + \";base64,\" + text;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if(_canonical_uri) {\n\t\t\t\tswitch(type) {\n\t\t\t\t\tcase \"application/pdf\":\n\t\t\t\t\t\ttag = \"embed\";\n\t\t\t\t\t\tsrc = _canonical_uri;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image/svg+xml\":\n\t\t\t\t\t\tsrc = _canonical_uri;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tsrc = _canonical_uri;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Just trigger loading of the tiddler\n\t\t\t\tthis.wiki.getTiddlerText(this.imageSource);\n\t\t\t}\n\t\t}\n\t}\n\t// Create the element and assign the attributes\n\tvar domNode = this.document.createElement(tag);\n\tdomNode.setAttribute(\"src\",src);\n\tif(this.imageClass) {\n\t\tdomNode.setAttribute(\"class\",this.imageClass);\n\t}\n\tif(this.imageWidth) {\n\t\tdomNode.setAttribute(\"width\",this.imageWidth);\n\t}\n\tif(this.imageHeight) {\n\t\tdomNode.setAttribute(\"height\",this.imageHeight);\n\t}\n\tif(this.imageTooltip) {\n\t\tdomNode.setAttribute(\"title\",this.imageTooltip);\n\t}\n\tif(this.imageAlt) {\n\t\tdomNode.setAttribute(\"alt\",this.imageAlt);\n\t}\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.domNodes.push(domNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nImageWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.imageSource = this.getAttribute(\"source\");\n\tthis.imageWidth = this.getAttribute(\"width\");\n\tthis.imageHeight = this.getAttribute(\"height\");\n\tthis.imageClass = this.getAttribute(\"class\");\n\tthis.imageTooltip = this.getAttribute(\"tooltip\");\n\tthis.imageAlt = this.getAttribute(\"alt\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nImageWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.source || changedAttributes.width || changedAttributes.height || changedAttributes[\"class\"] || changedAttributes.tooltip || changedTiddlers[this.imageSource]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\nexports.image = ImageWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/importvariables.js": {
"title": "$:/core/modules/widgets/importvariables.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/importvariables.js\ntype: application/javascript\nmodule-type: widget\n\nImport variable definitions from other tiddlers\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ImportVariablesWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nImportVariablesWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nImportVariablesWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nImportVariablesWidget.prototype.execute = function(tiddlerList) {\n\tvar widgetPointer = this;\n\t// Got to flush all the accumulated variables\n\tthis.variables = new this.variablesConstructor();\n\t// Compute the filter\n\tthis.tiddlerList = tiddlerList || this.getTiddlerList();\n\t// Accumulate the <$set> widgets from each tiddler\n\t$tw.utils.each(this.tiddlerList,function(title) {\n\t\tvar parser = widgetPointer.wiki.parseTiddler(title);\n\t\tif(parser) {\n\t\t\tvar parseTreeNode = parser.tree[0];\n\t\t\twhile(parseTreeNode && parseTreeNode.type === \"set\") {\n\t\t\t\tvar node = {\n\t\t\t\t\ttype: \"set\",\n\t\t\t\t\tattributes: parseTreeNode.attributes,\n\t\t\t\t\tparams: parseTreeNode.params,\n\t\t\t\t\tisMacroDefinition: parseTreeNode.isMacroDefinition\n\t\t\t\t};\n\t\t\t\tif (parseTreeNode.isMacroDefinition) {\n\t\t\t\t\t// Macro definitions can be folded into\n\t\t\t\t\t// current widget instead of adding\n\t\t\t\t\t// another link to the chain.\n\t\t\t\t\tvar widget = widgetPointer.makeChildWidget(node);\n\t\t\t\t\twidget.computeAttributes();\n\t\t\t\t\twidget.execute();\n\t\t\t\t\t// We SHALLOW copy over all variables\n\t\t\t\t\t// in widget. We can't use\n\t\t\t\t\t// $tw.utils.assign, because that copies\n\t\t\t\t\t// up the prototype chain, which we\n\t\t\t\t\t// don't want.\n\t\t\t\t\t$tw.utils.each(Object.keys(widget.variables), function(key) {\n\t\t\t\t\t\twidgetPointer.variables[key] = widget.variables[key];\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\twidgetPointer.children = [widgetPointer.makeChildWidget(node)];\n\t\t\t\t\t// No more regenerating children for\n\t\t\t\t\t// this widget. If it needs to refresh,\n\t\t\t\t\t// it'll do so along with the the whole\n\t\t\t\t\t// importvariable tree.\n\t\t\t\t\tif (widgetPointer != this) {\n\t\t\t\t\t\twidgetPointer.makeChildWidgets = function(){};\n\t\t\t\t\t}\n\t\t\t\t\twidgetPointer = widgetPointer.children[0];\n\t\t\t\t}\n\t\t\t\tparseTreeNode = parseTreeNode.children && parseTreeNode.children[0];\n\t\t\t}\n\t\t} \n\t});\n\tif (widgetPointer != this) {\n\t\twidgetPointer.parseTreeNode.children = this.parseTreeNode.children;\n\t} else {\n\t\twidgetPointer.makeChildWidgets();\n\t}\n};\n\nImportVariablesWidget.prototype.getTiddlerList = function() {\n\tvar filter = this.getAttribute(\"filter\"),\n\t\ttitle = this.getAttribute(\"tiddler\");\n\treturn (filter && this.wiki.filterTiddlers(filter,this)) || (title && [title]) || [];\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nImportVariablesWidget.prototype.refresh = function(changedTiddlers) {\n\t// Recompute our attributes and the filter list\n\tvar changedAttributes = this.computeAttributes(),\n\t\tfilter = this.getAttribute(\"filter\"),\n\t\ttitle = this.getAttribute(\"tiddler\"),\n\t\ttiddlerList = this.getTiddlerList();\n\t// Refresh if the filter has changed, or the list of tiddlers has changed, or any of the tiddlers in the list has changed\n\tfunction haveListedTiddlersChanged() {\n\t\tvar changed = false;\n\t\ttiddlerList.forEach(function(title) {\n\t\t\tif(changedTiddlers[title]) {\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t});\n\t\treturn changed;\n\t}\n\tif(changedAttributes.filter || changedAttributes.tiddler || !$tw.utils.isArrayEqual(this.tiddlerList,tiddlerList) || haveListedTiddlersChanged()) {\n\t\t// Compute the filter\n\t\tthis.removeChildDomNodes();\n\t\tthis.execute(tiddlerList);\n\t\tthis.renderChildren(this.parentDomNode,this.findNextSiblingDomNode());\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.importvariables = ImportVariablesWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/keyboard.js": {
"title": "$:/core/modules/widgets/keyboard.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/keyboard.js\ntype: application/javascript\nmodule-type: widget\n\nKeyboard shortcut widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar KeyboardWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nKeyboardWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nKeyboardWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar tag = this.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tif(this.tag && $tw.config.htmlUnsafeElements.indexOf(this.tag) === -1) {\n\t\ttag = this.tag;\n\t}\n\t// Create element\n\tvar domNode = this.document.createElement(tag);\n\t// Assign classes\n\tvar classes = (this[\"class\"] || \"\").split(\" \");\n\tclasses.push(\"tc-keyboard\");\n\tdomNode.className = classes.join(\" \");\n\t// Add a keyboard event handler\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"keydown\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n\t// Insert element\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\nKeyboardWidget.prototype.handleChangeEvent = function(event) {\n\tif($tw.keyboardManager.checkKeyDescriptors(event,this.keyInfoArray)) {\n\t\tvar handled = this.invokeActions(this,event);\n\t\tif(this.actions) {\n\t\t\tvar variables = {\n\t\t\t\t\t\"event-key\": event.key,\n\t\t\t\t\t\"event-code\": event.code,\n\t\t\t\t\t\"modifier\": $tw.keyboardManager.getEventModifierKeyDescriptor(event)\n\t\t\t\t};\n\t\t\tthis.invokeActionString(this.actions,this,event,variables);\n\t\t}\n\t\tthis.dispatchMessage(event);\n\t\tif(handled || this.actions || this.message) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nKeyboardWidget.prototype.dispatchMessage = function(event) {\n\tthis.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable(\"currentTiddler\")});\n};\n\n/*\nCompute the internal state of the widget\n*/\nKeyboardWidget.prototype.execute = function() {\n\tvar self = this;\n\t// Get attributes\n\tthis.actions = this.getAttribute(\"actions\",\"\");\n\tthis.message = this.getAttribute(\"message\",\"\");\n\tthis.param = this.getAttribute(\"param\",\"\");\n\tthis.key = this.getAttribute(\"key\",\"\");\n\tthis.tag = this.getAttribute(\"tag\",\"\");\n\tthis.keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(this.key);\n\tthis[\"class\"] = this.getAttribute(\"class\",\"\");\n\tif(this.key.substr(0,2) === \"((\" && this.key.substr(-2,2) === \"))\") {\n\t\tthis.shortcutTiddlers = [];\n\t\tvar name = this.key.substring(2,this.key.length -2);\n\t\t$tw.utils.each($tw.keyboardManager.lookupNames,function(platformDescriptor) {\n\t\t\tself.shortcutTiddlers.push(\"$:/config/\" + platformDescriptor + \"/\" + name);\n\t\t});\n\t}\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nKeyboardWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.message || changedAttributes.param || changedAttributes.key || changedAttributes[\"class\"] || changedAttributes.tag) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\t// Update the keyInfoArray if one of its shortcut-config-tiddlers has changed\n\tif(this.shortcutTiddlers && $tw.utils.hopArray(changedTiddlers,this.shortcutTiddlers)) {\n\t\tthis.keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(this.key);\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.keyboard = KeyboardWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/link.js": {
"title": "$:/core/modules/widgets/link.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/link.js\ntype: application/javascript\nmodule-type: widget\n\nLink widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar LinkWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nLinkWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nLinkWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Get the value of the tv-wikilinks configuration macro\n\tvar wikiLinksMacro = this.getVariable(\"tv-wikilinks\"),\n\t\tuseWikiLinks = wikiLinksMacro ? (wikiLinksMacro.trim() !== \"no\") : true,\n\t\tmissingLinksEnabled = !(this.hideMissingLinks && this.isMissing && !this.isShadow);\n\t// Render the link if required\n\tif(useWikiLinks && missingLinksEnabled) {\n\t\tthis.renderLink(parent,nextSibling);\n\t} else {\n\t\t// Just insert the link text\n\t\tvar domNode = this.document.createElement(\"span\");\n\t\tparent.insertBefore(domNode,nextSibling);\n\t\tthis.renderChildren(domNode,null);\n\t\tthis.domNodes.push(domNode);\n\t}\n};\n\n/*\nRender this widget into the DOM\n*/\nLinkWidget.prototype.renderLink = function(parent,nextSibling) {\n\tvar self = this;\n\t// Sanitise the specified tag\n\tvar tag = this.linkTag;\n\tif($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {\n\t\ttag = \"a\";\n\t}\n\t// Create our element\n\tvar namespace = this.getVariable(\"namespace\",{defaultValue: \"http://www.w3.org/1999/xhtml\"}),\n\t\tdomNode = this.document.createElementNS(namespace,tag);\n\t// Assign classes\n\tvar classes = [];\n\tif(this.overrideClasses === undefined) {\n\t\tclasses.push(\"tc-tiddlylink\");\n\t\tif(this.isShadow) {\n\t\t\tclasses.push(\"tc-tiddlylink-shadow\");\n\t\t}\n\t\tif(this.isMissing && !this.isShadow) {\n\t\t\tclasses.push(\"tc-tiddlylink-missing\");\n\t\t} else {\n\t\t\tif(!this.isMissing) {\n\t\t\t\tclasses.push(\"tc-tiddlylink-resolves\");\n\t\t\t}\n\t\t}\n\t\tif(this.linkClasses) {\n\t\t\tclasses.push(this.linkClasses);\n\t\t}\n\t} else if(this.overrideClasses !== \"\") {\n\t\tclasses.push(this.overrideClasses)\n\t}\n\tif(classes.length > 0) {\n\t\tdomNode.setAttribute(\"class\",classes.join(\" \"));\n\t}\n\t// Set an href\n\tvar wikilinkTransformFilter = this.getVariable(\"tv-filter-export-link\"),\n\t\twikiLinkText;\n\tif(wikilinkTransformFilter) {\n\t\t// Use the filter to construct the href\n\t\twikiLinkText = this.wiki.filterTiddlers(wikilinkTransformFilter,this,function(iterator) {\n\t\t\titerator(self.wiki.getTiddler(self.to),self.to)\n\t\t})[0];\n\t} else {\n\t\t// Expand the tv-wikilink-template variable to construct the href\n\t\tvar wikiLinkTemplateMacro = this.getVariable(\"tv-wikilink-template\"),\n\t\t\twikiLinkTemplate = wikiLinkTemplateMacro ? wikiLinkTemplateMacro.trim() : \"#$uri_encoded$\";\n\t\twikiLinkText = $tw.utils.replaceString(wikiLinkTemplate,\"$uri_encoded$\",encodeURIComponent(this.to));\n\t\twikiLinkText = $tw.utils.replaceString(wikiLinkText,\"$title_slugify$\",this.wiki.slugify(this.to));\n\t\twikiLinkText = $tw.utils.replaceString(wikiLinkText,\"$uri_doubleencoded$\",encodeURIComponent(encodeURIComponent(this.to)));\n\t}\n\t// Override with the value of tv-get-export-link if defined\n\twikiLinkText = this.getVariable(\"tv-get-export-link\",{params: [{name: \"to\",value: this.to}],defaultValue: wikiLinkText});\n\tif(tag === \"a\") {\n\t\tvar namespaceHref = (namespace === \"http://www.w3.org/2000/svg\") ? \"http://www.w3.org/1999/xlink\" : undefined;\n\t\tdomNode.setAttributeNS(namespaceHref,\"href\",wikiLinkText);\n\t}\n\t// Set the tabindex\n\tif(this.tabIndex) {\n\t\tdomNode.setAttribute(\"tabindex\",this.tabIndex);\n\t}\n\t// Set the tooltip\n\t// HACK: Performance issues with re-parsing the tooltip prevent us defaulting the tooltip to \"<$transclude field='tooltip'><$transclude field='title'/></$transclude>\"\n\tvar tooltipWikiText = this.tooltip || this.getVariable(\"tv-wikilink-tooltip\");\n\tif(tooltipWikiText) {\n\t\tvar tooltipText = this.wiki.renderText(\"text/plain\",\"text/vnd.tiddlywiki\",tooltipWikiText,{\n\t\t\t\tparseAsInline: true,\n\t\t\t\tvariables: {\n\t\t\t\t\tcurrentTiddler: this.to\n\t\t\t\t},\n\t\t\t\tparentWidget: this\n\t\t\t});\n\t\tdomNode.setAttribute(\"title\",tooltipText);\n\t}\n\tif(this[\"aria-label\"]) {\n\t\tdomNode.setAttribute(\"aria-label\",this[\"aria-label\"]);\n\t}\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"click\", handlerObject: this, handlerMethod: \"handleClickEvent\"},\n\t]);\n\t// Make the link draggable if required\n\tif(this.draggable === \"yes\") {\n\t\t$tw.utils.makeDraggable({\n\t\t\tdomNode: domNode,\n\t\t\tdragTiddlerFn: function() {return self.to;},\n\t\t\twidget: this\n\t\t});\n\t}\n\t// Insert the link into the DOM and render any children\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\nLinkWidget.prototype.handleClickEvent = function(event) {\n\t// Send the click on its way as a navigate event\n\tvar bounds = this.domNodes[0].getBoundingClientRect();\n\tthis.dispatchEvent({\n\t\ttype: \"tm-navigate\",\n\t\tnavigateTo: this.to,\n\t\tnavigateFromTitle: this.getVariable(\"storyTiddler\"),\n\t\tnavigateFromNode: this,\n\t\tnavigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height\n\t\t},\n\t\tnavigateSuppressNavigation: event.metaKey || event.ctrlKey || (event.button === 1),\n\t\tmetaKey: event.metaKey,\n\t\tctrlKey: event.ctrlKey,\n\t\taltKey: event.altKey,\n\t\tshiftKey: event.shiftKey,\n\t\tevent: event\n\t});\n\tif(this.domNodes[0].hasAttribute(\"href\")) {\n\t\tevent.preventDefault();\n\t}\n\tevent.stopPropagation();\n\treturn false;\n};\n\n/*\nCompute the internal state of the widget\n*/\nLinkWidget.prototype.execute = function() {\n\t// Pick up our attributes\n\tthis.to = this.getAttribute(\"to\",this.getVariable(\"currentTiddler\"));\n\tthis.tooltip = this.getAttribute(\"tooltip\");\n\tthis[\"aria-label\"] = this.getAttribute(\"aria-label\");\n\tthis.linkClasses = this.getAttribute(\"class\");\n\tthis.overrideClasses = this.getAttribute(\"overrideClass\");\n\tthis.tabIndex = this.getAttribute(\"tabindex\");\n\tthis.draggable = this.getAttribute(\"draggable\",\"yes\");\n\tthis.linkTag = this.getAttribute(\"tag\",\"a\");\n\t// Determine the link characteristics\n\tthis.isMissing = !this.wiki.tiddlerExists(this.to);\n\tthis.isShadow = this.wiki.isShadowTiddler(this.to);\n\tthis.hideMissingLinks = (this.getVariable(\"tv-show-missing-links\") || \"yes\") === \"no\";\n\t// Make the child widgets\n\tvar templateTree;\n\tif(this.parseTreeNode.children && this.parseTreeNode.children.length > 0) {\n\t\ttemplateTree = this.parseTreeNode.children;\n\t} else {\n\t\t// Default template is a link to the title\n\t\ttemplateTree = [{type: \"text\", text: this.to}];\n\t}\n\tthis.makeChildWidgets(templateTree);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nLinkWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.to || changedTiddlers[this.to] || changedAttributes[\"aria-label\"] || changedAttributes.tooltip) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.link = LinkWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/linkcatcher.js": {
"title": "$:/core/modules/widgets/linkcatcher.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/linkcatcher.js\ntype: application/javascript\nmodule-type: widget\n\nLinkcatcher widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar LinkCatcherWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nLinkCatcherWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nLinkCatcherWidget.prototype.render = function(parent,nextSibling) {\n\tthis.addEventListeners([\n\t\t{type: \"tm-navigate\", handler: \"handleNavigateEvent\"}\n\t]);\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nLinkCatcherWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.catchTo = this.getAttribute(\"to\");\n\tthis.catchMessage = this.getAttribute(\"message\");\n\tthis.catchSet = this.getAttribute(\"set\");\n\tthis.catchSetTo = this.getAttribute(\"setTo\");\n\tthis.catchActions = this.getAttribute(\"actions\");\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n\t// When executing actions we avoid trapping navigate events, so that we don't trigger ourselves recursively\n\tthis.executingActions = false;\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nLinkCatcherWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.to || changedAttributes.message || changedAttributes.set || changedAttributes.setTo) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\n/*\nHandle a tm-navigate event\n*/\nLinkCatcherWidget.prototype.handleNavigateEvent = function(event) {\n\tif(!this.executingActions) {\n\t\t// Execute the actions\n\t\tif(this.catchTo) {\n\t\t\tthis.wiki.setTextReference(this.catchTo,event.navigateTo,this.getVariable(\"currentTiddler\"));\n\t\t}\n\t\tif(this.catchMessage && this.parentWidget) {\n\t\t\tthis.parentWidget.dispatchEvent({\n\t\t\t\ttype: this.catchMessage,\n\t\t\t\tparam: event.navigateTo,\n\t\t\t\tnavigateTo: event.navigateTo\n\t\t\t});\n\t\t}\n\t\tif(this.catchSet) {\n\t\t\tvar tiddler = this.wiki.getTiddler(this.catchSet);\n\t\t\tthis.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.catchSet, text: this.catchSetTo}));\n\t\t}\n\t\tif(this.catchActions) {\n\t\t\tthis.executingActions = true;\n\t\t\tvar modifierKey = $tw.keyboardManager.getEventModifierKeyDescriptor(event);\n\t\t\tthis.invokeActionString(this.catchActions,this,event,{navigateTo: event.navigateTo, modifier: modifierKey});\n\t\t\tthis.executingActions = false;\n\t\t}\n\t} else {\n\t\t// This is a navigate event generated by the actions of this linkcatcher, so we don't trap it again, but just pass it to the parent\n\t\tthis.parentWidget.dispatchEvent({\n\t\t\ttype: \"tm-navigate\",\n\t\t\tparam: event.navigateTo,\n\t\t\tnavigateTo: event.navigateTo\n\t\t});\n\t}\n\treturn false;\n};\n\nexports.linkcatcher = LinkCatcherWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/list.js": {
"title": "$:/core/modules/widgets/list.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/list.js\ntype: application/javascript\nmodule-type: widget\n\nList and list item widgets\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\n/*\nThe list widget creates list element sub-widgets that reach back into the list widget for their configuration\n*/\n\nvar ListWidget = function(parseTreeNode,options) {\n\t// Main initialisation inherited from widget.js\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nListWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nListWidget.prototype.render = function(parent,nextSibling) {\n\t// Initialise the storyviews if they've not been done already\n\tif(!this.storyViews) {\n\t\tListWidget.prototype.storyViews = {};\n\t\t$tw.modules.applyMethods(\"storyview\",this.storyViews);\n\t}\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n\t// Construct the storyview\n\tvar StoryView = this.storyViews[this.storyViewName];\n\tif(this.storyViewName && !StoryView) {\n\t\tStoryView = this.storyViews[\"classic\"];\n\t}\n\tif(StoryView && !this.document.isTiddlyWikiFakeDom) {\n\t\tthis.storyview = new StoryView(this);\n\t} else {\n\t\tthis.storyview = null;\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nListWidget.prototype.execute = function() {\n\t// Get our attributes\n\tthis.template = this.getAttribute(\"template\");\n\tthis.editTemplate = this.getAttribute(\"editTemplate\");\n\tthis.variableName = this.getAttribute(\"variable\",\"currentTiddler\");\n\tthis.counterName = this.getAttribute(\"counter\");\n\tthis.storyViewName = this.getAttribute(\"storyview\");\n\tthis.historyTitle = this.getAttribute(\"history\");\n\t// Compose the list elements\n\tthis.list = this.getTiddlerList();\n\tvar members = [],\n\t\tself = this;\n\t// Check for an empty list\n\tif(this.list.length === 0) {\n\t\tmembers = this.getEmptyMessage();\n\t} else {\n\t\t$tw.utils.each(this.list,function(title,index) {\n\t\t\tmembers.push(self.makeItemTemplate(title,index));\n\t\t});\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets(members);\n\t// Clear the last history\n\tthis.history = [];\n};\n\nListWidget.prototype.getTiddlerList = function() {\n\tvar defaultFilter = \"[!is[system]sort[title]]\";\n\treturn this.wiki.filterTiddlers(this.getAttribute(\"filter\",defaultFilter),this);\n};\n\nListWidget.prototype.getEmptyMessage = function() {\n\tvar parser,\n\t\temptyMessage = this.getAttribute(\"emptyMessage\",\"\");\n\t// this.wiki.parseText() calls \n\t// new Parser(..), which should only be done, if needed, because it's heavy!\n\tif (emptyMessage === \"\") {\n\t\treturn [];\n\t}\n\tparser = this.wiki.parseText(\"text/vnd.tiddlywiki\",emptyMessage,{parseAsInline: true});\n\tif(parser) {\n\t\treturn parser.tree;\n\t} else {\n\t\treturn [];\n\t}\n};\n\n/*\nCompose the template for a list item\n*/\nListWidget.prototype.makeItemTemplate = function(title,index) {\n\t// Check if the tiddler is a draft\n\tvar tiddler = this.wiki.getTiddler(title),\n\t\tisDraft = tiddler && tiddler.hasField(\"draft.of\"),\n\t\ttemplate = this.template,\n\t\ttemplateTree;\n\tif(isDraft && this.editTemplate) {\n\t\ttemplate = this.editTemplate;\n\t}\n\t// Compose the transclusion of the template\n\tif(template) {\n\t\ttemplateTree = [{type: \"transclude\", attributes: {tiddler: {type: \"string\", value: template}}}];\n\t} else {\n\t\tif(this.parseTreeNode.children && this.parseTreeNode.children.length > 0) {\n\t\t\ttemplateTree = this.parseTreeNode.children;\n\t\t} else {\n\t\t\t// Default template is a link to the title\n\t\t\ttemplateTree = [{type: \"element\", tag: this.parseTreeNode.isBlock ? \"div\" : \"span\", children: [{type: \"link\", attributes: {to: {type: \"string\", value: title}}, children: [\n\t\t\t\t\t{type: \"text\", text: title}\n\t\t\t]}]}];\n\t\t}\n\t}\n\t// Return the list item\n\tvar parseTreeNode = {type: \"listitem\", itemTitle: title, variableName: this.variableName, children: templateTree};\n\tif(this.counterName) {\n\t\tparseTreeNode.counter = (index + 1).toString();\n\t\tparseTreeNode.counterName = this.counterName;\n\t\tparseTreeNode.isFirst = index === 0;\n\t\tparseTreeNode.isLast = index === this.list.length - 1;\n\t}\n\treturn parseTreeNode;\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nListWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes(),\n\t\tresult;\n\t// Call the storyview\n\tif(this.storyview && this.storyview.refreshStart) {\n\t\tthis.storyview.refreshStart(changedTiddlers,changedAttributes);\n\t}\n\t// Completely refresh if any of our attributes have changed\n\tif(changedAttributes.filter || changedAttributes.variable || changedAttributes.counter || changedAttributes.template || changedAttributes.editTemplate || changedAttributes.emptyMessage || changedAttributes.storyview || changedAttributes.history) {\n\t\tthis.refreshSelf();\n\t\tresult = true;\n\t} else {\n\t\t// Handle any changes to the list\n\t\tresult = this.handleListChanges(changedTiddlers);\n\t\t// Handle any changes to the history stack\n\t\tif(this.historyTitle && changedTiddlers[this.historyTitle]) {\n\t\t\tthis.handleHistoryChanges();\n\t\t}\n\t}\n\t// Call the storyview\n\tif(this.storyview && this.storyview.refreshEnd) {\n\t\tthis.storyview.refreshEnd(changedTiddlers,changedAttributes);\n\t}\n\treturn result;\n};\n\n/*\nHandle any changes to the history list\n*/\nListWidget.prototype.handleHistoryChanges = function() {\n\t// Get the history data\n\tvar newHistory = this.wiki.getTiddlerDataCached(this.historyTitle,[]);\n\t// Ignore any entries of the history that match the previous history\n\tvar entry = 0;\n\twhile(entry < newHistory.length && entry < this.history.length && newHistory[entry].title === this.history[entry].title) {\n\t\tentry++;\n\t}\n\t// Navigate forwards to each of the new tiddlers\n\twhile(entry < newHistory.length) {\n\t\tif(this.storyview && this.storyview.navigateTo) {\n\t\t\tthis.storyview.navigateTo(newHistory[entry]);\n\t\t}\n\t\tentry++;\n\t}\n\t// Update the history\n\tthis.history = newHistory;\n};\n\n/*\nProcess any changes to the list\n*/\nListWidget.prototype.handleListChanges = function(changedTiddlers) {\n\t// Get the new list\n\tvar prevList = this.list;\n\tthis.list = this.getTiddlerList();\n\t// Check for an empty list\n\tif(this.list.length === 0) {\n\t\t// Check if it was empty before\n\t\tif(prevList.length === 0) {\n\t\t\t// If so, just refresh the empty message\n\t\t\treturn this.refreshChildren(changedTiddlers);\n\t\t} else {\n\t\t\t// Replace the previous content with the empty message\n\t\t\tfor(t=this.children.length-1; t>=0; t--) {\n\t\t\t\tthis.removeListItem(t);\n\t\t\t}\n\t\t\tvar nextSibling = this.findNextSiblingDomNode();\n\t\t\tthis.makeChildWidgets(this.getEmptyMessage());\n\t\t\tthis.renderChildren(this.parentDomNode,nextSibling);\n\t\t\treturn true;\n\t\t}\n\t} else {\n\t\t// If the list was empty then we need to remove the empty message\n\t\tif(prevList.length === 0) {\n\t\t\tthis.removeChildDomNodes();\n\t\t\tthis.children = [];\n\t\t}\n\t\t// If we are providing an counter variable then we must refresh the items, otherwise we can rearrange them\n\t\tvar hasRefreshed = false,t;\n\t\tif(this.counterName) {\n\t\t\t// Cycle through the list and remove and re-insert the first item that has changed, and all the remaining items\n\t\t\tfor(t=0; t<this.list.length; t++) {\n\t\t\t\tif(hasRefreshed || !this.children[t] || this.children[t].parseTreeNode.itemTitle !== this.list[t]) {\n\t\t\t\t\tif(this.children[t]) {\n\t\t\t\t\t\tthis.removeListItem(t);\n\t\t\t\t\t}\n\t\t\t\t\tthis.insertListItem(t,this.list[t]);\n\t\t\t\t\thasRefreshed = true;\n\t\t\t\t} else {\n\t\t\t\t\t// Refresh the item we're reusing\n\t\t\t\t\tvar refreshed = this.children[t].refresh(changedTiddlers);\n\t\t\t\t\thasRefreshed = hasRefreshed || refreshed;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Cycle through the list, inserting and removing list items as needed\n\t\t\tfor(t=0; t<this.list.length; t++) {\n\t\t\t\tvar index = this.findListItem(t,this.list[t]);\n\t\t\t\tif(index === undefined) {\n\t\t\t\t\t// The list item must be inserted\n\t\t\t\t\tthis.insertListItem(t,this.list[t]);\n\t\t\t\t\thasRefreshed = true;\n\t\t\t\t} else {\n\t\t\t\t\t// There are intervening list items that must be removed\n\t\t\t\t\tfor(var n=index-1; n>=t; n--) {\n\t\t\t\t\t\tthis.removeListItem(n);\n\t\t\t\t\t\thasRefreshed = true;\n\t\t\t\t\t}\n\t\t\t\t\t// Refresh the item we're reusing\n\t\t\t\t\tvar refreshed = this.children[t].refresh(changedTiddlers);\n\t\t\t\t\thasRefreshed = hasRefreshed || refreshed;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Remove any left over items\n\t\tfor(t=this.children.length-1; t>=this.list.length; t--) {\n\t\t\tthis.removeListItem(t);\n\t\t\thasRefreshed = true;\n\t\t}\n\t\treturn hasRefreshed;\n\t}\n};\n\n/*\nFind the list item with a given title, starting from a specified position\n*/\nListWidget.prototype.findListItem = function(startIndex,title) {\n\twhile(startIndex < this.children.length) {\n\t\tif(this.children[startIndex].parseTreeNode.itemTitle === title) {\n\t\t\treturn startIndex;\n\t\t}\n\t\tstartIndex++;\n\t}\n\treturn undefined;\n};\n\n/*\nInsert a new list item at the specified index\n*/\nListWidget.prototype.insertListItem = function(index,title) {\n\t// Create, insert and render the new child widgets\n\tvar widget = this.makeChildWidget(this.makeItemTemplate(title,index));\n\twidget.parentDomNode = this.parentDomNode; // Hack to enable findNextSiblingDomNode() to work\n\tthis.children.splice(index,0,widget);\n\tvar nextSibling = widget.findNextSiblingDomNode();\n\twidget.render(this.parentDomNode,nextSibling);\n\t// Animate the insertion if required\n\tif(this.storyview && this.storyview.insert) {\n\t\tthis.storyview.insert(widget);\n\t}\n\treturn true;\n};\n\n/*\nRemove the specified list item\n*/\nListWidget.prototype.removeListItem = function(index) {\n\tvar widget = this.children[index];\n\t// Animate the removal if required\n\tif(this.storyview && this.storyview.remove) {\n\t\tthis.storyview.remove(widget);\n\t} else {\n\t\twidget.removeChildDomNodes();\n\t}\n\t// Remove the child widget\n\tthis.children.splice(index,1);\n};\n\nexports.list = ListWidget;\n\nvar ListItemWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nListItemWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nListItemWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nListItemWidget.prototype.execute = function() {\n\t// Set the current list item title\n\tthis.setVariable(this.parseTreeNode.variableName,this.parseTreeNode.itemTitle);\n\tif(this.parseTreeNode.counterName) {\n\t\tthis.setVariable(this.parseTreeNode.counterName,this.parseTreeNode.counter);\n\t\tthis.setVariable(this.parseTreeNode.counterName + \"-first\",this.parseTreeNode.isFirst ? \"yes\" : \"no\");\n\t\tthis.setVariable(this.parseTreeNode.counterName + \"-last\",this.parseTreeNode.isLast ? \"yes\" : \"no\");\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nListItemWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.listitem = ListItemWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/log.js": {
"title": "$:/core/modules/widgets/log.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/log.js\ntype: application/javascript\nmodule-type: widget-subclass\n\nWidget to log debug messages\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.baseClass = \"action-log\";\n\nexports.name = \"log\";\n\nexports.constructor = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n}\n\nexports.prototype = {};\n\nexports.prototype.render = function(event) {\n\tObject.getPrototypeOf(Object.getPrototypeOf(this)).render.call(this,event);\n\tObject.getPrototypeOf(Object.getPrototypeOf(this)).log.call(this);\n}\n\n})();",
"type": "application/javascript",
"module-type": "widget-subclass"
},
"$:/core/modules/widgets/macrocall.js": {
"title": "$:/core/modules/widgets/macrocall.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/macrocall.js\ntype: application/javascript\nmodule-type: widget\n\nMacrocall widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar MacroCallWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nMacroCallWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nMacroCallWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nMacroCallWidget.prototype.execute = function() {\n\t// Get the parse type if specified\n\tthis.parseType = this.getAttribute(\"$type\",\"text/vnd.tiddlywiki\");\n\tthis.renderOutput = this.getAttribute(\"$output\",\"text/html\");\n\t// Merge together the parameters specified in the parse tree with the specified attributes\n\tvar params = this.parseTreeNode.params ? this.parseTreeNode.params.slice(0) : [];\n\t$tw.utils.each(this.attributes,function(attribute,name) {\n\t\tif(name.charAt(0) !== \"$\") {\n\t\t\tparams.push({name: name, value: attribute});\n\t\t}\n\t});\n\t// Get the macro value\n\tvar macroName = this.parseTreeNode.name || this.getAttribute(\"$name\"),\n\t\tvariableInfo = this.getVariableInfo(macroName,{params: params}),\n\t\ttext = variableInfo.text,\n\t\tparseTreeNodes;\n\t// Are we rendering to HTML?\n\tif(this.renderOutput === \"text/html\") {\n\t\t// If so we'll return the parsed macro\n\t\t// Check if we've already cached parsing this macro\n\t\tvar mode = this.parseTreeNode.isBlock ? \"blockParser\" : \"inlineParser\",\n\t\t\tparser;\n\t\tif(variableInfo.srcVariable && variableInfo.srcVariable[mode]) {\n\t\t\tparser = variableInfo.srcVariable[mode];\n\t\t} else {\n\t\t\tparser = this.wiki.parseText(this.parseType,text,\n\t\t\t\t\t\t\t\t{parseAsInline: !this.parseTreeNode.isBlock});\n\t\t\tif(variableInfo.isCacheable && variableInfo.srcVariable) {\n\t\t\t\tvariableInfo.srcVariable[mode] = parser;\n\t\t\t}\n\t\t}\n\t\tvar parseTreeNodes = parser ? parser.tree : [];\n\t\t// Wrap the parse tree in a vars widget assigning the parameters to variables named \"__paramname__\"\n\t\tvar attributes = {};\n\t\t$tw.utils.each(variableInfo.params,function(param) {\n\t\t\tvar name = \"__\" + param.name + \"__\";\n\t\t\tattributes[name] = {\n\t\t\t\tname: name,\n\t\t\t\ttype: \"string\",\n\t\t\t\tvalue: param.value\n\t\t\t};\n\t\t});\n\t\tparseTreeNodes = [{\n\t\t\ttype: \"vars\",\n\t\t\tattributes: attributes,\n\t\t\tchildren: parseTreeNodes\n\t\t}];\n\t} else if(this.renderOutput === \"text/raw\") {\n\t\tparseTreeNodes = [{type: \"text\", text: text}];\n\t} else {\n\t\t// Otherwise, we'll render the text\n\t\tvar plainText = this.wiki.renderText(\"text/plain\",this.parseType,text,{parentWidget: this});\n\t\tparseTreeNodes = [{type: \"text\", text: plainText}];\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets(parseTreeNodes);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nMacroCallWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif($tw.utils.count(changedAttributes) > 0) {\n\t\t// Rerender ourselves\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.macrocall = MacroCallWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/messagecatcher.js": {
"title": "$:/core/modules/widgets/messagecatcher.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/messagecatcher.js\ntype: application/javascript\nmodule-type: widget\n\nMessage catcher widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar MessageCatcherWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nMessageCatcherWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nMessageCatcherWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Add our message handler\n\tif(this.messageType) {\n\t\tthis.addEventListeners([\n\t\t\t{type: this.messageType, handler: \"handleEvent\"}\n\t\t]);\n\t}\n\t// Render children\n\tthis.renderChildren(parent,null);\n};\n\n/*\nCompute the internal state of the widget\n*/\nMessageCatcherWidget.prototype.execute = function() {\n\tvar self = this;\n\t// Get attributes that require a refresh on change\n\tthis.messageType = this.getAttribute(\"type\");\n\tthis.messageActions = this.getAttribute(\"actions\");\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nHandle an event\n*/\nMessageCatcherWidget.prototype.handleEvent = function(event) {\n\tif(this.messageActions) {\n\t\t// Collect all the event properties into variables\n\t\tvar collectProps = function(obj,prefix) {\n\t\t\t\tprefix = prefix || \"\";\n\t\t\t\tvar props = {};\n\t\t\t\t$tw.utils.each(obj,function(value,name) {\n\t\t\t\t\tif([\"string\",\"boolean\",\"number\"].indexOf(typeof value) !== -1) {\n\t\t\t\t\t\tprops[prefix + name] = value.toString();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn props;\n\t\t\t};\n\t\tvar variables = $tw.utils.extend(\n\t\t\t{},\n\t\t\tcollectProps(event.paramObject,\"event-paramObject-\"),\n\t\t\tcollectProps(event,\"event-\"),\n\t\t\t{\n\t\t\t\tmodifier: $tw.keyboardManager.getEventModifierKeyDescriptor(event)\n\t\t\t});\n\t\tthis.invokeActionString(this.messageActions,this,event,variables);\n\t}\n\treturn false;\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nMessageCatcherWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"type\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.messagecatcher = MessageCatcherWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/navigator.js": {
"title": "$:/core/modules/widgets/navigator.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/navigator.js\ntype: application/javascript\nmodule-type: widget\n\nNavigator widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar IMPORT_TITLE = \"$:/Import\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar NavigatorWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nNavigatorWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nNavigatorWidget.prototype.render = function(parent,nextSibling) {\n\tthis.addEventListeners([\n\t\t{type: \"tm-navigate\", handler: \"handleNavigateEvent\"},\n\t\t{type: \"tm-edit-tiddler\", handler: \"handleEditTiddlerEvent\"},\n\t\t{type: \"tm-delete-tiddler\", handler: \"handleDeleteTiddlerEvent\"},\n\t\t{type: \"tm-save-tiddler\", handler: \"handleSaveTiddlerEvent\"},\n\t\t{type: \"tm-cancel-tiddler\", handler: \"handleCancelTiddlerEvent\"},\n\t\t{type: \"tm-close-tiddler\", handler: \"handleCloseTiddlerEvent\"},\n\t\t{type: \"tm-close-all-tiddlers\", handler: \"handleCloseAllTiddlersEvent\"},\n\t\t{type: \"tm-close-other-tiddlers\", handler: \"handleCloseOtherTiddlersEvent\"},\n\t\t{type: \"tm-new-tiddler\", handler: \"handleNewTiddlerEvent\"},\n\t\t{type: \"tm-import-tiddlers\", handler: \"handleImportTiddlersEvent\"},\n\t\t{type: \"tm-perform-import\", handler: \"handlePerformImportEvent\"},\n\t\t{type: \"tm-fold-tiddler\", handler: \"handleFoldTiddlerEvent\"},\n\t\t{type: \"tm-fold-other-tiddlers\", handler: \"handleFoldOtherTiddlersEvent\"},\n\t\t{type: \"tm-fold-all-tiddlers\", handler: \"handleFoldAllTiddlersEvent\"},\n\t\t{type: \"tm-unfold-all-tiddlers\", handler: \"handleUnfoldAllTiddlersEvent\"},\n\t\t{type: \"tm-rename-tiddler\", handler: \"handleRenameTiddlerEvent\"}\n\t]);\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nNavigatorWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.storyTitle = this.getAttribute(\"story\");\n\tthis.historyTitle = this.getAttribute(\"history\");\n\tthis.setVariable(\"tv-story-list\",this.storyTitle);\n\tthis.setVariable(\"tv-history-list\",this.historyTitle);\n\tthis.story = new $tw.Story({\n\t\twiki: this.wiki,\n\t\tstoryTitle: this.storyTitle,\n\t\thistoryTitle: this.historyTitle\n\t});\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nNavigatorWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.story || changedAttributes.history) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nNavigatorWidget.prototype.getStoryList = function() {\n\treturn this.storyTitle ? this.wiki.getTiddlerList(this.storyTitle) : null;\n};\n\nNavigatorWidget.prototype.saveStoryList = function(storyList) {\n\tif(this.storyTitle) {\n\t\tvar storyTiddler = this.wiki.getTiddler(this.storyTitle);\n\t\tthis.wiki.addTiddler(new $tw.Tiddler(\n\t\t\t{title: this.storyTitle},\n\t\t\tstoryTiddler,\n\t\t\t{list: storyList}\n\t\t));\n\t}\n};\n\nNavigatorWidget.prototype.removeTitleFromStory = function(storyList,title) {\n\tif(storyList) {\n\t\tvar p = storyList.indexOf(title);\n\t\twhile(p !== -1) {\n\t\t\tstoryList.splice(p,1);\n\t\t\tp = storyList.indexOf(title);\n\t\t}\n\t}\n};\n\nNavigatorWidget.prototype.replaceFirstTitleInStory = function(storyList,oldTitle,newTitle) {\n\tif(storyList) {\n\t\tvar pos = storyList.indexOf(oldTitle);\n\t\tif(pos !== -1) {\n\t\t\tstoryList[pos] = newTitle;\n\t\t\tdo {\n\t\t\t\tpos = storyList.indexOf(oldTitle,pos + 1);\n\t\t\t\tif(pos !== -1) {\n\t\t\t\t\tstoryList.splice(pos,1);\n\t\t\t\t}\n\t\t\t} while(pos !== -1);\n\t\t} else {\n\t\t\tstoryList.splice(0,0,newTitle);\n\t\t}\n\t}\n};\n\nNavigatorWidget.prototype.addToStory = function(title,fromTitle) {\n\tif(this.storyTitle) {\n\t\tthis.story.addToStory(title,fromTitle,{\n\t\t\topenLinkFromInsideRiver: this.getAttribute(\"openLinkFromInsideRiver\",\"top\"),\n\t\t\topenLinkFromOutsideRiver: this.getAttribute(\"openLinkFromOutsideRiver\",\"top\")\n\t\t});\n\t}\n};\n\n/*\nAdd a new record to the top of the history stack\ntitle: a title string or an array of title strings\nfromPageRect: page coordinates of the origin of the navigation\n*/\nNavigatorWidget.prototype.addToHistory = function(title,fromPageRect) {\n\tthis.story.addToHistory(title,fromPageRect,this.historyTitle);\n};\n\n/*\nHandle a tm-navigate event\n*/\nNavigatorWidget.prototype.handleNavigateEvent = function(event) {\n\tevent = $tw.hooks.invokeHook(\"th-navigating\",event);\n\tif(event.navigateTo) {\n\t\tthis.addToStory(event.navigateTo,event.navigateFromTitle);\n\t\tif(!event.navigateSuppressNavigation) {\n\t\t\tthis.addToHistory(event.navigateTo,event.navigateFromClientRect);\n\t\t}\n\t}\n\treturn false;\n};\n\n// Close a specified tiddler\nNavigatorWidget.prototype.handleCloseTiddlerEvent = function(event) {\n\tvar title = event.param || event.tiddlerTitle,\n\t\tstoryList = this.getStoryList();\n\t// Look for tiddlers with this title to close\n\tthis.removeTitleFromStory(storyList,title);\n\tthis.saveStoryList(storyList);\n\treturn false;\n};\n\n// Close all tiddlers\nNavigatorWidget.prototype.handleCloseAllTiddlersEvent = function(event) {\n\tthis.saveStoryList([]);\n\treturn false;\n};\n\n// Close other tiddlers\nNavigatorWidget.prototype.handleCloseOtherTiddlersEvent = function(event) {\n\tvar title = event.param || event.tiddlerTitle;\n\tthis.saveStoryList([title]);\n\treturn false;\n};\n\n// Place a tiddler in edit mode\nNavigatorWidget.prototype.handleEditTiddlerEvent = function(event) {\n\tvar editTiddler = $tw.hooks.invokeHook(\"th-editing-tiddler\",event);\n\tif(!editTiddler) {\n\t\treturn false;\n\t}\n\tvar self = this;\n\tfunction isUnmodifiedShadow(title) {\n\t\treturn self.wiki.isShadowTiddler(title) && !self.wiki.tiddlerExists(title);\n\t}\n\tfunction confirmEditShadow(title) {\n\t\treturn confirm($tw.language.getString(\n\t\t\t\"ConfirmEditShadowTiddler\",\n\t\t\t{variables:\n\t\t\t\t{title: title}\n\t\t\t}\n\t\t));\n\t}\n\tvar title = event.param || event.tiddlerTitle;\n\tif(isUnmodifiedShadow(title) && !confirmEditShadow(title)) {\n\t\treturn false;\n\t}\n\t// Replace the specified tiddler with a draft in edit mode\n\tvar draftTiddler = this.makeDraftTiddler(title);\n\t// Update the story and history if required\n\tif(!event.paramObject || event.paramObject.suppressNavigation !== \"yes\") {\n\t\tvar draftTitle = draftTiddler.fields.title,\n\t\t\tstoryList = this.getStoryList();\n\t\tthis.removeTitleFromStory(storyList,draftTitle);\n\t\tthis.replaceFirstTitleInStory(storyList,title,draftTitle);\n\t\tthis.addToHistory(draftTitle,event.navigateFromClientRect);\n\t\tthis.saveStoryList(storyList);\n\t\treturn false;\n\t}\n};\n\n// Delete a tiddler\nNavigatorWidget.prototype.handleDeleteTiddlerEvent = function(event) {\n\t// Get the tiddler we're deleting\n\tvar title = event.param || event.tiddlerTitle,\n\t\ttiddler = this.wiki.getTiddler(title),\n\t\tstoryList = this.getStoryList(),\n\t\toriginalTitle = tiddler ? tiddler.fields[\"draft.of\"] : \"\",\n\t\toriginalTiddler = originalTitle ? this.wiki.getTiddler(originalTitle) : undefined,\n\t\tconfirmationTitle;\n\tif(!tiddler) {\n\t\treturn false;\n\t}\n\t// Check if the tiddler we're deleting is in draft mode\n\tif(originalTitle) {\n\t\t// If so, we'll prompt for confirmation referencing the original tiddler\n\t\tconfirmationTitle = originalTitle;\n\t} else {\n\t\t// If not a draft, then prompt for confirmation referencing the specified tiddler\n\t\tconfirmationTitle = title;\n\t}\n\t// Seek confirmation\n\tif((this.wiki.getTiddler(originalTitle) || (tiddler.fields.text || \"\") !== \"\") && !confirm($tw.language.getString(\n\t\t\t\t\"ConfirmDeleteTiddler\",\n\t\t\t\t{variables:\n\t\t\t\t\t{title: confirmationTitle}\n\t\t\t\t}\n\t\t\t))) {\n\t\treturn false;\n\t}\n\t// Delete the original tiddler\n\tif(originalTitle) {\n\t\tif(originalTiddler) {\n\t\t\t$tw.hooks.invokeHook(\"th-deleting-tiddler\",originalTiddler);\n\t\t}\n\t\tthis.wiki.deleteTiddler(originalTitle);\n\t\tthis.removeTitleFromStory(storyList,originalTitle);\n\t}\n\t// Invoke the hook function and delete this tiddler\n\t$tw.hooks.invokeHook(\"th-deleting-tiddler\",tiddler);\n\tthis.wiki.deleteTiddler(title);\n\t// Remove the closed tiddler from the story\n\tthis.removeTitleFromStory(storyList,title);\n\tthis.saveStoryList(storyList);\n\t// Trigger an autosave\n\t$tw.rootWidget.dispatchEvent({type: \"tm-auto-save-wiki\"});\n\treturn false;\n};\n\n/*\nCreate/reuse the draft tiddler for a given title\n*/\nNavigatorWidget.prototype.makeDraftTiddler = function(targetTitle) {\n\t// See if there is already a draft tiddler for this tiddler\n\tvar draftTitle = this.wiki.findDraft(targetTitle);\n\tif(draftTitle) {\n\t\treturn this.wiki.getTiddler(draftTitle);\n\t}\n\t// Get the current value of the tiddler we're editing\n\tvar tiddler = this.wiki.getTiddler(targetTitle);\n\t// Save the initial value of the draft tiddler\n\tdraftTitle = this.generateDraftTitle(targetTitle);\n\tvar draftTiddler = new $tw.Tiddler({\n\t\t\t\ttext: \"\",\n\t\t\t},\n\t\t\ttiddler,\n\t\t\t{\n\t\t\t\ttitle: draftTitle,\n\t\t\t\t\"draft.title\": targetTitle,\n\t\t\t\t\"draft.of\": targetTitle\n\t\t\t},\n\t\t\tthis.wiki.getModificationFields()\n\t\t);\n\tthis.wiki.addTiddler(draftTiddler);\n\treturn draftTiddler;\n};\n\n/*\nGenerate a title for the draft of a given tiddler\n*/\nNavigatorWidget.prototype.generateDraftTitle = function(title) {\n\treturn this.wiki.generateDraftTitle(title);\n};\n\n// Take a tiddler out of edit mode, saving the changes\nNavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {\n\tvar title = event.param || event.tiddlerTitle,\n\t\ttiddler = this.wiki.getTiddler(title),\n\t\tstoryList = this.getStoryList();\n\t// Replace the original tiddler with the draft\n\tif(tiddler) {\n\t\tvar draftTitle = (tiddler.fields[\"draft.title\"] || \"\").trim(),\n\t\t\tdraftOf = (tiddler.fields[\"draft.of\"] || \"\").trim();\n\t\tif(draftTitle) {\n\t\t\tvar isRename = draftOf !== draftTitle,\n\t\t\t\tisConfirmed = true;\n\t\t\tif(isRename && this.wiki.tiddlerExists(draftTitle)) {\n\t\t\t\tisConfirmed = confirm($tw.language.getString(\n\t\t\t\t\t\"ConfirmOverwriteTiddler\",\n\t\t\t\t\t{variables:\n\t\t\t\t\t\t{title: draftTitle}\n\t\t\t\t\t}\n\t\t\t\t));\n\t\t\t}\n\t\t\tif(isConfirmed) {\n\t\t\t\t// Create the new tiddler and pass it through the th-saving-tiddler hook\n\t\t\t\tvar newTiddler = new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,{\n\t\t\t\t\ttitle: draftTitle,\n\t\t\t\t\t\"draft.title\": undefined,\n\t\t\t\t\t\"draft.of\": undefined\n\t\t\t\t},this.wiki.getModificationFields());\n\t\t\t\tnewTiddler = $tw.hooks.invokeHook(\"th-saving-tiddler\",newTiddler,tiddler);\n\t\t\t\tthis.wiki.addTiddler(newTiddler);\n\t\t\t\t// If enabled, relink references to renamed tiddler\n\t\t\t\tvar shouldRelink = this.getAttribute(\"relinkOnRename\",\"no\").toLowerCase().trim() === \"yes\";\n\t\t\t\tif(isRename && shouldRelink && this.wiki.tiddlerExists(draftOf)) {\n\t\t\t\t\tthis.wiki.relinkTiddler(draftOf,draftTitle);\n\t\t\t\t}\n\t\t\t\t// Remove the draft tiddler\n\t\t\t\tthis.wiki.deleteTiddler(title);\n\t\t\t\t// Remove the original tiddler if we're renaming it\n\t\t\t\tif(isRename) {\n\t\t\t\t\tthis.wiki.deleteTiddler(draftOf);\n\t\t\t\t}\n\t\t\t\t// #2381 always remove new title & old\n\t\t\t\tthis.removeTitleFromStory(storyList,draftTitle);\n\t\t\t\tthis.removeTitleFromStory(storyList,draftOf);\n\t\t\t\tif(!event.paramObject || event.paramObject.suppressNavigation !== \"yes\") {\n\t\t\t\t\t// Replace the draft in the story with the original\n\t\t\t\t\tthis.replaceFirstTitleInStory(storyList,title,draftTitle);\n\t\t\t\t\tthis.addToHistory(draftTitle,event.navigateFromClientRect);\n\t\t\t\t\tif(draftTitle !== this.storyTitle) {\n\t\t\t\t\t\tthis.saveStoryList(storyList);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Trigger an autosave\n\t\t\t\t$tw.rootWidget.dispatchEvent({type: \"tm-auto-save-wiki\"});\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\n// Take a tiddler out of edit mode without saving the changes\nNavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {\n\tevent = $tw.hooks.invokeHook(\"th-cancelling-tiddler\", event);\n\t// Flip the specified tiddler from draft back to the original\n\tvar draftTitle = event.param || event.tiddlerTitle,\n\t\tdraftTiddler = this.wiki.getTiddler(draftTitle),\n\t\toriginalTitle = draftTiddler && draftTiddler.fields[\"draft.of\"];\n\tif(draftTiddler && originalTitle) {\n\t\t// Ask for confirmation if the tiddler text has changed\n\t\tvar isConfirmed = true,\n\t\t\toriginalTiddler = this.wiki.getTiddler(originalTitle),\n\t\t\tstoryList = this.getStoryList();\n\t\tif(this.wiki.isDraftModified(draftTitle)) {\n\t\t\tisConfirmed = confirm($tw.language.getString(\n\t\t\t\t\"ConfirmCancelTiddler\",\n\t\t\t\t{variables:\n\t\t\t\t\t{title: draftTitle}\n\t\t\t\t}\n\t\t\t));\n\t\t}\n\t\t// Remove the draft tiddler\n\t\tif(isConfirmed) {\n\t\t\tthis.wiki.deleteTiddler(draftTitle);\n\t\t\tif(!event.paramObject || event.paramObject.suppressNavigation !== \"yes\") {\n\t\t\t\tif(originalTiddler) {\n\t\t\t\t\tthis.replaceFirstTitleInStory(storyList,draftTitle,originalTitle);\n\t\t\t\t\tthis.addToHistory(originalTitle,event.navigateFromClientRect);\n\t\t\t\t} else {\n\t\t\t\t\tthis.removeTitleFromStory(storyList,draftTitle);\n\t\t\t\t}\n\t\t\t\tthis.saveStoryList(storyList);\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\n// Create a new draft tiddler\n// event.param can either be the title of a template tiddler, or a hashmap of fields.\n//\n// The title of the newly created tiddler follows these rules:\n// * If a hashmap was used and a title field was specified, use that title\n// * If a hashmap was used without a title field, use a default title, if necessary making it unique with a numeric suffix\n// * If a template tiddler was used, use the title of the template, if necessary making it unique with a numeric suffix\n//\n// If a draft of the target tiddler already exists then it is reused\nNavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {\n\tevent = $tw.hooks.invokeHook(\"th-new-tiddler\", event);\n\t// Get the story details\n\tvar storyList = this.getStoryList(),\n\t\ttemplateTiddler, additionalFields, title, draftTitle, existingTiddler;\n\t// Get the template tiddler (if any)\n\tif(typeof event.param === \"string\") {\n\t\t// Get the template tiddler\n\t\ttemplateTiddler = this.wiki.getTiddler(event.param);\n\t\t// Generate a new title\n\t\ttitle = this.wiki.generateNewTitle(event.param || $tw.language.getString(\"DefaultNewTiddlerTitle\"));\n\t}\n\t// Get the specified additional fields\n\tif(typeof event.paramObject === \"object\") {\n\t\tadditionalFields = event.paramObject;\n\t}\n\tif(typeof event.param === \"object\") { // Backwards compatibility with 5.1.3\n\t\tadditionalFields = event.param;\n\t}\n\tif(additionalFields && additionalFields.title) {\n\t\ttitle = additionalFields.title;\n\t}\n\t// Make a copy of the additional fields excluding any blank ones\n\tvar filteredAdditionalFields = $tw.utils.extend({},additionalFields);\n\tObject.keys(filteredAdditionalFields).forEach(function(fieldName) {\n\t\tif(filteredAdditionalFields[fieldName] === \"\") {\n\t\t\tdelete filteredAdditionalFields[fieldName];\n\t\t}\n\t});\n\t// Generate a title if we don't have one\n\ttitle = title || this.wiki.generateNewTitle($tw.language.getString(\"DefaultNewTiddlerTitle\"));\n\t// Find any existing draft for this tiddler\n\tdraftTitle = this.wiki.findDraft(title);\n\t// Pull in any existing tiddler\n\tif(draftTitle) {\n\t\texistingTiddler = this.wiki.getTiddler(draftTitle);\n\t} else {\n\t\tdraftTitle = this.generateDraftTitle(title);\n\t\texistingTiddler = this.wiki.getTiddler(title);\n\t}\n\t// Merge the tags\n\tvar mergedTags = [];\n\tif(existingTiddler && existingTiddler.fields.tags) {\n\t\t$tw.utils.pushTop(mergedTags,existingTiddler.fields.tags);\n\t}\n\tif(additionalFields && additionalFields.tags) {\n\t\t// Merge tags\n\t\tmergedTags = $tw.utils.pushTop(mergedTags,$tw.utils.parseStringArray(additionalFields.tags));\n\t}\n\tif(templateTiddler && templateTiddler.fields.tags) {\n\t\t// Merge tags\n\t\tmergedTags = $tw.utils.pushTop(mergedTags,templateTiddler.fields.tags);\n\t}\n\t// Save the draft tiddler\n\tvar draftTiddler = new $tw.Tiddler({\n\t\t\ttext: \"\",\n\t\t\t\"draft.title\": title\n\t\t},\n\t\ttemplateTiddler,\n\t\tadditionalFields,\n\t\tthis.wiki.getCreationFields(),\n\t\texistingTiddler,\n\t\tfilteredAdditionalFields,\n\t\t{\n\t\t\ttitle: draftTitle,\n\t\t\t\"draft.of\": title,\n\t\t\ttags: mergedTags\n\t\t},this.wiki.getModificationFields());\n\tthis.wiki.addTiddler(draftTiddler);\n\t// Update the story to insert the new draft at the top and remove any existing tiddler\n\tif(storyList && storyList.indexOf(draftTitle) === -1) {\n\t\tvar slot = storyList.indexOf(event.navigateFromTitle);\n\t\tif(slot === -1) {\n\t\t\tslot = this.getAttribute(\"openLinkFromOutsideRiver\",\"top\") === \"bottom\" ? storyList.length - 1 : slot;\n\t\t}\n\t\tstoryList.splice(slot + 1,0,draftTitle);\n\t}\n\tif(storyList && storyList.indexOf(title) !== -1) {\n\t\tstoryList.splice(storyList.indexOf(title),1);\n\t}\n\tthis.saveStoryList(storyList);\n\t// Add a new record to the top of the history stack\n\tthis.addToHistory(draftTitle);\n\treturn false;\n};\n\n// Import JSON tiddlers into a pending import tiddler\nNavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {\n\t// Get the tiddlers\n\tvar tiddlers = [];\n\ttry {\n\t\ttiddlers = JSON.parse(event.param);\n\t} catch(e) {\n\t}\n\t// Get the current $:/Import tiddler\n\tvar importTitle = event.importTitle ? event.importTitle : IMPORT_TITLE,\n\t\timportTiddler = this.wiki.getTiddler(importTitle),\n\t\timportData = this.wiki.getTiddlerData(importTitle,{}),\n\t\tnewFields = new Object({\n\t\t\ttitle: importTitle,\n\t\t\ttype: \"application/json\",\n\t\t\t\"plugin-type\": \"import\",\n\t\t\t\"status\": \"pending\"\n\t\t}),\n\t\tincomingTiddlers = [];\n\t// Process each tiddler\n\timportData.tiddlers = importData.tiddlers || {};\n\t$tw.utils.each(tiddlers,function(tiddlerFields) {\n\t\ttiddlerFields.title = $tw.utils.trim(tiddlerFields.title);\n\t\tvar title = tiddlerFields.title;\n\t\tif(title) {\n\t\t\tincomingTiddlers.push(title);\n\t\t\timportData.tiddlers[title] = tiddlerFields;\n\t\t}\n\t});\n\t// Give the active upgrader modules a chance to process the incoming tiddlers\n\tvar messages = this.wiki.invokeUpgraders(incomingTiddlers,importData.tiddlers);\n\t// Deselect any disabled, but _not_ suppressed tiddlers\n\tvar systemMessage = $tw.language.getString(\"Import/Upgrader/Tiddler/Unselected\");\n\t$tw.utils.each(messages,function(message,title) {\n\t\tnewFields[\"message-\" + title] = message;\n\t\tif (message.indexOf(systemMessage) !== -1) {\n\t\t\tnewFields[\"selection-\" + title] = \"unchecked\";\n\t\t}\n\t});\n\t// Deselect suppressed tiddlers ... they have been removed and can't be selected anymore\n\t$tw.utils.each(importData.tiddlers,function(tiddler,title) {\n\t\tif($tw.utils.count(tiddler) === 0) {\n\t\t\tnewFields[\"selection-\" + title] = \"unchecked\";\n\t\t\tnewFields[\"suppressed-\" + title] = \"yes\";\n\t\t}\n\t});\n\t// Save the $:/Import tiddler\n\tnewFields.text = JSON.stringify(importData,null,$tw.config.preferences.jsonSpaces);\n\tthis.wiki.addTiddler(new $tw.Tiddler(importTiddler,newFields));\n\t// Update the story and history details\n\tvar autoOpenOnImport = event.autoOpenOnImport ? event.autoOpenOnImport : this.getVariable(\"tv-auto-open-on-import\"); \n\tif(autoOpenOnImport !== \"no\") {\n\t\tvar storyList = this.getStoryList(),\n\t\t\thistory = [];\n\t\t// Add it to the story\n\t\tif(storyList && storyList.indexOf(importTitle) === -1) {\n\t\t\tstoryList.unshift(importTitle);\n\t\t}\n\t\t// And to history\n\t\thistory.push(importTitle);\n\t\t// Save the updated story and history\n\t\tthis.saveStoryList(storyList);\n\t\tthis.addToHistory(history);\n\t}\n\treturn false;\n};\n\n//\nNavigatorWidget.prototype.handlePerformImportEvent = function(event) {\n\tvar self = this,\n\t\timportTiddler = this.wiki.getTiddler(event.param),\n\t\timportData,\n\t\timportReport = [];\n\timportReport.push($tw.language.getString(\"Import/Imported/Hint\") + \"\\n\");\n\t// If you need to modify the import tiddler payload then consider th-importing-tiddler instead\n\timportTiddler = $tw.hooks.invokeHook(\"th-before-importing\",importTiddler);\n\timportData = this.wiki.getTiddlerDataCached(event.param,{tiddlers: {}}),\n\t$tw.utils.each(importData.tiddlers,function(tiddlerFields) {\n\t\tvar title = tiddlerFields.title;\n\t\tif(title && importTiddler && importTiddler.fields[\"selection-\" + title] !== \"unchecked\") {\n\t\t\tif($tw.utils.hop(importTiddler.fields,[\"rename-\" + title])) {\n\t\t\t\tvar tiddler = new $tw.Tiddler(tiddlerFields,{title : importTiddler.fields[\"rename-\" + title]});\n\t\t\t} else {\n\t\t\t\tvar tiddler = new $tw.Tiddler(tiddlerFields);\n\t\t\t}\n\t\t\t// th-importing-tiddler doesn't allow user interaction by default\n\t\t\t// If you want to use the default UI then use: $:/core/modules/upgraders/ instead\n\t\t\ttiddler = $tw.hooks.invokeHook(\"th-importing-tiddler\",tiddler);\n\t\t\t// Add the tiddlers to the store\n\t\t\tself.wiki.addTiddler(tiddler);\n\t\t\timportReport.push(\"# [[\" + tiddler.fields.title + \"]]\");\n\t\t}\n\t});\n\t// Replace the $:/Import tiddler with an import report\n\tthis.wiki.addTiddler(new $tw.Tiddler({\n\t\ttitle: event.param,\n\t\ttext: importReport.join(\"\\n\"),\n\t\t\"status\": \"complete\"\n\t}));\n\t// Navigate to the $:/Import tiddler\n\tthis.addToHistory([event.param]);\n\t// Trigger an autosave\n\t$tw.rootWidget.dispatchEvent({type: \"tm-auto-save-wiki\"});\n};\n\nNavigatorWidget.prototype.handleFoldTiddlerEvent = function(event) {\n\tvar paramObject = event.paramObject || {};\n\tif(paramObject.foldedState) {\n\t\tvar foldedState = this.wiki.getTiddlerText(paramObject.foldedState,\"show\") === \"show\" ? \"hide\" : \"show\";\n\t\tthis.wiki.setText(paramObject.foldedState,\"text\",null,foldedState);\n\t}\n};\n\nNavigatorWidget.prototype.handleFoldOtherTiddlersEvent = function(event) {\n\tvar self = this,\n\t\tparamObject = event.paramObject || {},\n\t\tprefix = paramObject.foldedStatePrefix;\n\t$tw.utils.each(this.getStoryList(),function(title) {\n\t\tself.wiki.setText(prefix + title,\"text\",null,event.param === title ? \"show\" : \"hide\");\n\t});\n};\n\nNavigatorWidget.prototype.handleFoldAllTiddlersEvent = function(event) {\n\tvar self = this,\n\t\tparamObject = event.paramObject || {},\n\t\tprefix = paramObject.foldedStatePrefix || \"$:/state/folded/\";\n\t$tw.utils.each(this.getStoryList(),function(title) {\n\t\tself.wiki.setText(prefix + title,\"text\",null,\"hide\");\n\t});\n};\n\nNavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) {\n\tvar self = this,\n\t\tparamObject = event.paramObject || {},\n\t\tprefix = paramObject.foldedStatePrefix;\n\t$tw.utils.each(this.getStoryList(),function(title) {\n\t\tself.wiki.setText(prefix + title,\"text\",null,\"show\");\n\t});\n};\n\nNavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) {\n\tvar options = {},\n\t\tparamObject = event.paramObject || {},\n\t\tfrom = paramObject.from || event.tiddlerTitle,\n\t\tto = paramObject.to;\n\toptions.dontRenameInTags = (paramObject.renameInTags === \"false\" || paramObject.renameInTags === \"no\") ? true : false;\n\toptions.dontRenameInLists = (paramObject.renameInLists === \"false\" || paramObject.renameInLists === \"no\") ? true : false;\n\tthis.wiki.renameTiddler(from,to,options);\n};\n\nexports.navigator = NavigatorWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/password.js": {
"title": "$:/core/modules/widgets/password.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/password.js\ntype: application/javascript\nmodule-type: widget\n\nPassword widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar PasswordWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nPasswordWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nPasswordWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Get the current password\n\tvar password = $tw.browser ? $tw.utils.getPassword(this.passwordName) || \"\" : \"\";\n\t// Create our element\n\tvar domNode = this.document.createElement(\"input\");\n\tdomNode.setAttribute(\"type\",\"password\");\n\tdomNode.setAttribute(\"value\",password);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(domNode,[\n\t\t{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n\t// Insert the label into the DOM and render any children\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tthis.domNodes.push(domNode);\n};\n\nPasswordWidget.prototype.handleChangeEvent = function(event) {\n\tvar password = this.domNodes[0].value;\n\treturn $tw.utils.savePassword(this.passwordName,password);\n};\n\n/*\nCompute the internal state of the widget\n*/\nPasswordWidget.prototype.execute = function() {\n\t// Get the parameters from the attributes\n\tthis.passwordName = this.getAttribute(\"name\",\"\");\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nPasswordWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.name) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.password = PasswordWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/qualify.js": {
"title": "$:/core/modules/widgets/qualify.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/qualify.js\ntype: application/javascript\nmodule-type: widget\n\nQualify text to a variable \n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar QualifyWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nQualifyWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nQualifyWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nQualifyWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.qualifyName = this.getAttribute(\"name\");\n\tthis.qualifyTitle = this.getAttribute(\"title\");\n\t// Set context variable\n\tif(this.qualifyName) {\n\t\tthis.setVariable(this.qualifyName,this.qualifyTitle + \"-\" + this.getStateQualifier());\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nQualifyWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.name || changedAttributes.title) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.qualify = QualifyWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/radio.js": {
"title": "$:/core/modules/widgets/radio.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/radio.js\ntype: application/javascript\nmodule-type: widget\n\nSet a field or index at a given tiddler via radio buttons\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\nvar RadioWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nRadioWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nRadioWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\tvar isChecked = this.getValue() === this.radioValue;\n\t// Create our elements\n\tthis.labelDomNode = this.document.createElement(\"label\");\n\tthis.labelDomNode.setAttribute(\"class\",\n\t\t\"tc-radio \" + this.radioClass + (isChecked ? \" tc-radio-selected\" : \"\")\n\t);\n\tthis.inputDomNode = this.document.createElement(\"input\");\n\tthis.inputDomNode.setAttribute(\"type\",\"radio\");\n\tif(isChecked) {\n\t\tthis.inputDomNode.checked = true;\n\t}\n\tif(this.isDisabled === \"yes\") {\n\t\tthis.inputDomNode.setAttribute(\"disabled\",true);\n\t}\n\tthis.labelDomNode.appendChild(this.inputDomNode);\n\tthis.spanDomNode = this.document.createElement(\"span\");\n\tthis.labelDomNode.appendChild(this.spanDomNode);\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(this.inputDomNode,[\n\t\t{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n\t// Insert the label into the DOM and render any children\n\tparent.insertBefore(this.labelDomNode,nextSibling);\n\tthis.renderChildren(this.spanDomNode,null);\n\tthis.domNodes.push(this.labelDomNode);\n};\n\nRadioWidget.prototype.getValue = function() {\n\tvar value,\n\t\ttiddler = this.wiki.getTiddler(this.radioTitle);\n\tif(tiddler) {\n\t\tif(this.radioIndex) {\n\t\t\tvalue = this.wiki.extractTiddlerDataItem(this.radioTitle,this.radioIndex);\n\t\t} else {\n\t\t\tvalue = tiddler.getFieldString(this.radioField);\n\t\t}\n\t} else {\n\t\tvalue = this.radioDefault;\n\t}\n\treturn value;\n};\n\nRadioWidget.prototype.setValue = function() {\n\tif(this.radioIndex) {\n\t\tthis.wiki.setText(this.radioTitle,\"\",this.radioIndex,this.radioValue);\n\t} else {\n\t\tvar tiddler = this.wiki.getTiddler(this.radioTitle),\n\t\t\taddition = {};\n\t\taddition[this.radioField] = this.radioValue;\n\t\tthis.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),{title: this.radioTitle},tiddler,addition,this.wiki.getModificationFields()));\n\t}\n};\n\nRadioWidget.prototype.handleChangeEvent = function(event) {\n\tif(this.inputDomNode.checked) {\n\t\tthis.setValue();\n\t}\n\t// Trigger actions\n\tif(this.radioActions) {\n\t\tthis.invokeActionString(this.radioActions,this,event,{\"actionValue\": this.radioValue});\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nRadioWidget.prototype.execute = function() {\n\t// Get the parameters from the attributes\n\tthis.radioTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.radioField = this.getAttribute(\"field\",\"text\");\n\tthis.radioIndex = this.getAttribute(\"index\");\n\tthis.radioValue = this.getAttribute(\"value\");\n\tthis.radioClass = this.getAttribute(\"class\",\"\");\n\tthis.radioDefault = this.getAttribute(\"default\");\n\tthis.isDisabled = this.getAttribute(\"disabled\",\"no\");\n\tthis.radioActions = this.getAttribute(\"actions\",\"\");\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nRadioWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(($tw.utils.count(changedAttributes) > 0)) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else if(changedTiddlers[this.radioTitle]) {\n\t\tthis.inputDomNode.checked = this.getValue() === this.radioValue;\n\t\treturn this.refreshChildren(changedTiddlers);\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.radio = RadioWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/range.js": {
"title": "$:/core/modules/widgets/range.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/range.js\ntype: application/javascript\nmodule-type: widget\n\nRange widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar RangeWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nRangeWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nRangeWidget.prototype.render = function(parent,nextSibling) {\n\t// Save the parent dom node\n\tthis.parentDomNode = parent;\n\t// Compute our attributes\n\tthis.computeAttributes();\n\t// Execute our logic\n\tthis.execute();\n\t// Create our elements\n\tthis.inputDomNode = this.document.createElement(\"input\");\n\tthis.inputDomNode.setAttribute(\"type\",\"range\");\n\tthis.inputDomNode.setAttribute(\"class\",this.elementClass);\n\tif(this.minValue){\n\t\tthis.inputDomNode.setAttribute(\"min\", this.minValue);\n\t}\n\tif(this.maxValue){\n\t\tthis.inputDomNode.setAttribute(\"max\", this.maxValue);\n\t}\n\tif(this.increment){\n\t\tthis.inputDomNode.setAttribute(\"step\", this.increment);\n\t}\n\tif(this.isDisabled === \"yes\") {\n\t\tthis.inputDomNode.setAttribute(\"disabled\",true);\n\t}\n\tthis.inputDomNode.value = this.getValue();\n\t// Add a click event handler\n\t$tw.utils.addEventListeners(this.inputDomNode,[\n\t\t{name:\"mousedown\", handlerObject:this, handlerMethod:\"handleMouseDownEvent\"},\n\t\t{name:\"mouseup\", handlerObject:this, handlerMethod:\"handleMouseUpEvent\"},\n\t\t{name:\"change\", handlerObject:this, handlerMethod:\"handleChangeEvent\"},\n\t\t{name:\"input\", handlerObject:this, handlerMethod:\"handleInputEvent\"},\n\t]);\n\t// Insert the label into the DOM and render any children\n\tparent.insertBefore(this.inputDomNode,nextSibling);\n\tthis.domNodes.push(this.inputDomNode);\n};\n\nRangeWidget.prototype.getValue = function() {\n\tvar tiddler = this.wiki.getTiddler(this.tiddlerTitle),\n\t\tfieldName = this.tiddlerField,\n\t\tvalue = this.defaultValue;\n\tif(tiddler) {\n\t\tif(this.tiddlerIndex) {\n\t\t\tvalue = this.wiki.extractTiddlerDataItem(tiddler,this.tiddlerIndex,this.defaultValue);\n\t\t} else {\n\t\t\tif($tw.utils.hop(tiddler.fields,fieldName)) {\n\t\t\t\tvalue = tiddler.fields[fieldName] || \"\";\n\t\t\t} else {\n\t\t\t\tvalue = this.defaultValue;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n\nRangeWidget.prototype.getActionVariables = function(options) {\n\toptions = options || {};\n\tvar hasChanged = (this.startValue !== this.inputDomNode.value) ? \"yes\" : \"no\";\n\t// Trigger actions. Use variables = {key:value, key:value ...}\n\t// the \"value\" is needed.\n\treturn $tw.utils.extend({\"actionValue\": this.inputDomNode.value, \"actionValueHasChanged\": hasChanged}, options);\n}\n\n// actionsStart\nRangeWidget.prototype.handleMouseDownEvent = function(event) {\n\tthis.mouseDown = true; // TODO remove once IE is gone.\n\tthis.startValue = this.inputDomNode.value; // TODO remove this line once IE is gone!\n\tthis.handleEvent(event);\n\t// Trigger actions\n\tif(this.actionsMouseDown) {\n\t\tvar variables = this.getActionVariables() // TODO this line will go into the function call below.\n\t\tthis.invokeActionString(this.actionsMouseDown,this,event,variables);\n\t}\n}\n\n// actionsStop\nRangeWidget.prototype.handleMouseUpEvent = function(event) {\n\tthis.mouseDown = false; // TODO remove once IE is gone.\n\tthis.handleEvent(event);\n\t// Trigger actions\n\tif(this.actionsMouseUp) {\n\t\tvar variables = this.getActionVariables()\n\t\tthis.invokeActionString(this.actionsMouseUp,this,event,variables);\n\t}\n\t// TODO remove the following if() once IE is gone!\n\tif ($tw.browser.isIE) {\n\t\tif (this.startValue !== this.inputDomNode.value) {\n\t\t\tthis.handleChangeEvent(event);\n\t\t\tthis.startValue = this.inputDomNode.value;\n\t\t}\n\t}\n}\n\nRangeWidget.prototype.handleChangeEvent = function(event) {\n\tif (this.mouseDown) { // TODO refactor this function once IE is gone.\n\t\tthis.handleInputEvent(event);\n\t}\n};\n\nRangeWidget.prototype.handleInputEvent = function(event) {\n\tthis.handleEvent(event);\n\t// Trigger actions\n\tif(this.actionsInput) {\n\t\t// \"tiddler\" parameter may be missing. See .execute() below\n\t\tvar variables = this.getActionVariables({\"actionValueHasChanged\": \"yes\"}) // TODO this line will go into the function call below.\n\t\tthis.invokeActionString(this.actionsInput,this,event,variables);\n\t}\n};\n\nRangeWidget.prototype.handleEvent = function(event) {\n\tif(this.getValue() !== this.inputDomNode.value) {\n\t\tif(this.tiddlerIndex) {\n\t\t\tthis.wiki.setText(this.tiddlerTitle,\"\",this.tiddlerIndex,this.inputDomNode.value);\n\t\t} else {\n\t\t\tthis.wiki.setText(this.tiddlerTitle,this.tiddlerField,null,this.inputDomNode.value);\n\t\t}\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nRangeWidget.prototype.execute = function() {\n\t// TODO remove the next 1 lines once IE is gone!\n\tthis.mouseUp = true; // Needed for IE10\n\t// Get the parameters from the attributes\n\tthis.tiddlerTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.tiddlerField = this.getAttribute(\"field\",\"text\");\n\tthis.tiddlerIndex = this.getAttribute(\"index\");\n\tthis.minValue = this.getAttribute(\"min\");\n\tthis.maxValue = this.getAttribute(\"max\");\n\tthis.increment = this.getAttribute(\"increment\");\n\tthis.defaultValue = this.getAttribute(\"default\",\"\");\n\tthis.elementClass = this.getAttribute(\"class\",\"\");\n\tthis.isDisabled = this.getAttribute(\"disabled\",\"no\");\n\t// Actions since 5.1.23\n\t// Next 2 only fire once!\n\tthis.actionsMouseDown = this.getAttribute(\"actionsStart\",\"\");\n\tthis.actionsMouseUp = this.getAttribute(\"actionsStop\",\"\");\n\t// Input fires very often!\n\tthis.actionsInput = this.getAttribute(\"actions\",\"\");\n\t// Make the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nRangeWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif($tw.utils.count(changedAttributes) > 0) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\tvar refreshed = false;\n\t\tif(changedTiddlers[this.tiddlerTitle]) {\n\t\t\tvar value = this.getValue();\n\t\t\tif(this.inputDomNode.value !== value) {\n\t\t\t\tthis.inputDomNode.value = value;\n\t\t\t}\n\t\t\trefreshed = true;\n\t\t}\n\t\treturn this.refreshChildren(changedTiddlers) || refreshed;\n\t}\n};\n\nexports.range = RangeWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/raw.js": {
"title": "$:/core/modules/widgets/raw.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/raw.js\ntype: application/javascript\nmodule-type: widget\n\nRaw widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar RawWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nRawWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nRawWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.execute();\n\tvar div = this.document.createElement(\"div\");\n\tdiv.innerHTML=this.parseTreeNode.html;\n\tparent.insertBefore(div,nextSibling);\n\tthis.domNodes.push(div);\n};\n\n/*\nCompute the internal state of the widget\n*/\nRawWidget.prototype.execute = function() {\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nRawWidget.prototype.refresh = function(changedTiddlers) {\n\treturn false;\n};\n\nexports.raw = RawWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/reveal.js": {
"title": "$:/core/modules/widgets/reveal.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/reveal.js\ntype: application/javascript\nmodule-type: widget\n\nReveal widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar RevealWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nRevealWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nRevealWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar tag = this.parseTreeNode.isBlock ? \"div\" : \"span\";\n\tif(this.revealTag && $tw.config.htmlUnsafeElements.indexOf(this.revealTag) === -1) {\n\t\ttag = this.revealTag;\n\t}\n\tvar domNode = this.document.createElement(tag);\n\tthis.domNode = domNode;\n\tthis.assignDomNodeClasses();\n\tif(this.style) {\n\t\tdomNode.setAttribute(\"style\",this.style);\n\t}\n\tparent.insertBefore(domNode,nextSibling);\n\tthis.renderChildren(domNode,null);\n\tif(!domNode.isTiddlyWikiFakeDom && this.type === \"popup\" && this.isOpen) {\n\t\tthis.positionPopup(domNode);\n\t\t$tw.utils.addClass(domNode,\"tc-popup\"); // Make sure that clicks don't dismiss popups within the revealed content\n\t}\n\tif(!this.isOpen) {\n\t\tdomNode.setAttribute(\"hidden\",\"true\");\n\t}\n\tthis.domNodes.push(domNode);\n};\n\nRevealWidget.prototype.positionPopup = function(domNode) {\n\tdomNode.style.position = \"absolute\";\n\tdomNode.style.zIndex = \"1000\";\n\tvar left,top;\n\tswitch(this.position) {\n\t\tcase \"left\":\n\t\t\tleft = this.popup.left - domNode.offsetWidth;\n\t\t\ttop = this.popup.top;\n\t\t\tbreak;\n\t\tcase \"above\":\n\t\t\tleft = this.popup.left;\n\t\t\ttop = this.popup.top - domNode.offsetHeight;\n\t\t\tbreak;\n\t\tcase \"aboveright\":\n\t\t\tleft = this.popup.left + this.popup.width;\n\t\t\ttop = this.popup.top + this.popup.height - domNode.offsetHeight;\n\t\t\tbreak;\n\t\tcase \"belowright\":\n\t\t\tleft = this.popup.left + this.popup.width;\n\t\t\ttop = this.popup.top + this.popup.height;\n\t\t\tbreak;\n\t\tcase \"right\":\n\t\t\tleft = this.popup.left + this.popup.width;\n\t\t\ttop = this.popup.top;\n\t\t\tbreak;\n\t\tcase \"belowleft\":\n\t\t\tleft = this.popup.left + this.popup.width - domNode.offsetWidth;\n\t\t\ttop = this.popup.top + this.popup.height;\n\t\t\tbreak;\n\t\tcase \"aboveleft\":\n\t\t\tleft = this.popup.left - domNode.offsetWidth;\n\t\t\ttop = this.popup.top - domNode.offsetHeight;\n\t\t\tbreak;\n\t\tdefault: // Below\n\t\t\tleft = this.popup.left;\n\t\t\ttop = this.popup.top + this.popup.height;\n\t\t\tbreak;\n\t}\n\tif(!this.positionAllowNegative) {\n\t\tleft = Math.max(0,left);\n\t\ttop = Math.max(0,top);\n\t}\n\tdomNode.style.left = left + \"px\";\n\tdomNode.style.top = top + \"px\";\n};\n\n/*\nCompute the internal state of the widget\n*/\nRevealWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.state = this.getAttribute(\"state\");\n\tthis.revealTag = this.getAttribute(\"tag\");\n\tthis.type = this.getAttribute(\"type\");\n\tthis.text = this.getAttribute(\"text\");\n\tthis.position = this.getAttribute(\"position\");\n\tthis.positionAllowNegative = this.getAttribute(\"positionAllowNegative\") === \"yes\";\n\t// class attribute handled in assignDomNodeClasses()\n\tthis.style = this.getAttribute(\"style\",\"\");\n\tthis[\"default\"] = this.getAttribute(\"default\",\"\");\n\tthis.animate = this.getAttribute(\"animate\",\"no\");\n\tthis.retain = this.getAttribute(\"retain\",\"no\");\n\tthis.openAnimation = this.animate === \"no\" ? undefined : \"open\";\n\tthis.closeAnimation = this.animate === \"no\" ? undefined : \"close\";\n\tthis.updatePopupPosition = this.getAttribute(\"updatePopupPosition\",\"no\") === \"yes\";\n\t// Compute the title of the state tiddler and read it\n\tthis.stateTiddlerTitle = this.state;\n\tthis.stateTitle = this.getAttribute(\"stateTitle\");\n\tthis.stateField = this.getAttribute(\"stateField\");\n\tthis.stateIndex = this.getAttribute(\"stateIndex\");\n\tthis.readState();\n\t// Construct the child widgets\n\tvar childNodes = this.isOpen ? this.parseTreeNode.children : [];\n\tthis.hasChildNodes = this.isOpen;\n\tthis.makeChildWidgets(childNodes);\n};\n\n/*\nRead the state tiddler\n*/\nRevealWidget.prototype.readState = function() {\n\t// Read the information from the state tiddler\n\tvar state,\n\t defaultState = this[\"default\"];\n\tif(this.stateTitle) {\n\t\tvar stateTitleTiddler = this.wiki.getTiddler(this.stateTitle);\n\t\tif(this.stateField) {\n\t\t\tstate = stateTitleTiddler ? stateTitleTiddler.getFieldString(this.stateField) || defaultState : defaultState;\n\t\t} else if(this.stateIndex) {\n\t\t\tstate = stateTitleTiddler ? this.wiki.extractTiddlerDataItem(this.stateTitle,this.stateIndex) || defaultState : defaultState;\n\t\t} else if(stateTitleTiddler) {\n\t\t\tstate = this.wiki.getTiddlerText(this.stateTitle) || defaultState;\n\t\t} else {\n\t\t\tstate = defaultState;\n\t\t}\n\t} else {\n\t\tstate = this.stateTiddlerTitle ? this.wiki.getTextReference(this.state,this[\"default\"],this.getVariable(\"currentTiddler\")) : this[\"default\"];\n\t}\n\tif(state === null) {\n\t\tstate = this[\"default\"];\n\t}\n\tswitch(this.type) {\n\t\tcase \"popup\":\n\t\t\tthis.readPopupState(state);\n\t\t\tbreak;\n\t\tcase \"match\":\n\t\t\tthis.isOpen = this.text === state;\n\t\t\tbreak;\n\t\tcase \"nomatch\":\n\t\t\tthis.isOpen = this.text !== state;\n\t\t\tbreak;\n\t\tcase \"lt\":\n\t\t\tthis.isOpen = !!(this.compareStateText(state) < 0);\n\t\t\tbreak;\n\t\tcase \"gt\":\n\t\t\tthis.isOpen = !!(this.compareStateText(state) > 0);\n\t\t\tbreak;\n\t\tcase \"lteq\":\n\t\t\tthis.isOpen = !(this.compareStateText(state) > 0);\n\t\t\tbreak;\n\t\tcase \"gteq\":\n\t\t\tthis.isOpen = !(this.compareStateText(state) < 0);\n\t\t\tbreak;\n\t}\n};\n\nRevealWidget.prototype.compareStateText = function(state) {\n\treturn state.localeCompare(this.text,undefined,{numeric: true,sensitivity: \"case\"});\n};\n\nRevealWidget.prototype.readPopupState = function(state) {\n\tvar popupLocationRegExp = /^\\((-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+),(-?[0-9\\.E]+)\\)$/,\n\t\tmatch = popupLocationRegExp.exec(state);\n\t// Check if the state matches the location regexp\n\tif(match) {\n\t\t// If so, we're open\n\t\tthis.isOpen = true;\n\t\t// Get the location\n\t\tthis.popup = {\n\t\t\tleft: parseFloat(match[1]),\n\t\t\ttop: parseFloat(match[2]),\n\t\t\twidth: parseFloat(match[3]),\n\t\t\theight: parseFloat(match[4])\n\t\t};\n\t} else {\n\t\t// If not, we're closed\n\t\tthis.isOpen = false;\n\t}\n};\n\nRevealWidget.prototype.assignDomNodeClasses = function() {\n\tvar classes = this.getAttribute(\"class\",\"\").split(\" \");\n\tclasses.push(\"tc-reveal\");\n\tthis.domNode.className = classes.join(\" \");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nRevealWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.state || changedAttributes.type || changedAttributes.text || changedAttributes.position || changedAttributes.positionAllowNegative || changedAttributes[\"default\"] || changedAttributes.animate || changedAttributes.stateTitle || changedAttributes.stateField || changedAttributes.stateIndex) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\tvar currentlyOpen = this.isOpen;\n\t\tthis.readState();\n\t\tif(this.isOpen !== currentlyOpen) {\n\t\t\tif(this.retain === \"yes\") {\n\t\t\t\tthis.updateState();\n\t\t\t} else {\n\t\t\t\tthis.refreshSelf();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else if(this.type === \"popup\" && this.updatePopupPosition && (changedTiddlers[this.state] || changedTiddlers[this.stateTitle])) {\n\t\t\tthis.positionPopup(this.domNode);\n\t\t}\n\t\tif(changedAttributes.style) {\n\t\t\tthis.domNode.style = this.getAttribute(\"style\",\"\");\n\t\t}\n\t\tif(changedAttributes[\"class\"]) {\n\t\t\tthis.assignDomNodeClasses();\n\t\t}\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\n/*\nCalled by refresh() to dynamically show or hide the content\n*/\nRevealWidget.prototype.updateState = function() {\n\tvar self = this;\n\t// Read the current state\n\tthis.readState();\n\t// Construct the child nodes if needed\n\tvar domNode = this.domNodes[0];\n\tif(this.isOpen && !this.hasChildNodes) {\n\t\tthis.hasChildNodes = true;\n\t\tthis.makeChildWidgets(this.parseTreeNode.children);\n\t\tthis.renderChildren(domNode,null);\n\t}\n\t// Animate our DOM node\n\tif(!domNode.isTiddlyWikiFakeDom && this.type === \"popup\" && this.isOpen) {\n\t\tthis.positionPopup(domNode);\n\t\t$tw.utils.addClass(domNode,\"tc-popup\"); // Make sure that clicks don't dismiss popups within the revealed content\n\n\t}\n\tif(this.isOpen) {\n\t\tdomNode.removeAttribute(\"hidden\");\n $tw.anim.perform(this.openAnimation,domNode);\n\t} else {\n\t\t$tw.anim.perform(this.closeAnimation,domNode,{callback: function() {\n\t\t\t//make sure that the state hasn't changed during the close animation\n\t\t\tself.readState()\n\t\t\tif(!self.isOpen) {\n\t\t\t\tdomNode.setAttribute(\"hidden\",\"true\");\n\t\t\t}\n\t\t}});\n\t}\n};\n\nexports.reveal = RevealWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/scrollable.js": {
"title": "$:/core/modules/widgets/scrollable.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/scrollable.js\ntype: application/javascript\nmodule-type: widget\n\nScrollable widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ScrollableWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nScrollableWidget.prototype = new Widget();\n\nScrollableWidget.prototype.cancelScroll = function() {\n\tif(this.idRequestFrame) {\n\t\tthis.cancelAnimationFrame.call(window,this.idRequestFrame);\n\t\tthis.idRequestFrame = null;\n\t}\n};\n\n/*\nHandle a scroll event\n*/\nScrollableWidget.prototype.handleScrollEvent = function(event) {\n\t// Pass the scroll event through if our offsetsize is larger than our scrollsize\n\tif(this.outerDomNode.scrollWidth <= this.outerDomNode.offsetWidth && this.outerDomNode.scrollHeight <= this.outerDomNode.offsetHeight && this.fallthrough === \"yes\") {\n\t\treturn true;\n\t}\n\tif(event.paramObject && event.paramObject.selector) {\n\t\tthis.scrollSelectorIntoView(null,event.paramObject.selector);\n\t} else {\n\t\tthis.scrollIntoView(event.target);\n\t}\n\treturn false; // Handled event\n};\n\n/*\nScroll an element into view\n*/\nScrollableWidget.prototype.scrollIntoView = function(element) {\n\tvar duration = $tw.utils.getAnimationDuration(),\n\tsrcWindow = element ? element.ownerDocument.defaultView : window;\n\tthis.cancelScroll();\n\tthis.startTime = Date.now();\n\tvar scrollPosition = {\n\t\tx: this.outerDomNode.scrollLeft,\n\t\ty: this.outerDomNode.scrollTop\n\t};\n\t// Get the client bounds of the element and adjust by the scroll position\n\tvar scrollableBounds = this.outerDomNode.getBoundingClientRect(),\n\t\tclientTargetBounds = element.getBoundingClientRect(),\n\t\tbounds = {\n\t\t\tleft: clientTargetBounds.left + scrollPosition.x - scrollableBounds.left,\n\t\t\ttop: clientTargetBounds.top + scrollPosition.y - scrollableBounds.top,\n\t\t\twidth: clientTargetBounds.width,\n\t\t\theight: clientTargetBounds.height\n\t\t};\n\t// We'll consider the horizontal and vertical scroll directions separately via this function\n\tvar getEndPos = function(targetPos,targetSize,currentPos,currentSize) {\n\t\t\t// If the target is already visible then stay where we are\n\t\t\tif(targetPos >= currentPos && (targetPos + targetSize) <= (currentPos + currentSize)) {\n\t\t\t\treturn currentPos;\n\t\t\t// If the target is above/left of the current view, then scroll to its top/left\n\t\t\t} else if(targetPos <= currentPos) {\n\t\t\t\treturn targetPos;\n\t\t\t// If the target is smaller than the window and the scroll position is too far up, then scroll till the target is at the bottom of the window\n\t\t\t} else if(targetSize < currentSize && currentPos < (targetPos + targetSize - currentSize)) {\n\t\t\t\treturn targetPos + targetSize - currentSize;\n\t\t\t// If the target is big, then just scroll to the top\n\t\t\t} else if(currentPos < targetPos) {\n\t\t\t\treturn targetPos;\n\t\t\t// Otherwise, stay where we are\n\t\t\t} else {\n\t\t\t\treturn currentPos;\n\t\t\t}\n\t\t},\n\t\tendX = getEndPos(bounds.left,bounds.width,scrollPosition.x,this.outerDomNode.offsetWidth),\n\t\tendY = getEndPos(bounds.top,bounds.height,scrollPosition.y,this.outerDomNode.offsetHeight);\n\t// Only scroll if necessary\n\tif(endX !== scrollPosition.x || endY !== scrollPosition.y) {\n\t\tvar self = this,\n\t\t\tdrawFrame;\n\t\tdrawFrame = function () {\n\t\t\tvar t;\n\t\t\tif(duration <= 0) {\n\t\t\t\tt = 1;\n\t\t\t} else {\n\t\t\t\tt = ((Date.now()) - self.startTime) / duration;\n\t\t\t}\n\t\t\tif(t >= 1) {\n\t\t\t\tself.cancelScroll();\n\t\t\t\tt = 1;\n\t\t\t}\n\t\t\tt = $tw.utils.slowInSlowOut(t);\n\t\t\tself.outerDomNode.scrollLeft = scrollPosition.x + (endX - scrollPosition.x) * t;\n\t\t\tself.outerDomNode.scrollTop = scrollPosition.y + (endY - scrollPosition.y) * t;\n\t\t\tif(t < 1) {\n\t\t\t\tself.idRequestFrame = self.requestAnimationFrame.call(srcWindow,drawFrame);\n\t\t\t}\n\t\t};\n\t\tdrawFrame();\n\t}\n};\n\nScrollableWidget.prototype.scrollSelectorIntoView = function(baseElement,selector,callback) {\n\tbaseElement = baseElement || document.body;\n\tvar element = baseElement.querySelector(selector);\n\tif(element) {\n\t\tthis.scrollIntoView(element,callback);\n\t}\n};\n\n/*\nRender this widget into the DOM\n*/\nScrollableWidget.prototype.render = function(parent,nextSibling) {\n\tvar self = this;\n\tthis.scaleFactor = 1;\n\tthis.addEventListeners([\n\t\t{type: \"tm-scroll\", handler: \"handleScrollEvent\"}\n\t]);\n\tif($tw.browser) {\n\t\tthis.requestAnimationFrame = window.requestAnimationFrame ||\n\t\t\twindow.webkitRequestAnimationFrame ||\n\t\t\twindow.mozRequestAnimationFrame ||\n\t\t\tfunction(callback) {\n\t\t\t\treturn window.setTimeout(callback, 1000/60);\n\t\t\t};\n\t\tthis.cancelAnimationFrame = window.cancelAnimationFrame ||\n\t\t\twindow.webkitCancelAnimationFrame ||\n\t\t\twindow.webkitCancelRequestAnimationFrame ||\n\t\t\twindow.mozCancelAnimationFrame ||\n\t\t\twindow.mozCancelRequestAnimationFrame ||\n\t\t\tfunction(id) {\n\t\t\t\twindow.clearTimeout(id);\n\t\t\t};\n\t}\n\t// Remember parent\n\tthis.parentDomNode = parent;\n\t// Compute attributes and execute state\n\tthis.computeAttributes();\n\tthis.execute();\n\t// Create elements\n\tthis.outerDomNode = this.document.createElement(\"div\");\n\t$tw.utils.setStyle(this.outerDomNode,[\n\t\t{overflowY: \"auto\"},\n\t\t{overflowX: \"auto\"},\n\t\t{webkitOverflowScrolling: \"touch\"}\n\t]);\n\tthis.innerDomNode = this.document.createElement(\"div\");\n\tthis.outerDomNode.appendChild(this.innerDomNode);\n\t// Assign classes\n\tthis.outerDomNode.className = this[\"class\"] || \"\";\n\t// Insert element\n\tparent.insertBefore(this.outerDomNode,nextSibling);\n\tthis.renderChildren(this.innerDomNode,null);\n\tthis.domNodes.push(this.outerDomNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nScrollableWidget.prototype.execute = function() {\n\t// Get attributes\n\tthis.fallthrough = this.getAttribute(\"fallthrough\",\"yes\");\n\tthis[\"class\"] = this.getAttribute(\"class\");\n\t// Make child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nScrollableWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes[\"class\"]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports.scrollable = ScrollableWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/select.js": {
"title": "$:/core/modules/widgets/select.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/select.js\ntype: application/javascript\nmodule-type: widget\n\nSelect widget:\n\n```\n<$select tiddler=\"MyTiddler\" field=\"text\">\n<$list filter=\"[tag[chapter]]\">\n<option value=<<currentTiddler>>>\n<$view field=\"description\"/>\n</option>\n</$list>\n</$select>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar SelectWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nSelectWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nSelectWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n\tthis.setSelectValue();\n\t$tw.utils.addEventListeners(this.getSelectDomNode(),[\n\t\t{name: \"change\", handlerObject: this, handlerMethod: \"handleChangeEvent\"}\n\t]);\n};\n\n/*\nHandle a change event\n*/\nSelectWidget.prototype.handleChangeEvent = function(event) {\n\t// Get the new value and assign it to the tiddler\n\tif(this.selectMultiple == false) {\n\t\tvar value = this.getSelectDomNode().value;\n\t} else {\n\t\tvar value = this.getSelectValues()\n\t\t\t\tvalue = $tw.utils.stringifyList(value);\n\t}\n\tthis.wiki.setText(this.selectTitle,this.selectField,this.selectIndex,value);\n\t// Trigger actions\n\tif(this.selectActions) {\n\t\tthis.invokeActionString(this.selectActions,this,event);\n\t}\n};\n\n/*\nIf necessary, set the value of the select element to the current value\n*/\nSelectWidget.prototype.setSelectValue = function() {\n\tvar value = this.selectDefault;\n\t// Get the value\n\tif(this.selectIndex) {\n\t\tvalue = this.wiki.extractTiddlerDataItem(this.selectTitle,this.selectIndex,value);\n\t} else {\n\t\tvar tiddler = this.wiki.getTiddler(this.selectTitle);\n\t\tif(tiddler) {\n\t\t\tif(this.selectField === \"text\") {\n\t\t\t\t// Calling getTiddlerText() triggers lazy loading of skinny tiddlers\n\t\t\t\tvalue = this.wiki.getTiddlerText(this.selectTitle);\n\t\t\t} else {\n\t\t\t\tif($tw.utils.hop(tiddler.fields,this.selectField)) {\n\t\t\t\t\tvalue = tiddler.getFieldString(this.selectField);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif(this.selectField === \"title\") {\n\t\t\t\tvalue = this.selectTitle;\n\t\t\t}\n\t\t}\n\t}\n\t// Assign it to the select element if it's different than the current value\n\tif (this.selectMultiple) {\n\t\tvalue = value === undefined ? \"\" : value;\n\t\tvar select = this.getSelectDomNode();\n\t\tvar values = Array.isArray(value) ? value : $tw.utils.parseStringArray(value);\n\t\tfor(var i=0; i < select.children.length; i++){\n\t\t\tselect.children[i].selected = values.indexOf(select.children[i].value) !== -1\n\t\t}\n\t} else {\n\t\tvar domNode = this.getSelectDomNode();\n\t\tif(domNode.value !== value) {\n\t\t\tdomNode.value = value;\n\t\t}\n\t}\n};\n\n/*\nGet the DOM node of the select element\n*/\nSelectWidget.prototype.getSelectDomNode = function() {\n\treturn this.children[0].domNodes[0];\n};\n\n// Return an array of the selected opion values\n// select is an HTML select element\nSelectWidget.prototype.getSelectValues = function() {\n\tvar select, result, options, opt;\n\tselect = this.getSelectDomNode();\n\tresult = [];\n\toptions = select && select.options;\n\tfor (var i=0; i<options.length; i++) {\n\t\topt = options[i];\n\t\tif (opt.selected) {\n\t\t\tresult.push(opt.value || opt.text);\n\t\t}\n\t}\n\treturn result;\n}\n\n/*\nCompute the internal state of the widget\n*/\nSelectWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.selectActions = this.getAttribute(\"actions\");\n\tthis.selectTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.selectField = this.getAttribute(\"field\",\"text\");\n\tthis.selectIndex = this.getAttribute(\"index\");\n\tthis.selectClass = this.getAttribute(\"class\");\n\tthis.selectDefault = this.getAttribute(\"default\");\n\tthis.selectMultiple = this.getAttribute(\"multiple\", false);\n\tthis.selectSize = this.getAttribute(\"size\");\n\tthis.selectTooltip = this.getAttribute(\"tooltip\");\n\t// Make the child widgets\n\tvar selectNode = {\n\t\ttype: \"element\",\n\t\ttag: \"select\",\n\t\tchildren: this.parseTreeNode.children\n\t};\n\tif(this.selectClass) {\n\t\t$tw.utils.addAttributeToParseTreeNode(selectNode,\"class\",this.selectClass);\n\t}\n\tif(this.selectMultiple) {\n\t\t$tw.utils.addAttributeToParseTreeNode(selectNode,\"multiple\",\"multiple\");\n\t}\n\tif(this.selectSize) {\n\t\t$tw.utils.addAttributeToParseTreeNode(selectNode,\"size\",this.selectSize);\n\t}\n\tif(this.selectTooltip) {\n\t\t$tw.utils.addAttributeToParseTreeNode(selectNode,\"title\",this.selectTooltip);\n\t}\n\tthis.makeChildWidgets([selectNode]);\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nSelectWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\t// If we're using a different tiddler/field/index then completely refresh ourselves\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t// If the target tiddler value has changed, just update setting and refresh the children\n\t} else {\n\t\tvar childrenRefreshed = this.refreshChildren(changedTiddlers);\n\t\tif(changedTiddlers[this.selectTitle] || childrenRefreshed) {\n\t\t\tthis.setSelectValue();\n\t\t} \n\t\treturn childrenRefreshed;\n\t}\n};\n\nexports.select = SelectWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/set.js": {
"title": "$:/core/modules/widgets/set.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/set.js\ntype: application/javascript\nmodule-type: widget\n\nSet variable widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar SetWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nSetWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nSetWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nSetWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.setName = this.getAttribute(\"name\",\"currentTiddler\");\n\tthis.setFilter = this.getAttribute(\"filter\");\n\tthis.setSelect = this.getAttribute(\"select\");\n\tthis.setTiddler = this.getAttribute(\"tiddler\");\n\tthis.setSubTiddler = this.getAttribute(\"subtiddler\");\n\tthis.setField = this.getAttribute(\"field\");\n\tthis.setIndex = this.getAttribute(\"index\");\n\tthis.setValue = this.getAttribute(\"value\");\n\tthis.setEmptyValue = this.getAttribute(\"emptyValue\");\n\t// Set context variable\n\tthis.setVariable(this.setName,this.getValue(),this.parseTreeNode.params,!!this.parseTreeNode.isMacroDefinition);\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nGet the value to be assigned\n*/\nSetWidget.prototype.getValue = function() {\n\tvar value = this.setValue;\n\tif(this.setTiddler) {\n\t\tvar tiddler;\n\t\tif(this.setSubTiddler) {\n\t\t\ttiddler = this.wiki.getSubTiddler(this.setTiddler,this.setSubTiddler);\n\t\t} else {\n\t\t\ttiddler = this.wiki.getTiddler(this.setTiddler);\n\t\t}\n\t\tif(!tiddler) {\n\t\t\tvalue = this.setEmptyValue;\n\t\t} else if(this.setField) {\n\t\t\tvalue = tiddler.getFieldString(this.setField) || this.setEmptyValue;\n\t\t} else if(this.setIndex) {\n\t\t\tvalue = this.wiki.extractTiddlerDataItem(this.setTiddler,this.setIndex,this.setEmptyValue);\n\t\t} else {\n\t\t\tvalue = tiddler.fields.text || this.setEmptyValue ;\n\t\t}\n\t} else if(this.setFilter) {\n\t\tvar results = this.wiki.filterTiddlers(this.setFilter,this);\n\t\tif(this.setValue == null) {\n\t\t\tvar select;\n\t\t\tif(this.setSelect) {\n\t\t\t\tselect = parseInt(this.setSelect,10);\n\t\t\t}\n\t\t\tif(select !== undefined) {\n\t\t\t\tvalue = results[select] || \"\";\n\t\t\t} else {\n\t\t\t\tvalue = $tw.utils.stringifyList(results);\n\t\t\t}\n\t\t}\n\t\tif(results.length === 0 && this.setEmptyValue !== undefined) {\n\t\t\tvalue = this.setEmptyValue;\n\t\t}\n\t} else if(!value && this.setEmptyValue) {\n\t\tvalue = this.setEmptyValue;\n\t}\n\treturn value || \"\";\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nSetWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.name || changedAttributes.filter || changedAttributes.select || changedAttributes.tiddler || (this.setTiddler && changedTiddlers[this.setTiddler]) || changedAttributes.field || changedAttributes.index || changedAttributes.value || changedAttributes.emptyValue ||\n\t (this.setFilter && this.getValue() != this.variables[this.setName].value)) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.setvariable = SetWidget;\nexports.set = SetWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/text.js": {
"title": "$:/core/modules/widgets/text.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/text.js\ntype: application/javascript\nmodule-type: widget\n\nText node widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar TextNodeWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nTextNodeWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nTextNodeWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tvar text = this.getAttribute(\"text\",this.parseTreeNode.text || \"\");\n\ttext = text.replace(/\\r/mg,\"\");\n\tvar textNode = this.document.createTextNode(text);\n\tparent.insertBefore(textNode,nextSibling);\n\tthis.domNodes.push(textNode);\n};\n\n/*\nCompute the internal state of the widget\n*/\nTextNodeWidget.prototype.execute = function() {\n\t// Nothing to do for a text node\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nTextNodeWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.text) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\nexports.text = TextNodeWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/tiddler.js": {
"title": "$:/core/modules/widgets/tiddler.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/tiddler.js\ntype: application/javascript\nmodule-type: widget\n\nTiddler widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar TiddlerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nTiddlerWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nTiddlerWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nTiddlerWidget.prototype.execute = function() {\n\tthis.tiddlerState = this.computeTiddlerState();\n\tthis.setVariable(\"currentTiddler\",this.tiddlerState.currentTiddler);\n\tthis.setVariable(\"missingTiddlerClass\",this.tiddlerState.missingTiddlerClass);\n\tthis.setVariable(\"shadowTiddlerClass\",this.tiddlerState.shadowTiddlerClass);\n\tthis.setVariable(\"systemTiddlerClass\",this.tiddlerState.systemTiddlerClass);\n\tthis.setVariable(\"tiddlerTagClasses\",this.tiddlerState.tiddlerTagClasses);\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nCompute the tiddler state flags\n*/\nTiddlerWidget.prototype.computeTiddlerState = function() {\n\t// Get our parameters\n\tthis.tiddlerTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\t// Compute the state\n\tvar state = {\n\t\tcurrentTiddler: this.tiddlerTitle || \"\",\n\t\tmissingTiddlerClass: (this.wiki.tiddlerExists(this.tiddlerTitle) || this.wiki.isShadowTiddler(this.tiddlerTitle)) ? \"tc-tiddler-exists\" : \"tc-tiddler-missing\",\n\t\tshadowTiddlerClass: this.wiki.isShadowTiddler(this.tiddlerTitle) ? \"tc-tiddler-shadow\" : \"\",\n\t\tsystemTiddlerClass: this.wiki.isSystemTiddler(this.tiddlerTitle) ? \"tc-tiddler-system\" : \"\",\n\t\ttiddlerTagClasses: this.getTagClasses()\n\t};\n\t// Compute a simple hash to make it easier to detect changes\n\tstate.hash = state.currentTiddler + state.missingTiddlerClass + state.shadowTiddlerClass + state.systemTiddlerClass + state.tiddlerTagClasses;\n\treturn state;\n};\n\n/*\nCreate a string of CSS classes derived from the tags of the current tiddler\n*/\nTiddlerWidget.prototype.getTagClasses = function() {\n\tvar tiddler = this.wiki.getTiddler(this.tiddlerTitle);\n\tif(tiddler) {\n\t\tvar tags = [];\n\t\t$tw.utils.each(tiddler.fields.tags,function(tag) {\n\t\t\ttags.push(\"tc-tagged-\" + encodeURIComponent(tag));\n\t\t});\n\t\treturn tags.join(\" \");\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nTiddlerWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes(),\n\t\tnewTiddlerState = this.computeTiddlerState();\n\tif(changedAttributes.tiddler || newTiddlerState.hash !== this.tiddlerState.hash) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.tiddler = TiddlerWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/transclude.js": {
"title": "$:/core/modules/widgets/transclude.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/transclude.js\ntype: application/javascript\nmodule-type: widget\n\nTransclude widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar TranscludeWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nTranscludeWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nTranscludeWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nTranscludeWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.transcludeTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.transcludeSubTiddler = this.getAttribute(\"subtiddler\");\n\tthis.transcludeField = this.getAttribute(\"field\");\n\tthis.transcludeIndex = this.getAttribute(\"index\");\n\tthis.transcludeMode = this.getAttribute(\"mode\");\n\tthis.recursionMarker = this.getAttribute(\"recursionMarker\",\"yes\");\n\t// Parse the text reference\n\tvar parseAsInline = !this.parseTreeNode.isBlock;\n\tif(this.transcludeMode === \"inline\") {\n\t\tparseAsInline = true;\n\t} else if(this.transcludeMode === \"block\") {\n\t\tparseAsInline = false;\n\t}\n\tvar parser = this.wiki.parseTextReference(\n\t\t\t\t\t\tthis.transcludeTitle,\n\t\t\t\t\t\tthis.transcludeField,\n\t\t\t\t\t\tthis.transcludeIndex,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tparseAsInline: parseAsInline,\n\t\t\t\t\t\t\tsubTiddler: this.transcludeSubTiddler\n\t\t\t\t\t\t}),\n\t\tparseTreeNodes = parser ? parser.tree : this.parseTreeNode.children;\n\t// Set context variables for recursion detection\n\tvar recursionMarker = this.makeRecursionMarker();\n\tif(this.recursionMarker === \"yes\") {\n\t\tthis.setVariable(\"transclusion\",recursionMarker);\n\t}\n\t// Check for recursion\n\tif(parser) {\n\t\tif(this.parentWidget && this.parentWidget.hasVariable(\"transclusion\",recursionMarker)) {\n\t\t\tparseTreeNodes = [{type: \"element\", tag: \"span\", attributes: {\n\t\t\t\t\"class\": {type: \"string\", value: \"tc-error\"}\n\t\t\t}, children: [\n\t\t\t\t{type: \"text\", text: $tw.language.getString(\"Error/RecursiveTransclusion\")}\n\t\t\t]}];\n\t\t}\n\t}\n\t// Construct the child widgets\n\tthis.makeChildWidgets(parseTreeNodes);\n};\n\n/*\nCompose a string comprising the title, field and/or index to identify this transclusion for recursion detection\n*/\nTranscludeWidget.prototype.makeRecursionMarker = function() {\n\tvar output = [];\n\toutput.push(\"{\");\n\toutput.push(this.getVariable(\"currentTiddler\",{defaultValue: \"\"}));\n\toutput.push(\"|\");\n\toutput.push(this.transcludeTitle || \"\");\n\toutput.push(\"|\");\n\toutput.push(this.transcludeField || \"\");\n\toutput.push(\"|\");\n\toutput.push(this.transcludeIndex || \"\");\n\toutput.push(\"|\");\n\toutput.push(this.transcludeSubTiddler || \"\");\n\toutput.push(\"}\");\n\treturn output.join(\"\");\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nTranscludeWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedTiddlers[this.transcludeTitle]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.transclude = TranscludeWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/vars.js": {
"title": "$:/core/modules/widgets/vars.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/vars.js\ntype: application/javascript\nmodule-type: widget\n\nThis widget allows multiple variables to be set in one go:\n\n```\n\\define helloworld() Hello world!\n<$vars greeting=\"Hi\" me={{!!title}} sentence=<<helloworld>>>\n <<greeting>>! I am <<me>> and I say: <<sentence>>\n</$vars>\n```\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar VarsWidget = function(parseTreeNode,options) {\n\t// Initialise\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nVarsWidget.prototype = Object.create(Widget.prototype);\n\n/*\nRender this widget into the DOM\n*/\nVarsWidget.prototype.render = function(parent,nextSibling) {\n\t// Call the constructor\n\tWidget.call(this);\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nVarsWidget.prototype.execute = function() {\n\t// Parse variables\n\tvar self = this;\n\t$tw.utils.each(this.attributes,function(val,key) {\n\t\tif(key.charAt(0) !== \"$\") {\n\t\t\tself.setVariable(key,val);\n\t\t}\n\t});\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nRefresh the widget by ensuring our attributes are up to date\n*/\nVarsWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(Object.keys(changedAttributes).length) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t}\n\treturn this.refreshChildren(changedTiddlers);\n};\n\nexports[\"vars\"] = VarsWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/view.js": {
"title": "$:/core/modules/widgets/view.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/view.js\ntype: application/javascript\nmodule-type: widget\n\nView widget\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar ViewWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nViewWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nViewWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tif(this.text) {\n\t\tvar textNode = this.document.createTextNode(this.text);\n\t\tparent.insertBefore(textNode,nextSibling);\n\t\tthis.domNodes.push(textNode);\n\t} else {\n\t\tthis.makeChildWidgets();\n\t\tthis.renderChildren(parent,nextSibling);\n\t}\n};\n\n/*\nCompute the internal state of the widget\n*/\nViewWidget.prototype.execute = function() {\n\t// Get parameters from our attributes\n\tthis.viewTitle = this.getAttribute(\"tiddler\",this.getVariable(\"currentTiddler\"));\n\tthis.viewSubtiddler = this.getAttribute(\"subtiddler\");\n\tthis.viewField = this.getAttribute(\"field\",\"text\");\n\tthis.viewIndex = this.getAttribute(\"index\");\n\tthis.viewFormat = this.getAttribute(\"format\",\"text\");\n\tthis.viewTemplate = this.getAttribute(\"template\",\"\");\n\tthis.viewMode = this.getAttribute(\"mode\",\"block\");\n\tswitch(this.viewFormat) {\n\t\tcase \"htmlwikified\":\n\t\t\tthis.text = this.getValueAsHtmlWikified(this.viewMode);\n\t\t\tbreak;\n\t\tcase \"plainwikified\":\n\t\t\tthis.text = this.getValueAsPlainWikified(this.viewMode);\n\t\t\tbreak;\n\t\tcase \"htmlencodedplainwikified\":\n\t\t\tthis.text = this.getValueAsHtmlEncodedPlainWikified(this.viewMode);\n\t\t\tbreak;\n\t\tcase \"htmlencoded\":\n\t\t\tthis.text = this.getValueAsHtmlEncoded();\n\t\t\tbreak;\n\t\tcase \"htmltextencoded\":\n\t\t\tthis.text = this.getValueAsHtmlTextEncoded();\n\t\t\tbreak;\n\t\tcase \"urlencoded\":\n\t\t\tthis.text = this.getValueAsUrlEncoded();\n\t\t\tbreak;\n\t\tcase \"doubleurlencoded\":\n\t\t\tthis.text = this.getValueAsDoubleUrlEncoded();\n\t\t\tbreak;\n\t\tcase \"date\":\n\t\t\tthis.text = this.getValueAsDate(this.viewTemplate);\n\t\t\tbreak;\n\t\tcase \"relativedate\":\n\t\t\tthis.text = this.getValueAsRelativeDate();\n\t\t\tbreak;\n\t\tcase \"stripcomments\":\n\t\t\tthis.text = this.getValueAsStrippedComments();\n\t\t\tbreak;\n\t\tcase \"jsencoded\":\n\t\t\tthis.text = this.getValueAsJsEncoded();\n\t\t\tbreak;\n\t\tdefault: // \"text\"\n\t\t\tthis.text = this.getValueAsText();\n\t\t\tbreak;\n\t}\n};\n\n/*\nThe various formatter functions are baked into this widget for the moment. Eventually they will be replaced by macro functions\n*/\n\n/*\nRetrieve the value of the widget. Options are:\nasString: Optionally return the value as a string\n*/\nViewWidget.prototype.getValue = function(options) {\n\toptions = options || {};\n\tvar value = options.asString ? \"\" : undefined;\n\tif(this.viewIndex) {\n\t\tvalue = this.wiki.extractTiddlerDataItem(this.viewTitle,this.viewIndex);\n\t} else {\n\t\tvar tiddler;\n\t\tif(this.viewSubtiddler) {\n\t\t\ttiddler = this.wiki.getSubTiddler(this.viewTitle,this.viewSubtiddler);\n\t\t} else {\n\t\t\ttiddler = this.wiki.getTiddler(this.viewTitle);\n\t\t}\n\t\tif(tiddler) {\n\t\t\tif(this.viewField === \"text\" && !this.viewSubtiddler) {\n\t\t\t\t// Calling getTiddlerText() triggers lazy loading of skinny tiddlers\n\t\t\t\tvalue = this.wiki.getTiddlerText(this.viewTitle);\n\t\t\t} else {\n\t\t\t\tif($tw.utils.hop(tiddler.fields,this.viewField)) {\n\t\t\t\t\tif(options.asString) {\n\t\t\t\t\t\tvalue = tiddler.getFieldString(this.viewField);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalue = tiddler.fields[this.viewField];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif(this.viewField === \"title\") {\n\t\t\t\tvalue = this.viewTitle;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n\nViewWidget.prototype.getValueAsText = function() {\n\treturn this.getValue({asString: true});\n};\n\nViewWidget.prototype.getValueAsHtmlWikified = function(mode) {\n\treturn this.wiki.renderText(\"text/html\",\"text/vnd.tiddlywiki\",this.getValueAsText(),{\n\t\tparseAsInline: mode !== \"block\",\n\t\tparentWidget: this\n\t});\n};\n\nViewWidget.prototype.getValueAsPlainWikified = function(mode) {\n\treturn this.wiki.renderText(\"text/plain\",\"text/vnd.tiddlywiki\",this.getValueAsText(),{\n\t\tparseAsInline: mode !== \"block\",\n\t\tparentWidget: this\n\t});\n};\n\nViewWidget.prototype.getValueAsHtmlEncodedPlainWikified = function(mode) {\n\treturn $tw.utils.htmlEncode(this.wiki.renderText(\"text/plain\",\"text/vnd.tiddlywiki\",this.getValueAsText(),{\n\t\tparseAsInline: mode !== \"block\",\n\t\tparentWidget: this\n\t}));\n};\n\nViewWidget.prototype.getValueAsHtmlEncoded = function() {\n\treturn $tw.utils.htmlEncode(this.getValueAsText());\n};\n\nViewWidget.prototype.getValueAsHtmlTextEncoded = function() {\n\treturn $tw.utils.htmlTextEncode(this.getValueAsText());\n};\n\nViewWidget.prototype.getValueAsUrlEncoded = function() {\n\treturn encodeURIComponent(this.getValueAsText());\n};\n\nViewWidget.prototype.getValueAsDoubleUrlEncoded = function() {\n\treturn encodeURIComponent(encodeURIComponent(this.getValueAsText()));\n};\n\nViewWidget.prototype.getValueAsDate = function(format) {\n\tformat = format || \"YYYY MM DD 0hh:0mm\";\n\tvar value = $tw.utils.parseDate(this.getValue());\n\tif(value && $tw.utils.isDate(value) && value.toString() !== \"Invalid Date\") {\n\t\treturn $tw.utils.formatDateString(value,format);\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\nViewWidget.prototype.getValueAsRelativeDate = function(format) {\n\tvar value = $tw.utils.parseDate(this.getValue());\n\tif(value && $tw.utils.isDate(value) && value.toString() !== \"Invalid Date\") {\n\t\treturn $tw.utils.getRelativeDate((new Date()) - (new Date(value))).description;\n\t} else {\n\t\treturn \"\";\n\t}\n};\n\nViewWidget.prototype.getValueAsStrippedComments = function() {\n\tvar lines = this.getValueAsText().split(\"\\n\"),\n\t\tout = [];\n\tfor(var line=0; line<lines.length; line++) {\n\t\tvar text = lines[line];\n\t\tif(!/^\\s*\\/\\/#/.test(text)) {\n\t\t\tout.push(text);\n\t\t}\n\t}\n\treturn out.join(\"\\n\");\n};\n\nViewWidget.prototype.getValueAsJsEncoded = function() {\n\treturn $tw.utils.stringify(this.getValueAsText());\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nViewWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\tif(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.template || changedAttributes.format || changedTiddlers[this.viewTitle]) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\nexports.view = ViewWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/widget.js": {
"title": "$:/core/modules/widgets/widget.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/widget.js\ntype: application/javascript\nmodule-type: widget\n\nWidget base class\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nCreate a widget object for a parse tree node\n\tparseTreeNode: reference to the parse tree node to be rendered\n\toptions: see below\nOptions include:\n\twiki: mandatory reference to wiki associated with this render tree\n\tparentWidget: optional reference to a parent renderer node for the context chain\n\tdocument: optional document object to use instead of global document\n*/\nvar Widget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInitialise widget properties. These steps are pulled out of the constructor so that we can reuse them in subclasses\n*/\nWidget.prototype.initialise = function(parseTreeNode,options) {\n\t// Bail if parseTreeNode is undefined, meaning that the widget constructor was called without any arguments so that it can be subclassed\n\tif(parseTreeNode === undefined) {\n\t\treturn;\n\t}\n\toptions = options || {};\n\t// Save widget info\n\tthis.parseTreeNode = parseTreeNode;\n\tthis.wiki = options.wiki;\n\tthis.parentWidget = options.parentWidget;\n\tthis.variablesConstructor = function() {};\n\tthis.variablesConstructor.prototype = this.parentWidget ? this.parentWidget.variables : {};\n\tthis.variables = new this.variablesConstructor();\n\tthis.document = options.document;\n\tthis.attributes = {};\n\tthis.children = [];\n\tthis.domNodes = [];\n\tthis.eventListeners = {};\n\t// Hashmap of the widget classes\n\tif(!this.widgetClasses) {\n\t\t// Get widget classes\n\t\tWidget.prototype.widgetClasses = $tw.modules.applyMethods(\"widget\");\n\t\t// Process any subclasses\n\t\t$tw.modules.forEachModuleOfType(\"widget-subclass\",function(title,module) {\n\t\t\tif(module.baseClass) {\n\t\t\t\tvar baseClass = Widget.prototype.widgetClasses[module.baseClass];\n\t\t\t\tif(!baseClass) {\n\t\t\t\t\tthrow \"Module '\" + title + \"' is attemping to extend a non-existent base class '\" + module.baseClass + \"'\";\n\t\t\t\t}\n\t\t\t\tvar subClass = module.constructor;\n\t\t\t\tsubClass.prototype = new baseClass();\n\t\t\t\t$tw.utils.extend(subClass.prototype,module.prototype);\n\t\t\t\tWidget.prototype.widgetClasses[module.name || module.baseClass] = subClass;\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\nRender this widget into the DOM\n*/\nWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nWidget.prototype.execute = function() {\n\tthis.makeChildWidgets();\n};\n\n/*\nSet the value of a context variable\nname: name of the variable\nvalue: value of the variable\nparams: array of {name:, default:} for each parameter\nisMacroDefinition: true if the variable is set via a \\define macro pragma (and hence should have variable substitution performed)\n*/\nWidget.prototype.setVariable = function(name,value,params,isMacroDefinition) {\n\tthis.variables[name] = {value: value, params: params, isMacroDefinition: !!isMacroDefinition};\n};\n\n/*\nGet the prevailing value of a context variable\nname: name of variable\noptions: see below\nOptions include\nparams: array of {name:, value:} for each parameter\ndefaultValue: default value if the variable is not defined\n\nReturns an object with the following fields:\n\nparams: array of {name:,value:} of parameters passed to wikitext variables\ntext: text of variable, with parameters properly substituted\n*/\nWidget.prototype.getVariableInfo = function(name,options) {\n\toptions = options || {};\n\tvar actualParams = options.params || [],\n\t\tparentWidget = this.parentWidget;\n\t// Check for the variable defined in the parent widget (or an ancestor in the prototype chain)\n\tif(parentWidget && name in parentWidget.variables) {\n\t\tvar variable = parentWidget.variables[name],\n\t\t\toriginalValue = variable.value,\n\t\t\tvalue = originalValue,\n\t\t\tparams = this.resolveVariableParameters(variable.params,actualParams);\n\t\t// Substitute any parameters specified in the definition\n\t\t$tw.utils.each(params,function(param) {\n\t\t\tvalue = $tw.utils.replaceString(value,new RegExp(\"\\\\$\" + $tw.utils.escapeRegExp(param.name) + \"\\\\$\",\"mg\"),param.value);\n\t\t});\n\t\t// Only substitute variable references if this variable was defined with the \\define pragma\n\t\tif(variable.isMacroDefinition) {\n\t\t\tvalue = this.substituteVariableReferences(value);\n\t\t}\n\t\treturn {\n\t\t\ttext: value,\n\t\t\tparams: params,\n\t\t\tsrcVariable: variable,\n\t\t\tisCacheable: originalValue === value\n\t\t};\n\t}\n\t// If the variable doesn't exist in the parent widget then look for a macro module\n\treturn {\n\t\ttext: this.evaluateMacroModule(name,actualParams,options.defaultValue)\n\t};\n};\n\n/*\nSimplified version of getVariableInfo() that just returns the text\n*/\nWidget.prototype.getVariable = function(name,options) {\n\treturn this.getVariableInfo(name,options).text;\n};\n\nWidget.prototype.resolveVariableParameters = function(formalParams,actualParams) {\n\tformalParams = formalParams || [];\n\tactualParams = actualParams || [];\n\tvar nextAnonParameter = 0, // Next candidate anonymous parameter in macro call\n\t\tparamInfo, paramValue,\n\t\tresults = [];\n\t// Step through each of the parameters in the macro definition\n\tfor(var p=0; p<formalParams.length; p++) {\n\t\t// Check if we've got a macro call parameter with the same name\n\t\tparamInfo = formalParams[p];\n\t\tparamValue = undefined;\n\t\tfor(var m=0; m<actualParams.length; m++) {\n\t\t\tif(actualParams[m].name === paramInfo.name) {\n\t\t\t\tparamValue = actualParams[m].value;\n\t\t\t}\n\t\t}\n\t\t// If not, use the next available anonymous macro call parameter\n\t\twhile(nextAnonParameter < actualParams.length && actualParams[nextAnonParameter].name) {\n\t\t\tnextAnonParameter++;\n\t\t}\n\t\tif(paramValue === undefined && nextAnonParameter < actualParams.length) {\n\t\t\tparamValue = actualParams[nextAnonParameter++].value;\n\t\t}\n\t\t// If we've still not got a value, use the default, if any\n\t\tparamValue = paramValue || paramInfo[\"default\"] || \"\";\n\t\t// Store the parameter name and value\n\t\tresults.push({name: paramInfo.name, value: paramValue});\n\t}\n\treturn results;\n};\n\nWidget.prototype.substituteVariableReferences = function(text) {\n\tvar self = this;\n\treturn (text || \"\").replace(/\\$\\(([^\\)\\$]+)\\)\\$/g,function(match,p1,offset,string) {\n\t\treturn self.getVariable(p1,{defaultValue: \"\"});\n\t});\n};\n\nWidget.prototype.evaluateMacroModule = function(name,actualParams,defaultValue) {\n\tif($tw.utils.hop($tw.macros,name)) {\n\t\tvar macro = $tw.macros[name],\n\t\t\targs = [];\n\t\tif(macro.params.length > 0) {\n\t\t\tvar nextAnonParameter = 0, // Next candidate anonymous parameter in macro call\n\t\t\t\tparamInfo, paramValue;\n\t\t\t// Step through each of the parameters in the macro definition\n\t\t\tfor(var p=0; p<macro.params.length; p++) {\n\t\t\t\t// Check if we've got a macro call parameter with the same name\n\t\t\t\tparamInfo = macro.params[p];\n\t\t\t\tparamValue = undefined;\n\t\t\t\tfor(var m=0; m<actualParams.length; m++) {\n\t\t\t\t\tif(actualParams[m].name === paramInfo.name) {\n\t\t\t\t\t\tparamValue = actualParams[m].value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If not, use the next available anonymous macro call parameter\n\t\t\t\twhile(nextAnonParameter < actualParams.length && actualParams[nextAnonParameter].name) {\n\t\t\t\t\tnextAnonParameter++;\n\t\t\t\t}\n\t\t\t\tif(paramValue === undefined && nextAnonParameter < actualParams.length) {\n\t\t\t\t\tparamValue = actualParams[nextAnonParameter++].value;\n\t\t\t\t}\n\t\t\t\t// If we've still not got a value, use the default, if any\n\t\t\t\tparamValue = paramValue || paramInfo[\"default\"] || \"\";\n\t\t\t\t// Save the parameter\n\t\t\t\targs.push(paramValue);\n\t\t\t}\n\t\t}\n\t\telse for(var i=0; i<actualParams.length; ++i) {\n\t\t\targs.push(actualParams[i].value);\n\t\t}\n\t\treturn (macro.run.apply(this,args) || \"\").toString();\n\t} else {\n\t\treturn defaultValue;\n\t}\n};\n\n/*\nCheck whether a given context variable value exists in the parent chain\n*/\nWidget.prototype.hasVariable = function(name,value) {\n\tvar node = this;\n\twhile(node) {\n\t\tif($tw.utils.hop(node.variables,name) && node.variables[name].value === value) {\n\t\t\treturn true;\n\t\t}\n\t\tnode = node.parentWidget;\n\t}\n\treturn false;\n};\n\n/*\nConstruct a qualifying string based on a hash of concatenating the values of a given variable in the parent chain\n*/\nWidget.prototype.getStateQualifier = function(name) {\n\tthis.qualifiers = this.qualifiers || Object.create(null);\n\tname = name || \"transclusion\";\n\tif(this.qualifiers[name]) {\n\t\treturn this.qualifiers[name];\n\t} else {\n\t\tvar output = [],\n\t\t\tnode = this;\n\t\twhile(node && node.parentWidget) {\n\t\t\tif($tw.utils.hop(node.parentWidget.variables,name)) {\n\t\t\t\toutput.push(node.getVariable(name));\n\t\t\t}\n\t\t\tnode = node.parentWidget;\n\t\t}\n\t\tvar value = $tw.utils.hashString(output.join(\"\"));\n\t\tthis.qualifiers[name] = value;\n\t\treturn value;\n\t}\n};\n\n/*\nCompute the current values of the attributes of the widget. Returns a hashmap of the names of the attributes that have changed\n*/\nWidget.prototype.computeAttributes = function() {\n\tvar changedAttributes = {},\n\t\tself = this,\n\t\tvalue;\n\t$tw.utils.each(this.parseTreeNode.attributes,function(attribute,name) {\n\t\tif(attribute.type === \"filtered\") {\n\t\t\tvalue = self.wiki.filterTiddlers(attribute.filter,self)[0] || \"\";\n\t\t} else if(attribute.type === \"indirect\") {\n\t\t\tvalue = self.wiki.getTextReference(attribute.textReference,\"\",self.getVariable(\"currentTiddler\"));\n\t\t} else if(attribute.type === \"macro\") {\n\t\t\tvalue = self.getVariable(attribute.value.name,{params: attribute.value.params});\n\t\t} else { // String attribute\n\t\t\tvalue = attribute.value;\n\t\t}\n\t\t// Check whether the attribute has changed\n\t\tif(self.attributes[name] !== value) {\n\t\t\tself.attributes[name] = value;\n\t\t\tchangedAttributes[name] = true;\n\t\t}\n\t});\n\treturn changedAttributes;\n};\n\n/*\nCheck for the presence of an attribute\n*/\nWidget.prototype.hasAttribute = function(name) {\n\treturn $tw.utils.hop(this.attributes,name);\n};\n\n/*\nGet the value of an attribute\n*/\nWidget.prototype.getAttribute = function(name,defaultText) {\n\tif($tw.utils.hop(this.attributes,name)) {\n\t\treturn this.attributes[name];\n\t} else {\n\t\treturn defaultText;\n\t}\n};\n\n/*\nAssign the computed attributes of the widget to a domNode\noptions include:\nexcludeEventAttributes: ignores attributes whose name begins with \"on\"\n*/\nWidget.prototype.assignAttributes = function(domNode,options) {\n\toptions = options || {};\n\tvar self = this;\n\t$tw.utils.each(this.attributes,function(v,a) {\n\t\t// Check exclusions\n\t\tif(options.excludeEventAttributes && a.substr(0,2) === \"on\") {\n\t\t\tv = undefined;\n\t\t}\n\t\tif(v !== undefined) {\n\t\t\tvar b = a.split(\":\");\n\t\t\t// Setting certain attributes can cause a DOM error (eg xmlns on the svg element)\n\t\t\ttry {\n\t\t\t\tif (b.length == 2 && b[0] == \"xlink\"){\n\t\t\t\t\tdomNode.setAttributeNS(\"http://www.w3.org/1999/xlink\",b[1],v);\n\t\t\t\t} else {\n\t\t\t\t\tdomNode.setAttributeNS(null,a,v);\n\t\t\t\t}\n\t\t\t} catch(e) {\n\t\t\t}\n\t\t}\n\t});\n};\n\n/*\nMake child widgets correspondng to specified parseTreeNodes\n*/\nWidget.prototype.makeChildWidgets = function(parseTreeNodes,options) {\n\toptions = options || {};\n\tthis.children = [];\n\tvar self = this;\n\t// Create set variable widgets for each variable\n\t$tw.utils.each(options.variables,function(value,name) {\n\t\tvar setVariableWidget = {\n\t\t\ttype: \"set\",\n\t\t\tattributes: {\n\t\t\t\tname: {type: \"string\", value: name},\n\t\t\t\tvalue: {type: \"string\", value: value}\n\t\t\t},\n\t\t\tchildren: parseTreeNodes\n\t\t};\n\t\tparseTreeNodes = [setVariableWidget];\n\t});\n\t$tw.utils.each(parseTreeNodes || (this.parseTreeNode && this.parseTreeNode.children),function(childNode) {\n\t\tself.children.push(self.makeChildWidget(childNode));\n\t});\n};\n\n/*\nConstruct the widget object for a parse tree node\noptions include:\n\tvariables: optional hashmap of variables to wrap around the widget\n*/\nWidget.prototype.makeChildWidget = function(parseTreeNode,options) {\n\toptions = options || {};\n\tvar WidgetClass = this.widgetClasses[parseTreeNode.type];\n\tif(!WidgetClass) {\n\t\tWidgetClass = this.widgetClasses.text;\n\t\tparseTreeNode = {type: \"text\", text: \"Undefined widget '\" + parseTreeNode.type + \"'\"};\n\t}\n\t// Create set variable widgets for each variable\n\t$tw.utils.each(options.variables,function(value,name) {\n\t\tvar setVariableWidget = {\n\t\t\ttype: \"set\",\n\t\t\tattributes: {\n\t\t\t\tname: {type: \"string\", value: name},\n\t\t\t\tvalue: {type: \"string\", value: value}\n\t\t\t},\n\t\t\tchildren: [\n\t\t\t\tparseTreeNode\n\t\t\t]\n\t\t};\n\t\tparseTreeNode = setVariableWidget;\n\t});\n\treturn new WidgetClass(parseTreeNode,{\n\t\twiki: this.wiki,\n\t\tparentWidget: this,\n\t\tdocument: this.document\n\t});\n};\n\n/*\nGet the next sibling of this widget\n*/\nWidget.prototype.nextSibling = function() {\n\tif(this.parentWidget) {\n\t\tvar index = this.parentWidget.children.indexOf(this);\n\t\tif(index !== -1 && index < this.parentWidget.children.length-1) {\n\t\t\treturn this.parentWidget.children[index+1];\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nGet the previous sibling of this widget\n*/\nWidget.prototype.previousSibling = function() {\n\tif(this.parentWidget) {\n\t\tvar index = this.parentWidget.children.indexOf(this);\n\t\tif(index !== -1 && index > 0) {\n\t\t\treturn this.parentWidget.children[index-1];\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nRender the children of this widget into the DOM\n*/\nWidget.prototype.renderChildren = function(parent,nextSibling) {\n\tvar children = this.children;\n\tfor(var i = 0; i < children.length; i++) {\n\t\tchildren[i].render(parent,nextSibling);\n\t};\n};\n\n/*\nAdd a list of event listeners from an array [{type:,handler:},...]\n*/\nWidget.prototype.addEventListeners = function(listeners) {\n\tvar self = this;\n\t$tw.utils.each(listeners,function(listenerInfo) {\n\t\tself.addEventListener(listenerInfo.type,listenerInfo.handler);\n\t});\n};\n\n/*\nAdd an event listener\n*/\nWidget.prototype.addEventListener = function(type,handler) {\n\tvar self = this;\n\tif(typeof handler === \"string\") { // The handler is a method name on this widget\n\t\tthis.eventListeners[type] = function(event) {\n\t\t\treturn self[handler].call(self,event);\n\t\t};\n\t} else { // The handler is a function\n\t\tthis.eventListeners[type] = function(event) {\n\t\t\treturn handler.call(self,event);\n\t\t};\n\t}\n};\n\n/*\nDispatch an event to a widget. If the widget doesn't handle the event then it is also dispatched to the parent widget\n*/\nWidget.prototype.dispatchEvent = function(event) {\n\tevent.widget = event.widget || this;\n\t// Dispatch the event if this widget handles it\n\tvar listener = this.eventListeners[event.type];\n\tif(listener) {\n\t\t// Don't propagate the event if the listener returned false\n\t\tif(!listener(event)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\t// Dispatch the event to the parent widget\n\tif(this.parentWidget) {\n\t\treturn this.parentWidget.dispatchEvent(event);\n\t}\n\treturn true;\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nWidget.prototype.refresh = function(changedTiddlers) {\n\treturn this.refreshChildren(changedTiddlers);\n};\n\n/*\nRebuild a previously rendered widget\n*/\nWidget.prototype.refreshSelf = function() {\n\tvar nextSibling = this.findNextSiblingDomNode();\n\tthis.removeChildDomNodes();\n\tthis.render(this.parentDomNode,nextSibling);\n};\n\n/*\nRefresh all the children of a widget\n*/\nWidget.prototype.refreshChildren = function(changedTiddlers) {\n\tvar children = this.children,\n\t\trefreshed = false;\n\tfor (var i = 0; i < children.length; i++) {\n\t\trefreshed = children[i].refresh(changedTiddlers) || refreshed;\n\t}\n\treturn refreshed;\n};\n\n/*\nFind the next sibling in the DOM to this widget. This is done by scanning the widget tree through all next siblings and their descendents that share the same parent DOM node\n*/\nWidget.prototype.findNextSiblingDomNode = function(startIndex) {\n\t// Refer to this widget by its index within its parents children\n\tvar parent = this.parentWidget,\n\t\tindex = startIndex !== undefined ? startIndex : parent.children.indexOf(this);\nif(index === -1) {\n\tthrow \"node not found in parents children\";\n}\n\t// Look for a DOM node in the later siblings\n\twhile(++index < parent.children.length) {\n\t\tvar domNode = parent.children[index].findFirstDomNode();\n\t\tif(domNode) {\n\t\t\treturn domNode;\n\t\t}\n\t}\n\t// Go back and look for later siblings of our parent if it has the same parent dom node\n\tvar grandParent = parent.parentWidget;\n\tif(grandParent && parent.parentDomNode === this.parentDomNode) {\n\t\tindex = grandParent.children.indexOf(parent);\n\t\tif(index !== -1) {\n\t\t\treturn parent.findNextSiblingDomNode(index);\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nFind the first DOM node generated by a widget or its children\n*/\nWidget.prototype.findFirstDomNode = function() {\n\t// Return the first dom node of this widget, if we've got one\n\tif(this.domNodes.length > 0) {\n\t\treturn this.domNodes[0];\n\t}\n\t// Otherwise, recursively call our children\n\tfor(var t=0; t<this.children.length; t++) {\n\t\tvar domNode = this.children[t].findFirstDomNode();\n\t\tif(domNode) {\n\t\t\treturn domNode;\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nRemove any DOM nodes created by this widget or its children\n*/\nWidget.prototype.removeChildDomNodes = function() {\n\t// If this widget has directly created DOM nodes, delete them and exit. This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case\n\tif(this.domNodes.length > 0) {\n\t\t$tw.utils.each(this.domNodes,function(domNode) {\n\t\t\tdomNode.parentNode.removeChild(domNode);\n\t\t});\n\t\tthis.domNodes = [];\n\t} else {\n\t\t// Otherwise, ask the child widgets to delete their DOM nodes\n\t\t$tw.utils.each(this.children,function(childWidget) {\n\t\t\tchildWidget.removeChildDomNodes();\n\t\t});\n\t}\n};\n\n/*\nInvoke the action widgets that are descendents of the current widget.\n*/\nWidget.prototype.invokeActions = function(triggeringWidget,event) {\n\tvar handled = false;\n\t// For each child widget\n\tfor(var t=0; t<this.children.length; t++) {\n\t\tvar child = this.children[t];\n\t\t// Rerender the child to ensure the attribute values are up to date\n\t\tchild.refreshSelf();\n\t\t// Invoke the child if it is an action widget\n\t\tif(child.invokeAction) {\n\t\t\tif(child.invokeAction(triggeringWidget,event)) {\n\t\t\t\thandled = true;\n\t\t\t}\n\t\t}\n\t\t// Propagate through through the child if it permits it\n\t\tif(child.allowActionPropagation() && child.invokeActions(triggeringWidget,event)) {\n\t\t\thandled = true;\n\t\t}\n\t}\n\treturn handled;\n};\n\n/*\nInvoke the action widgets defined in a string\n*/\nWidget.prototype.invokeActionString = function(actions,triggeringWidget,event,variables) {\n\tactions = actions || \"\";\n\tvar parser = this.wiki.parseText(\"text/vnd.tiddlywiki\",actions,{\n\t\t\tparentWidget: this,\n\t\t\tdocument: this.document\n\t\t}),\n\t\twidgetNode = this.wiki.makeWidget(parser,{\n\t\t\tparentWidget: this,\n\t\t\tdocument: this.document,\n\t\t\tvariables: variables\n\t\t});\n\tvar container = this.document.createElement(\"div\");\n\twidgetNode.render(container,null);\n\treturn widgetNode.invokeActions(this,event);\n};\n\n/*\nExecute action tiddlers by tag\n*/\nWidget.prototype.invokeActionsByTag = function(tag,event,variables) {\n\tvar self = this;\n\t$tw.utils.each(self.wiki.filterTiddlers(\"[all[shadows+tiddlers]tag[\" + tag + \"]!has[draft.of]]\"),function(title) {\n\t\tself.invokeActionString(self.wiki.getTiddlerText(title),self,event,variables);\n\t});\n};\n\nWidget.prototype.allowActionPropagation = function() {\n\treturn true;\n};\n\nexports.widget = Widget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/widgets/wikify.js": {
"title": "$:/core/modules/widgets/wikify.js",
"text": "/*\\\ntitle: $:/core/modules/widgets/wikify.js\ntype: application/javascript\nmodule-type: widget\n\nWidget to wikify text into a variable\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\n\nvar WikifyWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n};\n\n/*\nInherit from the base widget class\n*/\nWikifyWidget.prototype = new Widget();\n\n/*\nRender this widget into the DOM\n*/\nWikifyWidget.prototype.render = function(parent,nextSibling) {\n\tthis.parentDomNode = parent;\n\tthis.computeAttributes();\n\tthis.execute();\n\tthis.renderChildren(parent,nextSibling);\n};\n\n/*\nCompute the internal state of the widget\n*/\nWikifyWidget.prototype.execute = function() {\n\t// Get our parameters\n\tthis.wikifyName = this.getAttribute(\"name\");\n\tthis.wikifyText = this.getAttribute(\"text\");\n\tthis.wikifyType = this.getAttribute(\"type\");\n\tthis.wikifyMode = this.getAttribute(\"mode\",\"block\");\n\tthis.wikifyOutput = this.getAttribute(\"output\",\"text\");\n\t// Create the parse tree\n\tthis.wikifyParser = this.wiki.parseText(this.wikifyType,this.wikifyText,{\n\t\t\tparseAsInline: this.wikifyMode === \"inline\"\n\t\t});\n\t// Create the widget tree \n\tthis.wikifyWidgetNode = this.wiki.makeWidget(this.wikifyParser,{\n\t\t\tdocument: $tw.fakeDocument,\n\t\t\tparentWidget: this\n\t\t});\n\t// Render the widget tree to the container\n\tthis.wikifyContainer = $tw.fakeDocument.createElement(\"div\");\n\tthis.wikifyWidgetNode.render(this.wikifyContainer,null);\n\tthis.wikifyResult = this.getResult();\n\t// Set context variable\n\tthis.setVariable(this.wikifyName,this.wikifyResult);\n\t// Construct the child widgets\n\tthis.makeChildWidgets();\n};\n\n/*\nReturn the result string\n*/\nWikifyWidget.prototype.getResult = function() {\n\tvar result;\n\tswitch(this.wikifyOutput) {\n\t\tcase \"text\":\n\t\t\tresult = this.wikifyContainer.textContent;\n\t\t\tbreak;\n\t\tcase \"formattedtext\":\n\t\t\tresult = this.wikifyContainer.formattedTextContent;\n\t\t\tbreak;\n\t\tcase \"html\":\n\t\t\tresult = this.wikifyContainer.innerHTML;\n\t\t\tbreak;\n\t\tcase \"parsetree\":\n\t\t\tresult = JSON.stringify(this.wikifyParser.tree,0,$tw.config.preferences.jsonSpaces);\n\t\t\tbreak;\n\t\tcase \"widgettree\":\n\t\t\tresult = JSON.stringify(this.getWidgetTree(),0,$tw.config.preferences.jsonSpaces);\n\t\t\tbreak;\n\t}\n\treturn result;\n};\n\n/*\nReturn a string of the widget tree\n*/\nWikifyWidget.prototype.getWidgetTree = function() {\n\tvar copyNode = function(widgetNode,resultNode) {\n\t\t\tvar type = widgetNode.parseTreeNode.type;\n\t\t\tresultNode.type = type;\n\t\t\tswitch(type) {\n\t\t\t\tcase \"element\":\n\t\t\t\t\tresultNode.tag = widgetNode.parseTreeNode.tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"text\":\n\t\t\t\t\tresultNode.text = widgetNode.parseTreeNode.text;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(Object.keys(widgetNode.attributes || {}).length > 0) {\n\t\t\t\tresultNode.attributes = {};\n\t\t\t\t$tw.utils.each(widgetNode.attributes,function(attr,attrName) {\n\t\t\t\t\tresultNode.attributes[attrName] = widgetNode.getAttribute(attrName);\n\t\t\t\t});\n\t\t\t}\n\t\t\tif(Object.keys(widgetNode.children || {}).length > 0) {\n\t\t\t\tresultNode.children = [];\n\t\t\t\t$tw.utils.each(widgetNode.children,function(widgetChildNode) {\n\t\t\t\t\tvar node = {};\n\t\t\t\t\tresultNode.children.push(node);\n\t\t\t\t\tcopyNode(widgetChildNode,node);\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tresults = {};\n\tcopyNode(this.wikifyWidgetNode,results);\n\treturn results;\n};\n\n/*\nSelectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering\n*/\nWikifyWidget.prototype.refresh = function(changedTiddlers) {\n\tvar changedAttributes = this.computeAttributes();\n\t// Refresh ourselves entirely if any of our attributes have changed\n\tif(changedAttributes.name || changedAttributes.text || changedAttributes.type || changedAttributes.mode || changedAttributes.output) {\n\t\tthis.refreshSelf();\n\t\treturn true;\n\t} else {\n\t\t// Refresh the widget tree\n\t\tif(this.wikifyWidgetNode.refresh(changedTiddlers)) {\n\t\t\t// Check if there was any change\n\t\t\tvar result = this.getResult();\n\t\t\tif(result !== this.wikifyResult) {\n\t\t\t\t// If so, save the change\n\t\t\t\tthis.wikifyResult = result;\n\t\t\t\tthis.setVariable(this.wikifyName,this.wikifyResult);\n\t\t\t\t// Refresh each of our child widgets\n\t\t\t\t$tw.utils.each(this.children,function(childWidget) {\n\t\t\t\t\tchildWidget.refreshSelf();\n\t\t\t\t});\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t// Just refresh the children\n\t\treturn this.refreshChildren(changedTiddlers);\n\t}\n};\n\nexports.wikify = WikifyWidget;\n\n})();\n",
"type": "application/javascript",
"module-type": "widget"
},
"$:/core/modules/wiki-bulkops.js": {
"title": "$:/core/modules/wiki-bulkops.js",
"text": "/*\\\ntitle: $:/core/modules/wiki-bulkops.js\ntype: application/javascript\nmodule-type: wikimethod\n\nBulk tiddler operations such as rename.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nRename a tiddler, and relink any tags or lists that reference it.\n*/\nfunction renameTiddler(fromTitle,toTitle,options) {\n\tfromTitle = (fromTitle || \"\").trim();\n\ttoTitle = (toTitle || \"\").trim();\n\toptions = options || {};\n\tif(fromTitle && toTitle && fromTitle !== toTitle) {\n\t\t// Rename the tiddler itself\n\t\tvar oldTiddler = this.getTiddler(fromTitle),\n\t\t\tnewTiddler = new $tw.Tiddler(oldTiddler,{title: toTitle},this.getModificationFields());\n\t\tnewTiddler = $tw.hooks.invokeHook(\"th-renaming-tiddler\",newTiddler,oldTiddler);\n\t\tthis.addTiddler(newTiddler);\n\t\tthis.deleteTiddler(fromTitle);\n\t\t// Rename any tags or lists that reference it\n\t\tthis.relinkTiddler(fromTitle,toTitle,options)\n\t}\n}\n\n/*\nRelink any tags or lists that reference a given tiddler\n*/\nfunction relinkTiddler(fromTitle,toTitle,options) {\n\tvar self = this;\n\tfromTitle = (fromTitle || \"\").trim();\n\ttoTitle = (toTitle || \"\").trim();\n\toptions = options || {};\n\tif(fromTitle && toTitle && fromTitle !== toTitle) {\n\t\tthis.each(function(tiddler,title) {\n\t\t\tvar type = tiddler.fields.type || \"\";\n\t\t\t// Don't touch plugins or JavaScript modules\n\t\t\tif(!tiddler.fields[\"plugin-type\"] && type !== \"application/javascript\") {\n\t\t\t\tvar tags = tiddler.fields.tags ? tiddler.fields.tags.slice(0) : undefined,\n\t\t\t\t\tlist = tiddler.fields.list ? tiddler.fields.list.slice(0) : undefined,\n\t\t\t\t\tisModified = false;\n\t\t\t\tif(!options.dontRenameInTags) {\n\t\t\t\t\t// Rename tags\n\t\t\t\t\t$tw.utils.each(tags,function (title,index) {\n\t\t\t\t\t\tif(title === fromTitle) {\nconsole.log(\"Renaming tag '\" + tags[index] + \"' to '\" + toTitle + \"' of tiddler '\" + tiddler.fields.title + \"'\");\n\t\t\t\t\t\t\ttags[index] = toTitle;\n\t\t\t\t\t\t\tisModified = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif(!options.dontRenameInLists) {\n\t\t\t\t\t// Rename lists\n\t\t\t\t\t$tw.utils.each(list,function (title,index) {\n\t\t\t\t\t\tif(title === fromTitle) {\nconsole.log(\"Renaming list item '\" + list[index] + \"' to '\" + toTitle + \"' of tiddler '\" + tiddler.fields.title + \"'\");\n\t\t\t\t\t\t\tlist[index] = toTitle;\n\t\t\t\t\t\t\tisModified = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif(isModified) {\n\t\t\t\t\tvar newTiddler = new $tw.Tiddler(tiddler,{tags: tags, list: list},self.getModificationFields())\n\t\t\t\t\tnewTiddler = $tw.hooks.invokeHook(\"th-relinking-tiddler\",newTiddler,tiddler);\n\t\t\t\t\tself.addTiddler(newTiddler);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n};\n\nexports.renameTiddler = renameTiddler;\nexports.relinkTiddler = relinkTiddler;\n\n})();\n",
"type": "application/javascript",
"module-type": "wikimethod"
},
"$:/core/modules/wiki.js": {
"title": "$:/core/modules/wiki.js",
"text": "/*\\\ntitle: $:/core/modules/wiki.js\ntype: application/javascript\nmodule-type: wikimethod\n\nExtension methods for the $tw.Wiki object\n\nAdds the following properties to the wiki object:\n\n* `eventListeners` is a hashmap by type of arrays of listener functions\n* `changedTiddlers` is a hashmap describing changes to named tiddlers since wiki change events were last dispatched. Each entry is a hashmap containing two fields:\n\tmodified: true/false\n\tdeleted: true/false\n* `changeCount` is a hashmap by tiddler title containing a numerical index that starts at zero and is incremented each time a tiddler is created changed or deleted\n* `caches` is a hashmap by tiddler title containing a further hashmap of named cache objects. Caches are automatically cleared when a tiddler is modified or deleted\n* `globalCache` is a hashmap by cache name of cache objects that are cleared whenever any tiddler change occurs\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar widget = require(\"$:/core/modules/widgets/widget.js\");\n\nvar USER_NAME_TITLE = \"$:/status/UserName\",\n\tTIMESTAMP_DISABLE_TITLE = \"$:/config/TimestampDisable\";\n\n/*\nAdd available indexers to this wiki\n*/\nexports.addIndexersToWiki = function() {\n\tvar self = this;\n\t$tw.utils.each($tw.modules.applyMethods(\"indexer\"),function(Indexer,name) {\n\t\tself.addIndexer(new Indexer(self),name);\n\t});\n};\n\n/*\nGet the value of a text reference. Text references can have any of these forms:\n\t<tiddlertitle>\n\t<tiddlertitle>!!<fieldname>\n\t!!<fieldname> - specifies a field of the current tiddlers\n\t<tiddlertitle>##<index>\n*/\nexports.getTextReference = function(textRef,defaultText,currTiddlerTitle) {\n\tvar tr = $tw.utils.parseTextReference(textRef),\n\t\ttitle = tr.title || currTiddlerTitle;\n\tif(tr.field) {\n\t\tvar tiddler = this.getTiddler(title);\n\t\tif(tr.field === \"title\") { // Special case so we can return the title of a non-existent tiddler\n\t\t\treturn title;\n\t\t} else if(tiddler && $tw.utils.hop(tiddler.fields,tr.field)) {\n\t\t\treturn tiddler.getFieldString(tr.field);\n\t\t} else {\n\t\t\treturn defaultText;\n\t\t}\n\t} else if(tr.index) {\n\t\treturn this.extractTiddlerDataItem(title,tr.index,defaultText);\n\t} else {\n\t\treturn this.getTiddlerText(title,defaultText);\n\t}\n};\n\nexports.setTextReference = function(textRef,value,currTiddlerTitle) {\n\tvar tr = $tw.utils.parseTextReference(textRef),\n\t\ttitle = tr.title || currTiddlerTitle;\n\tthis.setText(title,tr.field,tr.index,value);\n};\n\nexports.setText = function(title,field,index,value,options) {\n\toptions = options || {};\n\tvar creationFields = options.suppressTimestamp ? {} : this.getCreationFields(),\n\t\tmodificationFields = options.suppressTimestamp ? {} : this.getModificationFields();\n\t// Check if it is a reference to a tiddler field\n\tif(index) {\n\t\tvar data = this.getTiddlerData(title,Object.create(null));\n\t\tif(value !== undefined) {\n\t\t\tdata[index] = value;\n\t\t} else {\n\t\t\tdelete data[index];\n\t\t}\n\t\tthis.setTiddlerData(title,data,modificationFields);\n\t} else {\n\t\tvar tiddler = this.getTiddler(title),\n\t\t\tfields = {title: title};\n\t\tfields[field || \"text\"] = value;\n\t\tthis.addTiddler(new $tw.Tiddler(creationFields,tiddler,fields,modificationFields));\n\t}\n};\n\nexports.deleteTextReference = function(textRef,currTiddlerTitle) {\n\tvar tr = $tw.utils.parseTextReference(textRef),\n\t\ttitle,tiddler,fields;\n\t// Check if it is a reference to a tiddler\n\tif(tr.title && !tr.field) {\n\t\tthis.deleteTiddler(tr.title);\n\t// Else check for a field reference\n\t} else if(tr.field) {\n\t\ttitle = tr.title || currTiddlerTitle;\n\t\ttiddler = this.getTiddler(title);\n\t\tif(tiddler && $tw.utils.hop(tiddler.fields,tr.field)) {\n\t\t\tfields = Object.create(null);\n\t\t\tfields[tr.field] = undefined;\n\t\t\tthis.addTiddler(new $tw.Tiddler(tiddler,fields,this.getModificationFields()));\n\t\t}\n\t}\n};\n\nexports.addEventListener = function(type,listener) {\n\tthis.eventListeners = this.eventListeners || {};\n\tthis.eventListeners[type] = this.eventListeners[type] || [];\n\tthis.eventListeners[type].push(listener);\n};\n\nexports.removeEventListener = function(type,listener) {\n\tvar listeners = this.eventListeners[type];\n\tif(listeners) {\n\t\tvar p = listeners.indexOf(listener);\n\t\tif(p !== -1) {\n\t\t\tlisteners.splice(p,1);\n\t\t}\n\t}\n};\n\nexports.dispatchEvent = function(type /*, args */) {\n\tvar args = Array.prototype.slice.call(arguments,1),\n\t\tlisteners = this.eventListeners[type];\n\tif(listeners) {\n\t\tfor(var p=0; p<listeners.length; p++) {\n\t\t\tvar listener = listeners[p];\n\t\t\tlistener.apply(listener,args);\n\t\t}\n\t}\n};\n\n/*\nCauses a tiddler to be marked as changed, incrementing the change count, and triggers event handlers.\nThis method should be called after the changes it describes have been made to the wiki.tiddlers[] array.\n\ttitle: Title of tiddler\n\tisDeleted: defaults to false (meaning the tiddler has been created or modified),\n\t\ttrue if the tiddler has been deleted\n*/\nexports.enqueueTiddlerEvent = function(title,isDeleted) {\n\t// Record the touch in the list of changed tiddlers\n\tthis.changedTiddlers = this.changedTiddlers || Object.create(null);\n\tthis.changedTiddlers[title] = this.changedTiddlers[title] || Object.create(null);\n\tthis.changedTiddlers[title][isDeleted ? \"deleted\" : \"modified\"] = true;\n\t// Increment the change count\n\tthis.changeCount = this.changeCount || Object.create(null);\n\tif($tw.utils.hop(this.changeCount,title)) {\n\t\tthis.changeCount[title]++;\n\t} else {\n\t\tthis.changeCount[title] = 1;\n\t}\n\t// Trigger events\n\tthis.eventListeners = this.eventListeners || {};\n\tif(!this.eventsTriggered) {\n\t\tvar self = this;\n\t\t$tw.utils.nextTick(function() {\n\t\t\tvar changes = self.changedTiddlers;\n\t\t\tself.changedTiddlers = Object.create(null);\n\t\t\tself.eventsTriggered = false;\n\t\t\tif($tw.utils.count(changes) > 0) {\n\t\t\t\tself.dispatchEvent(\"change\",changes);\n\t\t\t}\n\t\t});\n\t\tthis.eventsTriggered = true;\n\t}\n};\n\nexports.getSizeOfTiddlerEventQueue = function() {\n\treturn $tw.utils.count(this.changedTiddlers);\n};\n\nexports.clearTiddlerEventQueue = function() {\n\tthis.changedTiddlers = Object.create(null);\n\tthis.changeCount = Object.create(null);\n};\n\nexports.getChangeCount = function(title) {\n\tthis.changeCount = this.changeCount || Object.create(null);\n\tif($tw.utils.hop(this.changeCount,title)) {\n\t\treturn this.changeCount[title];\n\t} else {\n\t\treturn 0;\n\t}\n};\n\n/*\nGenerate an unused title from the specified base\noptions.prefix must be a string\n*/\nexports.generateNewTitle = function(baseTitle,options) {\n\toptions = options || {};\n\tvar c = 0,\n\t\ttitle = baseTitle,\n\t\ttemplate = options.template,\n\t\tprefix = (typeof(options.prefix) === \"string\") ? options.prefix : \" \";\n\tif (template) {\n\t\t// \"count\" is important to avoid an endless loop in while(...)!!\n\t\ttemplate = (/\\$count:?(\\d+)?\\$/i.test(template)) ? template : template + \"$count$\";\n\t\ttitle = $tw.utils.formatTitleString(template,{\"base\":baseTitle,\"separator\":prefix,\"counter\":c});\n\t\twhile(this.tiddlerExists(title) || this.isShadowTiddler(title) || this.findDraft(title)) {\n\t\t\ttitle = $tw.utils.formatTitleString(template,{\"base\":baseTitle,\"separator\":prefix,\"counter\":(++c)});\n\t\t}\n\t} else {\n\t\twhile(this.tiddlerExists(title) || this.isShadowTiddler(title) || this.findDraft(title)) {\n\t\t\ttitle = baseTitle + prefix + (++c);\n\t\t}\n\t}\n\treturn title;\n};\n\nexports.isSystemTiddler = function(title) {\n\treturn title && title.indexOf(\"$:/\") === 0;\n};\n\nexports.isTemporaryTiddler = function(title) {\n\treturn title && title.indexOf(\"$:/temp/\") === 0;\n};\n\nexports.isVolatileTiddler = function(title) {\n\treturn title && title.indexOf(\"$:/temp/volatile/\") === 0;\n};\n\nexports.isImageTiddler = function(title) {\n\tvar tiddler = this.getTiddler(title);\n\tif(tiddler) {\n\t\tvar contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || \"text/vnd.tiddlywiki\"];\n\t\treturn !!contentTypeInfo && contentTypeInfo.flags.indexOf(\"image\") !== -1;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nexports.isBinaryTiddler = function(title) {\n\tvar tiddler = this.getTiddler(title);\n\tif(tiddler) {\n\t\tvar contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || \"text/vnd.tiddlywiki\"];\n\t\treturn !!contentTypeInfo && contentTypeInfo.encoding === \"base64\";\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/*\nLike addTiddler() except it will silently reject any plugin tiddlers that are older than the currently loaded version. Returns true if the tiddler was imported\n*/\nexports.importTiddler = function(tiddler) {\n\tvar existingTiddler = this.getTiddler(tiddler.fields.title);\n\t// Check if we're dealing with a plugin\n\tif(tiddler && tiddler.hasField(\"plugin-type\") && tiddler.hasField(\"version\") && existingTiddler && existingTiddler.hasField(\"plugin-type\") && existingTiddler.hasField(\"version\")) {\n\t\t// Reject the incoming plugin if it is older\n\t\tif(!$tw.utils.checkVersions(tiddler.fields.version,existingTiddler.fields.version)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\t// Fall through to adding the tiddler\n\tthis.addTiddler(tiddler);\n\treturn true;\n};\n\n/*\nReturn a hashmap of the fields that should be set when a tiddler is created\n*/\nexports.getCreationFields = function() {\n\tif(this.getTiddlerText(TIMESTAMP_DISABLE_TITLE,\"\").toLowerCase() !== \"yes\") {\n\t\tvar fields = {\n\t\t\t\tcreated: new Date()\n\t\t\t},\n\t\t\tcreator = this.getTiddlerText(USER_NAME_TITLE);\n\t\tif(creator) {\n\t\t\tfields.creator = creator;\n\t\t}\n\t\treturn fields;\n\t} else {\n\t\treturn {};\n\t}\n};\n\n/*\nReturn a hashmap of the fields that should be set when a tiddler is modified\n*/\nexports.getModificationFields = function() {\n\tif(this.getTiddlerText(TIMESTAMP_DISABLE_TITLE,\"\").toLowerCase() !== \"yes\") {\n\t\tvar fields = Object.create(null),\n\t\t\tmodifier = this.getTiddlerText(USER_NAME_TITLE);\n\t\tfields.modified = new Date();\n\t\tif(modifier) {\n\t\t\tfields.modifier = modifier;\n\t\t}\n\t\treturn fields;\n\t} else {\n\t\treturn {};\n\t}\n};\n\n/*\nReturn a sorted array of tiddler titles. Options include:\nsortField: field to sort by\nexcludeTag: tag to exclude\nincludeSystem: whether to include system tiddlers (defaults to false)\n*/\nexports.getTiddlers = function(options) {\n\toptions = options || Object.create(null);\n\tvar self = this,\n\t\tsortField = options.sortField || \"title\",\n\t\ttiddlers = [], t, titles = [];\n\tthis.each(function(tiddler,title) {\n\t\tif(options.includeSystem || !self.isSystemTiddler(title)) {\n\t\t\tif(!options.excludeTag || !tiddler.hasTag(options.excludeTag)) {\n\t\t\t\ttiddlers.push(tiddler);\n\t\t\t}\n\t\t}\n\t});\n\ttiddlers.sort(function(a,b) {\n\t\tvar aa = a.fields[sortField].toLowerCase() || \"\",\n\t\t\tbb = b.fields[sortField].toLowerCase() || \"\";\n\t\tif(aa < bb) {\n\t\t\treturn -1;\n\t\t} else {\n\t\t\tif(aa > bb) {\n\t\t\t\treturn 1;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t});\n\tfor(t=0; t<tiddlers.length; t++) {\n\t\ttitles.push(tiddlers[t].fields.title);\n\t}\n\treturn titles;\n};\n\nexports.countTiddlers = function(excludeTag) {\n\tvar tiddlers = this.getTiddlers({excludeTag: excludeTag});\n\treturn $tw.utils.count(tiddlers);\n};\n\n/*\nReturns a function iterator(callback) that iterates through the specified titles, and invokes the callback with callback(tiddler,title)\n*/\nexports.makeTiddlerIterator = function(titles) {\n\tvar self = this;\n\tif(!$tw.utils.isArray(titles)) {\n\t\ttitles = Object.keys(titles);\n\t} else {\n\t\ttitles = titles.slice(0);\n\t}\n\treturn function(callback) {\n\t\ttitles.forEach(function(title) {\n\t\t\tcallback(self.getTiddler(title),title);\n\t\t});\n\t};\n};\n\n/*\nSort an array of tiddler titles by a specified field\n\ttitles: array of titles (sorted in place)\n\tsortField: name of field to sort by\n\tisDescending: true if the sort should be descending\n\tisCaseSensitive: true if the sort should consider upper and lower case letters to be different\n*/\nexports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,isNumeric,isAlphaNumeric) {\n\tvar self = this;\n\ttitles.sort(function(a,b) {\n\t\tvar x,y,\n\t\t\tcompareNumbers = function(x,y) {\n\t\t\t\tvar result = \n\t\t\t\t\tisNaN(x) && !isNaN(y) ? (isDescending ? -1 : 1) :\n\t\t\t\t\t!isNaN(x) && isNaN(y) ? (isDescending ? 1 : -1) :\n\t\t\t\t\t\t\t\t\t\t\t(isDescending ? y - x : x - y);\n\t\t\t\treturn result;\n\t\t\t};\n\t\tif(sortField !== \"title\") {\n\t\t\tvar tiddlerA = self.getTiddler(a),\n\t\t\t\ttiddlerB = self.getTiddler(b);\n\t\t\tif(tiddlerA) {\n\t\t\t\ta = tiddlerA.getFieldString(sortField) || \"\";\n\t\t\t} else {\n\t\t\t\ta = \"\";\n\t\t\t}\n\t\t\tif(tiddlerB) {\n\t\t\t\tb = tiddlerB.getFieldString(sortField) || \"\";\n\t\t\t} else {\n\t\t\t\tb = \"\";\n\t\t\t}\n\t\t}\n\t\tx = Number(a);\n\t\ty = Number(b);\n\t\tif(isNumeric && (!isNaN(x) || !isNaN(y))) {\n\t\t\treturn compareNumbers(x,y);\n\t\t} else if($tw.utils.isDate(a) && $tw.utils.isDate(b)) {\n\t\t\treturn isDescending ? b - a : a - b;\n\t\t} else if(isAlphaNumeric) {\n\t\t\treturn isDescending ? b.localeCompare(a,undefined,{numeric: true,sensitivity: \"base\"}) : a.localeCompare(b,undefined,{numeric: true,sensitivity: \"base\"});\n\t\t} else {\n\t\t\ta = String(a);\n\t\t\tb = String(b);\n\t\t\tif(!isCaseSensitive) {\n\t\t\t\ta = a.toLowerCase();\n\t\t\t\tb = b.toLowerCase();\n\t\t\t}\n\t\t\treturn isDescending ? b.localeCompare(a) : a.localeCompare(b);\n\t\t}\n\t});\n};\n\n/*\nFor every tiddler invoke a callback(title,tiddler) with `this` set to the wiki object. Options include:\nsortField: field to sort by\nexcludeTag: tag to exclude\nincludeSystem: whether to include system tiddlers (defaults to false)\n*/\nexports.forEachTiddler = function(/* [options,]callback */) {\n\tvar arg = 0,\n\t\toptions = arguments.length >= 2 ? arguments[arg++] : {},\n\t\tcallback = arguments[arg++],\n\t\ttitles = this.getTiddlers(options),\n\t\tt, tiddler;\n\tfor(t=0; t<titles.length; t++) {\n\t\ttiddler = this.getTiddler(titles[t]);\n\t\tif(tiddler) {\n\t\t\tcallback.call(this,tiddler.fields.title,tiddler);\n\t\t}\n\t}\n};\n\n/*\nReturn an array of tiddler titles that are directly linked within the given parse tree\n */\nexports.extractLinks = function(parseTreeRoot) {\n\t// Count up the links\n\tvar links = [],\n\t\tcheckParseTree = function(parseTree) {\n\t\t\tfor(var t=0; t<parseTree.length; t++) {\n\t\t\t\tvar parseTreeNode = parseTree[t];\n\t\t\t\tif(parseTreeNode.type === \"link\" && parseTreeNode.attributes.to && parseTreeNode.attributes.to.type === \"string\") {\n\t\t\t\t\tvar value = parseTreeNode.attributes.to.value;\n\t\t\t\t\tif(links.indexOf(value) === -1) {\n\t\t\t\t\t\tlinks.push(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(parseTreeNode.children) {\n\t\t\t\t\tcheckParseTree(parseTreeNode.children);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\tcheckParseTree(parseTreeRoot);\n\treturn links;\n};\n\n/*\nReturn an array of tiddler titles that are directly linked from the specified tiddler\n*/\nexports.getTiddlerLinks = function(title) {\n\tvar self = this;\n\t// We'll cache the links so they only get computed if the tiddler changes\n\treturn this.getCacheForTiddler(title,\"links\",function() {\n\t\t// Parse the tiddler\n\t\tvar parser = self.parseTiddler(title);\n\t\tif(parser) {\n\t\t\treturn self.extractLinks(parser.tree);\n\t\t}\n\t\treturn [];\n\t});\n};\n\n/*\nReturn an array of tiddler titles that link to the specified tiddler\n*/\nexports.getTiddlerBacklinks = function(targetTitle) {\n\tvar self = this,\n\t\tbacklinksIndexer = this.getIndexer(\"BacklinksIndexer\"),\n\t\tbacklinks = backlinksIndexer && backlinksIndexer.lookup(targetTitle);\n\n\tif(!backlinks) {\n\t\tbacklinks = [];\n\t\tthis.forEachTiddler(function(title,tiddler) {\n\t\t\tvar links = self.getTiddlerLinks(title);\n\t\t\tif(links.indexOf(targetTitle) !== -1) {\n\t\t\t\tbacklinks.push(title);\n\t\t\t}\n\t\t});\n\t}\n\treturn backlinks;\n};\n\n/*\nReturn a hashmap of tiddler titles that are referenced but not defined. Each value is the number of times the missing tiddler is referenced\n*/\nexports.getMissingTitles = function() {\n\tvar self = this,\n\t\tmissing = [];\n// We should cache the missing tiddler list, even if we recreate it every time any tiddler is modified\n\tthis.forEachTiddler(function(title,tiddler) {\n\t\tvar links = self.getTiddlerLinks(title);\n\t\t$tw.utils.each(links,function(link) {\n\t\t\tif((!self.tiddlerExists(link) && !self.isShadowTiddler(link)) && missing.indexOf(link) === -1) {\n\t\t\t\tmissing.push(link);\n\t\t\t}\n\t\t});\n\t});\n\treturn missing;\n};\n\nexports.getOrphanTitles = function() {\n\tvar self = this,\n\t\torphans = this.getTiddlers();\n\tthis.forEachTiddler(function(title,tiddler) {\n\t\tvar links = self.getTiddlerLinks(title);\n\t\t$tw.utils.each(links,function(link) {\n\t\t\tvar p = orphans.indexOf(link);\n\t\t\tif(p !== -1) {\n\t\t\t\torphans.splice(p,1);\n\t\t\t}\n\t\t});\n\t});\n\treturn orphans; // Todo\n};\n\n/*\nRetrieves a list of the tiddler titles that are tagged with a given tag\n*/\nexports.getTiddlersWithTag = function(tag) {\n\t// Try to use the indexer\n\tvar self = this,\n\t\ttagIndexer = this.getIndexer(\"TagIndexer\"),\n\t\tresults = tagIndexer && tagIndexer.subIndexers[3].lookup(tag);\n\tif(!results) {\n\t\t// If not available, perform a manual scan\n\t\tresults = this.getGlobalCache(\"taglist-\" + tag,function() {\n\t\t\tvar tagmap = self.getTagMap();\n\t\t\treturn self.sortByList(tagmap[tag],tag);\n\t\t});\n\t}\n\treturn results;\n};\n\n/*\nGet a hashmap by tag of arrays of tiddler titles\n*/\nexports.getTagMap = function() {\n\tvar self = this;\n\treturn this.getGlobalCache(\"tagmap\",function() {\n\t\tvar tags = Object.create(null),\n\t\t\tstoreTags = function(tagArray,title) {\n\t\t\t\tif(tagArray) {\n\t\t\t\t\tfor(var index=0; index<tagArray.length; index++) {\n\t\t\t\t\t\tvar tag = tagArray[index];\n\t\t\t\t\t\tif($tw.utils.hop(tags,tag)) {\n\t\t\t\t\t\t\ttags[tag].push(title);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttags[tag] = [title];\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\ttitle, tiddler;\n\t\t// Collect up all the tags\n\t\tself.eachShadow(function(tiddler,title) {\n\t\t\tif(!self.tiddlerExists(title)) {\n\t\t\t\ttiddler = self.getTiddler(title);\n\t\t\t\tstoreTags(tiddler.fields.tags,title);\n\t\t\t}\n\t\t});\n\t\tself.each(function(tiddler,title) {\n\t\t\tstoreTags(tiddler.fields.tags,title);\n\t\t});\n\t\treturn tags;\n\t});\n};\n\n/*\nLookup a given tiddler and return a list of all the tiddlers that include it in the specified list field\n*/\nexports.findListingsOfTiddler = function(targetTitle,fieldName) {\n\tfieldName = fieldName || \"list\";\n\tvar titles = [];\n\tthis.each(function(tiddler,title) {\n\t\tvar list = $tw.utils.parseStringArray(tiddler.fields[fieldName]);\n\t\tif(list && list.indexOf(targetTitle) !== -1) {\n\t\t\ttitles.push(title);\n\t\t}\n\t});\n\treturn titles;\n};\n\n/*\nSorts an array of tiddler titles according to an ordered list\n*/\nexports.sortByList = function(array,listTitle) {\n\tvar self = this,\n\t\treplacedTitles = Object.create(null);\n\t// Given a title, this function will place it in the correct location\n\t// within titles.\n\tfunction moveItemInList(title) {\n\t\tif(!$tw.utils.hop(replacedTitles, title)) {\n\t\t\treplacedTitles[title] = true;\n\t\t\tvar newPos = -1,\n\t\t\t\ttiddler = self.getTiddler(title);\n\t\t\tif(tiddler) {\n\t\t\t\tvar beforeTitle = tiddler.fields[\"list-before\"],\n\t\t\t\t\tafterTitle = tiddler.fields[\"list-after\"];\n\t\t\t\tif(beforeTitle === \"\") {\n\t\t\t\t\tnewPos = 0;\n\t\t\t\t} else if(afterTitle === \"\") {\n\t\t\t\t\tnewPos = titles.length;\n\t\t\t\t} else if(beforeTitle) {\n\t\t\t\t\t// if this title is placed relative\n\t\t\t\t\t// to another title, make sure that\n\t\t\t\t\t// title is placed before we place\n\t\t\t\t\t// this one.\n\t\t\t\t\tmoveItemInList(beforeTitle);\n\t\t\t\t\tnewPos = titles.indexOf(beforeTitle);\n\t\t\t\t} else if(afterTitle) {\n\t\t\t\t\t// Same deal\n\t\t\t\t\tmoveItemInList(afterTitle);\n\t\t\t\t\tnewPos = titles.indexOf(afterTitle);\n\t\t\t\t\tif(newPos >= 0) {\n\t\t\t\t\t\t++newPos;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If a new position is specified, let's move it\n\t\t\t\tif (newPos !== -1) {\n\t\t\t\t\t// get its current Pos, and make sure\n\t\t\t\t\t// sure that it's _actually_ in the list\n\t\t\t\t\t// and that it would _actually_ move\n\t\t\t\t\t// (#4275) We don't bother calling\n\t\t\t\t\t// indexOf unless we have a new\n\t\t\t\t\t// position to work with\n\t\t\t\t\tvar currPos = titles.indexOf(title);\n\t\t\t\t\tif(currPos >= 0 && newPos !== currPos) {\n\t\t\t\t\t\t// move it!\n\t\t\t\t\t\ttitles.splice(currPos,1);\n\t\t\t\t\t\tif(newPos >= currPos) {\n\t\t\t\t\t\t\tnewPos--;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitles.splice(newPos,0,title);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tvar list = this.getTiddlerList(listTitle);\n\tif(!array || array.length === 0) {\n\t\treturn [];\n\t} else {\n\t\tvar titles = [], t, title;\n\t\t// First place any entries that are present in the list\n\t\tfor(t=0; t<list.length; t++) {\n\t\t\ttitle = list[t];\n\t\t\tif(array.indexOf(title) !== -1) {\n\t\t\t\ttitles.push(title);\n\t\t\t}\n\t\t}\n\t\t// Then place any remaining entries\n\t\tfor(t=0; t<array.length; t++) {\n\t\t\ttitle = array[t];\n\t\t\tif(list.indexOf(title) === -1) {\n\t\t\t\ttitles.push(title);\n\t\t\t}\n\t\t}\n\t\t// Finally obey the list-before and list-after fields of each tiddler in turn\n\t\tvar sortedTitles = titles.slice(0);\n\t\tfor(t=0; t<sortedTitles.length; t++) {\n\t\t\ttitle = sortedTitles[t];\n\t\t\tmoveItemInList(title);\n\t\t}\n\t\treturn titles;\n\t}\n};\n\nexports.getSubTiddler = function(title,subTiddlerTitle) {\n\tvar bundleInfo = this.getPluginInfo(title) || this.getTiddlerDataCached(title);\n\tif(bundleInfo && bundleInfo.tiddlers) {\n\t\tvar subTiddler = bundleInfo.tiddlers[subTiddlerTitle];\n\t\tif(subTiddler) {\n\t\t\treturn new $tw.Tiddler(subTiddler);\n\t\t}\n\t}\n\treturn null;\n};\n\n/*\nRetrieve a tiddler as a JSON string of the fields\n*/\nexports.getTiddlerAsJson = function(title) {\n\tvar tiddler = this.getTiddler(title);\n\tif(tiddler) {\n\t\tvar fields = Object.create(null);\n\t\t$tw.utils.each(tiddler.fields,function(value,name) {\n\t\t\tfields[name] = tiddler.getFieldString(name);\n\t\t});\n\t\treturn JSON.stringify(fields);\n\t} else {\n\t\treturn JSON.stringify({title: title});\n\t}\n};\n\nexports.getTiddlersAsJson = function(filter,spaces) {\n\tvar tiddlers = this.filterTiddlers(filter),\n\t\tspaces = (spaces === undefined) ? $tw.config.preferences.jsonSpaces : spaces,\n\t\tdata = [];\n\tfor(var t=0;t<tiddlers.length; t++) {\n\t\tvar tiddler = this.getTiddler(tiddlers[t]);\n\t\tif(tiddler) {\n\t\t\tvar fields = new Object();\n\t\t\tfor(var field in tiddler.fields) {\n\t\t\t\tfields[field] = tiddler.getFieldString(field);\n\t\t\t}\n\t\t\tdata.push(fields);\n\t\t}\n\t}\n\treturn JSON.stringify(data,null,spaces);\n};\n\n/*\nGet the content of a tiddler as a JavaScript object. How this is done depends on the type of the tiddler:\n\napplication/json: the tiddler JSON is parsed into an object\napplication/x-tiddler-dictionary: the tiddler is parsed as sequence of name:value pairs\n\nOther types currently just return null.\n\ntitleOrTiddler: string tiddler title or a tiddler object\ndefaultData: default data to be returned if the tiddler is missing or doesn't contain data\n\nNote that the same value is returned for repeated calls for the same tiddler data. The value is frozen to prevent modification; otherwise modifications would be visible to all callers\n*/\nexports.getTiddlerDataCached = function(titleOrTiddler,defaultData) {\n\tvar self = this,\n\t\ttiddler = titleOrTiddler;\n\tif(!(tiddler instanceof $tw.Tiddler)) {\n\t\ttiddler = this.getTiddler(tiddler);\n\t}\n\tif(tiddler) {\n\t\treturn this.getCacheForTiddler(tiddler.fields.title,\"data\",function() {\n\t\t\t// Return the frozen value\n\t\t\tvar value = self.getTiddlerData(tiddler.fields.title,undefined);\n\t\t\t$tw.utils.deepFreeze(value);\n\t\t\treturn value;\n\t\t}) || defaultData;\n\t} else {\n\t\treturn defaultData;\n\t}\n};\n\n/*\nAlternative, uncached version of getTiddlerDataCached(). The return value can be mutated freely and reused\n*/\nexports.getTiddlerData = function(titleOrTiddler,defaultData) {\n\tvar tiddler = titleOrTiddler,\n\t\tdata;\n\tif(!(tiddler instanceof $tw.Tiddler)) {\n\t\ttiddler = this.getTiddler(tiddler);\n\t}\n\tif(tiddler && tiddler.fields.text) {\n\t\tswitch(tiddler.fields.type) {\n\t\t\tcase \"application/json\":\n\t\t\t\t// JSON tiddler\n\t\t\t\ttry {\n\t\t\t\t\tdata = JSON.parse(tiddler.fields.text);\n\t\t\t\t} catch(ex) {\n\t\t\t\t\treturn defaultData;\n\t\t\t\t}\n\t\t\t\treturn data;\n\t\t\tcase \"application/x-tiddler-dictionary\":\n\t\t\t\treturn $tw.utils.parseFields(tiddler.fields.text);\n\t\t}\n\t}\n\treturn defaultData;\n};\n\n/*\nExtract an indexed field from within a data tiddler\n*/\nexports.extractTiddlerDataItem = function(titleOrTiddler,index,defaultText) {\n\tvar data = this.getTiddlerDataCached(titleOrTiddler,Object.create(null)),\n\t\ttext;\n\tif(data && $tw.utils.hop(data,index)) {\n\t\ttext = data[index];\n\t}\n\tif(typeof text === \"string\" || typeof text === \"number\") {\n\t\treturn text.toString();\n\t} else {\n\t\treturn defaultText;\n\t}\n};\n\n/*\nSet a tiddlers content to a JavaScript object. Currently this is done by setting the tiddler's type to \"application/json\" and setting the text to the JSON text of the data.\ntitle: title of tiddler\ndata: object that can be serialised to JSON\nfields: optional hashmap of additional tiddler fields to be set\n*/\nexports.setTiddlerData = function(title,data,fields) {\n\tvar existingTiddler = this.getTiddler(title),\n\t\tnewFields = {\n\t\t\ttitle: title\n\t};\n\tif(existingTiddler && existingTiddler.fields.type === \"application/x-tiddler-dictionary\") {\n\t\tnewFields.text = $tw.utils.makeTiddlerDictionary(data);\n\t} else {\n\t\tnewFields.type = \"application/json\";\n\t\tnewFields.text = JSON.stringify(data,null,$tw.config.preferences.jsonSpaces);\n\t}\n\tthis.addTiddler(new $tw.Tiddler(this.getCreationFields(),existingTiddler,fields,newFields,this.getModificationFields()));\n};\n\n/*\nReturn the content of a tiddler as an array containing each line\n*/\nexports.getTiddlerList = function(title,field,index) {\n\tif(index) {\n\t\treturn $tw.utils.parseStringArray(this.extractTiddlerDataItem(title,index,\"\"));\n\t}\n\tfield = field || \"list\";\n\tvar tiddler = this.getTiddler(title);\n\tif(tiddler) {\n\t\treturn ($tw.utils.parseStringArray(tiddler.fields[field]) || []).slice(0);\n\t}\n\treturn [];\n};\n\n// Return a named global cache object. Global cache objects are cleared whenever a tiddler change occurs\nexports.getGlobalCache = function(cacheName,initializer) {\n\tthis.globalCache = this.globalCache || Object.create(null);\n\tif($tw.utils.hop(this.globalCache,cacheName)) {\n\t\treturn this.globalCache[cacheName];\n\t} else {\n\t\tthis.globalCache[cacheName] = initializer();\n\t\treturn this.globalCache[cacheName];\n\t}\n};\n\nexports.clearGlobalCache = function() {\n\tthis.globalCache = Object.create(null);\n};\n\n// Return the named cache object for a tiddler. If the cache doesn't exist then the initializer function is invoked to create it\nexports.getCacheForTiddler = function(title,cacheName,initializer) {\n\tthis.caches = this.caches || Object.create(null);\n\tvar caches = this.caches[title];\n\tif(caches && caches[cacheName]) {\n\t\treturn caches[cacheName];\n\t} else {\n\t\tif(!caches) {\n\t\t\tcaches = Object.create(null);\n\t\t\tthis.caches[title] = caches;\n\t\t}\n\t\tcaches[cacheName] = initializer();\n\t\treturn caches[cacheName];\n\t}\n};\n\n// Clear all caches associated with a particular tiddler, or, if the title is null, clear all the caches for all the tiddlers\nexports.clearCache = function(title) {\n\tif(title) {\n\t\tthis.caches = this.caches || Object.create(null);\n\t\tif($tw.utils.hop(this.caches,title)) {\n\t\t\tdelete this.caches[title];\n\t\t}\n\t} else {\n\t\tthis.caches = Object.create(null);\n\t}\n};\n\nexports.initParsers = function(moduleType) {\n\t// Install the parser modules\n\t$tw.Wiki.parsers = {};\n\tvar self = this;\n\t$tw.modules.forEachModuleOfType(\"parser\",function(title,module) {\n\t\tfor(var f in module) {\n\t\t\tif($tw.utils.hop(module,f)) {\n\t\t\t\t$tw.Wiki.parsers[f] = module[f]; // Store the parser class\n\t\t\t}\n\t\t}\n\t});\n\t// Use the generic binary parser for any binary types not registered so far\n\tif($tw.Wiki.parsers[\"application/octet-stream\"]) {\n\t\tObject.keys($tw.config.contentTypeInfo).forEach(function(type) {\n\t\t\tif(!$tw.utils.hop($tw.Wiki.parsers,type) && $tw.config.contentTypeInfo[type].encoding === \"base64\") {\n\t\t\t\t$tw.Wiki.parsers[type] = $tw.Wiki.parsers[\"application/octet-stream\"];\n\t\t\t}\n\t\t});\n\t}\n};\n\n/*\nParse a block of text of a specified MIME type\n\ttype: content type of text to be parsed\n\ttext: text\n\toptions: see below\nOptions include:\n\tparseAsInline: if true, the text of the tiddler will be parsed as an inline run\n\t_canonical_uri: optional string of the canonical URI of this content\n*/\nexports.parseText = function(type,text,options) {\n\ttext = text || \"\";\n\toptions = options || {};\n\t// Select a parser\n\tvar Parser = $tw.Wiki.parsers[type];\n\tif(!Parser && $tw.utils.getFileExtensionInfo(type)) {\n\t\tParser = $tw.Wiki.parsers[$tw.utils.getFileExtensionInfo(type).type];\n\t}\n\tif(!Parser) {\n\t\tParser = $tw.Wiki.parsers[options.defaultType || \"text/vnd.tiddlywiki\"];\n\t}\n\tif(!Parser) {\n\t\treturn null;\n\t}\n\t// Return the parser instance\n\treturn new Parser(type,text,{\n\t\tparseAsInline: options.parseAsInline,\n\t\twiki: this,\n\t\t_canonical_uri: options._canonical_uri\n\t});\n};\n\n/*\nParse a tiddler according to its MIME type\n*/\nexports.parseTiddler = function(title,options) {\n\toptions = $tw.utils.extend({},options);\n\tvar cacheType = options.parseAsInline ? \"inlineParseTree\" : \"blockParseTree\",\n\t\ttiddler = this.getTiddler(title),\n\t\tself = this;\n\treturn tiddler ? this.getCacheForTiddler(title,cacheType,function() {\n\t\t\tif(tiddler.hasField(\"_canonical_uri\")) {\n\t\t\t\toptions._canonical_uri = tiddler.fields._canonical_uri;\n\t\t\t}\n\t\t\treturn self.parseText(tiddler.fields.type,tiddler.fields.text,options);\n\t\t}) : null;\n};\n\nexports.parseTextReference = function(title,field,index,options) {\n\tvar tiddler,text;\n\tif(options.subTiddler) {\n\t\ttiddler = this.getSubTiddler(title,options.subTiddler);\n\t} else {\n\t\ttiddler = this.getTiddler(title);\n\t\tif(field === \"text\" || (!field && !index)) {\n\t\t\tthis.getTiddlerText(title); // Force the tiddler to be lazily loaded\n\t\t\treturn this.parseTiddler(title,options);\n\t\t}\n\t}\n\tif(field === \"text\" || (!field && !index)) {\n\t\tif(tiddler && tiddler.fields) {\n\t\t\treturn this.parseText(tiddler.fields.type,tiddler.fields.text,options);\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t} else if(field) {\n\t\tif(field === \"title\") {\n\t\t\ttext = title;\n\t\t} else {\n\t\t\tif(!tiddler || !tiddler.hasField(field)) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\ttext = tiddler.fields[field];\n\t\t}\n\t\treturn this.parseText(\"text/vnd.tiddlywiki\",text.toString(),options);\n\t} else if(index) {\n\t\tthis.getTiddlerText(title); // Force the tiddler to be lazily loaded\n\t\ttext = this.extractTiddlerDataItem(tiddler,index,undefined);\n\t\tif(text === undefined) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this.parseText(\"text/vnd.tiddlywiki\",text,options);\n\t}\n};\n\n/*\nMake a widget tree for a parse tree\nparser: parser object\noptions: see below\nOptions include:\ndocument: optional document to use\nvariables: hashmap of variables to set\nparentWidget: optional parent widget for the root node\n*/\nexports.makeWidget = function(parser,options) {\n\toptions = options || {};\n\tvar widgetNode = {\n\t\t\ttype: \"widget\",\n\t\t\tchildren: []\n\t\t},\n\t\tcurrWidgetNode = widgetNode;\n\t// Create set variable widgets for each variable\n\t$tw.utils.each(options.variables,function(value,name) {\n\t\tvar setVariableWidget = {\n\t\t\ttype: \"set\",\n\t\t\tattributes: {\n\t\t\t\tname: {type: \"string\", value: name},\n\t\t\t\tvalue: {type: \"string\", value: value}\n\t\t\t},\n\t\t\tchildren: []\n\t\t};\n\t\tcurrWidgetNode.children = [setVariableWidget];\n\t\tcurrWidgetNode = setVariableWidget;\n\t});\n\t// Add in the supplied parse tree nodes\n\tcurrWidgetNode.children = parser ? parser.tree : [];\n\t// Create the widget\n\treturn new widget.widget(widgetNode,{\n\t\twiki: this,\n\t\tdocument: options.document || $tw.fakeDocument,\n\t\tparentWidget: options.parentWidget\n\t});\n};\n\n/*\nMake a widget tree for transclusion\ntitle: target tiddler title\noptions: as for wiki.makeWidget() plus:\noptions.field: optional field to transclude (defaults to \"text\")\noptions.mode: transclusion mode \"inline\" or \"block\"\noptions.recursionMarker : optional flag to set a recursion marker, defaults to \"yes\"\noptions.children: optional array of children for the transclude widget\noptions.importVariables: optional importvariables filter string for macros to be included\noptions.importPageMacros: optional boolean; if true, equivalent to passing \"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\" to options.importVariables\n*/\nexports.makeTranscludeWidget = function(title,options) {\n\toptions = options || {};\n\tvar parseTreeDiv = {tree: [{\n\t\t\ttype: \"element\",\n\t\t\ttag: \"div\",\n\t\t\tchildren: []}]},\n\t\tparseTreeImportVariables = {\n\t\t\ttype: \"importvariables\",\n\t\t\tattributes: {\n\t\t\t\tfilter: {\n\t\t\t\t\tname: \"filter\",\n\t\t\t\t\ttype: \"string\"\n\t\t\t\t}\n\t\t\t},\n\t\t\tisBlock: false,\n\t\t\tchildren: []},\n\t\tparseTreeTransclude = {\n\t\t\ttype: \"transclude\",\n\t\t\tattributes: {\n\t\t\t\trecursionMarker: {\n\t\t\t\t\tname: \"recursionMarker\",\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalue: options.recursionMarker || \"yes\"\n\t\t\t\t\t},\n\t\t\t\ttiddler: {\n\t\t\t\t\tname: \"tiddler\",\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalue: title\n\t\t\t\t}\n\t\t\t},\n\t\t\tisBlock: !options.parseAsInline};\n\tif(options.importVariables || options.importPageMacros) {\n\t\tif(options.importVariables) {\n\t\t\tparseTreeImportVariables.attributes.filter.value = options.importVariables;\n\t\t} else if(options.importPageMacros) {\n\t\t\tparseTreeImportVariables.attributes.filter.value = \"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\";\n\t\t}\n\t\tparseTreeDiv.tree[0].children.push(parseTreeImportVariables);\n\t\tparseTreeImportVariables.children.push(parseTreeTransclude);\n\t} else {\n\t\tparseTreeDiv.tree[0].children.push(parseTreeTransclude);\n\t}\n\tif(options.field) {\n\t\tparseTreeTransclude.attributes.field = {type: \"string\", value: options.field};\n\t}\n\tif(options.mode) {\n\t\tparseTreeTransclude.attributes.mode = {type: \"string\", value: options.mode};\n\t}\n\tif(options.children) {\n\t\tparseTreeTransclude.children = options.children;\n\t}\n\treturn this.makeWidget(parseTreeDiv,options);\n};\n\n/*\nParse text in a specified format and render it into another format\n\toutputType: content type for the output\n\ttextType: content type of the input text\n\ttext: input text\n\toptions: see below\nOptions include:\nvariables: hashmap of variables to set\nparentWidget: optional parent widget for the root node\n*/\nexports.renderText = function(outputType,textType,text,options) {\n\toptions = options || {};\n\tvar parser = this.parseText(textType,text,options),\n\t\twidgetNode = this.makeWidget(parser,options);\n\tvar container = $tw.fakeDocument.createElement(\"div\");\n\twidgetNode.render(container,null);\n\treturn outputType === \"text/html\" ? container.innerHTML : container.textContent;\n};\n\n/*\nParse text from a tiddler and render it into another format\n\toutputType: content type for the output\n\ttitle: title of the tiddler to be rendered\n\toptions: see below\nOptions include:\nvariables: hashmap of variables to set\nparentWidget: optional parent widget for the root node\n*/\nexports.renderTiddler = function(outputType,title,options) {\n\toptions = options || {};\n\tvar parser = this.parseTiddler(title,options),\n\t\twidgetNode = this.makeWidget(parser,options);\n\tvar container = $tw.fakeDocument.createElement(\"div\");\n\twidgetNode.render(container,null);\n\treturn outputType === \"text/html\" ? container.innerHTML : (outputType === \"text/plain-formatted\" ? container.formattedTextContent : container.textContent);\n};\n\n/*\nReturn an array of tiddler titles that match a search string\n\ttext: The text string to search for\n\toptions: see below\nOptions available:\n\tsource: an iterator function for the source tiddlers, called source(iterator), where iterator is called as iterator(tiddler,title)\n\texclude: An array of tiddler titles to exclude from the search\n\tinvert: If true returns tiddlers that do not contain the specified string\n\tcaseSensitive: If true forces a case sensitive search\n\tfield: If specified, restricts the search to the specified field, or an array of field names\n\tanchored: If true, forces all but regexp searches to be anchored to the start of text\n\texcludeField: If true, the field options are inverted to specify the fields that are not to be searched\n\tThe search mode is determined by the first of these boolean flags to be true\n\t\tliteral: searches for literal string\n\t\twhitespace: same as literal except runs of whitespace are treated as a single space\n\t\tregexp: treats the search term as a regular expression\n\t\twords: (default) treats search string as a list of tokens, and matches if all tokens are found, regardless of adjacency or ordering\n*/\nexports.search = function(text,options) {\n\toptions = options || {};\n\tvar self = this,\n\t\tt,\n\t\tinvert = !!options.invert;\n\t// Convert the search string into a regexp for each term\n\tvar terms, searchTermsRegExps,\n\t\tflags = options.caseSensitive ? \"\" : \"i\",\n\t\tanchor = options.anchored ? \"^\" : \"\";\n\tif(options.literal) {\n\t\tif(text.length === 0) {\n\t\t\tsearchTermsRegExps = null;\n\t\t} else {\n\t\t\tsearchTermsRegExps = [new RegExp(\"(\" + anchor + $tw.utils.escapeRegExp(text) + \")\",flags)];\n\t\t}\n\t} else if(options.whitespace) {\n\t\tterms = [];\n\t\t$tw.utils.each(text.split(/\\s+/g),function(term) {\n\t\t\tif(term) {\n\t\t\t\tterms.push($tw.utils.escapeRegExp(term));\n\t\t\t}\n\t\t});\n\t\tsearchTermsRegExps = [new RegExp(\"(\" + anchor + terms.join(\"\\\\s+\") + \")\",flags)];\n\t} else if(options.regexp) {\n\t\ttry {\n\t\t\tsearchTermsRegExps = [new RegExp(\"(\" + text + \")\",flags)];\n\t\t} catch(e) {\n\t\t\tsearchTermsRegExps = null;\n\t\t\tconsole.log(\"Regexp error parsing /(\" + text + \")/\" + flags + \": \",e);\n\t\t}\n\t} else {\n\t\tterms = text.split(/ +/);\n\t\tif(terms.length === 1 && terms[0] === \"\") {\n\t\t\tsearchTermsRegExps = null;\n\t\t} else {\n\t\t\tsearchTermsRegExps = [];\n\t\t\tfor(t=0; t<terms.length; t++) {\n\t\t\t\tsearchTermsRegExps.push(new RegExp(\"(\" + anchor + $tw.utils.escapeRegExp(terms[t]) + \")\",flags));\n\t\t\t}\n\t\t}\n\t}\n\t// Accumulate the array of fields to be searched or excluded from the search\n\tvar fields = [];\n\tif(options.field) {\n\t\tif($tw.utils.isArray(options.field)) {\n\t\t\t$tw.utils.each(options.field,function(fieldName) {\n\t\t\t\tif(fieldName) {\n\t\t\t\t\tfields.push(fieldName);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tfields.push(options.field);\n\t\t}\n\t}\n\t// Use default fields if none specified and we're not excluding fields (excluding fields with an empty field array is the same as searching all fields)\n\tif(fields.length === 0 && !options.excludeField) {\n\t\tfields.push(\"title\");\n\t\tfields.push(\"tags\");\n\t\tfields.push(\"text\");\n\t}\n\t// Function to check a given tiddler for the search term\n\tvar searchTiddler = function(title) {\n\t\tif(!searchTermsRegExps) {\n\t\t\treturn true;\n\t\t}\n\t\tvar notYetFound = searchTermsRegExps.slice();\n\n\t\tvar tiddler = self.getTiddler(title);\n\t\tif(!tiddler) {\n\t\t\ttiddler = new $tw.Tiddler({title: title, text: \"\", type: \"text/vnd.tiddlywiki\"});\n\t\t}\n\t\tvar contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type] || $tw.config.contentTypeInfo[\"text/vnd.tiddlywiki\"],\n\t\t\tsearchFields;\n\t\t// Get the list of fields we're searching\n\t\tif(options.excludeField) {\n\t\t\tsearchFields = Object.keys(tiddler.fields);\n\t\t\t$tw.utils.each(fields,function(fieldName) {\n\t\t\t\tvar p = searchFields.indexOf(fieldName);\n\t\t\t\tif(p !== -1) {\n\t\t\t\t\tsearchFields.splice(p,1);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tsearchFields = fields;\n\t\t}\n\t\tfor(var fieldIndex=0; notYetFound.length>0 && fieldIndex<searchFields.length; fieldIndex++) {\n\t\t\t// Don't search the text field if the content type is binary\n\t\t\tvar fieldName = searchFields[fieldIndex];\n\t\t\tif(fieldName === \"text\" && contentTypeInfo.encoding !== \"utf8\") {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar str = tiddler.fields[fieldName],\n\t\t\t\tt;\n\t\t\tif(str) {\n\t\t\t\tif($tw.utils.isArray(str)) {\n\t\t\t\t\t// If the field value is an array, test each regexp against each field array entry and fail if each regexp doesn't match at least one field array entry\n\t\t\t\t\tfor(var s=0; s<str.length; s++) {\n\t\t\t\t\t\tfor(t=0; t<notYetFound.length;) {\n\t\t\t\t\t\t\tif(notYetFound[t].test(str[s])) {\n\t\t\t\t\t\t\t\tnotYetFound.splice(t, 1);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tt++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If the field isn't an array, force it to a string and test each regexp against it and fail if any do not match\n\t\t\t\t\tstr = tiddler.getFieldString(fieldName);\n\t\t\t\t\tfor(t=0; t<notYetFound.length;) {\n\t\t\t\t\t\tif(notYetFound[t].test(str)) {\n\t\t\t\t\t\t\tnotYetFound.splice(t, 1);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tt++;\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\treturn notYetFound.length == 0;\n\t};\n\t// Loop through all the tiddlers doing the search\n\tvar results = [],\n\t\tsource = options.source || this.each;\n\tsource(function(tiddler,title) {\n\t\tif(searchTiddler(title) !== invert) {\n\t\t\tresults.push(title);\n\t\t}\n\t});\n\t// Remove any of the results we have to exclude\n\tif(options.exclude) {\n\t\tfor(t=0; t<options.exclude.length; t++) {\n\t\t\tvar p = results.indexOf(options.exclude[t]);\n\t\t\tif(p !== -1) {\n\t\t\t\tresults.splice(p,1);\n\t\t\t}\n\t\t}\n\t}\n\treturn results;\n};\n\n/*\nTrigger a load for a tiddler if it is skinny. Returns the text, or undefined if the tiddler is missing, null if the tiddler is being lazily loaded.\n*/\nexports.getTiddlerText = function(title,defaultText) {\n\tvar tiddler = this.getTiddler(title);\n\t// Return undefined if the tiddler isn't found\n\tif(!tiddler) {\n\t\treturn defaultText;\n\t}\n\tif(!tiddler.hasField(\"_is_skinny\")) {\n\t\t// Just return the text if we've got it\n\t\treturn tiddler.fields.text || \"\";\n\t} else {\n\t\t// Tell any listeners about the need to lazily load this tiddler\n\t\tthis.dispatchEvent(\"lazyLoad\",title);\n\t\t// Indicate that the text is being loaded\n\t\treturn null;\n\t}\n};\n\n/*\nCheck whether the text of a tiddler matches a given value. By default, the comparison is case insensitive, and any spaces at either end of the tiddler text is trimmed\n*/\nexports.checkTiddlerText = function(title,targetText,options) {\n\toptions = options || {};\n\tvar text = this.getTiddlerText(title,\"\");\n\tif(!options.noTrim) {\n\t\ttext = text.trim();\n\t}\n\tif(!options.caseSensitive) {\n\t\ttext = text.toLowerCase();\n\t\ttargetText = targetText.toLowerCase();\n\t}\n\treturn text === targetText;\n}\n\n/*\nRead an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read\n*/\nexports.readFiles = function(files,options) {\n\tvar callback;\n\tif(typeof options === \"function\") {\n\t\tcallback = options;\n\t\toptions = {};\n\t} else {\n\t\tcallback = options.callback;\n\t}\n\tvar result = [],\n\t\toutstanding = files.length,\n\t\treadFileCallback = function(tiddlerFieldsArray) {\n\t\t\tresult.push.apply(result,tiddlerFieldsArray);\n\t\t\tif(--outstanding === 0) {\n\t\t\t\tcallback(result);\n\t\t\t}\n\t\t};\n\tfor(var f=0; f<files.length; f++) {\n\t\tthis.readFile(files[f],$tw.utils.extend({},options,{callback: readFileCallback}));\n\t}\n\treturn files.length;\n};\n\n/*\nRead a browser File object, invoking callback(tiddlerFieldsArray) with an array of tiddler fields objects\n*/\nexports.readFile = function(file,options) {\n\tvar callback;\n\tif(typeof options === \"function\") {\n\t\tcallback = options;\n\t\toptions = {};\n\t} else {\n\t\tcallback = options.callback;\n\t}\n\t// Get the type, falling back to the filename extension\n\tvar self = this,\n\t\ttype = file.type;\n\tif(type === \"\" || !type) {\n\t\tvar dotPos = file.name.lastIndexOf(\".\");\n\t\tif(dotPos !== -1) {\n\t\t\tvar fileExtensionInfo = $tw.utils.getFileExtensionInfo(file.name.substr(dotPos));\n\t\t\tif(fileExtensionInfo) {\n\t\t\t\ttype = fileExtensionInfo.type;\n\t\t\t}\n\t\t}\n\t}\n\t// Figure out if we're reading a binary file\n\tvar contentTypeInfo = $tw.config.contentTypeInfo[type],\n\t\tisBinary = contentTypeInfo ? contentTypeInfo.encoding === \"base64\" : false;\n\t// Log some debugging information\n\tif($tw.log.IMPORT) {\n\t\tconsole.log(\"Importing file '\" + file.name + \"', type: '\" + type + \"', isBinary: \" + isBinary);\n\t}\n\t// Give the hook a chance to process the drag\n\tif($tw.hooks.invokeHook(\"th-importing-file\",{\n\t\tfile: file,\n\t\ttype: type,\n\t\tisBinary: isBinary,\n\t\tcallback: callback\n\t}) !== true) {\n\t\tthis.readFileContent(file,type,isBinary,options.deserializer,callback);\n\t}\n};\n\n/*\nLower level utility to read the content of a browser File object, invoking callback(tiddlerFieldsArray) with an array of tiddler fields objects\n*/\nexports.readFileContent = function(file,type,isBinary,deserializer,callback) {\n\tvar self = this;\n\t// Create the FileReader\n\tvar reader = new FileReader();\n\t// Onload\n\treader.onload = function(event) {\n\t\tvar text = event.target.result,\n\t\t\ttiddlerFields = {title: file.name || \"Untitled\"};\n\t\tif(isBinary) {\n\t\t\tvar commaPos = text.indexOf(\",\");\n\t\t\tif(commaPos !== -1) {\n\t\t\t\ttext = text.substr(commaPos + 1);\n\t\t\t}\n\t\t}\n\t\t// Check whether this is an encrypted TiddlyWiki file\n\t\tvar encryptedJson = $tw.utils.extractEncryptedStoreArea(text);\n\t\tif(encryptedJson) {\n\t\t\t// If so, attempt to decrypt it with the current password\n\t\t\t$tw.utils.decryptStoreAreaInteractive(encryptedJson,function(tiddlers) {\n\t\t\t\tcallback(tiddlers);\n\t\t\t});\n\t\t} else {\n\t\t\t// Otherwise, just try to deserialise any tiddlers in the file\n\t\t\tcallback(self.deserializeTiddlers(type,text,tiddlerFields,{deserializer: deserializer}));\n\t\t}\n\t};\n\t// Kick off the read\n\tif(isBinary) {\n\t\treader.readAsDataURL(file);\n\t} else {\n\t\treader.readAsText(file);\n\t}\n};\n\n/*\nFind any existing draft of a specified tiddler\n*/\nexports.findDraft = function(targetTitle) {\n\tvar draftTitle = undefined;\n\tthis.forEachTiddler({includeSystem: true},function(title,tiddler) {\n\t\tif(tiddler.fields[\"draft.title\"] && tiddler.fields[\"draft.of\"] === targetTitle) {\n\t\t\tdraftTitle = title;\n\t\t}\n\t});\n\treturn draftTitle;\n}\n\n/*\nCheck whether the specified draft tiddler has been modified.\nIf the original tiddler doesn't exist, create a vanilla tiddler variable,\nto check if additional fields have been added.\n*/\nexports.isDraftModified = function(title) {\n\tvar tiddler = this.getTiddler(title);\n\tif(!tiddler.isDraft()) {\n\t\treturn false;\n\t}\n\tvar ignoredFields = [\"created\", \"modified\", \"title\", \"draft.title\", \"draft.of\"],\n\t\torigTiddler = this.getTiddler(tiddler.fields[\"draft.of\"]) || new $tw.Tiddler({text:\"\", tags:[]}),\n\t\ttitleModified = tiddler.fields[\"draft.title\"] !== tiddler.fields[\"draft.of\"];\n\treturn titleModified || !tiddler.isEqual(origTiddler,ignoredFields);\n};\n\n/*\nAdd a new record to the top of the history stack\ntitle: a title string or an array of title strings\nfromPageRect: page coordinates of the origin of the navigation\nhistoryTitle: title of history tiddler (defaults to $:/HistoryList)\n*/\nexports.addToHistory = function(title,fromPageRect,historyTitle) {\n\tvar story = new $tw.Story({wiki: this, historyTitle: historyTitle});\n\tstory.addToHistory(title,fromPageRect);\n\tconsole.log(\"$tw.wiki.addToHistory() is deprecated since V5.1.23! Use the this.story.addToHistory() from the story-object!\")\n};\n\n/*\nAdd a new tiddler to the story river\ntitle: a title string or an array of title strings\nfromTitle: the title of the tiddler from which the navigation originated\nstoryTitle: title of story tiddler (defaults to $:/StoryList)\noptions: see story.js\n*/\nexports.addToStory = function(title,fromTitle,storyTitle,options) {\n\tvar story = new $tw.Story({wiki: this, storyTitle: storyTitle});\n\tstory.addToStory(title,fromTitle,options);\n\tconsole.log(\"$tw.wiki.addToStory() is deprecated since V5.1.23! Use the this.story.addToStory() from the story-object!\")\n};\n\n/*\nGenerate a title for the draft of a given tiddler\n*/\nexports.generateDraftTitle = function(title) {\n\tvar c = 0,\n\t\tdraftTitle,\n\t\tusername = this.getTiddlerText(\"$:/status/UserName\"),\n\t\tattribution = username ? \" by \" + username : \"\";\n\tdo {\n\t\tdraftTitle = \"Draft \" + (c ? (c + 1) + \" \" : \"\") + \"of '\" + title + \"'\" + attribution;\n\t\tc++;\n\t} while(this.tiddlerExists(draftTitle));\n\treturn draftTitle;\n};\n\n/*\nInvoke the available upgrader modules\ntitles: array of tiddler titles to be processed\ntiddlers: hashmap by title of tiddler fields of pending import tiddlers. These can be modified by the upgraders. An entry with no fields indicates a tiddler that was pending import has been suppressed. When entries are added to the pending import the tiddlers hashmap may have entries that are not present in the titles array\nReturns a hashmap of messages keyed by tiddler title.\n*/\nexports.invokeUpgraders = function(titles,tiddlers) {\n\t// Collect up the available upgrader modules\n\tvar self = this;\n\tif(!this.upgraderModules) {\n\t\tthis.upgraderModules = [];\n\t\t$tw.modules.forEachModuleOfType(\"upgrader\",function(title,module) {\n\t\t\tif(module.upgrade) {\n\t\t\t\tself.upgraderModules.push(module);\n\t\t\t}\n\t\t});\n\t}\n\t// Invoke each upgrader in turn\n\tvar messages = {};\n\tfor(var t=0; t<this.upgraderModules.length; t++) {\n\t\tvar upgrader = this.upgraderModules[t],\n\t\t\tupgraderMessages = upgrader.upgrade(this,titles,tiddlers);\n\t\t$tw.utils.extend(messages,upgraderMessages);\n\t}\n\treturn messages;\n};\n\n// Determine whether a plugin by title is dynamically loadable\nexports.doesPluginRequireReload = function(title) {\n\tvar tiddler = this.getTiddler(title);\n\tif(tiddler && tiddler.fields.type === \"application/json\" && tiddler.fields[\"plugin-type\"]) {\n\t\tif(tiddler.fields[\"plugin-type\"] === \"import\") {\n\t\t\t// The import plugin never requires reloading\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn this.doesPluginInfoRequireReload(this.getPluginInfo(title) || this.getTiddlerDataCached(title));\n};\n\n// Determine whether a plugin info structure is dynamically loadable\nexports.doesPluginInfoRequireReload = function(pluginInfo) {\n\tif(pluginInfo) {\n\t\tvar foundModule = false;\n\t\t$tw.utils.each(pluginInfo.tiddlers,function(tiddler) {\n\t\t\tif(tiddler.type === \"application/javascript\" && $tw.utils.hop(tiddler,\"module-type\")) {\n\t\t\t\tfoundModule = true;\n\t\t\t}\n\t\t});\n\t\treturn foundModule;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nexports.slugify = function(title,options) {\n\tvar tiddler = this.getTiddler(title),\n\t\tslug;\n\tif(tiddler && tiddler.fields.slug) {\n\t\tslug = tiddler.fields.slug;\n\t} else {\n\t\tslug = $tw.utils.transliterate(title.toString().toLowerCase()) // Replace diacritics with basic lowercase ASCII\n\t\t\t.replace(/\\s+/g,\"-\") // Replace spaces with -\n\t\t\t.replace(/[^\\w\\-\\.]+/g,\"\") // Remove all non-word chars except dash and dot\n\t\t\t.replace(/\\-\\-+/g,\"-\") // Replace multiple - with single -\n\t\t\t.replace(/^-+/,\"\") // Trim - from start of text\n\t\t\t.replace(/-+$/,\"\"); // Trim - from end of text\n\t}\n\t// If the resulting slug is blank (eg because the title is just punctuation characters)\n\tif(!slug) {\n\t\t// ...then just use the character codes of the title\n\t\tvar result = [];\n\t\t$tw.utils.each(title.split(\"\"),function(char) {\n\t\t\tresult.push(char.charCodeAt(0).toString());\n\t\t});\n\t\tslug = result.join(\"-\");\n\t}\n\treturn slug;\n};\n\n/*\nReturn an array of the titles that would generate a specified slug, if any. Options include:\n*/\nexports.unslugify = function(slug) {\n\tvar self = this,\n\t\tslugToTitle = this.getGlobalCache(\"slugs\",function() {\n\t\t\tvar map = {};\n\t\t\t$tw.utils.each($tw.wiki.allTitles(),function(title) {\n\t\t\t\tvar slug = self.slugify(title);\n\t\t\t\tif(!(slug in map)) {\n\t\t\t\t\tmap[slug] = [];\n\t\t\t\t}\n\t\t\t\tmap[slug].push(title);\n\t\t\t});\n\t\t\treturn map;\n\t\t});\n\treturn slugToTitle[slug];\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "wikimethod"
},
"$:/palettes/Blanca": {
"title": "$:/palettes/Blanca",
"name": "Blanca",
"color-scheme": "light",
"description": "A clean white palette to let you focus",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #ffffff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background:\nbutton-foreground:\nbutton-border:\ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndirty-indicator: #ff0000\ndownload-background: #66cccc\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333333\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #999999\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #ffffff\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #7897f3\nselect-tag-background:\nselect-tag-foreground:\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #000000\nsidebar-controls-foreground: #ccc\nsidebar-foreground-shadow: rgba(255,255,255, 0.8)\nsidebar-foreground: #acacac\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #c0c0c0\nsidebar-tab-background-selected: #ffffff\nsidebar-tab-background: <<colour tab-background>>\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: <<colour tab-divider>>\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #444444\nsidebar-tiddler-link-foreground: #7897f3\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: #ffffff\ntab-background: #eeeeee\ntab-border-selected: #cccccc\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #ffeedd\ntag-foreground: #000\ntiddler-background: <<colour background>>\ntiddler-border: #eee\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #f8f8f8\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #f8f8f8\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #ff9900\ntoolbar-new-button:\ntoolbar-options-button:\ntoolbar-save-button:\ntoolbar-info-button:\ntoolbar-edit-button:\ntoolbar-close-button:\ntoolbar-delete-button:\ntoolbar-cancel-button:\ntoolbar-done-button:\nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/Blue": {
"title": "$:/palettes/Blue",
"name": "Blue",
"color-scheme": "light",
"description": "A blue theme",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #fff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background:\nbutton-foreground:\nbutton-border:\ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndirty-indicator: #ff0000\ndownload-background: #34c734\ndownload-foreground: <<colour foreground>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333353\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #999999\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #ddddff\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #5778d8\nselect-tag-background:\nselect-tag-foreground:\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #000000\nsidebar-controls-foreground: #ffffff\nsidebar-foreground-shadow: rgba(255,255,255, 0.8)\nsidebar-foreground: #acacac\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #c0c0c0\nsidebar-tab-background-selected: <<colour page-background>>\nsidebar-tab-background: <<colour tab-background>>\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: <<colour tab-divider>>\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #444444\nsidebar-tiddler-link-foreground: #5959c0\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: <<colour background>>\ntab-background: #ccccdd\ntab-border-selected: #ccccdd\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #eeeeff\ntag-foreground: #000\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #666666\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #ffffff\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #ffffff\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #5959c0\ntoolbar-new-button: #5eb95e\ntoolbar-options-button: rgb(128, 88, 165)\ntoolbar-save-button: #0e90d2\ntoolbar-info-button: #0e90d2\ntoolbar-edit-button: rgb(243, 123, 29)\ntoolbar-close-button: #dd514c\ntoolbar-delete-button: #dd514c\ntoolbar-cancel-button: rgb(243, 123, 29)\ntoolbar-done-button: #5eb95e\nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/Muted": {
"title": "$:/palettes/Muted",
"name": "Muted",
"color-scheme": "light",
"description": "Bright tiddlers on a muted background",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #ffffff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background:\nbutton-foreground:\nbutton-border:\ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndirty-indicator: #ff0000\ndownload-background: #34c734\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333333\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #bbb\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #6f6f70\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #29a6ee\nselect-tag-background:\nselect-tag-foreground:\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #000000\nsidebar-controls-foreground: #c2c1c2\nsidebar-foreground-shadow: rgba(255,255,255,0)\nsidebar-foreground: #d3d2d4\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #c0c0c0\nsidebar-tab-background-selected: #6f6f70\nsidebar-tab-background: #666667\nsidebar-tab-border-selected: #999\nsidebar-tab-border: #515151\nsidebar-tab-divider: #999\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: #999\nsidebar-tiddler-link-foreground-hover: #444444\nsidebar-tiddler-link-foreground: #d1d0d2\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: #ffffff\ntab-background: #d8d8d8\ntab-border-selected: #d8d8d8\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #d5ad34\ntag-foreground: #ffffff\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #f8f8f8\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #f8f8f8\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #182955\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/ContrastLight": {
"title": "$:/palettes/ContrastLight",
"name": "Contrast (Light)",
"color-scheme": "light",
"description": "High contrast and unambiguous (light version)",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #f00\nalert-border: <<colour background>>\nalert-highlight: <<colour foreground>>\nalert-muted-foreground: #800\nbackground: #fff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background: <<colour background>>\nbutton-foreground: <<colour foreground>>\nbutton-border: <<colour foreground>>\ncode-background: <<colour background>>\ncode-border: <<colour foreground>>\ncode-foreground: <<colour foreground>>\ndirty-indicator: #f00\ndownload-background: #080\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: <<colour foreground>>\ndropdown-tab-background: <<colour foreground>>\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #00a\nexternal-link-foreground: #00e\nforeground: #000\nmessage-background: <<colour foreground>>\nmessage-border: <<colour background>>\nmessage-foreground: <<colour background>>\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: <<colour foreground>>\nmodal-footer-background: <<colour background>>\nmodal-footer-border: <<colour foreground>>\nmodal-header-border: <<colour foreground>>\nmuted-foreground: <<colour foreground>>\nnotification-background: <<colour background>>\nnotification-border: <<colour foreground>>\npage-background: <<colour background>>\npre-background: <<colour background>>\npre-border: <<colour foreground>>\nprimary: #00f\nselect-tag-background:\nselect-tag-foreground:\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: <<colour background>>\nsidebar-controls-foreground: <<colour foreground>>\nsidebar-foreground-shadow: rgba(0,0,0, 0)\nsidebar-foreground: <<colour foreground>>\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: <<colour foreground>>\nsidebar-tab-background-selected: <<colour background>>\nsidebar-tab-background: <<colour tab-background>>\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: <<colour tab-divider>>\nsidebar-tab-foreground-selected: <<colour foreground>>\nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: <<colour foreground>>\nsidebar-tiddler-link-foreground: <<colour primary>>\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: <<colour background>>\ntab-background: <<colour foreground>>\ntab-border-selected: <<colour foreground>>\ntab-border: <<colour foreground>>\ntab-divider: <<colour foreground>>\ntab-foreground-selected: <<colour foreground>>\ntab-foreground: <<colour background>>\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #000\ntag-foreground: #fff\ntiddler-background: <<colour background>>\ntiddler-border: <<colour foreground>>\ntiddler-controls-foreground-hover: #ddd\ntiddler-controls-foreground-selected: #fdd\ntiddler-controls-foreground: <<colour foreground>>\ntiddler-editor-background: <<colour background>>\ntiddler-editor-border-image: <<colour foreground>>\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: <<colour background>>\ntiddler-editor-fields-odd: <<colour background>>\ntiddler-info-background: <<colour background>>\ntiddler-info-border: <<colour foreground>>\ntiddler-info-tab-background: <<colour background>>\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: <<colour foreground>>\ntiddler-title-foreground: <<colour foreground>>\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: <<colour foreground>>\nvery-muted-foreground: #888888\n"
},
"$:/palettes/ContrastDark": {
"title": "$:/palettes/ContrastDark",
"name": "Contrast (Dark)",
"color-scheme": "dark",
"description": "High contrast and unambiguous (dark version)",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #f00\nalert-border: <<colour background>>\nalert-highlight: <<colour foreground>>\nalert-muted-foreground: #800\nbackground: #000\nblockquote-bar: <<colour muted-foreground>>\nbutton-background: <<colour background>>\nbutton-foreground: <<colour foreground>>\nbutton-border: <<colour foreground>>\ncode-background: <<colour background>>\ncode-border: <<colour foreground>>\ncode-foreground: <<colour foreground>>\ndirty-indicator: #f00\ndownload-background: #080\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: <<colour foreground>>\ndropdown-tab-background: <<colour foreground>>\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #00a\nexternal-link-foreground: #00e\nforeground: #fff\nmessage-background: <<colour foreground>>\nmessage-border: <<colour background>>\nmessage-foreground: <<colour background>>\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: <<colour foreground>>\nmodal-footer-background: <<colour background>>\nmodal-footer-border: <<colour foreground>>\nmodal-header-border: <<colour foreground>>\nmuted-foreground: <<colour foreground>>\nnotification-background: <<colour background>>\nnotification-border: <<colour foreground>>\npage-background: <<colour background>>\npre-background: <<colour background>>\npre-border: <<colour foreground>>\nprimary: #00f\nselect-tag-background:\nselect-tag-foreground:\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: <<colour background>>\nsidebar-controls-foreground: <<colour foreground>>\nsidebar-foreground-shadow: rgba(0,0,0, 0)\nsidebar-foreground: <<colour foreground>>\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: <<colour foreground>>\nsidebar-tab-background-selected: <<colour background>>\nsidebar-tab-background: <<colour tab-background>>\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: <<colour tab-divider>>\nsidebar-tab-foreground-selected: <<colour foreground>>\nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: <<colour foreground>>\nsidebar-tiddler-link-foreground: <<colour primary>>\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: <<colour background>>\ntab-background: <<colour foreground>>\ntab-border-selected: <<colour foreground>>\ntab-border: <<colour foreground>>\ntab-divider: <<colour foreground>>\ntab-foreground-selected: <<colour foreground>>\ntab-foreground: <<colour background>>\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #fff\ntag-foreground: #000\ntiddler-background: <<colour background>>\ntiddler-border: <<colour foreground>>\ntiddler-controls-foreground-hover: #ddd\ntiddler-controls-foreground-selected: #fdd\ntiddler-controls-foreground: <<colour foreground>>\ntiddler-editor-background: <<colour background>>\ntiddler-editor-border-image: <<colour foreground>>\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: <<colour background>>\ntiddler-editor-fields-odd: <<colour background>>\ntiddler-info-background: <<colour background>>\ntiddler-info-border: <<colour foreground>>\ntiddler-info-tab-background: <<colour background>>\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: <<colour foreground>>\ntiddler-title-foreground: <<colour foreground>>\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: <<colour foreground>>\nvery-muted-foreground: #888888\n"
},
"$:/palettes/CupertinoDark": {
"title": "$:/palettes/CupertinoDark",
"tags": "$:/tags/Palette",
"color-scheme": "dark",
"name": "Cupertino Dark",
"description": "A macOS inspired dark palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #FF453A\nalert-border: #FF453A\nalert-highlight: #FFD60A\nalert-muted-foreground: <<colour muted-foreground>>\nbackground: #282828\nblockquote-bar: <<colour page-background>>\nbutton-foreground: <<colour background>>\ncode-background: <<colour pre-background>>\ncode-border: <<colour pre-border>>\ncode-foreground: rgba(255, 255, 255, 0.54)\ndirty-indicator: #FF453A\ndownload-background: <<colour primary>>\ndownload-foreground: <<colour foreground>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour tiddler-info-background>>\ndropdown-border: <<colour dropdown-background>>\ndropdown-tab-background-selected: #3F638B\ndropdown-tab-background: #323232\ndropzone-background: #30D158\nexternal-link-background-hover: transparent\nexternal-link-background-visited: transparent\nexternal-link-background: transparent\nexternal-link-foreground-hover: \nexternal-link-foreground-visited: #BF5AF2\nexternal-link-foreground: #32D74B\nforeground: #FFFFFF\nmenubar-background: #464646\nmenubar-foreground: #ffffff\nmessage-background: <<colour background>>\nmessage-border: <<colour very-muted-foreground>>\nmessage-foreground: rgba(255, 255, 255, 0.54)\nmodal-backdrop: <<colour page-background>>\nmodal-background: <<colour background>>\nmodal-border: <<colour very-muted-foreground>>\nmodal-footer-background: <<colour background>>\nmodal-footer-border: <<colour background>>\nmodal-header-border: <<colour very-muted-foreground>>\nmuted-foreground: #98989D\nnotification-background: <<colour dropdown-background>>\nnotification-border: <<colour dropdown-background>>\npage-background: #323232\npre-background: #464646\npre-border: transparent\nprimary: #0A84FF\nselect-tag-background: <<colour background>>\nselect-tag-foreground: <<colour foreground>>\nsidebar-button-foreground: <<colour background>>\nsidebar-controls-foreground-hover: #FF9F0A\nsidebar-controls-foreground: #8E8E93\nsidebar-foreground-shadow: transparent\nsidebar-foreground: rgba(255, 255, 255, 0.54)\nsidebar-muted-foreground-hover: rgba(255, 255, 255, 0.54)\nsidebar-muted-foreground: rgba(255, 255, 255, 0.38)\nsidebar-tab-background-selected: #3F638B\nsidebar-tab-background: <<colour background>>\nsidebar-tab-border-selected: <<colour background>>\nsidebar-tab-border: <<colour background>>\nsidebar-tab-divider: <<colour background>>\nsidebar-tab-foreground-selected: rgba(255, 255, 255, 0.87)\nsidebar-tab-foreground: rgba(255, 255, 255, 0.54)\nsidebar-tiddler-link-foreground-hover: rgba(255, 255, 255, 0.7)\nsidebar-tiddler-link-foreground: rgba(255, 255, 255, 0.54)\nsite-title-foreground: #ffffff\nstatic-alert-foreground: #B4B4B4\ntab-background-selected: #3F638B\ntab-background: <<colour page-background>>\ntab-border-selected: <<colour page-background>>\ntab-border: <<colour page-background>>\ntab-divider: <<colour page-background>>\ntab-foreground-selected: rgba(255, 255, 255, 0.87)\ntab-foreground: rgba(255, 255, 255, 0.54)\ntable-border: #464646\ntable-footer-background: <<colour tiddler-editor-fields-odd>>\ntable-header-background: <<colour tiddler-editor-fields-even>>\ntag-background: #48484A\ntag-foreground: #323232\ntiddler-background: <<colour background>>\ntiddler-border: transparent\ntiddler-controls-foreground-hover: <<colour sidebar-controls-foreground-hover>>\ntiddler-controls-foreground-selected: <<colour sidebar-controls-foreground-hover>>\ntiddler-controls-foreground: #48484A\ntiddler-editor-background: transparent\ntiddler-editor-border-image: \ntiddler-editor-border: rgba(255, 255, 255, 0.08)\ntiddler-editor-fields-even: rgba(255, 255, 255, 0.1)\ntiddler-editor-fields-odd: rgba(255, 255, 255, 0.04)\ntiddler-info-background: #1E1E1E\ntiddler-info-border: #1E1E1E\ntiddler-info-tab-background: #3F638B\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: <<colour muted-foreground>>\ntiddler-title-foreground: #FFFFFF\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: <<colour very-muted-foreground>>\nvery-muted-foreground: #464646\nselection-background: #3F638B\nselection-foreground: #ffffff\nwikilist-background: <<colour page-background>>\nwikilist-button-background: #3F638B\nwikilist-button-foreground: <<colour foreground>>\nwikilist-button-open: #32D74B\nwikilist-button-open-hover: #32D74B\nwikilist-button-reveal: #0A84FF\nwikilist-button-reveal-hover: #0A84FF\nwikilist-button-remove: #FF453A\nwikilist-button-remove-hover: #FF453A\nwikilist-droplink-dragover: #32D74B\nwikilist-item: <<colour background>>\nwikilist-toolbar-background: <<colour background>>\nwikilist-title: <<colour foreground>>\nwikilist-title-svg: <<colour foreground>>\nwikilist-toolbar-foreground: <<colour foreground>>\nwikilist-url: <<colour muted-foreground>>\n"
},
"$:/palettes/DarkPhotos": {
"title": "$:/palettes/DarkPhotos",
"created": "20150402111612188",
"description": "Good with dark photo backgrounds",
"modified": "20150402112344080",
"name": "DarkPhotos",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"color-scheme": "light",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #ffffff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background: \nbutton-foreground: \nbutton-border: \ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndirty-indicator: #ff0000\ndownload-background: #34c734\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333333\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #ddd\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #336438\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #5778d8\nselect-tag-background:\nselect-tag-foreground:\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #ccf\nsidebar-controls-foreground: #fff\nsidebar-foreground-shadow: rgba(0,0,0, 0.5)\nsidebar-foreground: #fff\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #eee\nsidebar-tab-background-selected: rgba(255,255,255, 0.8)\nsidebar-tab-background: rgba(255,255,255, 0.4)\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: rgba(255,255,255, 0.2)\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #aaf\nsidebar-tiddler-link-foreground: #ddf\nsite-title-foreground: #fff\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: #ffffff\ntab-background: #d8d8d8\ntab-border-selected: #d8d8d8\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #ec6\ntag-foreground: #ffffff\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #f8f8f8\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #f8f8f8\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #182955\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/DesertSand": {
"title": "$:/palettes/DesertSand",
"tags": "$:/tags/Palette",
"color-scheme": "light",
"name": "Desert Sand",
"description": "A desert sand palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #E9E0C7\nblockquote-bar: <<colour muted-foreground>>\nbutton-foreground: <<colour foreground>>\ncode-background: #F3EDDF\ncode-border: #C3BAA1\ncode-foreground: #ab3250\ndiff-delete-background: #bd8b8b\ndiff-delete-foreground: <<colour foreground>>\ndiff-equal-background: \ndiff-equal-foreground: <<colour foreground>>\ndiff-insert-background: #91c093\ndiff-insert-foreground: <<colour foreground>>\ndiff-invisible-background: \ndiff-invisible-foreground: <<colour muted-foreground>>\ndirty-indicator: #ad3434\ndownload-background: #6ca16c\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #E9E0C7\ndropdown-tab-background: #BAB29C\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #313163\nexternal-link-foreground: #555592\nforeground: #2D2A23\nmenubar-background: #CDC2A6\nmenubar-foreground: #5A5446\nmessage-background: #ECE5CF\nmessage-border: #D6CBAA\nmessage-foreground: #5f6e7d\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #8A8885\nmodal-footer-background: #CDC2A6\nmodal-footer-border: #9D998E\nmodal-header-border: #9D998E\nmuted-foreground: #9D998E\nnotification-background: #F0E9D7\nnotification-border: #939189\npage-background: #e0d3af\npre-background: #D6CBAA\npre-border: #CDC2A6\nprimary: #5B6F55\nselection-background: #9D947B\nselection-foreground: <<colour foreground>>\nselect-tag-background: #F0E9D7\nselect-tag-foreground: #2D2A23\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #2D2A23\nsidebar-controls-foreground: #867F69\nsidebar-foreground-shadow: transparent\nsidebar-foreground: #867F69\nsidebar-muted-foreground-hover: #706A58\nsidebar-muted-foreground: #B3A98C\nsidebar-tab-background-selected: #e0d3af\nsidebar-tab-background: #A6A193\nsidebar-tab-border-selected: #C3BAA1\nsidebar-tab-border: #C3BAA1\nsidebar-tab-divider: #CDC2A6\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: #2D2A23\nsidebar-tiddler-link-foreground-hover: #433F35\nsidebar-tiddler-link-foreground: #706A58\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #A6A193\ntab-background-selected: #E9E0C7\ntab-background: #A6A193\ntab-border-selected: #C3BAA1\ntab-border: #C3BAA1\ntab-divider: #CDC2A6\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #2D2A23\ntable-border: #9D998E\ntable-footer-background: #8A8885\ntable-header-background: #B0AA98\ntag-background: #706A58\ntag-foreground: #E3D7B7\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #9D947B\ntiddler-controls-foreground-selected: #706A58\ntiddler-controls-foreground: #C3BAA1\ntiddler-editor-background: #E9E0C7\ntiddler-editor-border-image: #A6A193\ntiddler-editor-border: #A6A193\ntiddler-editor-fields-even: #D6CBAA\ntiddler-editor-fields-odd: #C3BAA1\ntiddler-info-background: #E3D7B7\ntiddler-info-border: #BAB29C\ntiddler-info-tab-background: #E9E0C7\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #867F69\ntiddler-title-foreground: #374464\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: #8A8885\nvery-muted-foreground: #CDC2A6\nwikilist-background: <<colour page-background>>\nwikilist-item: #CDC2A6\nwikilist-info: #161512\nwikilist-title: #433F35\nwikilist-title-svg: <<colour wikilist-title>>\nwikilist-url: #706A58\nwikilist-button-open: #7db66a\nwikilist-button-open-hover: #56a556\nwikilist-button-reveal: #5a6c9e\nwikilist-button-reveal-hover: #454591\nwikilist-button-remove: #bc5972\nwikilist-button-remove-hover: #814040\nwikilist-toolbar-background: #CDC2A6\nwikilist-toolbar-foreground: #2D2A23\nwikilist-droplink-dragover: rgba(255,192,192,0.5)\nwikilist-button-background: #A6A193\nwikilist-button-foreground: #161512\n"
},
"$:/palettes/GruvboxDark": {
"title": "$:/palettes/GruvboxDark",
"name": "Gruvbox Dark",
"color-scheme": "dark",
"description": "Retro groove color scheme",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"license": "https://github.com/morhetz/gruvbox",
"text": "alert-background: #cc241d\nalert-border: #cc241d\nalert-highlight: #d79921\nalert-muted-foreground: #504945\nbackground: #3c3836\nblockquote-bar: <<colour muted-foreground>>\nbutton-foreground: <<colour page-background>>\ncode-background: #504945\ncode-border: #504945\ncode-foreground: #fb4934\ndiff-delete-background: #fb4934\ndiff-delete-foreground: <<colour foreground>>\ndiff-equal-background: \ndiff-equal-foreground: <<colour foreground>>\ndiff-insert-background: #b8bb26\ndiff-insert-foreground: <<colour foreground>>\ndiff-invisible-background: \ndiff-invisible-foreground: <<colour muted-foreground>>\ndirty-indicator: #fb4934\ndownload-background: #b8bb26\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: #665c54\ndropdown-border: <<colour background>>\ndropdown-tab-background-selected: #ebdbb2\ndropdown-tab-background: #665c54\ndropzone-background: #98971a\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #d3869b\nexternal-link-foreground: #8ec07c\nforeground: #fbf1c7\nmenubar-background: #504945\nmenubar-foreground: <<colour foreground>>\nmessage-background: #83a598\nmessage-border: #83a598\nmessage-foreground: #3c3836\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #504945\nmodal-footer-background: #3c3836\nmodal-footer-border: #3c3836\nmodal-header-border: #3c3836\nmuted-foreground: #d5c4a1\nnotification-background: <<colour primary>>\nnotification-border: <<colour primary>>\npage-background: #282828\npre-background: #504945\npre-border: #504945\nprimary: #d79921\nselect-tag-background: #665c54\nselect-tag-foreground: <<colour foreground>>\nselection-background: #458588\nselection-foreground: <<colour foreground>>\nsidebar-button-foreground: <<colour page-background>>\nsidebar-controls-foreground-hover: #7c6f64\nsidebar-controls-foreground: #504945\nsidebar-foreground-shadow: transparent\nsidebar-foreground: #fbf1c7\nsidebar-muted-foreground-hover: #7c6f64\nsidebar-muted-foreground: #504945\nsidebar-tab-background-selected: #bdae93\nsidebar-tab-background: #3c3836\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: #bdae93\nsidebar-tab-divider: <<colour page-background>>\nsidebar-tab-foreground-selected: #282828\nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #458588\nsidebar-tiddler-link-foreground: #98971a\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #B48EAD\ntab-background-selected: #ebdbb2\ntab-background: #665c54\ntab-border-selected: #665c54\ntab-border: #665c54\ntab-divider: #bdae93\ntab-foreground-selected: #282828\ntab-foreground: #ebdbb2\ntable-border: #7c6f64\ntable-footer-background: #665c54\ntable-header-background: #504945\ntag-background: #d3869b\ntag-foreground: #282828\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #7c6f64\ntiddler-controls-foreground-selected: <<colour primary>>\ntiddler-controls-foreground: #665c54\ntiddler-editor-background: #32302f\ntiddler-editor-border-image: #282828\ntiddler-editor-border: #282828\ntiddler-editor-fields-even: #504945\ntiddler-editor-fields-odd: #7c6f64\ntiddler-info-background: #32302f\ntiddler-info-border: #ebdbb2\ntiddler-info-tab-background: #ebdbb2\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #7c6f64\ntiddler-title-foreground: #a89984\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: #504945\nvery-muted-foreground: #bdae93\nwikilist-background: <<colour page-background>>\nwikilist-button-background: #acacac\nwikilist-button-foreground: <<colour button-foreground>>\nwikilist-item: <<colour background>>\nwikilist-toolbar-background: <<colour background>>\nwikilist-toolbar-foreground: <<colour foreground>>\nwikilist-title: <<colour foreground>>\nwikilist-title-svg: <<colour wikilist-title>>\nwikilist-url: <<colour muted-foreground>>\nwikilist-button-open-hover: <<colour primary>>\nwikilist-button-open: <<colour dropzone-background>>\nwikilist-button-remove: <<colour dirty-indicator>>\nwikilist-button-remove-hover: <<colour alert-background>>\nwikilist-droplink-dragover: <<colour dropzone-background>>\nwikilist-button-reveal: <<colour sidebar-tiddler-link-foreground-hover>>\nwikilist-button-reveal-hover: <<colour message-background>>\n"
},
"$:/palettes/Nord": {
"title": "$:/palettes/Nord",
"name": "Nord",
"color-scheme": "dark",
"description": "An arctic, north-bluish color palette.",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"license": "MIT, arcticicestudio, https://github.com/arcticicestudio/nord/blob/develop/LICENSE.md",
"text": "alert-background: #D08770\nalert-border: #D08770\nalert-highlight: #B48EAD\nalert-muted-foreground: #4C566A\nbackground: #3b4252\nblockquote-bar: <<colour muted-foreground>>\nbutton-foreground: <<colour page-background>>\ncode-background: #2E3440\ncode-border: #2E3440\ncode-foreground: #BF616A\ndiff-delete-background: #BF616A\ndiff-delete-foreground: <<colour foreground>>\ndiff-equal-background: \ndiff-equal-foreground: <<colour foreground>>\ndiff-insert-background: #A3BE8C\ndiff-insert-foreground: <<colour foreground>>\ndiff-invisible-background: \ndiff-invisible-foreground: <<colour muted-foreground>>\ndirty-indicator: #BF616A\ndownload-background: #A3BE8C\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour background>>\ndropdown-tab-background-selected: #ECEFF4\ndropdown-tab-background: #4C566A\ndropzone-background: #A3BE8C\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #5E81AC\nexternal-link-foreground: #8FBCBB\nforeground: #d8dee9\nmenubar-background: #2E3440\nmenubar-foreground: #d8dee9\nmessage-background: #2E3440\nmessage-border: #2E3440\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #3b4252\nmodal-footer-background: #3b4252\nmodal-footer-border: #3b4252\nmodal-header-border: #3b4252\nmuted-foreground: #4C566A\nnotification-background: <<colour primary>>\nnotification-border: #EBCB8B\npage-background: #2e3440\npre-background: #2E3440\npre-border: #2E3440\nprimary: #5E81AC\nselect-tag-background: #3b4252\nselect-tag-foreground: <<colour foreground>>\nselection-background: #5E81AC\nselection-foreground: <<colour foreground>>\nsidebar-button-foreground: <<colour page-background>>\nsidebar-controls-foreground-hover: #D8DEE9\nsidebar-controls-foreground: #4C566A\nsidebar-foreground-shadow: transparent\nsidebar-foreground: #D8DEE9\nsidebar-muted-foreground-hover: #4C566A\nsidebar-muted-foreground: #4C566A\nsidebar-tab-background-selected: #ECEFF4\nsidebar-tab-background: #4C566A\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: #4C566A\nsidebar-tab-divider: <<colour page-background>>\nsidebar-tab-foreground-selected: #4C566A\nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #A3BE8C\nsidebar-tiddler-link-foreground: #81A1C1\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #B48EAD\ntab-background-selected: #ECEFF4\ntab-background: #4C566A\ntab-border-selected: #4C566A\ntab-border: #4C566A\ntab-divider: #4C566A\ntab-foreground-selected: #4C566A\ntab-foreground: #D8DEE9\ntable-border: #4C566A\ntable-footer-background: #2e3440\ntable-header-background: #2e3440\ntag-background: #A3BE8C\ntag-foreground: #4C566A\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: \ntiddler-controls-foreground-selected: #EBCB8B\ntiddler-controls-foreground: #4C566A\ntiddler-editor-background: #2e3440\ntiddler-editor-border-image: #2e3440\ntiddler-editor-border: #3b4252\ntiddler-editor-fields-even: #2e3440\ntiddler-editor-fields-odd: #2e3440\ntiddler-info-background: #2e3440\ntiddler-info-border: #2e3440\ntiddler-info-tab-background: #2e3440\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #4C566A\ntiddler-title-foreground: #81A1C1\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: #2d3038\nvery-muted-foreground: #2d3038\nwikilist-background: <<colour page-background>>\nwikilist-toolbar-background: <<colour background>>\nwikilist-item: <<colour background>>\nwikilist-title: <<colour foreground>>\nwikilist-info: <<colour muted-foreground>>\nwikilist-button-open: #A3BE8C\nwikilist-button-open-hover: #A3BE8C\nwikilist-button-reveal: #81A1C1\nwikilist-button-reveal-hover: #81A1C1\nwikilist-button-remove: #B48EAD\nwikilist-button-remove-hover: #B48EAD\n"
},
"$:/palettes/Rocker": {
"title": "$:/palettes/Rocker",
"name": "Rocker",
"color-scheme": "dark",
"description": "A dark theme",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #ffffff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background:\nbutton-foreground:\nbutton-border:\ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndirty-indicator: #ff0000\ndownload-background: #34c734\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333333\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #999999\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #000\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #cc0000\nselect-tag-background:\nselect-tag-foreground:\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #000000\nsidebar-controls-foreground: #ffffff\nsidebar-foreground-shadow: rgba(255,255,255, 0.0)\nsidebar-foreground: #acacac\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #c0c0c0\nsidebar-tab-background-selected: #000\nsidebar-tab-background: <<colour tab-background>>\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: <<colour tab-divider>>\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #ffbb99\nsidebar-tiddler-link-foreground: #cc0000\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: #ffffff\ntab-background: #d8d8d8\ntab-border-selected: #d8d8d8\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #ffbb99\ntag-foreground: #000\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #f8f8f8\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #f8f8f8\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #cc0000\ntoolbar-new-button:\ntoolbar-options-button:\ntoolbar-save-button:\ntoolbar-info-button:\ntoolbar-edit-button:\ntoolbar-close-button:\ntoolbar-delete-button:\ntoolbar-cancel-button:\ntoolbar-done-button:\nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/SolarFlare": {
"title": "$:/palettes/SolarFlare",
"name": "Solar Flare",
"color-scheme": "light",
"description": "Warm, relaxing earth colours",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": ": Background Tones\n\nbase03: #002b36\nbase02: #073642\n\n: Content Tones\n\nbase01: #586e75\nbase00: #657b83\nbase0: #839496\nbase1: #93a1a1\n\n: Background Tones\n\nbase2: #eee8d5\nbase3: #fdf6e3\n\n: Accent Colors\n\nyellow: #b58900\norange: #cb4b16\nred: #dc322f\nmagenta: #d33682\nviolet: #6c71c4\nblue: #268bd2\ncyan: #2aa198\ngreen: #859900\n\n: Additional Tones (RA)\n\nbase10: #c0c4bb\nviolet-muted: #7c81b0\nblue-muted: #4e7baa\n\nyellow-hot: #ffcc44\norange-hot: #eb6d20\nred-hot: #ff2222\nblue-hot: #2298ee\ngreen-hot: #98ee22\n\n: Palette\n\n: Do not use colour macro for background and foreground\nbackground: #fdf6e3\n download-foreground: <<colour background>>\n dragger-foreground: <<colour background>>\n dropdown-background: <<colour background>>\n modal-background: <<colour background>>\n sidebar-foreground-shadow: <<colour background>>\n tiddler-background: <<colour background>>\n tiddler-border: <<colour background>>\n tiddler-link-background: <<colour background>>\n tab-background-selected: <<colour background>>\n dropdown-tab-background-selected: <<colour tab-background-selected>>\nforeground: #657b83\n dragger-background: <<colour foreground>>\n tab-foreground: <<colour foreground>>\n tab-foreground-selected: <<colour tab-foreground>>\n sidebar-tab-foreground-selected: <<colour tab-foreground-selected>>\n sidebar-tab-foreground: <<colour tab-foreground>>\n sidebar-button-foreground: <<colour foreground>>\n sidebar-controls-foreground: <<colour foreground>>\n sidebar-foreground: <<colour foreground>>\n: base03\n: base02\n: base01\n alert-muted-foreground: <<colour base01>>\n: base00\n code-foreground: <<colour base00>>\n message-foreground: <<colour base00>>\n tag-foreground: <<colour base00>>\n: base0\n sidebar-tiddler-link-foreground: <<colour base0>>\n: base1\n muted-foreground: <<colour base1>>\n blockquote-bar: <<colour muted-foreground>>\n dropdown-border: <<colour muted-foreground>>\n sidebar-muted-foreground: <<colour muted-foreground>>\n tiddler-title-foreground: <<colour muted-foreground>>\n site-title-foreground: <<colour tiddler-title-foreground>>\n: base2\n modal-footer-background: <<colour base2>>\n page-background: <<colour base2>>\n modal-backdrop: <<colour page-background>>\n notification-background: <<colour page-background>>\n code-background: <<colour page-background>>\n code-border: <<colour code-background>>\n pre-background: <<colour page-background>>\n pre-border: <<colour pre-background>>\n sidebar-tab-background-selected: <<colour page-background>>\n table-header-background: <<colour base2>>\n tag-background: <<colour base2>>\n tiddler-editor-background: <<colour base2>>\n tiddler-info-background: <<colour base2>>\n tiddler-info-tab-background: <<colour base2>>\n tab-background: <<colour base2>>\n dropdown-tab-background: <<colour tab-background>>\n: base3\n alert-background: <<colour base3>>\n message-background: <<colour base3>>\n: yellow\n: orange\n: red\n: magenta\n alert-highlight: <<colour magenta>>\n: violet\n external-link-foreground: <<colour violet>>\n: blue\n: cyan\n: green\n: base10\n tiddler-controls-foreground: <<colour base10>>\n: violet-muted\n external-link-foreground-visited: <<colour violet-muted>>\n: blue-muted\n primary: <<colour blue-muted>>\n download-background: <<colour primary>>\n tiddler-link-foreground: <<colour primary>>\n\nalert-border: #b99e2f\ndirty-indicator: #ff0000\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nmessage-border: #cfd6e6\nmodal-border: #999999\nselect-tag-background:\nselect-tag-foreground:\nsidebar-controls-foreground-hover:\nsidebar-muted-foreground-hover:\nsidebar-tab-background: #ded8c5\nsidebar-tiddler-link-foreground-hover:\nstatic-alert-foreground: #aaaaaa\ntab-border: #cccccc\n modal-footer-border: <<colour tab-border>>\n modal-header-border: <<colour tab-border>>\n notification-border: <<colour tab-border>>\n sidebar-tab-border: <<colour tab-border>>\n tab-border-selected: <<colour tab-border>>\n sidebar-tab-border-selected: <<colour tab-border-selected>>\ntab-divider: #d8d8d8\n sidebar-tab-divider: <<colour tab-divider>>\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-border: #dddddd\ntiddler-subtitle-foreground: #c0c0c0\ntoolbar-new-button:\ntoolbar-options-button:\ntoolbar-save-button:\ntoolbar-info-button:\ntoolbar-edit-button:\ntoolbar-close-button:\ntoolbar-delete-button:\ntoolbar-cancel-button:\ntoolbar-done-button:\nuntagged-background: #999999\nvery-muted-foreground: #888888\n"
},
"$:/palettes/SolarizedDark": {
"title": "$:/palettes/SolarizedDark",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"description": "Precision dark colors for machines and people",
"license": "MIT, Ethan Schoonover, https://github.com/altercation/solarized/blob/master/LICENSE",
"name": "SolarizedDark",
"color-scheme": "dark",
"text": "alert-background: #073642\nalert-border: #93a1a1\nalert-highlight: #d33682\nalert-muted-foreground: #d33682\nbackground: #073642\nblockquote-bar: #d33682\nbutton-background: #073642\nbutton-border: #586e75\nbutton-foreground: #93a1a1\ncode-background: #073642\ncode-border: #586e75\ncode-foreground: #93a1a1\ndirty-indicator: inherit\ndownload-background: #859900\ndownload-foreground: #073642\ndragger-background: #073642\ndragger-foreground: #839496\ndropdown-background: #073642\ndropdown-border: #93a1a1\ndropdown-tab-background: #002b36\ndropdown-tab-background-selected: #073642\ndropzone-background: #859900\nexternal-link-background: inherit\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-foreground: #268bd2\nexternal-link-foreground-hover:\nexternal-link-foreground-visited: #268bd2\nforeground: #839496\nmessage-background: #002b36\nmessage-border: #586e75\nmessage-foreground: #839496\nmodal-backdrop: #657b83\nmodal-background: #002b36\nmodal-border: #586e75\nmodal-footer-background: #073642\nmodal-footer-border: #586e75\nmodal-header-border: #586e75\nmuted-foreground: #93a1a1\nnotification-background: #002b36\nnotification-border: #586e75\npage-background: #073642\npre-background: inherit\npre-border: #657b83\nprimary: #859900\nselect-tag-background: #002b36\nselect-tag-foreground: #839496\nsidebar-button-foreground: #93a1a1\nsidebar-controls-foreground: #93a1a1\nsidebar-controls-foreground-hover: #eee8d5\nsidebar-foreground: #93a1a1\nsidebar-foreground-shadow: transparent\nsidebar-muted-foreground: #839496\nsidebar-muted-foreground-hover: #93a1a1\nsidebar-tab-background: #002b36\nsidebar-tab-background-selected: #073642\nsidebar-tab-border: #073642\nsidebar-tab-border-selected: #839496\nsidebar-tab-divider: #002b36\nsidebar-tab-foreground: #657b83\nsidebar-tab-foreground-selected: #93a1a1\nsidebar-tiddler-link-foreground: #2aa198\nsidebar-tiddler-link-foreground-hover: #eee8d5\nsite-title-foreground: #d33682\nstatic-alert-foreground: #93a1a1\ntab-background: #073642\ntab-background-selected: #002b36\ntab-border: #586e75\ntab-border-selected: #93a1a1\ntab-divider: #93a1a1\ntab-foreground: #839496\ntab-foreground-selected: #93a1a1\ntable-border: #586e75\ntable-footer-background: #073642\ntable-header-background: #073642\ntag-background: #b58900\ntag-foreground: #002b36\ntiddler-background: #002b36\ntiddler-border: #586e75\ntiddler-controls-foreground: inherit\ntiddler-controls-foreground-hover: #d33682\ntiddler-controls-foreground-selected: #2aa198\ntiddler-editor-background: #002b36\ntiddler-editor-border: #073642\ntiddler-editor-border-image: #002b36\ntiddler-editor-fields-even: #002b36\ntiddler-editor-fields-odd: #073642\ntiddler-info-background: #073642\ntiddler-info-border: #657b83\ntiddler-info-tab-background: #002b36\ntiddler-link-background: #002b36\ntiddler-link-foreground: #2aa198\ntiddler-subtitle-foreground: #839496\ntiddler-title-foreground: #d33682\ntoolbar-cancel-button: #839496\ntoolbar-close-button: #839496\ntoolbar-delete-button: #dc322f\ntoolbar-done-button: #839496\ntoolbar-edit-button: #839496\ntoolbar-info-button: #839496\ntoolbar-new-button: #839496\ntoolbar-options-button: #839496\ntoolbar-save-button: inherit\nuntagged-background: #586e75\nvery-muted-foreground: #586e75\n"
},
"$:/palettes/SolarizedLight": {
"title": "$:/palettes/SolarizedLight",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"description": "Precision colors for machines and people",
"license": "MIT, Ethan Schoonover, https://github.com/altercation/solarized/blob/master/LICENSE",
"name": "SolarizedLight",
"color-scheme": "light",
"text": "alert-background: #eee8d5\nalert-border: #586e75\nalert-highlight: #d33682\nalert-muted-foreground: #d33682\nbackground: #eee8d5\nblockquote-bar: #d33682\nbutton-background: #eee8d5\nbutton-border: #93a1a1\nbutton-foreground: #586e75\ncode-background: #eee8d5\ncode-border: #93a1a1\ncode-foreground: #586e75\ndirty-indicator: inherit\ndownload-background: #859900\ndownload-foreground: #eee8d5\ndragger-background: #eee8d5\ndragger-foreground: #657b83\ndropdown-background: #eee8d5\ndropdown-border: #586e75\ndropdown-tab-background: #fdf6e3\ndropdown-tab-background-selected: #eee8d5\ndropzone-background: #859900\nexternal-link-background: inherit\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-foreground: #268bd2\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #268bd2\nforeground: #657b83\nmessage-background: #fdf6e3\nmessage-border: #93a1a1\nmessage-foreground: #657b83\nmodal-backdrop: #839496\nmodal-background: #fdf6e3\nmodal-border: #93a1a1\nmodal-footer-background: #eee8d5\nmodal-footer-border: #93a1a1\nmodal-header-border: #93a1a1\nmuted-foreground: #586e75\nnotification-background: #fdf6e3\nnotification-border: #93a1a1\npage-background: #eee8d5\npre-background: #eee8d5\npre-border: #839496\nprimary: #859900\nselect-tag-background: #fdf6e3\nselect-tag-foreground: #657b83\nsidebar-button-foreground: #586e75\nsidebar-controls-foreground: #586e75\nsidebar-controls-foreground-hover: #d33682\nsidebar-foreground: #586e75\nsidebar-foreground-shadow: transparent\nsidebar-muted-foreground: #657b83\nsidebar-muted-foreground-hover: #586e75\nsidebar-tab-background: #fdf6e3\nsidebar-tab-background-selected: #eee8d5\nsidebar-tab-border: #eee8d5\nsidebar-tab-border-selected: #657b83\nsidebar-tab-divider: #fdf6e3\nsidebar-tab-foreground: #839496\nsidebar-tab-foreground-selected: #586e75\nsidebar-tiddler-link-foreground: #2aa198\nsidebar-tiddler-link-foreground-hover: #002b36\nsite-title-foreground: #d33682\nstatic-alert-foreground: #586e75\ntab-background: #eee8d5\ntab-background-selected: #fdf6e3\ntab-border: #93a1a1\ntab-border-selected: #586e75\ntab-divider: #586e75\ntab-foreground: #657b83\ntab-foreground-selected: #586e75\ntable-border: #93a1a1\ntable-footer-background: #eee8d5\ntable-header-background: #eee8d5\ntag-background: #b58900\ntag-foreground: #fdf6e3\ntiddler-background: #fdf6e3\ntiddler-border: #93a1a1\ntiddler-controls-foreground: inherit\ntiddler-controls-foreground-hover: #d33682\ntiddler-controls-foreground-selected: #2aa198\ntiddler-editor-background: #fdf6e3\ntiddler-editor-border: #eee8d5\ntiddler-editor-border-image: #fdf6e3\ntiddler-editor-fields-even: #fdf6e3\ntiddler-editor-fields-odd: #eee8d5\ntiddler-info-background: #eee8d5\ntiddler-info-border: #839496\ntiddler-info-tab-background: #fdf6e3\ntiddler-link-background: #fdf6e3\ntiddler-link-foreground: #2aa198\ntiddler-subtitle-foreground: #657b83\ntiddler-title-foreground: #d33682\ntoolbar-cancel-button: #657b83\ntoolbar-close-button: #657b83\ntoolbar-delete-button: #dc322f\ntoolbar-done-button: #657b83\ntoolbar-edit-button: #657b83\ntoolbar-info-button: #657b83\ntoolbar-new-button: #657b83\ntoolbar-options-button: #657b83\ntoolbar-save-button: inherit\nuntagged-background: #586e75\nvery-muted-foreground: #93a1a1\n"
},
"$:/palettes/SpartanDay": {
"title": "$:/palettes/SpartanDay",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"description": "Cold, spartan day colors",
"name": "Spartan Day",
"color-scheme": "light",
"text": "alert-background: <<colour background>>\nalert-border: <<colour very-muted-foreground>>\nalert-highlight: <<colour very-muted-foreground>>\nalert-muted-foreground: <<colour muted-foreground>>\nbackground: #FAFAFA\nblockquote-bar: <<colour page-background>>\nbutton-background: transparent\nbutton-foreground: inherit\nbutton-border: <<colour tag-background>>\ncode-background: #ececec\ncode-border: #ececec\ncode-foreground: \ndirty-indicator: #c80000\ndownload-background: <<colour primary>>\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: #FFFFFF\ndropdown-border: <<colour dropdown-background>>\ndropdown-tab-background-selected: <<colour dropdown-background>>\ndropdown-tab-background: #F5F5F5\ndropzone-background: <<colour tag-background>>\nexternal-link-background-hover: transparent\nexternal-link-background-visited: transparent\nexternal-link-background: transparent\nexternal-link-foreground-hover: \nexternal-link-foreground-visited: \nexternal-link-foreground: \nforeground: rgba(0, 0, 0, 0.87)\nmessage-background: <<colour background>>\nmessage-border: <<colour very-muted-foreground>>\nmessage-foreground: rgba(0, 0, 0, 0.54)\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: <<colour very-muted-foreground>>\nmodal-footer-background: <<colour background>>\nmodal-footer-border: <<colour very-muted-foreground>>\nmodal-header-border: <<colour very-muted-foreground>>\nmuted-foreground: rgba(0, 0, 0, 0.54)\nnotification-background: <<colour dropdown-background>>\nnotification-border: <<colour dropdown-background>>\npage-background: #f4f4f4\npre-background: #ececec\npre-border: #ececec\nprimary: #3949ab\nselect-tag-background: <<colour background>>\nselect-tag-foreground: <<colour foreground>>\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #aeaeae\nsidebar-controls-foreground: #c6c6c6\nsidebar-foreground-shadow: transparent\nsidebar-foreground: rgba(0, 0, 0, 0.54)\nsidebar-muted-foreground-hover: rgba(0, 0, 0, 0.54)\nsidebar-muted-foreground: rgba(0, 0, 0, 0.38)\nsidebar-tab-background-selected: <<colour page-background>>\nsidebar-tab-background: transparent\nsidebar-tab-border-selected: <<colour table-border>>\nsidebar-tab-border: transparent\nsidebar-tab-divider: <<colour table-border>>\nsidebar-tab-foreground-selected: rgba(0, 0, 0, 0.87)\nsidebar-tab-foreground: rgba(0, 0, 0, 0.54)\nsidebar-tiddler-link-foreground-hover: rgba(0, 0, 0, 0.87)\nsidebar-tiddler-link-foreground: rgba(0, 0, 0, 0.54)\nsite-title-foreground: rgba(0, 0, 0, 0.87)\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: <<colour background>>\ntab-background: transparent\ntab-border-selected: <<colour table-border>>\ntab-border: transparent\ntab-divider: <<colour table-border>>\ntab-foreground-selected: rgba(0, 0, 0, 0.87)\ntab-foreground: rgba(0, 0, 0, 0.54)\ntable-border: #d8d8d8\ntable-footer-background: <<colour tiddler-editor-fields-odd>>\ntable-header-background: <<colour tiddler-editor-fields-even>>\ntag-background: #ec6\ntag-foreground: <<colour button-foreground>>\ntiddler-background: <<colour background>>\ntiddler-border: #f9f9f9\ntiddler-controls-foreground-hover: <<colour sidebar-controls-foreground-hover>>\ntiddler-controls-foreground-selected: <<colour sidebar-controls-foreground-hover>>\ntiddler-controls-foreground: <<colour sidebar-controls-foreground>>\ntiddler-editor-background: transparent\ntiddler-editor-border-image: \ntiddler-editor-border: #e8e7e7\ntiddler-editor-fields-even: rgba(0, 0, 0, 0.1)\ntiddler-editor-fields-odd: rgba(0, 0, 0, 0.04)\ntiddler-info-background: #F5F5F5\ntiddler-info-border: #F5F5F5\ntiddler-info-tab-background: <<colour tiddler-editor-fields-odd>>\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: <<colour muted-foreground>>\ntiddler-title-foreground: #000000\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: <<colour very-muted-foreground>>\nvery-muted-foreground: rgba(0, 0, 0, 0.12)\n"
},
"$:/palettes/SpartanNight": {
"title": "$:/palettes/SpartanNight",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"description": "Dark spartan colors",
"name": "Spartan Night",
"color-scheme": "dark",
"text": "alert-background: <<colour background>>\nalert-border: <<colour very-muted-foreground>>\nalert-highlight: <<colour very-muted-foreground>>\nalert-muted-foreground: <<colour muted-foreground>>\nbackground: #303030\nblockquote-bar: <<colour page-background>>\nbutton-background: transparent\nbutton-foreground: inherit\nbutton-border: <<colour tag-background>>\ncode-background: <<colour pre-background>>\ncode-border: <<colour pre-border>>\ncode-foreground: rgba(255, 255, 255, 0.54)\ndirty-indicator: #c80000\ndownload-background: <<colour primary>>\ndownload-foreground: <<colour foreground>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: #424242\ndropdown-border: <<colour dropdown-background>>\ndropdown-tab-background-selected: <<colour dropdown-background>>\ndropdown-tab-background: #050505\ndropzone-background: <<colour tag-background>>\nexternal-link-background-hover: transparent\nexternal-link-background-visited: transparent\nexternal-link-background: transparent\nexternal-link-foreground-hover: \nexternal-link-foreground-visited: #7c318c\nexternal-link-foreground: #9e3eb3\nforeground: rgba(255, 255, 255, 0.7)\nmessage-background: <<colour background>>\nmessage-border: <<colour very-muted-foreground>>\nmessage-foreground: rgba(255, 255, 255, 0.54)\nmodal-backdrop: <<colour page-background>>\nmodal-background: <<colour background>>\nmodal-border: <<colour very-muted-foreground>>\nmodal-footer-background: <<colour background>>\nmodal-footer-border: <<colour background>>\nmodal-header-border: <<colour very-muted-foreground>>\nmuted-foreground: rgba(255, 255, 255, 0.54)\nnotification-background: <<colour dropdown-background>>\nnotification-border: <<colour dropdown-background>>\npage-background: #212121\npre-background: #2a2a2a\npre-border: transparent\nprimary: #5656f3\nselect-tag-background: <<colour background>>\nselect-tag-foreground: <<colour foreground>>\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #494949\nsidebar-controls-foreground: #5d5d5d\nsidebar-foreground-shadow: transparent\nsidebar-foreground: rgba(255, 255, 255, 0.54)\nsidebar-muted-foreground-hover: rgba(255, 255, 255, 0.54)\nsidebar-muted-foreground: rgba(255, 255, 255, 0.38)\nsidebar-tab-background-selected: <<colour page-background>>\nsidebar-tab-background: transparent\nsidebar-tab-border-selected: <<colour table-border>>\nsidebar-tab-border: transparent\nsidebar-tab-divider: <<colour table-border>>\nsidebar-tab-foreground-selected: rgba(255, 255, 255, 0.87)\nsidebar-tab-foreground: rgba(255, 255, 255, 0.54)\nsidebar-tiddler-link-foreground-hover: rgba(255, 255, 255, 0.7)\nsidebar-tiddler-link-foreground: rgba(255, 255, 255, 0.54)\nsite-title-foreground: rgba(255, 255, 255, 0.7)\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: <<colour background>>\ntab-background: transparent\ntab-border-selected: <<colour table-border>>\ntab-border: transparent\ntab-divider: <<colour table-border>>\ntab-foreground-selected: rgba(255, 255, 255, 0.87)\ntab-foreground: rgba(255, 255, 255, 0.54)\ntable-border: #3a3a3a\ntable-footer-background: <<colour tiddler-editor-fields-odd>>\ntable-header-background: <<colour tiddler-editor-fields-even>>\ntag-background: #ec6\ntag-foreground: <<colour button-foreground>>\ntiddler-background: <<colour background>>\ntiddler-border: rgb(55,55,55)\ntiddler-controls-foreground-hover: <<colour sidebar-controls-foreground-hover>>\ntiddler-controls-foreground-selected: <<colour sidebar-controls-foreground-hover>>\ntiddler-controls-foreground: <<colour sidebar-controls-foreground>>\ntiddler-editor-background: transparent\ntiddler-editor-border-image: \ntiddler-editor-border: rgba(255, 255, 255, 0.08)\ntiddler-editor-fields-even: rgba(255, 255, 255, 0.1)\ntiddler-editor-fields-odd: rgba(255, 255, 255, 0.04)\ntiddler-info-background: #454545\ntiddler-info-border: #454545\ntiddler-info-tab-background: <<colour tiddler-editor-fields-odd>>\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: <<colour muted-foreground>>\ntiddler-title-foreground: #FFFFFF\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: <<colour very-muted-foreground>>\nvery-muted-foreground: rgba(255, 255, 255, 0.12)\n"
},
"$:/palettes/Twilight": {
"title": "$:/palettes/Twilight",
"tags": "$:/tags/Palette",
"author": "Thomas Elmiger",
"type": "application/x-tiddler-dictionary",
"name": "Twilight",
"description": "Delightful, soft darkness.",
"color-scheme": "dark",
"text": "alert-background: rgb(255, 255, 102)\nalert-border: rgb(232, 232, 125)\nalert-highlight: rgb(255, 51, 51)\nalert-muted-foreground: rgb(224, 82, 82)\nbackground: rgb(38, 38, 38)\nblockquote-bar: rgba(240, 196, 117, 0.7)\nbutton-background: rgb(63, 63, 63)\nbutton-border: rgb(127, 127, 127)\nbutton-foreground: rgb(179, 179, 179)\ncode-background: rgba(0,0,0,0.03)\ncode-border: rgba(0,0,0,0.08)\ncode-foreground: rgb(255, 94, 94)\ndiff-delete-background: #ffc9c9\ndiff-delete-foreground: <<colour foreground>>\ndiff-equal-background: \ndiff-equal-foreground: <<colour foreground>>\ndiff-insert-background: #aaefad\ndiff-insert-foreground: <<colour foreground>>\ndiff-invisible-background: \ndiff-invisible-foreground: <<colour muted-foreground>>\ndirty-indicator: rgb(255, 94, 94)\ndownload-background: #19a974\ndownload-foreground: rgb(38, 38, 38)\ndragger-background: rgb(179, 179, 179)\ndragger-foreground: rgb(38, 38, 38)\ndropdown-background: rgb(38, 38, 38)\ndropdown-border: rgb(255, 255, 255)\ndropdown-tab-background: rgba(0,0,0,.1)\ndropdown-tab-background-selected: rgba(255,255,255,1)\ndropzone-background: #9eebcf\nexternal-link-background: inherit\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-foreground: rgb(179, 179, 255)\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: rgb(153, 153, 255)\nforeground: rgb(179, 179, 179)\nmessage-background: <<colour tag-foreground>>\nmessage-border: #96ccff\nmessage-foreground: <<colour tag-background>>\nmodal-backdrop: rgb(179, 179, 179)\nmodal-background: rgb(38, 38, 38)\nmodal-border: rgba(0,0,0,.5)\nmodal-footer-background: #f4f4f4\nmodal-footer-border: rgba(0,0,0,.1)\nmodal-header-border: rgba(0,0,0,.2)\nmuted-foreground: rgb(255, 255, 255)\nnotification-background: <<colour tag-foreground>>\nnotification-border: <<colour tag-background>>\npage-background: rgb(26, 26, 26)\npre-background: rgb(25, 25, 25)\npre-border: rgba(0,0,0,.2)\nprimary: rgb(255, 201, 102)\nselect-tag-background: \nselect-tag-foreground: \nsidebar-button-foreground: rgb(179, 179, 179)\nsidebar-controls-foreground: rgb(153, 153, 153)\nsidebar-controls-foreground-hover: <<colour tiddler-controls-foreground-hover>>\nsidebar-foreground: rgb(141, 141, 141)\nsidebar-foreground-shadow: transparent\nsidebar-muted-foreground: rgba(0, 0, 0, 0.5)\nsidebar-muted-foreground-hover: rgb(141, 141, 141)\nsidebar-tab-background: rgba(141, 141, 141, 0.2)\nsidebar-tab-background-selected: rgb(26, 26, 26)\nsidebar-tab-border: rgb(127, 127, 127)\nsidebar-tab-border-selected: rgb(127, 127, 127)\nsidebar-tab-divider: rgb(127, 127, 127)\nsidebar-tab-foreground: rgb(179, 179, 179)\nsidebar-tab-foreground-selected: rgb(179, 179, 179)\nsidebar-tiddler-link-foreground: rgb(179, 179, 179)\nsidebar-tiddler-link-foreground-hover: rgb(115, 115, 115)\nsite-title-foreground: rgb(255, 201, 102)\nstatic-alert-foreground: rgba(0,0,0,.3)\ntab-background: rgba(0,0,0,0.125)\ntab-background-selected: rgb(38, 38, 38)\ntab-border: rgb(255, 201, 102)\ntab-border-selected: rgb(255, 201, 102)\ntab-divider: rgb(255, 201, 102)\ntab-foreground: rgb(179, 179, 179)\ntab-foreground-selected: rgb(179, 179, 179)\ntable-border: rgba(255,255,255,.3)\ntable-footer-background: rgba(0,0,0,.4)\ntable-header-background: rgba(0,0,0,.1)\ntag-background: rgb(255, 201, 102)\ntag-foreground: rgb(25, 25, 25)\ntiddler-background: rgb(38, 38, 38)\ntiddler-border: rgba(240, 196, 117, 0.7)\ntiddler-controls-foreground: rgb(128, 128, 128)\ntiddler-controls-foreground-hover: rgba(255, 255, 255, 0.8)\ntiddler-controls-foreground-selected: rgba(255, 255, 255, 0.9)\ntiddler-editor-background: rgb(33, 33, 33)\ntiddler-editor-border: rgb(63, 63, 63)\ntiddler-editor-border-image: rgb(25, 25, 25)\ntiddler-editor-fields-even: rgb(33, 33, 33)\ntiddler-editor-fields-odd: rgb(28, 28, 28)\ntiddler-info-background: rgb(43, 43, 43)\ntiddler-info-border: rgb(25, 25, 25)\ntiddler-info-tab-background: rgb(43, 43, 43)\ntiddler-link-background: rgb(38, 38, 38)\ntiddler-link-foreground: rgb(204, 204, 255)\ntiddler-subtitle-foreground: rgb(255, 255, 255)\ntiddler-title-foreground: rgb(255, 192, 76)\ntoolbar-cancel-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-done-button: \ntoolbar-edit-button: \ntoolbar-info-button: \ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \nuntagged-background: rgb(255, 255, 255)\nvery-muted-foreground: rgba(240, 196, 117, 0.7)\n"
},
"$:/palettes/Vanilla": {
"title": "$:/palettes/Vanilla",
"name": "Vanilla",
"description": "Pale and unobtrusive",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"color-scheme": "light",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #ffffff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background:\nbutton-foreground:\nbutton-border:\ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndiff-delete-background: #ffc9c9\ndiff-delete-foreground: <<colour foreground>>\ndiff-equal-background: \ndiff-equal-foreground: <<colour foreground>>\ndiff-insert-background: #aaefad\ndiff-insert-foreground: <<colour foreground>>\ndiff-invisible-background: \ndiff-invisible-foreground: <<colour muted-foreground>>\ndirty-indicator: #ff0000\ndownload-background: #34c734\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333333\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #bbb\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #f4f4f4\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #5778d8\nselection-background:\nselection-foreground:\nselect-tag-background:\nselect-tag-foreground:\nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #000000\nsidebar-controls-foreground: #aaaaaa\nsidebar-foreground-shadow: rgba(255,255,255, 0.8)\nsidebar-foreground: #acacac\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #c0c0c0\nsidebar-tab-background-selected: #f4f4f4\nsidebar-tab-background: #e0e0e0\nsidebar-tab-border-selected: <<colour tab-border-selected>>\nsidebar-tab-border: <<colour tab-border>>\nsidebar-tab-divider: #e4e4e4\nsidebar-tab-foreground-selected:\nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #444444\nsidebar-tiddler-link-foreground: #999999\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: #ffffff\ntab-background: #d8d8d8\ntab-border-selected: #d8d8d8\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #ec6\ntag-foreground: #ffffff\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #cccccc\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #f8f8f8\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #f8f8f8\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #182955\ntoolbar-new-button:\ntoolbar-options-button:\ntoolbar-save-button:\ntoolbar-info-button:\ntoolbar-edit-button:\ntoolbar-close-button:\ntoolbar-delete-button:\ntoolbar-cancel-button:\ntoolbar-done-button:\nuntagged-background: #999999\nvery-muted-foreground: #888888\nwikilist-background: #e5e5e5\nwikilist-item: #fff\nwikilist-info: #000\nwikilist-title: #666\nwikilist-title-svg: <<colour wikilist-title>>\nwikilist-url: #aaa\nwikilist-button-open: #4fb82b\nwikilist-button-open-hover: green\nwikilist-button-reveal: #5778d8\nwikilist-button-reveal-hover: blue\nwikilist-button-remove: #d85778\nwikilist-button-remove-hover: red\nwikilist-toolbar-background: #d3d3d3\nwikilist-toolbar-foreground: #888\nwikilist-droplink-dragover: rgba(255,192,192,0.5)\nwikilist-button-background: #acacac\nwikilist-button-foreground: #000\n"
},
"$:/core/readme": {
"title": "$:/core/readme",
"text": "This plugin contains TiddlyWiki's core components, comprising:\n\n* JavaScript code modules\n* Icons\n* Templates needed to create TiddlyWiki's user interface\n* British English (''en-GB'') translations of the localisable strings used by the core\n"
},
"$:/library/sjcl.js/license": {
"title": "$:/library/sjcl.js/license",
"type": "text/plain",
"text": "SJCL is open. You can use, modify and redistribute it under a BSD\nlicense or under the GNU GPL, version 2.0.\n\n---------------------------------------------------------------------\n\nhttp://opensource.org/licenses/BSD-2-Clause\n\nCopyright (c) 2009-2015, Emily Stark, Mike Hamburg and Dan Boneh at\nStanford University. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n1. Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\nIS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\nTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\nPARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n---------------------------------------------------------------------\n\nhttp://opensource.org/licenses/GPL-2.0\n\nThe Stanford Javascript Crypto Library (hosted here on GitHub) is a\nproject by the Stanford Computer Security Lab to build a secure,\npowerful, fast, small, easy-to-use, cross-browser library for\ncryptography in Javascript.\n\nCopyright (c) 2009-2015, Emily Stark, Mike Hamburg and Dan Boneh at\nStanford University.\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 2 of the License, or (at your\noption) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\nPublic License for more details.\n\nYou should have received a copy of the GNU General Public License along\nwith this program; if not, write to the Free Software Foundation, Inc.,\n59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"
},
"$:/core/templates/MOTW.html": {
"title": "$:/core/templates/MOTW.html",
"text": "\\rules only filteredtranscludeinline transcludeinline entity\n<!-- The following comment is called a MOTW comment and is necessary for the TiddlyIE Internet Explorer extension -->\n<!-- saved from url=(0021)https://tiddlywiki.com --> "
},
"$:/core/templates/alltiddlers.template.html": {
"title": "$:/core/templates/alltiddlers.template.html",
"type": "text/vnd.tiddlywiki-html",
"text": "<!-- This template is provided for backwards compatibility with older versions of TiddlyWiki -->\n\n<$set name=\"exportFilter\" value=\"[!is[system]sort[title]]\">\n\n{{$:/core/templates/exporters/StaticRiver}}\n\n</$set>\n"
},
"$:/core/templates/canonical-uri-external-image": {
"title": "$:/core/templates/canonical-uri-external-image",
"text": "<!--\n\nThis template is used to assign the ''_canonical_uri'' field to external images.\n\nChange the `./images/` part to a different base URI. The URI can be relative or absolute.\n\n-->\n./images/<$view field=\"title\" format=\"doubleurlencoded\"/>"
},
"$:/core/templates/canonical-uri-external-raw": {
"title": "$:/core/templates/canonical-uri-external-raw",
"text": "<!--\n\nThis template is used to assign the ''_canonical_uri'' field to external raw files that are stored in the same directory\n\n-->\n<$view field=\"title\" format=\"doubleurlencoded\"/>"
},
"$:/core/templates/canonical-uri-external-text": {
"title": "$:/core/templates/canonical-uri-external-text",
"text": "<!--\n\nThis template is used to assign the ''_canonical_uri'' field to external text files.\n\nChange the `./text/` part to a different base URI. The URI can be relative or absolute.\n\n-->\n./text/<$view field=\"title\" format=\"doubleurlencoded\"/>.tid"
},
"$:/core/templates/css-tiddler": {
"title": "$:/core/templates/css-tiddler",
"text": "<!--\n\nThis template is used for saving CSS tiddlers as a style tag with data attributes representing the tiddler fields.\n\n-->`<style`<$fields template=' data-tiddler-$name$=\"$encoded_value$\"'></$fields>` type=\"text/css\">`<$view field=\"text\" format=\"text\" />`</style>`"
},
"$:/core/templates/exporters/CsvFile": {
"title": "$:/core/templates/exporters/CsvFile",
"tags": "$:/tags/Exporter",
"description": "{{$:/language/Exporters/CsvFile}}",
"extension": ".csv",
"text": "<$macrocall $name=\"csvtiddlers\" filter=<<exportFilter>> format=\"quoted-comma-sep\" $output=\"text/raw\"/>\n"
},
"$:/core/templates/exporters/JsonFile": {
"title": "$:/core/templates/exporters/JsonFile",
"tags": "$:/tags/Exporter",
"description": "{{$:/language/Exporters/JsonFile}}",
"extension": ".json",
"text": "<$macrocall $name=\"jsontiddlers\" filter=<<exportFilter>> $output=\"text/raw\"/>\n"
},
"$:/core/templates/exporters/StaticRiver": {
"title": "$:/core/templates/exporters/StaticRiver",
"tags": "$:/tags/Exporter",
"description": "{{$:/language/Exporters/StaticRiver}}",
"extension": ".html",
"text": "\\define tv-wikilink-template() #$uri_encoded$\n\\define tv-config-toolbar-icons() no\n\\define tv-config-toolbar-text() no\n\\define tv-config-toolbar-class() tc-btn-invisible\n\\rules only filteredtranscludeinline transcludeinline\n<!doctype html>\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"{{$:/core/templates/version}}\" />\n<meta name=\"format-detection\" content=\"telephone=no\">\n<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<title>{{$:/core/wiki/title}}</title>\n<div id=\"styleArea\">\n{{$:/boot/boot.css||$:/core/templates/css-tiddler}}\n</div>\n<style type=\"text/css\">\n{{$:/core/ui/PageStylesheet||$:/core/templates/wikified-tiddler}}\n</style>\n</head>\n<body class=\"tc-body\">\n{{$:/StaticBanner||$:/core/templates/html-tiddler}}\n<section class=\"tc-story-river tc-static-story-river\">\n{{$:/core/templates/exporters/StaticRiver/Content||$:/core/templates/html-tiddler}}\n</section>\n</body>\n</html>\n"
},
"$:/core/templates/exporters/StaticRiver/Content": {
"title": "$:/core/templates/exporters/StaticRiver/Content",
"text": "\\define renderContent()\n{{{ $(exportFilter)$ ||$:/core/templates/static-tiddler}}}\n\\end\n\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n<<renderContent>>\n"
},
"$:/core/templates/exporters/TidFile": {
"title": "$:/core/templates/exporters/TidFile",
"tags": "$:/tags/Exporter",
"description": "{{$:/language/Exporters/TidFile}}",
"extension": ".tid",
"condition": "[<count>compare:lte[1]]",
"text": "\\define renderContent()\n{{{ $(exportFilter)$ +[limit[1]] ||$:/core/templates/tid-tiddler}}}\n\\end\n\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n<<renderContent>>"
},
"$:/core/save/all-external-js": {
"title": "$:/core/save/all-external-js",
"text": "\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n\\define saveTiddlerFilter()\n[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$\n\\end\n{{$:/core/templates/tiddlywiki5-external-js.html}}\n"
},
"$:/core/templates/tiddlywiki5.js": {
"title": "$:/core/templates/tiddlywiki5.js",
"text": "\\rules only filteredtranscludeinline transcludeinline codeinline\n\n/*\n{{ $:/core/copyright.txt ||$:/core/templates/plain-text-tiddler}}\n`*/\n`<!--~~ Library modules ~~-->\n{{{ [is[system]type[application/javascript]library[yes]] ||$:/core/templates/plain-text-tiddler}}}\n<!--~~ Boot prefix ~~-->\n{{ $:/boot/bootprefix.js ||$:/core/templates/plain-text-tiddler}}\n<!--~~ Core plugin ~~-->\n{{$:/core/templates/tiddlywiki5.js/tiddlers}}\n<!--~~ Boot kernel ~~-->\n{{ $:/boot/boot.js ||$:/core/templates/plain-text-tiddler}}\n"
},
"$:/core/templates/tiddlywiki5.js/tiddlers": {
"title": "$:/core/templates/tiddlywiki5.js/tiddlers",
"text": "`\n$tw.preloadTiddlerArray(`<$text text=<<jsontiddlers \"[[$:/core]]\">>/>`);\n`\n"
},
"$:/core/templates/tiddlywiki5-external-js.html": {
"title": "$:/core/templates/tiddlywiki5-external-js.html",
"text": "\\rules only filteredtranscludeinline transcludeinline\n<!doctype html>\n{{$:/core/templates/MOTW.html}}<html lang=\"`<$text text={{{ [{$:/language}get[name]] }}}/>`\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<!--~~ Raw markup for the top of the head section ~~-->\n{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/TopHead]] ||$:/core/templates/raw-static-tiddler}}}\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\"/>\n<meta name=\"application-name\" content=\"TiddlyWiki\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"{{$:/core/templates/version}}\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n<meta name=\"mobile-web-app-capable\" content=\"yes\"/>\n<meta name=\"format-detection\" content=\"telephone=no\" />\n<meta name=\"copyright\" content=\"{{$:/core/copyright.txt}}\" />\n<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<title>{{$:/core/wiki/title}}</title>\n<!--~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~-->\n\n<!--~~ Raw markup ~~-->\n{{{ [all[shadows+tiddlers]tag[$:/core/wiki/rawmarkup]] [all[shadows+tiddlers]tag[$:/tags/RawMarkup]] ||$:/core/templates/plain-text-tiddler}}}\n{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified]] ||$:/core/templates/raw-static-tiddler}}}\n</head>\n<body class=\"tc-body\">\n<!--~~ Raw markup for the top of the body section ~~-->\n{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/TopBody]] ||$:/core/templates/raw-static-tiddler}}}\n<!--~~ Static styles ~~-->\n<div id=\"styleArea\">\n{{$:/boot/boot.css||$:/core/templates/css-tiddler}}\n</div>\n<!--~~ Static content for Google and browsers without JavaScript ~~-->\n<noscript>\n<div id=\"splashArea\">\n{{$:/core/templates/static.area}}\n</div>\n</noscript>\n<!--~~ Ordinary tiddlers ~~-->\n{{$:/core/templates/store.area.template.html}}\n<!--~~ Raw markup for the bottom of the body section ~~-->\n{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/BottomBody]] ||$:/core/templates/raw-static-tiddler}}}\n</body>\n<script src=\"%24%3A%2Fcore%2Ftemplates%2Ftiddlywiki5.js\" onerror=\"alert('Error: Cannot load tiddlywiki.js');\"></script>\n</html>\n"
},
"$:/core/templates/html-div-skinny-tiddler": {
"title": "$:/core/templates/html-div-skinny-tiddler",
"text": "<!--\n\nThis template is a variant of $:/core/templates/html-div-tiddler used for saving skinny tiddlers (with no text field)\n\n-->`<div`<$fields template=' $name$=\"$encoded_value$\"'></$fields>`>\n<pre></pre>\n</div>`\n"
},
"$:/core/templates/html-div-tiddler": {
"title": "$:/core/templates/html-div-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers as an HTML DIV tag with attributes representing the tiddler fields.\n\n-->`<div`<$fields template=' $name$=\"$encoded_value$\"'></$fields>`>\n<pre>`<$view field=\"text\" format=\"htmltextencoded\" />`</pre>\n</div>`\n"
},
"$:/core/templates/html-tiddler": {
"title": "$:/core/templates/html-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers as raw HTML\n\n--><$view field=\"text\" format=\"htmlwikified\" />"
},
"$:/core/templates/javascript-tiddler": {
"title": "$:/core/templates/javascript-tiddler",
"text": "<!--\n\nThis template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields.\n\n-->`<script`<$fields template=' data-tiddler-$name$=\"$encoded_value$\"'></$fields>` type=\"text/javascript\">`<$view field=\"text\" format=\"text\" />`</script>`"
},
"$:/core/templates/json-tiddler": {
"title": "$:/core/templates/json-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers as raw JSON\n\n--><$text text=<<jsontiddler>>/>"
},
"$:/core/templates/module-tiddler": {
"title": "$:/core/templates/module-tiddler",
"text": "<!--\n\nThis template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields. The body of the tiddler is wrapped in a call to the `$tw.modules.define` function in order to define the body of the tiddler as a module\n\n-->`<script`<$fields template=' data-tiddler-$name$=\"$encoded_value$\"'></$fields>` type=\"text/javascript\" data-module=\"yes\">$tw.modules.define(\"`<$view field=\"title\" format=\"jsencoded\" />`\",\"`<$view field=\"module-type\" format=\"jsencoded\" />`\",function(module,exports,require) {`<$view field=\"text\" format=\"text\" />`});\n</script>`"
},
"$:/core/templates/plain-text-tiddler": {
"title": "$:/core/templates/plain-text-tiddler",
"text": "<$view field=\"text\" format=\"text\" />"
},
"$:/core/templates/raw-static-tiddler": {
"title": "$:/core/templates/raw-static-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers as static HTML\n\n--><$view field=\"text\" format=\"plainwikified\" />"
},
"$:/core/save/all": {
"title": "$:/core/save/all",
"text": "\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n\\define saveTiddlerFilter()\n[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$\n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n"
},
"$:/core/save/empty": {
"title": "$:/core/save/empty",
"text": "\\define saveTiddlerFilter()\n[is[system]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]\n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n"
},
"$:/core/save/lazy-all": {
"title": "$:/core/save/lazy-all",
"text": "\\define saveTiddlerFilter()\n[is[system]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] \n\\end\n\\define skinnySaveTiddlerFilter()\n[!is[system]]\n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n"
},
"$:/core/save/lazy-images": {
"title": "$:/core/save/lazy-images",
"text": "\\define saveTiddlerFilter()\n[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[!is[system]is[image]] +[sort[title]] \n\\end\n\\define skinnySaveTiddlerFilter()\n[!is[system]is[image]]\n\\end\n{{$:/core/templates/tiddlywiki5.html}}\n"
},
"$:/core/templates/server/static.sidebar.wikitext": {
"title": "$:/core/templates/server/static.sidebar.wikitext",
"text": "\\whitespace trim\n<div class=\"tc-sidebar-scrollable\" style=\"overflow: auto;\">\n<div class=\"tc-sidebar-header\">\n<h1 class=\"tc-site-title\">\n<$transclude tiddler=\"$:/SiteTitle\"/>\n</h1>\n<div class=\"tc-site-subtitle\">\n<$transclude tiddler=\"$:/SiteSubtitle\"/>\n</div>\n<h2>\n</h2>\n<div class=\"tc-sidebar-lists\">\n<$list filter={{$:/DefaultTiddlers}}>\n<div class=\"tc-menu-list-subitem\">\n<$link><$text text=<<currentTiddler>>/></$link>\n</div>\n</$list>\n</div>\n<!-- Currently disabled the recent list as it is unweildy when the responsive narrow view kicks in\n<h2>\n{{$:/language/SideBar/Recent/Caption}}\n</h2>\n<div class=\"tc-sidebar-lists\">\n<$macrocall $name=\"timeline\" format={{$:/language/RecentChanges/DateFormat}}/>\n</div>\n</div>\n</div>\n-->\n"
},
"$:/core/templates/server/static.tiddler.html": {
"title": "$:/core/templates/server/static.tiddler.html",
"text": "\\whitespace trim\n\\define tv-wikilink-template() $uri_encoded$\n\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content={{$:/core/templates/version}} />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n<meta name=\"mobile-web-app-capable\" content=\"yes\"/>\n<meta name=\"format-detection\" content=\"telephone=no\">\n<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<link rel=\"stylesheet\" href=\"%24%3A%2Fcore%2Ftemplates%2Fstatic.template.css\">\n<title><$view field=\"caption\" format=\"plainwikified\"><$view field=\"title\"/></$view>: <$view tiddler=\"$:/core/wiki/title\" format=\"plainwikified\"/></title>\n</head>\n<body class=\"tc-body\">\n<$transclude tiddler=\"$:/core/templates/server/static.sidebar.wikitext\" mode=\"inline\"/>\n<section class=\"tc-story-river\">\n<div class=\"tc-tiddler-frame\">\n<$transclude tiddler=\"$:/core/templates/server/static.tiddler.wikitext\" mode=\"inline\"/>\n</div>\n</section>\n</body>\n</html>"
},
"$:/core/templates/server/static.tiddler.wikitext": {
"title": "$:/core/templates/server/static.tiddler.wikitext",
"text": "\\whitespace trim\n<div class=\"tc-tiddler-title\">\n<div class=\"tc-titlebar\">\n<h2><$text text=<<currentTiddler>>/></h2>\n</div>\n</div>\n<div class=\"tc-subtitle\">\n<$link to={{!!modifier}}>\n<$view field=\"modifier\"/>\n</$link> <$view field=\"modified\" format=\"date\" template={{$:/language/Tiddler/DateFormat}}/>\n</div>\n<div class=\"tc-tags-wrapper\">\n<$list filter=\"[all[current]tags[]sort[title]]\">\n<a href={{{ [<currentTiddler>encodeuricomponent[]] }}}>\n<$macrocall $name=\"tag-pill\" tag=<<currentTiddler>>/>\n</a>\n</$list>\n</div>\n<div class=\"tc-tiddler-body\">\n<$transclude mode=\"block\"/>\n</div>\n"
},
"$:/core/templates/single.tiddler.window": {
"title": "$:/core/templates/single.tiddler.window",
"text": "\\whitespace trim\n\\define containerClasses()\ntc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$\n\\end\n\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n\n<$vars\n\ttv-config-toolbar-icons={{$:/config/Toolbar/Icons}}\n\ttv-config-toolbar-text={{$:/config/Toolbar/Text}}\n\ttv-config-toolbar-class={{$:/config/Toolbar/ButtonClass}}\n\ttv-show-missing-links={{$:/config/MissingLinks}}\n\tstoryviewTitle={{$:/view}}\n\tlanguageTitle={{{ [{$:/language}get[name]] }}}>\n\n<div class=<<containerClasses>>>\n\n<$navigator story=\"$:/StoryList\" history=\"$:/HistoryList\">\n\n<$transclude mode=\"block\"/>\n\n</$navigator>\n\n</div>\n\n</$vars>\n"
},
"$:/core/templates/split-recipe": {
"title": "$:/core/templates/split-recipe",
"text": "<$list filter=\"[!is[system]]\">\ntiddler: <$view field=\"title\" format=\"urlencoded\"/>.tid\n</$list>\n"
},
"$:/core/templates/static-tiddler": {
"title": "$:/core/templates/static-tiddler",
"text": "<a name=<<currentTiddler>>>\n<$transclude tiddler=\"$:/core/ui/ViewTemplate\"/>\n</a>"
},
"$:/core/templates/static.area": {
"title": "$:/core/templates/static.area",
"text": "<$reveal type=\"nomatch\" state=\"$:/isEncrypted\" text=\"yes\">\n{{{ [all[shadows+tiddlers]tag[$:/tags/RawStaticContent]!has[draft.of]] ||$:/core/templates/raw-static-tiddler}}}\n{{$:/core/templates/static.content||$:/core/templates/html-tiddler}}\n</$reveal>\n<$reveal type=\"match\" state=\"$:/isEncrypted\" text=\"yes\">\nThis file contains an encrypted ~TiddlyWiki. Enable ~JavaScript and enter the decryption password when prompted.\n</$reveal>\n<!-- ensure splash screen isn't shown when JS is disabled -->\n`<style>\n.tc-remove-when-wiki-loaded {display: none;}\n</style>`\n"
},
"$:/core/templates/static.content": {
"title": "$:/core/templates/static.content",
"text": "<!-- For Google, and people without JavaScript-->\nThis [[TiddlyWiki|https://tiddlywiki.com]] contains the following tiddlers:\n\n<ul>\n<$list filter=<<saveTiddlerFilter>>>\n<li><$view field=\"title\" format=\"text\"></$view></li>\n</$list>\n</ul>\n"
},
"$:/core/templates/static.template.css": {
"title": "$:/core/templates/static.template.css",
"text": "{{$:/boot/boot.css||$:/core/templates/plain-text-tiddler}}\n\n{{$:/core/ui/PageStylesheet||$:/core/templates/wikified-tiddler}}\n"
},
"$:/core/templates/static.template.html": {
"title": "$:/core/templates/static.template.html",
"type": "text/vnd.tiddlywiki-html",
"text": "\\define tv-wikilink-template() static/$uri_doubleencoded$.html\n\\define tv-config-toolbar-icons() no\n\\define tv-config-toolbar-text() no\n\\define tv-config-toolbar-class() tc-btn-invisible\n\\rules only filteredtranscludeinline transcludeinline\n<!doctype html>\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"{{$:/core/templates/version}}\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n<meta name=\"mobile-web-app-capable\" content=\"yes\"/>\n<meta name=\"format-detection\" content=\"telephone=no\">\n<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<title>{{$:/core/wiki/title}}</title>\n<div id=\"styleArea\">\n{{$:/boot/boot.css||$:/core/templates/css-tiddler}}\n</div>\n<style type=\"text/css\">\n{{$:/core/ui/PageStylesheet||$:/core/templates/wikified-tiddler}}\n</style>\n</head>\n<body class=\"tc-body\">\n{{$:/StaticBanner||$:/core/templates/html-tiddler}}\n{{$:/core/ui/PageTemplate||$:/core/templates/html-tiddler}}\n</body>\n</html>\n"
},
"$:/core/templates/static.tiddler.html": {
"title": "$:/core/templates/static.tiddler.html",
"text": "\\define tv-wikilink-template() $uri_doubleencoded$.html\n\\define tv-config-toolbar-icons() no\n\\define tv-config-toolbar-text() no\n\\define tv-config-toolbar-class() tc-btn-invisible\n\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n`<!doctype html>\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"`{{$:/core/templates/version}}`\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n<meta name=\"mobile-web-app-capable\" content=\"yes\"/>\n<meta name=\"format-detection\" content=\"telephone=no\">\n<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<link rel=\"stylesheet\" href=\"static.css\">\n<title>`<$view field=\"caption\"><$view field=\"title\"/></$view>: {{$:/core/wiki/title}}`</title>\n</head>\n<body class=\"tc-body\">\n`{{$:/StaticBanner||$:/core/templates/html-tiddler}}`\n<section class=\"tc-story-river tc-static-story-river\">\n`<$view tiddler=\"$:/core/ui/ViewTemplate\" format=\"htmlwikified\"/>`\n</section>\n</body>\n</html>\n`\n"
},
"$:/core/templates/store.area.template.html": {
"title": "$:/core/templates/store.area.template.html",
"text": "<$reveal type=\"nomatch\" state=\"$:/isEncrypted\" text=\"yes\">\n`<div id=\"storeArea\" style=\"display:none;\">`\n<$list filter=<<saveTiddlerFilter>> template=\"$:/core/templates/html-div-tiddler\"/>\n<$list filter={{{ [<skinnySaveTiddlerFilter>] }}} template=\"$:/core/templates/html-div-skinny-tiddler\"/>\n`</div>`\n</$reveal>\n<$reveal type=\"match\" state=\"$:/isEncrypted\" text=\"yes\">\n`<!--~~ Encrypted tiddlers ~~-->`\n`<pre id=\"encryptedStoreArea\" type=\"text/plain\" style=\"display:none;\">`\n<$encrypt filter=<<saveTiddlerFilter>>/>\n`</pre>`\n</$reveal>"
},
"$:/core/templates/tid-tiddler": {
"title": "$:/core/templates/tid-tiddler",
"text": "<!--\n\nThis template is used for saving tiddlers in TiddlyWeb *.tid format\n\n--><$fields exclude='text bag' template='$name$: $value$\n'></$fields>`\n`<$view field=\"text\" format=\"text\" />"
},
"$:/core/templates/tiddler-metadata": {
"title": "$:/core/templates/tiddler-metadata",
"text": "<!--\n\nThis template is used for saving tiddler metadata *.meta files\n\n--><$fields exclude='text bag' template='$name$: $value$\n'></$fields>"
},
"$:/core/templates/tiddlywiki5.html": {
"title": "$:/core/templates/tiddlywiki5.html",
"text": "<$set name=\"saveTiddlerAndShadowsFilter\" filter=\"[subfilter<saveTiddlerFilter>] [subfilter<saveTiddlerFilter>plugintiddlers[]]\">\n`<!doctype html>\n`{{$:/core/templates/MOTW.html}}`<html lang=\"`<$text text={{{ [{$:/language}get[name]] }}}/>`\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n<!--~~ Raw markup for the top of the head section ~~-->\n`{{{ [<saveTiddlerAndShadowsFilter>tag[$:/tags/RawMarkupWikified/TopHead]] ||$:/core/templates/raw-static-tiddler}}}`\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\"/>\n<meta name=\"application-name\" content=\"TiddlyWiki\" />\n<meta name=\"generator\" content=\"TiddlyWiki\" />\n<meta name=\"tiddlywiki-version\" content=\"`{{$:/core/templates/version}}`\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n<meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\" />\n<meta name=\"mobile-web-app-capable\" content=\"yes\"/>\n<meta name=\"format-detection\" content=\"telephone=no\" />\n<meta name=\"copyright\" content=\"`{{$:/core/copyright.txt}}`\" />\n<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<title>`{{$:/core/wiki/title}}`</title>\n<!--~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~-->\n\n<!--~~ Raw markup ~~-->\n`{{{ [enlist<saveTiddlerAndShadowsFilter>tag[$:/core/wiki/rawmarkup]] ||$:/core/templates/plain-text-tiddler}}}\n{{{ [enlist<saveTiddlerAndShadowsFilter>tag[$:/tags/RawMarkup]] ||$:/core/templates/plain-text-tiddler}}}\n{{{ [enlist<saveTiddlerAndShadowsFilter>tag[$:/tags/RawMarkupWikified]] ||$:/core/templates/raw-static-tiddler}}}`\n</head>\n<body class=\"tc-body\">\n<!--~~ Raw markup for the top of the body section ~~-->\n`{{{ [enlist<saveTiddlerAndShadowsFilter>tag[$:/tags/RawMarkupWikified/TopBody]] ||$:/core/templates/raw-static-tiddler}}}`\n<!--~~ Static styles ~~-->\n<div id=\"styleArea\">\n`{{$:/boot/boot.css||$:/core/templates/css-tiddler}}`\n</div>\n<!--~~ Static content for Google and browsers without JavaScript ~~-->\n<noscript>\n<div id=\"splashArea\">\n`{{$:/core/templates/static.area}}`\n</div>\n</noscript>\n<!--~~ Ordinary tiddlers ~~-->\n`{{$:/core/templates/store.area.template.html}}`\n<!--~~ Library modules ~~-->\n<div id=\"libraryModules\" style=\"display:none;\">\n`{{{ [is[system]type[application/javascript]library[yes]] ||$:/core/templates/javascript-tiddler}}}`\n</div>\n<!--~~ Boot kernel prologue ~~-->\n<div id=\"bootKernelPrefix\" style=\"display:none;\">\n`{{ $:/boot/bootprefix.js ||$:/core/templates/javascript-tiddler}}`\n</div>\n<!--~~ Boot kernel ~~-->\n<div id=\"bootKernel\" style=\"display:none;\">\n`{{ $:/boot/boot.js ||$:/core/templates/javascript-tiddler}}`\n</div>\n<!--~~ Raw markup for the bottom of the body section ~~-->\n`{{{ [enlist<saveTiddlerAndShadowsFilter>tag[$:/tags/RawMarkupWikified/BottomBody]] ||$:/core/templates/raw-static-tiddler}}}`\n</body>\n</html>`\n"
},
"$:/core/templates/version": {
"title": "$:/core/templates/version",
"text": "<<version>>"
},
"$:/core/templates/wikified-tiddler": {
"title": "$:/core/templates/wikified-tiddler",
"text": "<$transclude />"
},
"$:/core/ui/AboveStory/tw2-plugin-check": {
"title": "$:/core/ui/AboveStory/tw2-plugin-check",
"tags": "$:/tags/AboveStory",
"text": "\\define lingo-base() $:/language/AboveStory/ClassicPlugin/\n<$list filter=\"[all[system+tiddlers]tag[systemConfig]limit[1]]\">\n\n<div class=\"tc-message-box\">\n\n<<lingo Warning>>\n\n<ul>\n\n<$list filter=\"[all[system+tiddlers]tag[systemConfig]]\">\n\n<li>\n\n<$link><$view field=\"title\"/></$link>\n\n</li>\n\n</$list>\n\n</ul>\n\n</div>\n\n</$list>\n"
},
"$:/core/ui/Actions/new-image": {
"title": "$:/core/ui/Actions/new-image",
"tags": "$:/tags/Actions",
"description": "create a new image tiddler",
"text": "\\define get-type()\nimage/$(imageType)$\n\\end\n\\define get-tags() $(textFieldTags)$ $(tagsFieldTags)$\n<$vars imageType={{$:/config/NewImageType}} textFieldTags={{$:/config/NewJournal/Tags}} tagsFieldTags={{$:/config/NewJournal/Tags!!tags}}>\n<$action-sendmessage $message=\"tm-new-tiddler\" type=<<get-type>> tags=<<get-tags>>/>\n</$vars>\n"
},
"$:/core/ui/Actions/new-journal": {
"title": "$:/core/ui/Actions/new-journal",
"tags": "$:/tags/Actions",
"description": "create a new journal tiddler",
"text": "\\define get-tags() $(textFieldTags)$ $(tagsFieldTags)$\n<$vars journalTitleTemplate={{$:/config/NewJournal/Title}} textFieldTags={{$:/config/NewJournal/Tags}} tagsFieldTags={{$:/config/NewJournal/Tags!!tags}} journalText={{$:/config/NewJournal/Text}}>\n<$wikify name=\"journalTitle\" text=\"\"\"<$macrocall $name=\"now\" format=<<journalTitleTemplate>>/>\"\"\">\n<$reveal type=\"nomatch\" state=<<journalTitle>> text=\"\">\n<$action-sendmessage $message=\"tm-new-tiddler\" title=<<journalTitle>> tags=<<get-tags>> text={{{ [<journalTitle>get[]] }}}/>\n</$reveal>\n<$reveal type=\"match\" state=<<journalTitle>> text=\"\">\n<$action-sendmessage $message=\"tm-new-tiddler\" title=<<journalTitle>> tags=<<get-tags>> text=<<journalText>>/>\n</$reveal>\n</$wikify>\n</$vars>\n"
},
"$:/core/ui/Actions/new-tiddler": {
"title": "$:/core/ui/Actions/new-tiddler",
"tags": "$:/tags/Actions",
"description": "create a new empty tiddler",
"text": "\\define get-tags() $(textFieldTags)$ $(tagsFieldTags)$\n<$vars textFieldTags={{$:/config/NewTiddler/Tags}} tagsFieldTags={{$:/config/NewTiddler/Tags!!tags}}>\n<$action-sendmessage $message=\"tm-new-tiddler\" tags=<<get-tags>>/>\n</$vars>\n"
},
"$:/core/ui/AdvancedSearch/Filter": {
"title": "$:/core/ui/AdvancedSearch/Filter",
"tags": "$:/tags/AdvancedSearch",
"caption": "{{$:/language/Search/Filter/Caption}}",
"text": "\\define lingo-base() $:/language/Search/\n\\define set-next-input-tab(beforeafter:\"after\") <$macrocall $name=\"change-input-tab\" stateTitle=\"$:/state/tab--1498284803\" tag=\"$:/tags/AdvancedSearch\" beforeafter=\"$beforeafter$\" defaultState=\"$:/core/ui/AdvancedSearch/System\" actions=\"\"\"<$action-setfield $tiddler=\"$:/state/advancedsearch/currentTab\" text=<<nextTab>>/>\"\"\"/>\n\n\\define cancel-search-actions() <$list filter=\"[{$:/temp/advancedsearch/input}!match{$:/temp/advancedsearch}]\" emptyMessage=\"\"\"<$action-deletetiddler $filter=\"[[$:/temp/advancedsearch]] [[$:/temp/advancedsearch/input]] [[$:/temp/advancedsearch/selected-item]]\" />\"\"\"><$action-setfield $tiddler=\"$:/temp/advancedsearch/input\" text={{$:/temp/advancedsearch}}/><$action-setfield $tiddler=\"$:/temp/advancedsearch/refresh\" text=\"yes\"/></$list>\n\n\\define input-accept-actions() <$list filter=\"[{$:/config/Search/NavigateOnEnter/enable}match[yes]]\" emptyMessage=\"\"\"<$list filter=\"[<__tiddler__>get[text]!is[missing]] ~[<__tiddler__>get[text]is[shadow]]\"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/></$list>\"\"\"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/></$list>\n\n\\define input-accept-variant-actions() <$list filter=\"[{$:/config/Search/NavigateOnEnter/enable}match[yes]]\" emptyMessage=\"\"\"<$list filter=\"[<__tiddler__>get[text]!is[missing]] ~[<__tiddler__>get[text]is[shadow]]\"><$list filter=\"[<__tiddler__>get[text]minlength[1]]\"><$action-sendmessage $message=\"tm-edit-tiddler\" $param={{{ [<__tiddler__>get[text]] }}}/></$list></$list>\"\"\"><$list filter=\"[<__tiddler__>get[text]minlength[1]]\"><$action-sendmessage $message=\"tm-edit-tiddler\" $param={{{ [<__tiddler__>get[text]] }}}/></$list></$list>\n\n<<lingo Filter/Hint>>\n\n<div class=\"tc-search tc-advanced-search\">\n<$keyboard key=\"((input-tab-right))\" actions=<<set-next-input-tab>>>\n<$keyboard key=\"((input-tab-left))\" actions=<<set-next-input-tab \"before\">>>\n<$macrocall $name=\"keyboard-driven-input\" tiddler=\"$:/temp/advancedsearch/input\" storeTitle=\"$:/temp/advancedsearch\" \n\t\trefreshTitle=\"$:/temp/advancedsearch/refresh\" selectionStateTitle=\"$:/temp/advancedsearch/selected-item\" type=\"search\" \n\t\ttag=\"input\" focus={{$:/config/Search/AutoFocus}} configTiddlerFilter=\"[[$:/temp/advancedsearch]]\" firstSearchFilterField=\"text\" \n\t\tinputAcceptActions=<<input-accept-actions>> inputAcceptVariantActions=<<input-accept-variant-actions>> \n\t\tinputCancelActions=<<cancel-search-actions>>/>\n</$keyboard>\n</$keyboard>\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/AdvancedSearch/FilterButton]!has[draft.of]]\"><$transclude/></$list>\n</div>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$set name=\"resultCount\" value=\"\"\"<$count filter={{$:/temp/advancedsearch}}/>\"\"\">\n<div class=\"tc-search-results\">\n<<lingo Filter/Matches>>\n<$list filter={{$:/temp/advancedsearch}}>\n<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] +[then[]else[tc-list-item-selected]] }}}>\n<$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n</span>\n</$list>\n</div>\n</$set>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Filter/FilterButtons/clear": {
"title": "$:/core/ui/AdvancedSearch/Filter/FilterButtons/clear",
"tags": "$:/tags/AdvancedSearch/FilterButton",
"text": "<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$button class=\"tc-btn-invisible\">\n<<cancel-search-actions>>\n<$action-sendmessage $message=\"tm-focus-selector\" $param=\"\"\".tc-advanced-search input\"\"\" />\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Filter/FilterButtons/delete": {
"title": "$:/core/ui/AdvancedSearch/Filter/FilterButtons/delete",
"tags": "$:/tags/AdvancedSearch/FilterButton",
"text": "<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$button popup=<<qualify \"$:/state/filterDeleteDropdown\">> class=\"tc-btn-invisible\">\n{{$:/core/images/delete-button}}\n</$button>\n</$reveal>\n\n<$reveal state=<<qualify \"$:/state/filterDeleteDropdown\">> type=\"popup\" position=\"belowleft\" animate=\"yes\">\n<div class=\"tc-block-dropdown-wrapper\">\n<div class=\"tc-block-dropdown tc-edit-type-dropdown\">\n<div class=\"tc-dropdown-item-plain\">\n<$set name=\"resultCount\" value=\"\"\"<$count filter={{$:/temp/advancedsearch}}/>\"\"\">\nAre you sure you wish to delete <<resultCount>> tiddler(s)?\n</$set>\n</div>\n<div class=\"tc-dropdown-item-plain\">\n<$button class=\"tc-btn\">\n<$action-deletetiddler $filter={{$:/temp/advancedsearch}}/>\nDelete these tiddlers\n</$button>\n</div>\n</div>\n</div>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Filter/FilterButtons/dropdown": {
"title": "$:/core/ui/AdvancedSearch/Filter/FilterButtons/dropdown",
"tags": "$:/tags/AdvancedSearch/FilterButton",
"text": "<span class=\"tc-popup-keep\">\n<$button popup=<<qualify \"$:/state/filterDropdown\">> class=\"tc-btn-invisible\">\n{{$:/core/images/down-arrow}}\n</$button>\n</span>\n\n<$reveal state=<<qualify \"$:/state/filterDropdown\">> type=\"popup\" position=\"belowleft\" animate=\"yes\">\n<$set name=\"tv-show-missing-links\" value=\"yes\">\n<$linkcatcher actions=\"\"\"<$action-setfield $tiddler=\"$:/temp/advancedsearch\" text=<<navigateTo>>/><$action-setfield $tiddler=\"$:/temp/advancedsearch/input\" text=<<navigateTo>>/><$action-setfield $tiddler=\"$:/temp/advancedsearch/refresh\" text=\"yes\"/><$action-sendmessage $message=\"tm-focus-selector\" $param='.tc-advanced-search input' />\"\"\">\n<div class=\"tc-block-dropdown-wrapper\">\n<div class=\"tc-block-dropdown tc-edit-type-dropdown\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Filter]]\"><$link to={{!!filter}}><$transclude field=\"description\"/></$link>\n</$list>\n</div>\n</div>\n</$linkcatcher>\n</$set>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Filter/FilterButtons/export": {
"title": "$:/core/ui/AdvancedSearch/Filter/FilterButtons/export",
"tags": "$:/tags/AdvancedSearch/FilterButton",
"text": "<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$macrocall $name=\"exportButton\" exportFilter={{$:/temp/advancedsearch}} lingoBase=\"$:/language/Buttons/ExportTiddlers/\"/>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Shadows": {
"title": "$:/core/ui/AdvancedSearch/Shadows",
"tags": "$:/tags/AdvancedSearch",
"caption": "{{$:/language/Search/Shadows/Caption}}",
"first-search-filter": "[all[shadows]search<userInput>sort[title]limit[250]] -[[$:/temp/advancedsearch]] -[[$:/temp/advancedsearch/input]]",
"text": "\\define lingo-base() $:/language/Search/\n\n\\define set-next-input-tab(beforeafter:\"after\") <$macrocall $name=\"change-input-tab\" stateTitle=\"$:/state/tab--1498284803\" tag=\"$:/tags/AdvancedSearch\" beforeafter=\"$beforeafter$\" defaultState=\"$:/core/ui/AdvancedSearch/System\" actions=\"\"\"<$action-setfield $tiddler=\"$:/state/advancedsearch/currentTab\" text=<<nextTab>>/>\"\"\"/>\n\n\\define cancel-search-actions() <$list filter=\"[{$:/temp/advancedsearch}!match{$:/temp/advancedsearch/input}]\" emptyMessage=\"\"\"<$action-deletetiddler $filter=\"[[$:/temp/advancedsearch]] [[$:/temp/advancedsearch/input]] [[$:/temp/advancedsearch/selected-item]]\" />\"\"\"><$action-setfield $tiddler=\"$:/temp/advancedsearch/input\" text={{$:/temp/advancedsearch}}/><$action-setfield $tiddler=\"$:/temp/advancedsearch/refresh\" text=\"yes\"/></$list><$action-sendmessage $message=\"tm-focus-selector\" $param=\"\"\".tc-advanced-search input\"\"\"/>\n\n\\define input-accept-actions() <$list filter=\"[{$:/config/Search/NavigateOnEnter/enable}match[yes]]\" emptyMessage=\"\"\"<$list filter=\"[<__tiddler__>get[text]!is[missing]] ~[<__tiddler__>get[text]is[shadow]]\"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/></$list>\"\"\"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/></$list>\n\n\\define input-accept-variant-actions() <$list filter=\"[{$:/config/Search/NavigateOnEnter/enable}match[yes]]\" emptyMessage=\"\"\"<$list filter=\"[<__tiddler__>get[text]!is[missing]] ~[<__tiddler__>get[text]is[shadow]]\"><$list filter=\"[<__tiddler__>get[text]minlength[1]]\"><$action-sendmessage $message=\"tm-edit-tiddler\" $param={{{ [<__tiddler__>get[text]] }}}/></$list></$list>\"\"\"><$list filter=\"[<__tiddler__>get[text]minlength[1]]\"><$action-sendmessage $message=\"tm-edit-tiddler\" $param={{{ [<__tiddler__>get[text]] }}}/></$list></$list>\n\n<<lingo Shadows/Hint>>\n\n<div class=\"tc-search\">\n<$keyboard key=\"((input-tab-right))\" actions=<<set-next-input-tab>>>\n<$keyboard key=\"((input-tab-left))\" actions=<<set-next-input-tab \"before\">>>\n<$macrocall $name=\"keyboard-driven-input\" tiddler=\"$:/temp/advancedsearch/input\" storeTitle=\"$:/temp/advancedsearch\"\n\t\trefreshTitle=\"$:/temp/advancedsearch/refresh\" selectionStateTitle=\"$:/temp/advancedsearch/selected-item\" type=\"search\"\n\t\ttag=\"input\" focus={{$:/config/Search/AutoFocus}} configTiddlerFilter=\"[[$:/core/ui/AdvancedSearch/Shadows]]\"\n\t\tinputCancelActions=<<cancel-search-actions>> inputAcceptActions=<<input-accept-actions>> \n\t\tinputAcceptVariantActions=<<input-accept-variant-actions>> filterMinLength={{$:/config/Search/MinLength}}/>\n</$keyboard>\n</$keyboard>\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$button class=\"tc-btn-invisible\">\n<<cancel-search-actions>>\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n</div>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n\n<$list filter=\"[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]\" emptyMessage=\"\"\"<div class=\"tc-search-results\">{{$:/language/Search/Search/TooShort}}</div>\"\"\" variable=\"listItem\">\n\n<$set name=\"resultCount\" value=\"\"\"<$count filter=\"[all[shadows]search{$:/temp/advancedsearch}] -[[$:/temp/advancedsearch]] -[[$:/temp/advancedsearch/input]]\"/>\"\"\">\n\n<div class=\"tc-search-results\">\n\n<<lingo Shadows/Matches>>\n\n<$list filter=\"[all[shadows]search{$:/temp/advancedsearch}sort[title]limit[250]] -[[$:/temp/advancedsearch]] -[[$:/temp/advancedsearch/input]]\">\n<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] +[then[]else[tc-list-item-selected]] }}}>\n<$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n</span>\n</$list>\n\n</div>\n\n</$set>\n\n</$list>\n\n</$reveal>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"match\" text=\"\">\n\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/Standard": {
"title": "$:/core/ui/AdvancedSearch/Standard",
"tags": "$:/tags/AdvancedSearch",
"caption": "{{$:/language/Search/Standard/Caption}}",
"text": "\\define lingo-base() $:/language/Search/\n\\define set-next-input-tab(beforeafter:\"after\") <$macrocall $name=\"change-input-tab\" stateTitle=\"$:/state/tab--1498284803\" tag=\"$:/tags/AdvancedSearch\" beforeafter=\"$beforeafter$\" defaultState=\"$:/core/ui/AdvancedSearch/System\" actions=\"\"\"<$action-setfield $tiddler=\"$:/state/advancedsearch/currentTab\" text=<<nextTab>>/>\"\"\"/>\n\n\\define next-search-tab(beforeafter:\"after\") <$macrocall $name=\"change-input-tab\" stateTitle=\"$:/state/tab/search-results/advancedsearch\" tag=\"$:/tags/SearchResults\" beforeafter=\"$beforeafter$\" defaultState={{$:/config/SearchResults/Default}} actions=\"\"\"<$action-setfield $tiddler=\"$:/state/advancedsearch/standard/currentTab\" text=<<nextTab>>/>\"\"\"/>\n\n\\define cancel-search-actions() <$list filter=\"[{$:/temp/advancedsearch}!match{$:/temp/advancedsearch/input}]\" emptyMessage=\"\"\"<$action-deletetiddler $filter=\"[[$:/temp/advancedsearch]] [[$:/temp/advancedsearch/input]] [[$:/temp/advancedsearch/selected-item]]\" />\"\"\"><$action-setfield $tiddler=\"$:/temp/advancedsearch/input\" text={{$:/temp/advancedsearch}}/><$action-setfield $tiddler=\"$:/temp/advancedsearch/refresh\" text=\"yes\"/></$list><$action-sendmessage $message=\"tm-focus-selector\" $param=\"\"\".tc-advanced-search input\"\"\"/>\n\n\\define input-accept-actions() <$list filter=\"[{$:/config/Search/NavigateOnEnter/enable}match[yes]]\" emptyMessage=\"\"\"<$list filter=\"[<__tiddler__>get[text]!is[missing]] ~[<__tiddler__>get[text]is[shadow]]\"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/></$list>\"\"\"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/></$list>\n\n\\define input-accept-variant-actions() <$list filter=\"[{$:/config/Search/NavigateOnEnter/enable}match[yes]]\" emptyMessage=\"\"\"<$list filter=\"[<__tiddler__>get[text]!is[missing]] ~[<__tiddler__>get[text]is[shadow]]\"><$list filter=\"[<__tiddler__>get[text]minlength[1]]\"><$action-sendmessage $message=\"tm-edit-tiddler\" $param={{{ [<__tiddler__>get[text]] }}}/></$list></$list>\"\"\"><$list filter=\"[<__tiddler__>get[text]minlength[1]]\"><$action-sendmessage $message=\"tm-edit-tiddler\" $param={{{ [<__tiddler__>get[text]] }}}/></$list></$list>\n\n<<lingo Standard/Hint>>\n\n<div class=\"tc-search\">\n<$keyboard key=\"((input-tab-right))\" actions=<<set-next-input-tab>>>\n<$keyboard key=\"((input-tab-left))\" actions=<<set-next-input-tab \"before\">>>\n<$keyboard key=\"shift-alt-Right\" actions=<<next-search-tab>>>\n<$keyboard key=\"shift-alt-Left\" actions=<<next-search-tab \"before\">>>\n<$macrocall $name=\"keyboard-driven-input\" tiddler=\"$:/temp/advancedsearch/input\" storeTitle=\"$:/temp/advancedsearch\"\n\t\trefreshTitle=\"$:/temp/advancedsearch/refresh\" selectionStateTitle=\"$:/temp/advancedsearch/selected-item\" type=\"search\"\n\t\ttag=\"input\" focus={{$:/config/Search/AutoFocus}} inputCancelActions=<<cancel-search-actions>> \n\t\tinputAcceptActions=<<input-accept-actions>> inputAcceptVariantActions=<<input-accept-variant-actions>> \n\t\tconfigTiddlerFilter=\"[[$:/state/search/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}]\"\n\t\tfilterMinLength={{$:/config/Search/MinLength}}/>\n</$keyboard>\n</$keyboard>\n</$keyboard>\n</$keyboard>\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$button class=\"tc-btn-invisible\">\n<<cancel-search-actions>>\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n</div>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$list filter=\"[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]\" emptyMessage=\"\"\"<div class=\"tc-search-results\">{{$:/language/Search/Search/TooShort}}</div>\"\"\" variable=\"listItem\">\n<$vars userInput={{{ [[$:/temp/advancedsearch]get[text]] }}} configTiddler={{{ [[$:/state/search/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}] }}} searchListState=\"$:/temp/advancedsearch/selected-item\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]butfirst[]limit[1]]\" emptyMessage=\"\"\"\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]\">\n<$transclude/>\n</$list>\n\"\"\">\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]\" default={{$:/config/SearchResults/Default}} actions=\"\"\"<$action-setfield $tiddler=\"$:/state/advancedsearch/standard/currentTab\" text=<<currentTab>>/>\"\"\" explicitState=\"$:/state/tab/search-results/advancedsearch\" />\n</$list>\n</$vars>\n</$list>\n</$reveal>\n"
},
"$:/core/ui/AdvancedSearch/System": {
"title": "$:/core/ui/AdvancedSearch/System",
"tags": "$:/tags/AdvancedSearch",
"caption": "{{$:/language/Search/System/Caption}}",
"first-search-filter": "[is[system]search<userInput>sort[title]limit[250]] -[[$:/temp/advancedsearch]] -[[$:/temp/advancedsearch/input]] -[[$:/temp/advancedsearch/selected-item]]",
"text": "\\define lingo-base() $:/language/Search/\n\\define set-next-input-tab(beforeafter:\"after\",stateTitle,tag,defaultState,currentTabTiddler) <$macrocall $name=\"change-input-tab\" stateTitle=\"$:/state/tab--1498284803\" tag=\"$:/tags/AdvancedSearch\" beforeafter=\"$beforeafter$\" defaultState=\"$:/core/ui/AdvancedSearch/System\" actions=\"\"\"<$action-setfield $tiddler=\"$:/state/advancedsearch/currentTab\" text=<<nextTab>>/>\"\"\"/>\n\n\\define cancel-search-actions() <$list filter=\"[{$:/temp/advancedsearch}!match{$:/temp/advancedsearch/input}]\" emptyMessage=\"\"\"<$action-deletetiddler $filter=\"[[$:/temp/advancedsearch]] [[$:/temp/advancedsearch/input]] [[$:/temp/advancedsearch/selected-item]]\" />\"\"\"><$action-setfield $tiddler=\"$:/temp/advancedsearch/input\" text={{$:/temp/advancedsearch}}/><$action-setfield $tiddler=\"$:/temp/advancedsearch/refresh\" text=\"yes\"/></$list><$action-sendmessage $message=\"tm-focus-selector\" $param=\"\"\".tc-advanced-search input\"\"\"/>\n\n\\define input-accept-actions() <$list filter=\"[{$:/config/Search/NavigateOnEnter/enable}match[yes]]\" emptyMessage=\"\"\"<$list filter=\"[<__tiddler__>get[text]!is[missing]] ~[<__tiddler__>get[text]is[shadow]]\"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/></$list>\"\"\"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/></$list>\n\n\\define input-accept-variant-actions() <$list filter=\"[{$:/config/Search/NavigateOnEnter/enable}match[yes]]\" emptyMessage=\"\"\"<$list filter=\"[<__tiddler__>get[text]!is[missing]] ~[<__tiddler__>get[text]is[shadow]]\"><$list filter=\"[<__tiddler__>get[text]minlength[1]]\"><$action-sendmessage $message=\"tm-edit-tiddler\" $param={{{ [<__tiddler__>get[text]] }}}/></$list></$list>\"\"\"><$list filter=\"[<__tiddler__>get[text]minlength[1]]\"><$action-sendmessage $message=\"tm-edit-tiddler\" $param={{{ [<__tiddler__>get[text]] }}}/></$list></$list>\n\n<<lingo System/Hint>>\n\n<div class=\"tc-search\">\n<$keyboard key=\"((input-tab-right))\" actions=<<set-next-input-tab>>>\n<$keyboard key=\"((input-tab-left))\" actions=<<set-next-input-tab \"before\">>>\n<$macrocall $name=\"keyboard-driven-input\" tiddler=\"$:/temp/advancedsearch/input\" storeTitle=\"$:/temp/advancedsearch\"\n\t\trefreshTitle=\"$:/temp/advancedsearch/refresh\" selectionStateTitle=\"$:/temp/advancedsearch/selected-item\"\n\t\ttype=\"search\" tag=\"input\" focus={{$:/config/Search/AutoFocus}} configTiddlerFilter=\"[[$:/core/ui/AdvancedSearch/System]]\"\n\t\tinputCancelActions=<<cancel-search-actions>> inputAcceptActions=<<input-accept-actions>> \n\t\tinputAcceptVariantActions=<<input-accept-variant-actions>> filterMinLength={{$:/config/Search/MinLength}}/>\n</$keyboard>\n</$keyboard>\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n<$button class=\"tc-btn-invisible\">\n<<cancel-search-actions>>\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n</div>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"nomatch\" text=\"\">\n\n<$list filter=\"[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]\" emptyMessage=\"\"\"<div class=\"tc-search-results\">{{$:/language/Search/Search/TooShort}}</div>\"\"\" variable=\"listItem\">\n\n<$set name=\"resultCount\" value=\"\"\"<$count filter=\"[is[system]search{$:/temp/advancedsearch}] -[[$:/temp/advancedsearch]] -[[$:/temp/advancedsearch/input]] -[[$:/temp/advancedsearch/selected-item]]\"/>\"\"\">\n\n<div class=\"tc-search-results\">\n\n<<lingo System/Matches>>\n\n<$list filter=\"[is[system]search{$:/temp/advancedsearch}sort[title]limit[250]] -[[$:/temp/advancedsearch]] -[[$:/temp/advancedsearch/input]] -[[$:/temp/advancedsearch/selected-item]]\">\n<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] +[then[]else[tc-list-item-selected]] }}}>\n<$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n</span>\n</$list>\n\n</div>\n\n</$set>\n\n</$list>\n\n</$reveal>\n\n<$reveal state=\"$:/temp/advancedsearch\" type=\"match\" text=\"\">\n\n</$reveal>\n"
},
"$:/AdvancedSearch": {
"title": "$:/AdvancedSearch",
"icon": "$:/core/images/advanced-search-button",
"color": "#bbb",
"text": "<div class=\"tc-advanced-search\">\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/AdvancedSearch]!has[draft.of]]\" default=\"$:/core/ui/AdvancedSearch/System\" actions=\"\"\"<$action-setfield $tiddler=\"$:/state/advancedsearch/currentTab\" text=<<currentTab>>/>\"\"\" explicitState=\"$:/state/tab--1498284803\"/>\n</div>\n"
},
"$:/core/ui/AlertTemplate": {
"title": "$:/core/ui/AlertTemplate",
"text": "<div class=\"tc-alert\">\n<div class=\"tc-alert-toolbar\">\n<$button class=\"tc-btn-invisible\"><$action-deletetiddler $tiddler=<<currentTiddler>>/>{{$:/core/images/cancel-button}}</$button>\n</div>\n<div class=\"tc-alert-subtitle\">\n<$wikify name=\"format\" text=<<lingo Tiddler/DateFormat>>>\n<$view field=\"component\"/> - <$view field=\"modified\" format=\"date\" template=<<format>>/> <$reveal type=\"nomatch\" state=\"!!count\" text=\"\"><span class=\"tc-alert-highlight\">({{$:/language/Count}}: <$view field=\"count\"/>)</span></$reveal>\n</$wikify>\n</div>\n<div class=\"tc-alert-body\">\n\n<$transclude/>\n\n</div>\n</div>\n"
},
"$:/core/ui/BinaryWarning": {
"title": "$:/core/ui/BinaryWarning",
"text": "\\define lingo-base() $:/language/BinaryWarning/\n<<lingo Prompt>>\n"
},
"$:/core/ui/Components/plugin-info": {
"title": "$:/core/ui/Components/plugin-info",
"text": "\\define lingo-base() $:/language/ControlPanel/Plugins/\n\n\\define popup-state-macro()\n$(qualified-state)$-$(currentTiddler)$\n\\end\n\n\\define tabs-state-macro()\n$(popup-state)$-$(pluginInfoType)$\n\\end\n\n\\define plugin-icon-title()\n$(currentTiddler)$/icon\n\\end\n\n\\define plugin-disable-title()\n$:/config/Plugins/Disabled/$(currentTiddler)$\n\\end\n\n\\define plugin-table-body(type,disabledMessage,default-popup-state)\n<div class=\"tc-plugin-info-chunk tc-plugin-info-toggle\">\n<$reveal type=\"nomatch\" state=<<popup-state>> text=\"yes\" default=\"\"\"$default-popup-state$\"\"\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<<popup-state>> setTo=\"yes\">\n{{$:/core/images/chevron-right}}\n</$button>\n</$reveal>\n<$reveal type=\"match\" state=<<popup-state>> text=\"yes\" default=\"\"\"$default-popup-state$\"\"\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<<popup-state>> setTo=\"no\">\n{{$:/core/images/chevron-down}}\n</$button>\n</$reveal>\n</div>\n<div class=\"tc-plugin-info-chunk tc-plugin-info-icon\">\n<$transclude tiddler=<<currentTiddler>> subtiddler=<<plugin-icon-title>>>\n<$transclude tiddler=\"$:/core/images/plugin-generic-$type$\"/>\n</$transclude>\n</div>\n<div class=\"tc-plugin-info-chunk tc-plugin-info-description\">\n<h1>\n''<$text text={{{ [<currentTiddler>get[name]] ~[<currentTiddler>split[/]last[1]] }}}/>'': <$view field=\"description\"><$view field=\"title\"/></$view> $disabledMessage$\n</h1>\n<h2>\n<$view field=\"title\"/>\n</h2>\n<h2>\n<div><em><$view field=\"version\"/></em></div>\n</h2>\n</div>\n\\end\n\n\\define plugin-info(type,default-popup-state)\n<$set name=\"popup-state\" value=<<popup-state-macro>>>\n<$reveal type=\"nomatch\" state=<<plugin-disable-title>> text=\"yes\">\n<$link to={{!!title}} class=\"tc-plugin-info\">\n<<plugin-table-body type:\"$type$\" default-popup-state:\"\"\"$default-popup-state$\"\"\">>\n</$link>\n</$reveal>\n<$reveal type=\"match\" state=<<plugin-disable-title>> text=\"yes\">\n<$link to={{!!title}} class=\"tc-plugin-info tc-plugin-info-disabled\">\n<<plugin-table-body type:\"$type$\" default-popup-state:\"\"\"$default-popup-state$\"\"\" disabledMessage:\"<$macrocall $name='lingo' title='Disabled/Status'/>\">>\n</$link>\n</$reveal>\n<$reveal type=\"match\" text=\"yes\" state=<<popup-state>> default=\"\"\"$default-popup-state$\"\"\">\n<div class=\"tc-plugin-info-dropdown\">\n<div class=\"tc-plugin-info-dropdown-body\">\n<$list filter=\"[all[current]] -[[$:/core]]\">\n<div style=\"float:right;\">\n<$reveal type=\"nomatch\" state=<<plugin-disable-title>> text=\"yes\">\n<$button set=<<plugin-disable-title>> setTo=\"yes\" tooltip={{$:/language/ControlPanel/Plugins/Disable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Disable/Caption}}>\n<<lingo Disable/Caption>>\n</$button>\n</$reveal>\n<$reveal type=\"match\" state=<<plugin-disable-title>> text=\"yes\">\n<$button set=<<plugin-disable-title>> setTo=\"no\" tooltip={{$:/language/ControlPanel/Plugins/Enable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Enable/Caption}}>\n<<lingo Enable/Caption>>\n</$button>\n</$reveal>\n</div>\n</$list>\n<$set name=\"tabsList\" filter=\"[<currentTiddler>list[]] contents\">\n<$macrocall $name=\"tabs\" state=<<tabs-state-macro>> tabsList=<<tabsList>> default={{{ [enlist<tabsList>] }}} template=\"$:/core/ui/PluginInfo\"/>\n</$set>\n</div>\n</div>\n</$reveal>\n</$set>\n\\end\n\n<$macrocall $name=\"plugin-info\" type=<<plugin-type>> default-popup-state=<<default-popup-state>>/>\n"
},
"$:/core/ui/Components/tag-link": {
"title": "$:/core/ui/Components/tag-link",
"text": "<$link>\n<$set name=\"backgroundColor\" value={{!!color}}>\n<span style=<<tag-styles>> class=\"tc-tag-label\">\n<$view field=\"title\" format=\"text\"/>\n</span>\n</$set>\n</$link>"
},
"$:/core/ui/ControlPanel/Advanced": {
"title": "$:/core/ui/ControlPanel/Advanced",
"tags": "$:/tags/ControlPanel/Info",
"caption": "{{$:/language/ControlPanel/Advanced/Caption}}",
"text": "{{$:/language/ControlPanel/Advanced/Hint}}\n\n<div class=\"tc-control-panel\">\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Advanced]!has[draft.of]]\" default=\"$:/core/ui/ControlPanel/TiddlerFields\" explicitState=\"$:/state/tab--959111941\"/>\n</div>\n"
},
"$:/core/ui/ControlPanel/Appearance": {
"title": "$:/core/ui/ControlPanel/Appearance",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/Appearance/Caption}}",
"text": "{{$:/language/ControlPanel/Appearance/Hint}}\n\n<div class=\"tc-control-panel\">\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Appearance]!has[draft.of]]\" default=\"$:/core/ui/ControlPanel/Theme\" explicitState=\"$:/state/tab--1963855381\"/>\n</div>\n"
},
"$:/core/ui/ControlPanel/Basics": {
"title": "$:/core/ui/ControlPanel/Basics",
"tags": "$:/tags/ControlPanel/Info",
"caption": "{{$:/language/ControlPanel/Basics/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Basics/\n\n\\define show-filter-count(filter)\n<$button class=\"tc-btn-invisible\">\n<$action-setfield $tiddler=\"$:/temp/advancedsearch\" $value=\"\"\"$filter$\"\"\"/>\n<$action-setfield $tiddler=\"$:/temp/advancedsearch/input\" $value=\"\"\"$filter$\"\"\"/>\n<$action-setfield $tiddler=\"$:/temp/advancedsearch/refresh\" text=\"yes\"/>\n<$action-setfield $tiddler=\"$:/state/tab--1498284803\" $value=\"$:/core/ui/AdvancedSearch/Filter\"/>\n<$action-navigate $to=\"$:/AdvancedSearch\"/>\n<$action-sendmessage $message=\"tm-focus-selector\" $param=\".tc-advanced-search input\"/>\n''<$count filter=\"\"\"$filter$\"\"\"/>''\n{{$:/core/images/advanced-search-button}}\n</$button>\n\\end\n\n|<<lingo Version/Prompt>> |''<<version>>'' |\n|<$link to=\"$:/SiteTitle\"><<lingo Title/Prompt>></$link> |<$edit-text tiddler=\"$:/SiteTitle\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/SiteSubtitle\"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler=\"$:/SiteSubtitle\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/status/UserName\"><<lingo Username/Prompt>></$link> |<$edit-text tiddler=\"$:/status/UserName\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/config/AnimationDuration\"><<lingo AnimDuration/Prompt>></$link> |<$edit-text tiddler=\"$:/config/AnimationDuration\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/DefaultTiddlers\"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag=\"textarea\" tiddler=\"$:/DefaultTiddlers\" class=\"tc-edit-texteditor\"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |\n|<$link to=\"$:/language/DefaultNewTiddlerTitle\"><<lingo NewTiddler/Title/Prompt>></$link> |<$edit-text tiddler=\"$:/language/DefaultNewTiddlerTitle\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/config/NewJournal/Title\"><<lingo NewJournal/Title/Prompt>></$link> |<$edit-text tiddler=\"$:/config/NewJournal/Title\" default=\"\" tag=\"input\"/> |\n|<$link to=\"$:/config/NewJournal/Text\"><<lingo NewJournal/Text/Prompt>></$link> |<$edit tiddler=\"$:/config/NewJournal/Text\" tag=\"textarea\" class=\"tc-edit-texteditor\" default=\"\"/> |\n|<$link to=\"$:/config/NewTiddler/Tags\"><<lingo NewTiddler/Tags/Prompt>></$link> |<$vars currentTiddler=\"$:/config/NewTiddler/Tags\" tagField=\"text\">{{||$:/core/ui/EditTemplate/tags}}<$list filter=\"[<currentTiddler>tags[]] +[limit[1]]\" variable=\"ignore\"><$button tooltip={{$:/language/ControlPanel/Basics/RemoveTags/Hint}}><<lingo RemoveTags>><$action-listops $tiddler=<<currentTiddler>> $field=\"text\" $subfilter={{{ [<currentTiddler>get[tags]] }}}/><$action-setfield $tiddler=<<currentTiddler>> tags=\"\"/></$button></$list></$vars> |\n|<$link to=\"$:/config/NewJournal/Tags\"><<lingo NewJournal/Tags/Prompt>></$link> |<$vars currentTiddler=\"$:/config/NewJournal/Tags\" tagField=\"text\">{{||$:/core/ui/EditTemplate/tags}}<$list filter=\"[<currentTiddler>tags[]] +[limit[1]]\" variable=\"ignore\"><$button tooltip={{$:/language/ControlPanel/Basics/RemoveTags/Hint}}><<lingo RemoveTags>><$action-listops $tiddler=<<currentTiddler>> $field=\"text\" $subfilter={{{ [<currentTiddler>get[tags]] }}}/><$action-setfield $tiddler=<<currentTiddler>> tags=\"\"/></$button></$list></$vars> |\n|<$link to=\"$:/config/AutoFocus\"><<lingo AutoFocus/Prompt>></$link> |{{$:/snippets/minifocusswitcher}} |\n|<<lingo Language/Prompt>> |{{$:/snippets/minilanguageswitcher}} |\n|<<lingo Tiddlers/Prompt>> |<<show-filter-count \"[!is[system]sort[title]]\">> |\n|<<lingo Tags/Prompt>> |<<show-filter-count \"[tags[]sort[title]]\">> |\n|<<lingo SystemTiddlers/Prompt>> |<<show-filter-count \"[is[system]sort[title]]\">> |\n|<<lingo ShadowTiddlers/Prompt>> |<<show-filter-count \"[all[shadows]sort[title]]\">> |\n|<<lingo OverriddenShadowTiddlers/Prompt>> |<<show-filter-count \"[is[tiddler]is[shadow]sort[title]]\">> |\n"
},
"$:/core/ui/ControlPanel/EditorTypes": {
"title": "$:/core/ui/ControlPanel/EditorTypes",
"tags": "$:/tags/ControlPanel/Advanced",
"caption": "{{$:/language/ControlPanel/EditorTypes/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/EditorTypes/\n\n<<lingo Hint>>\n\n<table>\n<tbody>\n<tr>\n<th><<lingo Type/Caption>></th>\n<th><<lingo Editor/Caption>></th>\n</tr>\n<$list filter=\"[all[shadows+tiddlers]prefix[$:/config/EditorTypeMappings/]sort[title]]\">\n<tr>\n<td>\n<$link>\n<$list filter=\"[all[current]removeprefix[$:/config/EditorTypeMappings/]]\">\n<$text text={{!!title}}/>\n</$list>\n</$link>\n</td>\n<td>\n<$view field=\"text\"/>\n</td>\n</tr>\n</$list>\n</tbody>\n</table>\n"
},
"$:/core/ui/ControlPanel/Info": {
"title": "$:/core/ui/ControlPanel/Info",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/Info/Caption}}",
"text": "{{$:/language/ControlPanel/Info/Hint}}\n\n<div class=\"tc-control-panel\">\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Info]!has[draft.of]]\" default=\"$:/core/ui/ControlPanel/Basics\" explicitState=\"$:/state/tab--2112689675\"/>\n</div>\n"
},
"$:/core/ui/ControlPanel/KeyboardShortcuts": {
"title": "$:/core/ui/ControlPanel/KeyboardShortcuts",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/KeyboardShortcuts/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/KeyboardShortcuts/\n\n\\define new-shortcut(title)\n<div class=\"tc-dropdown-item-plain\">\n<$edit-shortcut tiddler=\"$title$\" placeholder={{$:/language/ControlPanel/KeyboardShortcuts/Add/Prompt}} focus=\"true\" style=\"width:auto;\"/> <$button>\n<<lingo Add/Caption>>\n<$action-listops\n\t$tiddler=\"$(shortcutTitle)$\"\n\t$field=\"text\"\n\t$subfilter=\"[{$title$}]\"\n/>\n<$action-deletetiddler\n\t$tiddler=\"$title$\"\n/>\n</$button>\n</div>\n\\end\n\n\\define shortcut-list-item(caption)\n<td>\n</td>\n<td style=\"text-align:right;font-size:0.7em;\">\n<<lingo Platform/$caption$>>\n</td>\n<td>\n<div style=\"position:relative;\">\n<$button popup=<<qualify \"$:/state/dropdown/$(shortcutTitle)$\">> class=\"tc-btn-invisible\">\n{{$:/core/images/edit-button}}\n</$button>\n<$macrocall $name=\"displayshortcuts\" $output=\"text/html\" shortcuts={{$(shortcutTitle)$}} prefix=\"<kbd>\" separator=\"</kbd> <kbd>\" suffix=\"</kbd>\"/>\n\n<$reveal state=<<qualify \"$:/state/dropdown/$(shortcutTitle)$\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-block-dropdown-wrapper\">\n<div class=\"tc-block-dropdown tc-edit-type-dropdown tc-popup-keep\">\n<$list filter=\"[list[$(shortcutTitle)$!!text]sort[title]]\" variable=\"shortcut\" emptyMessage=\"\"\"\n<div class=\"tc-dropdown-item-plain\">\n//<<lingo NoShortcuts/Caption>>//\n</div>\n\"\"\">\n<div class=\"tc-dropdown-item-plain\">\n<$button class=\"tc-btn-invisible\" tooltip={{$:/language/ControlPanel/KeyboardShortcuts/Remove/Hint}}>\n<$action-listops\n\t$tiddler=\"$(shortcutTitle)$\"\n\t$field=\"text\"\n\t$subfilter=\"+[remove<shortcut>]\"\n/>\n<small>{{$:/core/images/close-button}}</small>\n</$button>\n<kbd>\n<$macrocall $name=\"displayshortcuts\" $output=\"text/html\" shortcuts=<<shortcut>>/>\n</kbd>\n</div>\n</$list>\n<hr/>\n<$macrocall $name=\"new-shortcut\" title=<<qualify \"$:/state/new-shortcut/$(shortcutTitle)$\">>/>\n</div>\n</div>\n</$reveal>\n</div>\n</td>\n\\end\n\n\\define shortcut-list(caption,prefix)\n<tr>\n<$list filter=\"[[$prefix$$(shortcutName)$]]\" variable=\"shortcutTitle\">\n<<shortcut-list-item \"$caption$\">>\n</$list>\n</tr>\n\\end\n\n\\define shortcut-editor()\n<<shortcut-list \"All\" \"$:/config/shortcuts/\">>\n<<shortcut-list \"Mac\" \"$:/config/shortcuts-mac/\">>\n<<shortcut-list \"NonMac\" \"$:/config/shortcuts-not-mac/\">>\n<<shortcut-list \"Linux\" \"$:/config/shortcuts-linux/\">>\n<<shortcut-list \"NonLinux\" \"$:/config/shortcuts-not-linux/\">>\n<<shortcut-list \"Windows\" \"$:/config/shortcuts-windows/\">>\n<<shortcut-list \"NonWindows\" \"$:/config/shortcuts-not-windows/\">>\n\\end\n\n\\define shortcut-preview()\n<$macrocall $name=\"displayshortcuts\" $output=\"text/html\" shortcuts={{$(shortcutPrefix)$$(shortcutName)$}} prefix=\"<kbd>\" separator=\"</kbd> <kbd>\" suffix=\"</kbd>\"/>\n\\end\n\n\\define shortcut-item-inner()\n<tr>\n<td>\n<$reveal type=\"nomatch\" state=<<dropdownStateTitle>> text=\"open\">\n<$button class=\"tc-btn-invisible\">\n<$action-setfield\n\t$tiddler=<<dropdownStateTitle>>\n\t$value=\"open\"\n/>\n{{$:/core/images/right-arrow}}\n</$button>\n</$reveal>\n<$reveal type=\"match\" state=<<dropdownStateTitle>> text=\"open\">\n<$button class=\"tc-btn-invisible\">\n<$action-setfield\n\t$tiddler=<<dropdownStateTitle>>\n\t$value=\"close\"\n/>\n{{$:/core/images/down-arrow}}\n</$button>\n</$reveal>\n''<$text text=<<shortcutName>>/>''\n</td>\n<td>\n<$transclude tiddler=\"$:/config/ShortcutInfo/$(shortcutName)$\"/>\n</td>\n<td>\n<$list filter=\"$:/config/shortcuts/ $:/config/shortcuts-mac/ $:/config/shortcuts-not-mac/ $:/config/shortcuts-linux/ $:/config/shortcuts-not-linux/ $:/config/shortcuts-windows/ $:/config/shortcuts-not-windows/\" variable=\"shortcutPrefix\">\n<<shortcut-preview>>\n</$list>\n</td>\n</tr>\n<$set name=\"dropdownState\" value={{$(dropdownStateTitle)$}}>\n<$list filter=\"[<dropdownState>match[open]]\" variable=\"listItem\">\n<<shortcut-editor>>\n</$list>\n</$set>\n\\end\n\n\\define shortcut-item()\n<$set name=\"dropdownStateTitle\" value=<<qualify \"$:/state/dropdown/keyboardshortcut/$(shortcutName)$\">>>\n<<shortcut-item-inner>>\n</$set>\n\\end\n\n<table>\n<tbody>\n<$list filter=\"[all[shadows+tiddlers]removeprefix[$:/config/ShortcutInfo/]]\" variable=\"shortcutName\">\n<<shortcut-item>>\n</$list>\n</tbody>\n</table>\n"
},
"$:/core/ui/ControlPanel/LoadedModules": {
"title": "$:/core/ui/ControlPanel/LoadedModules",
"tags": "$:/tags/ControlPanel/Advanced",
"caption": "{{$:/language/ControlPanel/LoadedModules/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/\n<<lingo LoadedModules/Hint>>\n\n{{$:/snippets/modules}}\n"
},
"$:/core/ui/ControlPanel/Modals/AddPlugins": {
"title": "$:/core/ui/ControlPanel/Modals/AddPlugins",
"subtitle": "{{$:/core/images/download-button}} {{$:/language/ControlPanel/Plugins/Add/Caption}}",
"text": "\\define install-plugin-actions()\n<$action-sendmessage $message=\"tm-load-plugin-from-library\" url={{!!url}} title={{$(assetInfo)$!!original-title}}/>\n<$set name=\"url\" value={{!!url}}>\n<$set name=\"currentTiddler\" value=<<assetInfo>>>\n<$list filter=\"[enlist{!!dependents}] [{!!parent-plugin}] +[sort[name]]\" variable=\"dependency\">\n<$action-sendmessage $message=\"tm-load-plugin-from-library\" url=<<url>> title=<<dependency>>/>\n</$list>\n</$set>\n</$set>\n\\end\n\n\\define install-plugin-button()\n<div>\n<$set name=\"libraryVersion\" value={{{ [<assetInfo>get[version]] }}}>\n<$set name=\"installedVersion\" value={{{ [<assetInfo>get[original-title]get[version]] }}}>\n<$set name=\"reinstall-type\" value={{{ [<libraryVersion>compare:version:eq<installedVersion>then[tc-reinstall]] [<libraryVersion>compare:version:gt<installedVersion>then[tc-reinstall-upgrade]] [<libraryVersion>compare:version:lt<installedVersion>then[tc-reinstall-downgrade]] }}}>\n<$button actions=<<install-plugin-actions>> class={{{ [<assetInfo>get[original-title]has[version]then<reinstall-type>] tc-btn-invisible tc-install-plugin +[join[ ]] }}}>\n{{$:/core/images/download-button}}\n<$list filter=\"[<assetInfo>get[original-title]get[version]]\" variable=\"ignore\" emptyMessage=\"{{$:/language/ControlPanel/Plugins/Install/Caption}}\">\n<$list filter=\"[<libraryVersion>compare:version:gt<installedVersion>]\" variable=\"ignore\" emptyMessage=\"\"\"\n<$list filter=\"[<libraryVersion>compare:version:lt<installedVersion>]\" variable=\"ignore\" emptyMessage=\"{{$:/language/ControlPanel/Plugins/Reinstall/Caption}}\">\n{{$:/language/ControlPanel/Plugins/Downgrade/Caption}}\n</$list>\n\"\"\">\n{{$:/language/ControlPanel/Plugins/Update/Caption}}\n</$list>\n</$list>\n</$button>\n<div>\n</div>\n<$reveal stateTitle=<<assetInfo>> stateField=\"requires-reload\" type=\"match\" text=\"yes\">{{$:/language/ControlPanel/Plugins/PluginWillRequireReload}}</$reveal>\n</$set>\n</$set>\n</$set>\n</div>\n\\end\n\n\\define popup-state-macro()\n$:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$\n\\end\n\n\\define display-plugin-info(type)\n<$set name=\"popup-state\" value=<<popup-state-macro>>>\n<div class=\"tc-plugin-info\">\n<div class=\"tc-plugin-info-chunk tc-plugin-info-toggle\">\n<$reveal type=\"nomatch\" state=<<popup-state>> text=\"yes\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<<popup-state>> setTo=\"yes\">\n{{$:/core/images/chevron-right}}\n</$button>\n</$reveal>\n<$reveal type=\"match\" state=<<popup-state>> text=\"yes\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<<popup-state>> setTo=\"no\">\n{{$:/core/images/chevron-down}}\n</$button>\n</$reveal>\n</div>\n<div class=\"tc-plugin-info-chunk tc-plugin-info-icon\">\n<$list filter=\"[<assetInfo>has[icon]]\" emptyMessage=\"\"\"<$transclude tiddler=\"$:/core/images/plugin-generic-$type$\"/>\"\"\">\n<img src={{$(assetInfo)$!!icon}}/>\n</$list>\n</div>\n<div class=\"tc-plugin-info-chunk tc-plugin-info-description\">\n<h1><strong><$text text={{{ [<assetInfo>get[name]] ~[<assetInfo>get[original-title]split[/]last[1]] }}}/></strong>: <$view tiddler=<<assetInfo>> field=\"description\"/></h1>\n<h2><$view tiddler=<<assetInfo>> field=\"original-title\"/></h2>\n<div><em><$view tiddler=<<assetInfo>> field=\"version\"/></em></div>\n<$list filter=\"[<assetInfo>get[original-title]get[version]]\" variable=\"installedVersion\"><div><em>{{$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint}}</em></div></$list>\n</div>\n<div class=\"tc-plugin-info-chunk tc-plugin-info-buttons\">\n<<install-plugin-button>>\n</div>\n</div>\n<$set name=\"original-title\" value={{{ [<assetInfo>get[original-title]] }}}>\n<$reveal type=\"match\" text=\"yes\" state=<<popup-state>>>\n<div class=\"tc-plugin-info-dropdown\">\n<$list filter=\"[enlist{!!dependents}] [<currentTiddler>get[parent-plugin]] +[limit[1]] ~[<assetInfo>get[original-title]!is[tiddler]]\" variable=\"ignore\">\n<div class=\"tc-plugin-info-dropdown-message\">\n<$list filter=\"[<assetInfo>get[original-title]!is[tiddler]]\">\n{{$:/language/ControlPanel/Plugins/NotInstalled/Hint}}\n</$list>\n<$set name=\"currentTiddler\" value=<<assetInfo>>>\n<$list filter=\"[enlist{!!dependents}] [<currentTiddler>get[parent-plugin]] +[limit[1]]\" variable=\"ignore\">\n<div>\n{{$:/language/ControlPanel/Plugins/AlsoRequires}}\n<$list filter=\"[enlist{!!dependents}] [{!!parent-plugin}] +[sort[name]]\" variable=\"dependency\">\n<$text text=<<dependency>>/>\n</$list>\n</div>\n</$list>\n</$set>\n</div>\n</$list>\n<div class=\"tc-plugin-info-dropdown-body\">\n<$transclude tiddler=<<assetInfo>> field=\"readme\" mode=\"block\"/>\n</div>\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]has[parent-plugin]parent-plugin<original-title>limit[1]]\" variable=\"ignore\">\n<div class=\"tc-plugin-info-sub-plugins\">\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]has[parent-plugin]parent-plugin<original-title>sort[name]]\" variable=\"assetInfo\">\n<<display-plugin-info \"$type$\">>\n</$list>\n</div>\n</$list>\n</div>\n</$reveal>\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]has[parent-plugin]parent-plugin<original-title>limit[1]]\" variable=\"ignore\">\n<$reveal type=\"nomatch\" text=\"yes\" state=<<popup-state>> tag=\"div\" class=\"tc-plugin-info-sub-plugin-indicator\">\n<$wikify name=\"count\" text=\"\"\"<$count filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]has[parent-plugin]parent-plugin<original-title>]\"/>\"\"\">\n<$button class=\"tc-btn-invisible\" set=<<popup-state>> setTo=\"yes\">\n{{$:/language/ControlPanel/Plugins/SubPluginPrompt}}\n</$button>\n</$wikify>\n</$reveal>\n</$list>\n</$set>\n</$set>\n\\end\n\n\\define load-plugin-library-button()\n<$list filter=\"[<currentTiddler>get[enabled]else[yes]match[yes]]\" variable=\"ignore\">\n<$button class=\"tc-btn-big-green\">\n<$action-sendmessage $message=\"tm-load-plugin-library\" url={{!!url}} infoTitlePrefix=\"$:/temp/RemoteAssetInfo/\"/>\n{{$:/core/images/chevron-right}} {{$:/language/ControlPanel/Plugins/OpenPluginLibrary}}\n</$button>\n</$list>\n\\end\n\n\\define display-server-assets(type)\n{{$:/language/Search/Search}}: <$edit-text tiddler=\"\"\"$:/temp/RemoteAssetSearch/$(currentTiddler)$\"\"\" default=\"\" type=\"search\" tag=\"input\"/>\n<$reveal state=\"\"\"$:/temp/RemoteAssetSearch/$(currentTiddler)$\"\"\" type=\"nomatch\" text=\"\">\n<$button class=\"tc-btn-invisible\">\n<$action-setfield $tiddler=\"\"\"$:/temp/RemoteAssetSearch/$(currentTiddler)$\"\"\" $field=\"text\" $value=\"\"/>\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n<div class=\"tc-plugin-library-listing\">\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]search:author,description,original-title,readme,title{$:/temp/RemoteAssetSearch/$(currentTiddler)$}sort[name]]\" variable=\"assetInfo\">\n<$list filter=\"[[$:/temp/RemoteAssetSearch/$(currentTiddler)$]has[text]] ~[<assetInfo>!has[parent-plugin]]\" variable=\"ignore\"><!-- Hide sub-plugins if we're not searching -->\n<<display-plugin-info \"$type$\">>\n</$list>\n</$list>\n</div>\n\\end\n\n\\define display-server-connection()\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/ServerConnection]suffix{!!url}]\" variable=\"connectionTiddler\" emptyMessage=<<load-plugin-library-button>>>\n\n<$set name=\"transclusion\" value=<<connectionTiddler>>>\n\n<<tabs \"[[$:/core/ui/ControlPanel/Plugins/Add/Updates]] [[$:/core/ui/ControlPanel/Plugins/Add/Plugins]] [[$:/core/ui/ControlPanel/Plugins/Add/Themes]] [[$:/core/ui/ControlPanel/Plugins/Add/Languages]]\" \"$:/core/ui/ControlPanel/Plugins/Add/Plugins\">>\n\n</$set>\n\n</$list>\n\\end\n\n\\define close-library-button()\n<$reveal type='nomatch' state='$:/temp/ServerConnection/$(PluginLibraryURL)$' text=''>\n<$button class='tc-btn-big-green'>\n<$action-sendmessage $message=\"tm-unload-plugin-library\" url={{!!url}}/>\n{{$:/core/images/chevron-left}} {{$:/language/ControlPanel/Plugins/ClosePluginLibrary}}\n<$action-deletetiddler $filter=\"[prefix[$:/temp/ServerConnection/$(PluginLibraryURL)$]][prefix[$:/temp/RemoteAssetInfo/$(PluginLibraryURL)$]]\"/>\n</$button>\n</$reveal>\n\\end\n\n\\define plugin-library-listing()\n<div class=\"tc-tab-set\">\n<$set name=\"defaultTab\" value={{{ [all[tiddlers+shadows]tag[$:/tags/PluginLibrary]] }}}>\n<div class=\"tc-tab-buttons\">\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/PluginLibrary]]\">\n<$button set=<<qualify \"$:/state/addplugins/tab\">> setTo=<<currentTiddler>> default=<<defaultTab>> selectedClass=\"tc-tab-selected\">\n<$set name=\"tv-wikilinks\" value=\"no\">\n<$transclude field=\"caption\"/>\n</$set>\n</$button>\n</$list>\n</div>\n<div class=\"tc-tab-divider\"/>\n<div class=\"tc-tab-content\">\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/PluginLibrary]]\">\n<$reveal type=\"match\" state=<<qualify \"$:/state/addplugins/tab\">> text=<<currentTiddler>> default=<<defaultTab>>>\n<h2><$link><$transclude field=\"caption\"><$view field=\"title\"/></$transclude></$link></h2>\n//<$view field=\"url\"/>//\n<$transclude mode=\"block\"/>\n<$set name=PluginLibraryURL value={{!!url}}>\n<<close-library-button>>\n</$set>\n<<display-server-connection>>\n</$reveal>\n</$list>\n</div>\n</$set>\n</div>\n\\end\n\n\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n\n<div>\n<<plugin-library-listing>>\n</div>\n"
},
"$:/core/ui/ControlPanel/Palette": {
"title": "$:/core/ui/ControlPanel/Palette",
"tags": "$:/tags/ControlPanel/Appearance",
"caption": "{{$:/language/ControlPanel/Palette/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Palette/\n\n{{$:/snippets/paletteswitcher}}\n\n<$reveal type=\"nomatch\" state=\"$:/state/ShowPaletteEditor\" text=\"yes\">\n\n<$button set=\"$:/state/ShowPaletteEditor\" setTo=\"yes\"><<lingo ShowEditor/Caption>></$button>\n\n</$reveal>\n\n<$reveal type=\"match\" state=\"$:/state/ShowPaletteEditor\" text=\"yes\">\n\n<$button set=\"$:/state/ShowPaletteEditor\" setTo=\"no\"><<lingo HideEditor/Caption>></$button>\n{{$:/PaletteManager}}\n\n</$reveal>\n\n"
},
"$:/core/ui/ControlPanel/Parsing": {
"title": "$:/core/ui/ControlPanel/Parsing",
"tags": "$:/tags/ControlPanel/Advanced",
"caption": "{{$:/language/ControlPanel/Parsing/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Parsing/\n\n\\define toggle(Type)\n<$checkbox\ntiddler=\"\"\"$:/config/WikiParserRules/$Type$/$(rule)$\"\"\"\nfield=\"text\"\nchecked=\"enable\"\nunchecked=\"disable\"\ndefault=\"enable\">\n<<rule>>\n</$checkbox>\n\\end\n\n\\define rules(type,Type)\n<$list filter=\"[wikiparserrules[$type$]]\" variable=\"rule\">\n<dd><<toggle $Type$>></dd>\n</$list>\n\\end\n\n<<lingo Hint>>\n\n<dl>\n<dt><<lingo Pragma/Caption>></dt>\n<<rules pragma Pragma>>\n<dt><<lingo Inline/Caption>></dt>\n<<rules inline Inline>>\n<dt><<lingo Block/Caption>></dt>\n<<rules block Block>>\n</dl>"
},
"$:/core/ui/ControlPanel/Plugins/Add/Languages": {
"title": "$:/core/ui/ControlPanel/Plugins/Add/Languages",
"caption": "{{$:/language/ControlPanel/Plugins/Languages/Caption}} (<$count filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[language]]\"/>)",
"text": "<<display-server-assets language>>\n"
},
"$:/core/ui/ControlPanel/Plugins/Add/Plugins": {
"title": "$:/core/ui/ControlPanel/Plugins/Add/Plugins",
"caption": "{{$:/language/ControlPanel/Plugins/Plugins/Caption}} (<$count filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[plugin]]\"/>)",
"text": "<<display-server-assets plugin>>\n"
},
"$:/core/ui/ControlPanel/Plugins/Add/Themes": {
"title": "$:/core/ui/ControlPanel/Plugins/Add/Themes",
"caption": "{{$:/language/ControlPanel/Plugins/Themes/Caption}} (<$count filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[theme]]\"/>)",
"text": "<<display-server-assets theme>>\n"
},
"$:/core/ui/ControlPanel/Plugins/Add/Updates": {
"title": "$:/core/ui/ControlPanel/Plugins/Add/Updates",
"caption": "<$importvariables filter=\"$:/core/ui/ControlPanel/Plugins/Add/Updates\">{{$:/language/ControlPanel/Plugins/Updates/Caption}} (<<update-count>>)</$importvariables>",
"text": "\\define each-updateable-plugin(body)\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}sort[title]]\" variable=\"assetInfo\">\n<$set name=\"libraryVersion\" value={{{ [<assetInfo>get[version]] }}}>\n<$list filter=\"[<assetInfo>get[original-title]has[version]!version<libraryVersion>]\" variable=\"ignore\">\n<$set name=\"installedVersion\" value={{{ [<assetInfo>get[original-title]get[version]] }}}>\n<$list filter=\"[<installedversion>!match<libraryVersion>]\" variable=\"ignore\">\n$body$\n</$list>\n</$set>\n</$list>\n</$set>\n</$list>\n\\end\n\n\\define update-all-actions()\n<$macrocall $name=\"each-updateable-plugin\" body=\"\"\"\n<<install-plugin-actions>>\n\"\"\"/>\n\\end\n\n\\define update-count()\n<$wikify name=\"count-filter\" text=<<each-updateable-plugin \"[[<$text text=<<assetInfo>>/>]]\">>><$count filter=<<count-filter>>/></$wikify>\n\\end\n\n<$button actions=<<update-all-actions>> class=\"tc-btn-invisible tc-install-plugin tc-reinstall-upgrade\">\n{{$:/core/images/download-button}} {{||$:/language/ControlPanel/Plugins/Updates/UpdateAll/Caption}}\n</$button>\n\n<div class=\"tc-plugin-library-listing\">\n<$macrocall $name=\"each-updateable-plugin\" body=\"\"\"\n<$macrocall $name=\"display-plugin-info\" type={{{ [<assetInfo>get[original-plugin-type]] }}}/>\n\"\"\"/>\n</div>\n"
},
"$:/core/ui/ControlPanel/Plugins/AddPlugins": {
"title": "$:/core/ui/ControlPanel/Plugins/AddPlugins",
"text": "\\define lingo-base() $:/language/ControlPanel/Plugins/\n\n<$button message=\"tm-modal\" param=\"$:/core/ui/ControlPanel/Modals/AddPlugins\" tooltip={{$:/language/ControlPanel/Plugins/Add/Hint}} class=\"tc-btn-big-green tc-primary-btn\">\n{{$:/core/images/download-button}} <<lingo Add/Caption>>\n</$button>\n"
},
"$:/core/ui/ControlPanel/Plugins/Installed/Languages": {
"title": "$:/core/ui/ControlPanel/Plugins/Installed/Languages",
"caption": "{{$:/language/ControlPanel/Plugins/Languages/Caption}} (<$count filter=\"[!has[draft.of]plugin-type[language]]\"/>)",
"text": "<<plugin-table language>>\n"
},
"$:/core/ui/ControlPanel/Plugins/Installed/Plugins": {
"title": "$:/core/ui/ControlPanel/Plugins/Installed/Plugins",
"caption": "{{$:/language/ControlPanel/Plugins/Plugins/Caption}} (<$count filter=\"[!has[draft.of]plugin-type[plugin]]\"/>)",
"text": "<<plugin-table plugin>>\n"
},
"$:/core/ui/ControlPanel/Plugins/Installed/Themes": {
"title": "$:/core/ui/ControlPanel/Plugins/Installed/Themes",
"caption": "{{$:/language/ControlPanel/Plugins/Themes/Caption}} (<$count filter=\"[!has[draft.of]plugin-type[theme]]\"/>)",
"text": "<<plugin-table theme>>\n"
},
"$:/core/ui/ControlPanel/Plugins": {
"title": "$:/core/ui/ControlPanel/Plugins",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/Plugins/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Plugins/\n\n\\define plugin-table(type)\n<$set name=\"plugin-type\" value=\"\"\"$type$\"\"\">\n<$set name=\"qualified-state\" value=<<qualify \"$:/state/plugin-info\">>>\n<$list filter=\"[!has[draft.of]plugin-type[$type$]sort[name]]\" emptyMessage=<<lingo \"Empty/Hint\">> template=\"$:/core/ui/Components/plugin-info\"/>\n</$set>\n</$set>\n\\end\n\n{{$:/core/ui/ControlPanel/Plugins/AddPlugins}}\n\n<<lingo Installed/Hint>>\n\n<$macrocall $name=\"tabs\" tabsList=\"[[$:/core/ui/ControlPanel/Plugins/Installed/Plugins]] [[$:/core/ui/ControlPanel/Plugins/Installed/Themes]] [[$:/core/ui/ControlPanel/Plugins/Installed/Languages]]\" default=\"$:/core/ui/ControlPanel/Plugins/Installed/Plugins\" explicitState=\"$:/state/tab--86143343\"/>\n"
},
"$:/core/ui/ControlPanel/Publishing": {
"title": "$:/core/ui/ControlPanel/Publishing",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/Publishing/Caption}}",
"text": "{{$:/language/ControlPanel/Publishing/Hint}}\n\n<div class=\"tc-publishing-job-listing\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/PublishingJob]]\" variable=\"job\">\n\n<div class=\"tc-publishing-job\">\n\n<h2>Job: <$link to=<<job>>><$transclude tiddler=<<job>> field=\"caption\" mode=\"inline\"/></$link></h2>\n\nPublisher: <$select tiddler=<<job>> field=\"publisher\">\n<$list filter=\"[[publisher]modules[]moduleproperty[name]]\">\n<option value=<<currentTiddler>>><$text text=<<currentTiddler>>/></option>\n</$list>\n</$select>\n\nBase URL: <$edit-text tiddler=<<job>> size=\"50\" field=\"baseurl\"/>\n\nLogs: <$view tiddler=<<job>> field=\"list\"/>\n\n<$set name=\"publisher-name\" value={{{ [<job>get[publisher]] }}}>\n\n<$set name=\"publisher-module\" value={{{ [[publisher]modules[name],<publisher-name>] }}}>\n\n<div class=\"tc-publishing-job-publisher\">\n\n<h2>Publisher: <$text text=<<publisher-name>>/></h2>\n\n<$set name=\"publisher-ui\" value={{{ [<publisher-module>modulestring[ui],{$:/language}] }}}>\n\n<$tiddler tiddler=<<job>>>\n\n<<publisher-ui>>\n\n</$tiddler>\n\n</$set>\n\n</div>\n\n<$vars sitemap={{{ [<job>get[sitemap]] }}}>\n\n<div class=\"tc-publishing-sitemap\">\n\n<h2>Sitemap: <$link to=<<sitemap>>><$view tiddler=<<sitemap>> field=\"caption\"><$text text=<<sitemap>>/></$view></$link></h2>\n\n<$list filter=\"[<sitemap>get[list]enlist-input[]]\" variable=\"route\">\n\n<div class=\"tc-publishing-route\">\n\n<h2>Route: <$link to=<<route>>><$view tiddler=<<route>> field=\"caption\"><$text text=<<route>>/></$view></$link></h2>\n\nroute type: <$view tiddler=<<route>> field=\"route-type\"/>\n\npath: <$edit-text tiddler=<<route>> size=\"50\" field=\"route-path\"/>\n\nfilter: <$edit-text tiddler=<<route>> size=\"50\" field=\"route-tiddler-filter\"/>\n\ntemplate: <$edit-text tiddler=<<route>> size=\"50\" field=\"route-template\"/>\n\n</div>\n\n</$list>\n\n</div>\n\n</$vars>\n\n</$set>\n\n</$set>\n\n</div>\n\n</$list>\n\n</div>\n"
},
"$:/core/ui/ControlPanel/Saving/DownloadSaver": {
"title": "$:/core/ui/ControlPanel/Saving/DownloadSaver",
"tags": "$:/tags/ControlPanel/Saving",
"caption": "{{$:/language/ControlPanel/Saving/DownloadSaver/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Saving/DownloadSaver/\n\n<<lingo Hint>>\n\n!! <$link to=\"$:/config/DownloadSaver/AutoSave\"><<lingo AutoSave/Hint>></$link>\n\n<$checkbox tiddler=\"$:/config/DownloadSaver/AutoSave\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"no\"> <<lingo AutoSave/Description>> </$checkbox>\n"
},
"$:/core/ui/ControlPanel/Saving/General": {
"title": "$:/core/ui/ControlPanel/Saving/General",
"tags": "$:/tags/ControlPanel/Saving",
"caption": "{{$:/language/ControlPanel/Saving/General/Caption}}",
"list-before": "",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/\n\n{{$:/language/ControlPanel/Saving/General/Hint}}\n\n!! <$link to=\"$:/config/AutoSave\"><<lingo AutoSave/Caption>></$link>\n\n<<lingo AutoSave/Hint>>\n\n<$radio tiddler=\"$:/config/AutoSave\" value=\"yes\"> <<lingo AutoSave/Enabled/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/AutoSave\" value=\"no\"> <<lingo AutoSave/Disabled/Description>> </$radio>\n"
},
"$:/core/ui/ControlPanel/Saving/GitHub": {
"title": "$:/core/ui/ControlPanel/Saving/GitHub",
"tags": "$:/tags/ControlPanel/Saving",
"caption": "{{$:/language/ControlPanel/Saving/GitService/GitHub/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Saving/GitService/\n\\define service-name() ~GitHub\n\n<<lingo Description>>\n\n|<<lingo UserName>> |<$edit-text tiddler=\"$:/GitHub/Username\" default=\"\" tag=\"input\"/> |\n|<<lingo GitHub/Password>> |<$password name=\"github\"/> |\n|<<lingo Repo>> |<$edit-text tiddler=\"$:/GitHub/Repo\" default=\"\" tag=\"input\"/> |\n|<<lingo Branch>> |<$edit-text tiddler=\"$:/GitHub/Branch\" default=\"main\" tag=\"input\"/> |\n|<<lingo Path>> |<$edit-text tiddler=\"$:/GitHub/Path\" default=\"\" tag=\"input\"/> |\n|<<lingo Filename>> |<$edit-text tiddler=\"$:/GitHub/Filename\" default=\"\" tag=\"input\"/> |\n|<<lingo ServerURL>> |<$edit-text tiddler=\"$:/GitHub/ServerURL\" default=\"https://api.github.com\" tag=\"input\"/> |"
},
"$:/core/ui/ControlPanel/Saving/GitLab": {
"title": "$:/core/ui/ControlPanel/Saving/GitLab",
"tags": "$:/tags/ControlPanel/Saving",
"caption": "{{$:/language/ControlPanel/Saving/GitService/GitLab/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Saving/GitService/\n\\define service-name() ~GitLab\n\n<<lingo Description>>\n\n|<<lingo UserName>> |<$edit-text tiddler=\"$:/GitLab/Username\" default=\"\" tag=\"input\"/> |\n|<<lingo GitLab/Password>> |<$password name=\"gitlab\"/> |\n|<<lingo Repo>> |<$edit-text tiddler=\"$:/GitLab/Repo\" default=\"\" tag=\"input\"/> |\n|<<lingo Branch>> |<$edit-text tiddler=\"$:/GitLab/Branch\" default=\"master\" tag=\"input\"/> |\n|<<lingo Path>> |<$edit-text tiddler=\"$:/GitLab/Path\" default=\"\" tag=\"input\"/> |\n|<<lingo Filename>> |<$edit-text tiddler=\"$:/GitLab/Filename\" default=\"\" tag=\"input\"/> |\n|<<lingo ServerURL>> |<$edit-text tiddler=\"$:/GitLab/ServerURL\" default=\"https://gitlab.com/api/v4\" tag=\"input\"/> |"
},
"$:/core/ui/ControlPanel/Saving/TiddlySpot": {
"title": "$:/core/ui/ControlPanel/Saving/TiddlySpot",
"tags": "$:/tags/ControlPanel/Saving",
"caption": "{{$:/language/ControlPanel/Saving/TiddlySpot/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Saving/TiddlySpot/\n\n\\define siteURL(path)\nhttp://$(userName)$.tiddlyspot.com/$path$/\n\\end\n\\define siteLink(path)\n<$reveal type=\"nomatch\" state=\"$:/UploadName\" text=\"\">\n<$set name=\"userName\" value={{$:/UploadName}}>\n<$reveal type=\"match\" state=\"$:/UploadURL\" text=\"\">\n<<siteURL $path$>>\n</$reveal>\n<$reveal type=\"nomatch\" state=\"$:/UploadURL\" text=\"\">\n<$macrocall $name=resolvePath source={{$:/UploadBackupDir}} root={{$:/UploadURL}}>>\n</$reveal>\n</$set>\n</$reveal>\n\\end\n\n<div class=\"tc-message-box\">\n\n<<lingo ReadOnly>>\n\n</div>\n\n<<lingo Description>>\n\n|<<lingo UserName>> |<$edit-text tiddler=\"$:/UploadName\" default=\"\" tag=\"input\"/> |\n|<<lingo Password>> |<$password name=\"upload\"/> |\n\n''<<lingo Advanced/Heading>>''\n\n|<<lingo ServerURL>> |<$edit-text tiddler=\"$:/UploadURL\" default=\"\" tag=\"input\"/> |\n|<<lingo Filename>> |<$edit-text tiddler=\"$:/UploadFilename\" default=\"index.html\" tag=\"input\"/> |\n|<<lingo UploadDir>> |<$edit-text tiddler=\"$:/UploadDir\" default=\".\" tag=\"input\"/> |\n|<<lingo BackupDir>> |<$edit-text tiddler=\"$:/UploadBackupDir\" default=\".\" tag=\"input\"/> |\n\n<<lingo TiddlySpot/Hint>>\n"
},
"$:/core/ui/ControlPanel/Saving/Gitea": {
"title": "$:/core/ui/ControlPanel/Saving/Gitea",
"tags": "$:/tags/ControlPanel/Saving",
"caption": "{{$:/language/ControlPanel/Saving/GitService/Gitea/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Saving/GitService/\n\\define service-name() ~Gitea\n\n<<lingo Description>>\n\n|<<lingo UserName>> |<$edit-text tiddler=\"$:/Gitea/Username\" default=\"\" tag=\"input\"/> |\n|<<lingo Gitea/Password>> |<$password name=\"Gitea\"/> |\n|<<lingo Repo>> |<$edit-text tiddler=\"$:/Gitea/Repo\" default=\"\" tag=\"input\"/> |\n|<<lingo Branch>> |<$edit-text tiddler=\"$:/Gitea/Branch\" default=\"master\" tag=\"input\"/> |\n|<<lingo Path>> |<$edit-text tiddler=\"$:/Gitea/Path\" default=\"\" tag=\"input\"/> |\n|<<lingo Filename>> |<$edit-text tiddler=\"$:/Gitea/Filename\" default=\"\" tag=\"input\"/> |\n|<<lingo ServerURL>> |<$edit-text tiddler=\"$:/Gitea/ServerURL\" default=\"https://gitea/api/v1\" tag=\"input\"/> |\n"
},
"$:/core/ui/ControlPanel/Saving": {
"title": "$:/core/ui/ControlPanel/Saving",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/Saving/Caption}}",
"text": "{{$:/language/ControlPanel/Saving/Hint}}\n\n<div class=\"tc-control-panel\">\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Saving]!has[draft.of]]\" default=\"$:/core/ui/ControlPanel/Saving/General\" explicitState=\"$:/state/tab-2065006209\"/>\n</div>\n"
},
"$:/core/buttonstyles/Borderless": {
"title": "$:/core/buttonstyles/Borderless",
"tags": "$:/tags/ToolbarButtonStyle",
"caption": "{{$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Borderless}}",
"text": "tc-btn-invisible"
},
"$:/core/buttonstyles/Boxed": {
"title": "$:/core/buttonstyles/Boxed",
"tags": "$:/tags/ToolbarButtonStyle",
"caption": "{{$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Boxed}}",
"text": "tc-btn-boxed"
},
"$:/core/buttonstyles/Rounded": {
"title": "$:/core/buttonstyles/Rounded",
"tags": "$:/tags/ToolbarButtonStyle",
"caption": "{{$:/language/ControlPanel/Settings/ToolbarButtonStyle/Styles/Rounded}}",
"text": "tc-btn-rounded"
},
"$:/core/ui/ControlPanel/Settings/CamelCase": {
"title": "$:/core/ui/ControlPanel/Settings/CamelCase",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/CamelCase/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/CamelCase/\n<<lingo Hint>>\n\n<$checkbox tiddler=\"$:/config/WikiParserRules/Inline/wikilink\" field=\"text\" checked=\"enable\" unchecked=\"disable\" default=\"enable\"> <$link to=\"$:/config/WikiParserRules/Inline/wikilink\"><<lingo Description>></$link> </$checkbox>\n"
},
"$:/core/ui/ControlPanel/Settings/DefaultMoreSidebarTab": {
"title": "$:/core/ui/ControlPanel/Settings/DefaultMoreSidebarTab",
"caption": "{{$:/language/ControlPanel/Settings/DefaultMoreSidebarTab/Caption}}",
"tags": "$:/tags/ControlPanel/Settings",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/DefaultMoreSidebarTab/\n\n<$link to=\"$:/config/DefaultMoreSidebarTab\"><<lingo Hint>></$link>\n\n<$select tiddler=\"$:/config/DefaultMoreSidebarTab\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/MoreSideBar]!has[draft.of]]\">\n<option value=<<currentTiddler>>><$transclude field=\"caption\"><$text text=<<currentTiddler>>/></$transclude></option>\n</$list>\n</$select>\n"
},
"$:/core/ui/ControlPanel/Settings/DefaultSidebarTab": {
"title": "$:/core/ui/ControlPanel/Settings/DefaultSidebarTab",
"caption": "{{$:/language/ControlPanel/Settings/DefaultSidebarTab/Caption}}",
"tags": "$:/tags/ControlPanel/Settings",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/DefaultSidebarTab/\n\n<$link to=\"$:/config/DefaultSidebarTab\"><<lingo Hint>></$link>\n\n<$select tiddler=\"$:/config/DefaultSidebarTab\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]\">\n<option value=<<currentTiddler>>><$transclude field=\"caption\"><$text text=<<currentTiddler>>/></$transclude></option>\n</$list>\n</$select>\n"
},
"$:/core/ui/ControlPanel/Settings/EditorToolbar": {
"title": "$:/core/ui/ControlPanel/Settings/EditorToolbar",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/EditorToolbar/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/EditorToolbar/\n<<lingo Hint>>\n\n<$checkbox tiddler=\"$:/config/TextEditor/EnableToolbar\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"yes\"> <$link to=\"$:/config/TextEditor/EnableToolbar\"><<lingo Description>></$link> </$checkbox>\n\n"
},
"$:/core/ui/ControlPanel/Settings/InfoPanelMode": {
"title": "$:/core/ui/ControlPanel/Settings/InfoPanelMode",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/InfoPanelMode/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/InfoPanelMode/\n<$link to=\"$:/config/TiddlerInfo/Mode\"><<lingo Hint>></$link>\n\n<$radio tiddler=\"$:/config/TiddlerInfo/Mode\" value=\"popup\"> <<lingo Popup/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/TiddlerInfo/Mode\" value=\"sticky\"> <<lingo Sticky/Description>> </$radio>\n"
},
"$:/core/ui/ControlPanel/Settings/LinkToBehaviour": {
"title": "$:/core/ui/ControlPanel/Settings/LinkToBehaviour",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/LinkToBehaviour/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/LinkToBehaviour/\n\n<$link to=\"$:/config/Navigation/openLinkFromInsideRiver\"><<lingo \"InsideRiver/Hint\">></$link>\n\n<$select tiddler=\"$:/config/Navigation/openLinkFromInsideRiver\">\n <option value=\"above\"><<lingo \"OpenAbove\">></option>\n <option value=\"below\"><<lingo \"OpenBelow\">></option>\n <option value=\"top\"><<lingo \"OpenAtTop\">></option>\n <option value=\"bottom\"><<lingo \"OpenAtBottom\">></option>\n</$select>\n\n<$link to=\"$:/config/Navigation/openLinkFromOutsideRiver\"><<lingo \"OutsideRiver/Hint\">></$link>\n\n<$select tiddler=\"$:/config/Navigation/openLinkFromOutsideRiver\">\n <option value=\"top\"><<lingo \"OpenAtTop\">></option>\n <option value=\"bottom\"><<lingo \"OpenAtBottom\">></option>\n</$select>\n"
},
"$:/core/ui/ControlPanel/Settings/MissingLinks": {
"title": "$:/core/ui/ControlPanel/Settings/MissingLinks",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/MissingLinks/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/MissingLinks/\n<<lingo Hint>>\n\n<$checkbox tiddler=\"$:/config/MissingLinks\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"yes\"> <$link to=\"$:/config/MissingLinks\"><<lingo Description>></$link> </$checkbox>\n\n"
},
"$:/core/ui/ControlPanel/Settings/NavigationAddressBar": {
"title": "$:/core/ui/ControlPanel/Settings/NavigationAddressBar",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/NavigationAddressBar/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/NavigationAddressBar/\n\n<$link to=\"$:/config/Navigation/UpdateAddressBar\"><<lingo Hint>></$link>\n\n<$radio tiddler=\"$:/config/Navigation/UpdateAddressBar\" value=\"permaview\"> <<lingo Permaview/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/Navigation/UpdateAddressBar\" value=\"permalink\"> <<lingo Permalink/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/Navigation/UpdateAddressBar\" value=\"no\"> <<lingo No/Description>> </$radio>\n"
},
"$:/core/ui/ControlPanel/Settings/NavigationHistory": {
"title": "$:/core/ui/ControlPanel/Settings/NavigationHistory",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/NavigationHistory/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/NavigationHistory/\n<$link to=\"$:/config/Navigation/UpdateHistory\"><<lingo Hint>></$link>\n\n<$radio tiddler=\"$:/config/Navigation/UpdateHistory\" value=\"yes\"> <<lingo Yes/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/Navigation/UpdateHistory\" value=\"no\"> <<lingo No/Description>> </$radio>\n"
},
"$:/core/ui/ControlPanel/Settings/NavigationPermalinkviewMode": {
"title": "$:/core/ui/ControlPanel/Settings/NavigationPermalinkviewMode",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/NavigationPermalinkviewMode/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/NavigationPermalinkviewMode/\n<<lingo Hint>>\n\n<$checkbox tiddler=\"$:/config/Navigation/Permalinkview/CopyToClipboard\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"yes\"> <$link to=\"$:/config/Navigation/Permalinkview/CopyToClipboard\"><<lingo CopyToClipboard/Description>></$link> </$checkbox>\n\n<$checkbox tiddler=\"$:/config/Navigation/Permalinkview/UpdateAddressBar\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"yes\"> <$link to=\"$:/config/Navigation/Permalinkview/UpdateAddressBar\"><<lingo UpdateAddressBar/Description>></$link> </$checkbox>\n"
},
"$:/core/ui/ControlPanel/Settings/PerformanceInstrumentation": {
"title": "$:/core/ui/ControlPanel/Settings/PerformanceInstrumentation",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/PerformanceInstrumentation/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/PerformanceInstrumentation/\n<<lingo Hint>>\n\n<$checkbox tiddler=\"$:/config/Performance/Instrumentation\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"no\"> <$link to=\"$:/config/Performance/Instrumentation\"><<lingo Description>></$link> </$checkbox>\n"
},
"$:/core/ui/ControlPanel/Settings/TitleLinks": {
"title": "$:/core/ui/ControlPanel/Settings/TitleLinks",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/TitleLinks/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/TitleLinks/\n<$link to=\"$:/config/Tiddlers/TitleLinks\"><<lingo Hint>></$link>\n\n<$radio tiddler=\"$:/config/Tiddlers/TitleLinks\" value=\"yes\"> <<lingo Yes/Description>> </$radio>\n\n<$radio tiddler=\"$:/config/Tiddlers/TitleLinks\" value=\"no\"> <<lingo No/Description>> </$radio>\n"
},
"$:/core/ui/ControlPanel/Settings/ToolbarButtonStyle": {
"title": "$:/core/ui/ControlPanel/Settings/ToolbarButtonStyle",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/ToolbarButtonStyle/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/ToolbarButtonStyle/\n<$link to=\"$:/config/Toolbar/ButtonClass\"><<lingo \"Hint\">></$link>\n\n<$select tiddler=\"$:/config/Toolbar/ButtonClass\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ToolbarButtonStyle]]\">\n<option value={{!!text}}>{{!!caption}}</option>\n</$list>\n</$select>\n"
},
"$:/core/ui/ControlPanel/Settings/ToolbarButtons": {
"title": "$:/core/ui/ControlPanel/Settings/ToolbarButtons",
"tags": "$:/tags/ControlPanel/Settings",
"caption": "{{$:/language/ControlPanel/Settings/ToolbarButtons/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/ToolbarButtons/\n<<lingo Hint>>\n\n<$checkbox tiddler=\"$:/config/Toolbar/Icons\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"yes\"> <$link to=\"$:/config/Toolbar/Icons\"><<lingo Icons/Description>></$link> </$checkbox>\n\n<$checkbox tiddler=\"$:/config/Toolbar/Text\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"no\"> <$link to=\"$:/config/Toolbar/Text\"><<lingo Text/Description>></$link> </$checkbox>\n"
},
"$:/core/ui/ControlPanel/Settings": {
"title": "$:/core/ui/ControlPanel/Settings",
"tags": "$:/tags/ControlPanel",
"caption": "{{$:/language/ControlPanel/Settings/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/Settings/\n\n<<lingo Hint>>\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Settings]]\">\n\n<div style=\"border-top:1px solid #eee;\">\n\n!! <$link><$transclude field=\"caption\"/></$link>\n\n<$transclude/>\n\n</div>\n\n</$list>\n"
},
"$:/core/ui/ControlPanel/StoryView": {
"title": "$:/core/ui/ControlPanel/StoryView",
"tags": "$:/tags/ControlPanel/Appearance",
"caption": "{{$:/language/ControlPanel/StoryView/Caption}}",
"text": "{{$:/snippets/viewswitcher}}\n"
},
"$:/core/ui/ControlPanel/Stylesheets": {
"title": "$:/core/ui/ControlPanel/Stylesheets",
"tags": "$:/tags/ControlPanel/Advanced",
"caption": "{{$:/language/ControlPanel/Stylesheets/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/\n\n<<lingo Stylesheets/Hint>>\n\n{{$:/snippets/peek-stylesheets}}\n"
},
"$:/core/ui/ControlPanel/Theme": {
"title": "$:/core/ui/ControlPanel/Theme",
"tags": "$:/tags/ControlPanel/Appearance",
"caption": "{{$:/language/ControlPanel/Theme/Caption}}",
"text": "{{$:/snippets/themeswitcher}}\n"
},
"$:/core/ui/ControlPanel/TiddlerFields": {
"title": "$:/core/ui/ControlPanel/TiddlerFields",
"tags": "$:/tags/ControlPanel/Advanced",
"caption": "{{$:/language/ControlPanel/TiddlerFields/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/\n\n<<lingo TiddlerFields/Hint>>\n\n{{$:/snippets/allfields}}"
},
"$:/core/ui/ControlPanel/Toolbars/EditToolbar": {
"title": "$:/core/ui/ControlPanel/Toolbars/EditToolbar",
"tags": "$:/tags/ControlPanel/Toolbars",
"caption": "{{$:/language/ControlPanel/Toolbars/EditToolbar/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n\n\\define config-base() $:/config/EditToolbarButtons/Visibility/\n\n{{$:/language/ControlPanel/Toolbars/EditToolbar/Hint}}\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$macrocall $name=\"list-tagged-draggable\" tag=\"$:/tags/EditToolbar\" itemTemplate=\"$:/core/ui/ControlPanel/Toolbars/ItemTemplate\"/>\n\n</$set>\n\n</$set>"
},
"$:/core/ui/ControlPanel/Toolbars/EditorItemTemplate": {
"title": "$:/core/ui/ControlPanel/Toolbars/EditorItemTemplate",
"text": "\\define config-title()\n$(config-base)$$(currentTiddler)$\n\\end\n\n<$draggable tiddler=<<currentTiddler>>>\n<$checkbox tiddler=<<config-title>> field=\"text\" checked=\"show\" unchecked=\"hide\" default=\"show\"/> <span class=\"tc-icon-wrapper\"><$transclude tiddler={{!!icon}}/></span> <$transclude field=\"caption\"/> -- <i class=\"tc-muted\"><$transclude field=\"description\"/></i>\n</$draggable>\n"
},
"$:/core/ui/ControlPanel/Toolbars/EditorToolbar": {
"title": "$:/core/ui/ControlPanel/Toolbars/EditorToolbar",
"tags": "$:/tags/ControlPanel/Toolbars",
"caption": "{{$:/language/ControlPanel/Toolbars/EditorToolbar/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n\n\\define config-base() $:/config/EditorToolbarButtons/Visibility/\n\n{{$:/language/ControlPanel/Toolbars/EditorToolbar/Hint}}\n\n<$macrocall $name=\"list-tagged-draggable\" tag=\"$:/tags/EditorToolbar\" itemTemplate=\"$:/core/ui/ControlPanel/Toolbars/EditorItemTemplate\"/>\n"
},
"$:/core/ui/ControlPanel/Toolbars/ItemTemplate": {
"title": "$:/core/ui/ControlPanel/Toolbars/ItemTemplate",
"text": "\\define config-title()\n$(config-base)$$(currentTiddler)$\n\\end\n\n<$draggable tiddler=<<currentTiddler>>>\n<$checkbox tiddler=<<config-title>> field=\"text\" checked=\"show\" unchecked=\"hide\" default=\"show\"/> <span class=\"tc-icon-wrapper\"> <$transclude field=\"caption\"/> <i class=\"tc-muted\">-- <$transclude field=\"description\"/></i></span>\n</$draggable>\n"
},
"$:/core/ui/ControlPanel/Toolbars/PageControls": {
"title": "$:/core/ui/ControlPanel/Toolbars/PageControls",
"tags": "$:/tags/ControlPanel/Toolbars",
"caption": "{{$:/language/ControlPanel/Toolbars/PageControls/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n\n\\define config-base() $:/config/PageControlButtons/Visibility/\n\n{{$:/language/ControlPanel/Toolbars/PageControls/Hint}}\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$macrocall $name=\"list-tagged-draggable\" tag=\"$:/tags/PageControls\" itemTemplate=\"$:/core/ui/ControlPanel/Toolbars/ItemTemplate\"/>\n\n</$set>\n\n</$set>\n"
},
"$:/core/ui/ControlPanel/Toolbars/ViewToolbar": {
"title": "$:/core/ui/ControlPanel/Toolbars/ViewToolbar",
"tags": "$:/tags/ControlPanel/Toolbars",
"caption": "{{$:/language/ControlPanel/Toolbars/ViewToolbar/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n\n\\define config-base() $:/config/ViewToolbarButtons/Visibility/\n\n{{$:/language/ControlPanel/Toolbars/ViewToolbar/Hint}}\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$macrocall $name=\"list-tagged-draggable\" tag=\"$:/tags/ViewToolbar\" itemTemplate=\"$:/core/ui/ControlPanel/Toolbars/ItemTemplate\"/>\n\n</$set>\n\n</$set>\n"
},
"$:/core/ui/ControlPanel/Toolbars": {
"title": "$:/core/ui/ControlPanel/Toolbars",
"tags": "$:/tags/ControlPanel/Appearance",
"caption": "{{$:/language/ControlPanel/Toolbars/Caption}}",
"text": "{{$:/language/ControlPanel/Toolbars/Hint}}\n\n<div class=\"tc-control-panel\">\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Toolbars]!has[draft.of]]\" default=\"$:/core/ui/ControlPanel/Toolbars/ViewToolbar\" class=\"tc-vertical\" explicitState=\"$:/state/tabs/controlpanel/toolbars-1345989671\"/>\n</div>\n"
},
"$:/ControlPanel": {
"title": "$:/ControlPanel",
"icon": "$:/core/images/options-button",
"color": "#bbb",
"text": "<div class=\"tc-control-panel\">\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/ControlPanel]!has[draft.of]]\" default=\"$:/core/ui/ControlPanel/Info\" explicitState=\"$:/state/tab-1749438307\"/>\n</div>\n"
},
"$:/core/ui/DefaultSearchResultList": {
"title": "$:/core/ui/DefaultSearchResultList",
"tags": "$:/tags/SearchResults",
"caption": "{{$:/language/Search/DefaultResults/Caption}}",
"first-search-filter": "[!is[system]search:title<userInput>sort[title]limit[250]]",
"second-search-filter": "[!is[system]search<userInput>sort[title]limit[250]]",
"text": "\\define searchResultList()\n//<small>{{$:/language/Search/Matches/Title}}</small>//\n\n<$list filter=\"[<userInput>minlength[1]]\" variable=\"ignore\">\n<$list filter={{{ [<configTiddler>get[first-search-filter]] }}}>\n<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[<searchListState>get[text]] +[then[]else[tc-list-item-selected]] }}}>\n<$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n</span>\n</$list>\n</$list>\n\n//<small>{{$:/language/Search/Matches/All}}</small>//\n\n<$list filter=\"[<userInput>minlength[1]]\" variable=\"ignore\">\n<$list filter={{{ [<configTiddler>get[second-search-filter]] }}}>\n<span class={{{[<currentTiddler>addsuffix[-secondaryList]] -[<searchListState>get[text]] +[then[]else[tc-list-item-selected]] }}}>\n<$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n</span>\n</$list>\n</$list>\n\n\\end\n<<searchResultList>>\n"
},
"$:/core/ui/EditTemplate/body/preview/diffs-current": {
"title": "$:/core/ui/EditTemplate/body/preview/diffs-current",
"tags": "$:/tags/EditPreview",
"caption": "{{$:/language/EditTemplate/Body/Preview/Type/DiffCurrent}}",
"list-after": "$:/core/ui/EditTemplate/body/preview/output",
"text": "<$list filter=\"[<currentTiddler>!is[image]]\" emptyMessage={{$:/core/ui/EditTemplate/body/preview/output}}>\n\n<$macrocall $name=\"compareTiddlerText\" sourceTiddlerTitle={{!!draft.of}} destTiddlerTitle=<<currentTiddler>>/>\n\n</$list>\n\n"
},
"$:/core/ui/EditTemplate/body/preview/diffs-shadow": {
"title": "$:/core/ui/EditTemplate/body/preview/diffs-shadow",
"tags": "$:/tags/EditPreview",
"caption": "{{$:/language/EditTemplate/Body/Preview/Type/DiffShadow}}",
"list-after": "$:/core/ui/EditTemplate/body/preview/output",
"text": "<$list filter=\"[<currentTiddler>!is[image]]\" emptyMessage={{$:/core/ui/EditTemplate/body/preview/output}}>\n\n<$macrocall $name=\"compareTiddlerText\" sourceTiddlerTitle={{{ [{!!draft.of}shadowsource[]] }}} sourceSubTiddlerTitle={{!!draft.of}} destTiddlerTitle=<<currentTiddler>>/>\n\n</$list>\n\n"
},
"$:/core/ui/EditTemplate/body/preview/output": {
"title": "$:/core/ui/EditTemplate/body/preview/output",
"tags": "$:/tags/EditPreview",
"caption": "{{$:/language/EditTemplate/Body/Preview/Type/Output}}",
"text": "\\import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!has[draft.of]]\n<$set name=\"tv-tiddler-preview\" value=\"yes\">\n\n<$transclude />\n\n</$set>\n"
},
"$:/state/showeditpreview": {
"title": "$:/state/showeditpreview",
"text": "no"
},
"$:/core/ui/EditTemplate/body/editor": {
"title": "$:/core/ui/EditTemplate/body/editor",
"text": "<$edit\n\n field=\"text\"\n class=\"tc-edit-texteditor tc-edit-texteditor-body\"\n placeholder={{$:/language/EditTemplate/Body/Placeholder}}\n tabindex={{$:/config/EditTabIndex}}\n focus={{{ [{$:/config/AutoFocus}match[text]then[true]] ~[[false]] }}}\n cancelPopups=\"yes\"\n fileDrop={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}}\n\n><$set\n\n name=\"targetTiddler\"\n value=<<currentTiddler>>\n\n><$list\n\n filter=\"[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]]\"\n\n><$reveal\n\n type=\"nomatch\"\n state=<<config-visibility-title>>\n text=\"hide\"\n class=\"tc-text-editor-toolbar-item-wrapper\"\n\n><$transclude\n\n tiddler=\"$:/core/ui/EditTemplate/body/toolbar/button\"\n mode=\"inline\"\n\n/></$reveal></$list><$list\n\n filter=\"[all[shadows+tiddlers]tag[$:/tags/EditorTools]!has[draft.of]]\"\n\n><$list\n\tfilter={{!!condition}}\n\tvariable=\"list-condition\"\n><$transclude/>\n</$list></$list></$set></$edit>\n"
},
"$:/core/ui/EditTemplate/body/toolbar/button": {
"title": "$:/core/ui/EditTemplate/body/toolbar/button",
"text": "\\define toolbar-button-icon()\n<$list\n\n filter=\"[all[current]!has[custom-icon]]\"\n variable=\"no-custom-icon\"\n\n><$transclude\n\n tiddler={{!!icon}}\n\n/></$list>\n\\end\n\n\\define toolbar-button-tooltip()\n{{!!description}}<$macrocall $name=\"displayshortcuts\" $output=\"text/plain\" shortcuts={{!!shortcuts}} prefix=\"` - [\" separator=\"] [\" suffix=\"]`\"/>\n\\end\n\n\\define toolbar-button()\n<$list\n\n filter={{!!condition}}\n variable=\"list-condition\"\n\n><$wikify\n\n name=\"tooltip-text\"\n text=<<toolbar-button-tooltip>>\n mode=\"inline\"\n output=\"text\"\n\n><$list\n\n filter=\"[all[current]!has[dropdown]]\"\n variable=\"no-dropdown\"\n\n><$set name=disabled filter={{!!condition-disabled}}><$button\n\n class=\"tc-btn-invisible $(buttonClasses)$\"\n tooltip=<<tooltip-text>>\n actions={{!!actions}}\n disabled=<<disabled>>\n\n><span\n\n data-tw-keyboard-shortcut={{{ [<disabled>match[yes]then[]else{!!shortcuts}] }}}\n\n/><<toolbar-button-icon>><$transclude\n\n tiddler=<<currentTiddler>>\n field=\"text\"\n\n/></$button></$set></$list><$list\n\n filter=\"[all[current]has[dropdown]]\"\n variable=\"dropdown\"\n\n><$set\n\n name=\"dropdown-state\"\n value=<<qualify \"$:/state/EditorToolbarDropdown\">>\n\n><$set name=disabled filter={{!!condition-disabled}}><$button\n\n popup=<<dropdown-state>>\n class=\"tc-popup-keep tc-btn-invisible $(buttonClasses)$\"\n selectedClass=\"tc-selected\"\n tooltip=<<tooltip-text>>\n actions={{!!actions}}\n disabled=<<disabled>>\n\n><span\n\n data-tw-keyboard-shortcut={{{ [<disabled>match[yes]then[]else{!!shortcuts}] }}}\n\n/><<toolbar-button-icon>><$transclude\n\n tiddler=<<currentTiddler>>\n field=\"text\"\n\n/></$button></$set><$reveal\n\n state=<<dropdown-state>>\n type=\"popup\"\n position=\"below\"\n animate=\"yes\"\n tag=\"span\"\n\n><div\n\n class=\"tc-drop-down tc-popup-keep\"\n\n><$transclude\n\n tiddler={{!!dropdown}}\n mode=\"block\"\n\n/></div></$reveal></$set></$list></$wikify></$list>\n\\end\n\n\\define toolbar-button-outer()\n<$set\n\n name=\"buttonClasses\"\n value={{!!button-classes}}\n\n><<toolbar-button>></$set>\n\\end\n\n<<toolbar-button-outer>>"
},
"$:/core/ui/EditTemplate/body": {
"title": "$:/core/ui/EditTemplate/body",
"tags": "$:/tags/EditTemplate",
"text": "\\define lingo-base() $:/language/EditTemplate/Body/\n\\define config-visibility-title()\n$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$\n\\end\n\n\\define importFileActions()\n<$action-popup $state=<<importState>> $coords=\"(0,0,0,0)\" $floating=\"yes\"/>\n\\end\n\n<$list filter=\"[all[current]has[_canonical_uri]]\">\n\n<div class=\"tc-message-box\">\n\n<<lingo External/Hint>>\n\n<a href={{!!_canonical_uri}}><$text text={{!!_canonical_uri}}/></a>\n\n<$edit-text field=\"_canonical_uri\" class=\"tc-edit-fields\" tabindex={{$:/config/EditTabIndex}} cancelPopups=\"yes\"></$edit-text>\n\n</div>\n\n</$list>\n\n<$list filter=\"[all[current]!has[_canonical_uri]]\">\n<$vars importTitle=<<qualify $:/ImportImage>> importState=<<qualify $:/state/ImportImage>> >\n<$dropzone importTitle=<<importTitle>> autoOpenOnImport=\"no\" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class=\"tc-dropzone-editor\" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly=\"yes\" actions=<<importFileActions>> ><$reveal state=\"$:/state/showeditpreview\" type=\"match\" text=\"yes\">\n<div class=\"tc-tiddler-preview\">\n\n<$transclude tiddler=\"$:/core/ui/EditTemplate/body/editor\" mode=\"inline\"/>\n\n<div class=\"tc-tiddler-preview-preview\">\n\n<$transclude tiddler={{$:/state/editpreviewtype}} mode=\"inline\">\n\n<$transclude tiddler=\"$:/core/ui/EditTemplate/body/preview/output\" mode=\"inline\"/>\n\n</$transclude>\n\n</div>\n\n</div>\n</$reveal>\n\n<$reveal state=\"$:/state/showeditpreview\" type=\"nomatch\" text=\"yes\">\n\n<$transclude tiddler=\"$:/core/ui/EditTemplate/body/editor\" mode=\"inline\"/>\n\n</$reveal>\n</$dropzone>\n</$vars>\n</$list>"
},
"$:/core/ui/EditTemplate/controls": {
"title": "$:/core/ui/EditTemplate/controls",
"tags": "$:/tags/EditTemplate",
"text": "\\define config-title()\n$:/config/EditToolbarButtons/Visibility/$(listItem)$\n\\end\n<div class=\"tc-tiddler-title tc-tiddler-edit-title\">\n<$view field=\"title\"/>\n<span class=\"tc-tiddler-controls tc-titlebar\"><$list filter=\"[all[shadows+tiddlers]tag[$:/tags/EditToolbar]!has[draft.of]]\" variable=\"listItem\"><$reveal type=\"nomatch\" state=<<config-title>> text=\"hide\"><$transclude tiddler=<<listItem>>/></$reveal></$list></span>\n<div style=\"clear: both;\"></div>\n</div>\n"
},
"$:/core/ui/EditTemplate/fields": {
"title": "$:/core/ui/EditTemplate/fields",
"tags": "$:/tags/EditTemplate",
"text": "\\define lingo-base() $:/language/EditTemplate/\n\\define config-title()\n$:/config/EditTemplateFields/Visibility/$(currentField)$\n\\end\n\n\\define config-filter()\n[[hide]] -[title{$(config-title)$}]\n\\end\n\n\\define current-tiddler-new-field-selector()\n[data-tiddler-title=\"$(currentTiddlerCSSescaped)$\"] .tc-edit-field-add-name-wrapper input\n\\end\n\n\\define new-field-actions()\n<$action-sendmessage $message=\"tm-add-field\" $name={{{ [<newFieldNameTiddler>get[text]] }}} $value={{{ [<newFieldValueTiddler>get[text]] }}}/>\n<$action-deletetiddler $filter=\"[<newFieldNameTiddler>] [<newFieldValueTiddler>] [<storeTitle>] [<searchListState>]\"/>\n<$action-sendmessage $message=\"tm-focus-selector\" $param=<<current-tiddler-new-field-selector>>/>\n\\end\n\n\\define delete-state-tiddlers() <$action-deletetiddler $filter=\"[<newFieldNameTiddler>] [<storeTitle>] [<searchListState>]\"/>\n\n\\define cancel-search-actions-inner()\n<$list filter=\"[<storeTitle>has[text]] [<newFieldNameTiddler>has[text]]\" variable=\"ignore\" emptyMessage=\"\"\"<<cancel-delete-tiddler-actions \"cancel\">>\"\"\">\n<<delete-state-tiddlers>>\n</$list>\n\\end\n\n\\define cancel-search-actions()\n<$set name=\"userInput\" value={{{ [<storeTitle>get[text]] }}}>\n<$list filter=\"[<newFieldNameTiddler>get[text]!match<userInput>]\" emptyMessage=\"\"\"<<cancel-search-actions-inner>>\"\"\">\n<$action-setfield $tiddler=<<newFieldNameTiddler>> text=<<userInput>>/><$action-setfield $tiddler=<<refreshTitle>> text=\"yes\"/>\n</$list>\n</$set>\n\\end\n\n\\define new-field()\n<$vars name={{{ [<newFieldNameTiddler>get[text]] }}}>\n<$reveal type=\"nomatch\" text=\"\" default=<<name>>>\n<$button tooltip=<<lingo Fields/Add/Button/Hint>>>\n<$action-sendmessage $message=\"tm-add-field\"\n$name=<<name>>\n$value={{{ [<newFieldValueTiddler>get[text]] }}}/>\n<$action-deletetiddler $filter=\"[<newFieldNameTiddler>] [<newFieldValueTiddler>] [<storeTitle>] [<searchListState>]\"/>\n<<lingo Fields/Add/Button>>\n</$button>\n</$reveal>\n<$reveal type=\"match\" text=\"\" default=<<name>>>\n<$button>\n<<lingo Fields/Add/Button>>\n</$button>\n</$reveal>\n</$vars>\n\\end\n\\whitespace trim\n\n<div class=\"tc-edit-fields\">\n<table class={{{ [all[current]fields[]] :filter[lookup[$:/config/EditTemplateFields/Visibility/]!match[hide]] +[count[]!match[0]] +[then[tc-edit-fields]] ~[[tc-edit-fields tc-edit-fields-small]] }}}>\n<tbody>\n<$list filter=\"[all[current]fields[]] +[sort[title]]\" variable=\"currentField\" storyview=\"pop\">\n<$list filter=<<config-filter>> variable=\"temp\">\n<tr class=\"tc-edit-field\">\n<td class=\"tc-edit-field-name\">\n<$text text=<<currentField>>/>:</td>\n<td class=\"tc-edit-field-value\">\n<$keyboard key=\"((delete-field))\" actions=\"\"\"<$action-deletefield $field=<<currentField>>/><$set name=\"currentTiddlerCSSescaped\" value={{{ [<currentTiddler>escapecss[]] }}}><$action-sendmessage $message=\"tm-focus-selector\" $param=<<current-tiddler-new-field-selector>>/></$set>\"\"\">\n<$edit-text tiddler=<<currentTiddler>> field=<<currentField>> placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}} tabindex={{$:/config/EditTabIndex}} cancelPopups=\"yes\"/>\n</$keyboard>\n</td>\n<td class=\"tc-edit-field-remove\">\n<$button class=\"tc-btn-invisible\" tooltip={{$:/language/EditTemplate/Field/Remove/Hint}} aria-label={{$:/language/EditTemplate/Field/Remove/Caption}}>\n<$action-deletefield $field=<<currentField>>/><$set name=\"currentTiddlerCSSescaped\" value={{{ [<currentTiddler>escapecss[]] }}}><$action-sendmessage $message=\"tm-focus-selector\" $param=<<current-tiddler-new-field-selector>>/></$set>\n{{$:/core/images/delete-button}}\n</$button>\n</td>\n</tr>\n</$list>\n</$list>\n</tbody>\n</table>\n</div>\n\n<$fieldmangler>\n<div class=\"tc-edit-field-add\">\n<em class=\"tc-edit tc-small-gap-right\">\n<<lingo Fields/Add/Prompt>>\n</em>\n<$vars refreshTitle=<<qualify \"$:/temp/fieldname/refresh\">> storeTitle=<<newFieldNameInputTiddler>> searchListState=<<newFieldNameSelectionTiddler>>>\n<div class=\"tc-edit-field-add-name-wrapper\">\n<$macrocall $name=\"keyboard-driven-input\" tiddler=<<newFieldNameTiddler>> storeTitle=<<storeTitle>> refreshTitle=<<refreshTitle>>\n\t\tselectionStateTitle=<<searchListState>> tag=\"input\" default=\"\" placeholder={{$:/language/EditTemplate/Fields/Add/Name/Placeholder}}\n\t\tfocusPopup=<<qualify \"$:/state/popup/field-dropdown\">> class=\"tc-edit-texteditor tc-popup-handle\" tabindex={{$:/config/EditTabIndex}}\n\t\tfocus={{{ [{$:/config/AutoFocus}match[fields]then[true]] ~[[false]] }}} cancelPopups=\"yes\"\n\t\tconfigTiddlerFilter=\"[[$:/config/EditMode/fieldname-filter]]\" inputCancelActions=<<cancel-search-actions>> />\n<$button popup=<<qualify \"$:/state/popup/field-dropdown\">> class=\"tc-btn-invisible tc-btn-dropdown tc-small-gap\" tooltip={{$:/language/EditTemplate/Field/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Field/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button>\n<$reveal state=<<qualify \"$:/state/popup/field-dropdown\">> type=\"nomatch\" text=\"\" default=\"\">\n<div class=\"tc-block-dropdown tc-edit-type-dropdown\">\n<$set name=\"tv-show-missing-links\" value=\"yes\">\n<$linkcatcher to=<<newFieldNameTiddler>>>\n<div class=\"tc-dropdown-item\">\n<<lingo Fields/Add/Dropdown/User>>\n</div>\n<$set name=\"newFieldName\" value={{{ [<storeTitle>get[text]] }}}>\n<$list filter=\"[!is[shadow]!is[system]fields[]search:title<newFieldName>sort[]] -created -creator -draft.of -draft.title -modified -modifier -tags -text -title -type\" variable=\"currentField\">\n<$list filter=\"[<currentField>addsuffix[-primaryList]] -[<searchListState>get[text]]\" emptyMessage=\"\"\"<$link to=<<currentField>> class=\"tc-list-item-selected\"><$text text=<<currentField>>/></$link>\"\"\">\n<$link to=<<currentField>>>\n<$text text=<<currentField>>/>\n</$link>\n</$list>\n</$list>\n<div class=\"tc-dropdown-item\">\n<<lingo Fields/Add/Dropdown/System>>\n</div>\n<$list filter=\"[fields[]search:title<newFieldName>sort[]] -[!is[shadow]!is[system]fields[]]\" variable=\"currentField\">\n<$list filter=\"[<currentField>addsuffix[-secondaryList]] -[<searchListState>get[text]]\" emptyMessage=\"\"\"<$link to=<<currentField>> class=\"tc-list-item-selected\"><$text text=<<currentField>>/></$link>\"\"\">\n<$link to=<<currentField>>>\n<$text text=<<currentField>>/>\n</$link>\n</$list>\n</$list>\n</$set>\n</$linkcatcher>\n</$set>\n</div>\n</$reveal>\n</div>\n<span class=\"tc-edit-field-add-value tc-small-gap-right\">\n<$set name=\"currentTiddlerCSSescaped\" value={{{ [<currentTiddler>escapecss[]] }}}>\n<$keyboard key=\"((add-field))\" actions=<<new-field-actions>>>\n<$edit-text tiddler=<<newFieldValueTiddler>> tag=\"input\" default=\"\" placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}} class=\"tc-edit-texteditor\" tabindex={{$:/config/EditTabIndex}} cancelPopups=\"yes\"/>\n</$keyboard>\n</$set>\n</span>\n<span class=\"tc-edit-field-add-button\">\n<$macrocall $name=\"new-field\"/>\n</span>\n</$vars>\n</div>\n</$fieldmangler>\n"
},
"$:/core/ui/EditTemplate/shadow": {
"title": "$:/core/ui/EditTemplate/shadow",
"tags": "$:/tags/EditTemplate",
"text": "\\define lingo-base() $:/language/EditTemplate/Shadow/\n\\define pluginLinkBody()\n<$link to=\"\"\"$(pluginTitle)$\"\"\">\n<$text text=\"\"\"$(pluginTitle)$\"\"\"/>\n</$link>\n\\end\n<$list filter=\"[all[current]get[draft.of]is[shadow]!is[tiddler]]\">\n\n<$list filter=\"[all[current]shadowsource[]]\" variable=\"pluginTitle\">\n\n<$set name=\"pluginLink\" value=<<pluginLinkBody>>>\n<div class=\"tc-message-box\">\n\n<<lingo Warning>>\n\n</div>\n</$set>\n</$list>\n\n</$list>\n\n<$list filter=\"[all[current]get[draft.of]is[shadow]is[tiddler]]\">\n\n<$list filter=\"[all[current]shadowsource[]]\" variable=\"pluginTitle\">\n\n<$set name=\"pluginLink\" value=<<pluginLinkBody>>>\n<div class=\"tc-message-box\">\n\n<<lingo OverriddenWarning>>\n\n</div>\n</$set>\n</$list>\n\n</$list>"
},
"$:/core/ui/EditTemplate/tags": {
"title": "$:/core/ui/EditTemplate/tags",
"tags": "$:/tags/EditTemplate",
"text": "\\whitespace trim\n\n\\define lingo-base() $:/language/EditTemplate/\n\n\\define tag-styles()\nbackground-color:$(backgroundColor)$;\nfill:$(foregroundColor)$;\ncolor:$(foregroundColor)$;\n\\end\n\n\\define tag-body-inner(colour,fallbackTarget,colourA,colourB,icon,tagField:\"tags\")\n\\whitespace trim\n<$vars foregroundColor=<<contrastcolour target:\"\"\"$colour$\"\"\" fallbackTarget:\"\"\"$fallbackTarget$\"\"\" colourA:\"\"\"$colourA$\"\"\" colourB:\"\"\"$colourB$\"\"\">> backgroundColor=\"\"\"$colour$\"\"\">\n<span style=<<tag-styles>> class=\"tc-tag-label tc-tag-list-item tc-small-gap-right\">\n<$transclude tiddler=\"\"\"$icon$\"\"\"/><$view field=\"title\" format=\"text\" />\n<$button class=\"tc-btn-invisible tc-remove-tag-button\" style=<<tag-styles>>><$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter=\"-[{!!title}]\"/>{{$:/core/images/close-button}}</$button>\n</span>\n</$vars>\n\\end\n\n\\define tag-body(colour,palette,icon,tagField:\"tags\")\n<$macrocall $name=\"tag-body-inner\" colour=\"\"\"$colour$\"\"\" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}} icon=\"\"\"$icon$\"\"\" tagField=<<__tagField__>>/>\n\\end\n\n\\define edit-tags-template(tagField:\"tags\")\n\\whitespace trim\n<div class=\"tc-edit-tags\">\n<$list filter=\"[list[!!$tagField$]sort[title]]\" storyview=\"pop\">\n<$macrocall $name=\"tag-body\" colour={{!!color}} palette={{$:/palette}} icon={{!!icon}} tagField=<<__tagField__>>/>\n</$list>\n<$vars tabIndex={{$:/config/EditTabIndex}} cancelPopups=\"yes\">\n<$macrocall $name=\"tag-picker\" tagField=<<__tagField__>>/>\n</$vars>\n</div>\n\\end\n<$set name=\"saveTiddler\" value=<<currentTiddler>>>\n<$macrocall $name=\"edit-tags-template\" tagField=<<tagField>>/>\n</$set>\n"
},
"$:/core/ui/EditTemplate/title": {
"title": "$:/core/ui/EditTemplate/title",
"tags": "$:/tags/EditTemplate",
"text": "<$edit-text field=\"draft.title\" class=\"tc-titlebar tc-edit-texteditor\" focus={{{ [{$:/config/AutoFocus}match[title]then[true]] ~[[false]] }}} tabindex={{$:/config/EditTabIndex}} cancelPopups=\"yes\"/>\n\n<$vars pattern=\"\"\"[\\|\\[\\]{}]\"\"\" bad-chars=\"\"\"`| [ ] { }`\"\"\">\n\n<$list filter=\"[all[current]regexp:draft.title<pattern>]\" variable=\"listItem\">\n\n<div class=\"tc-message-box\">\n\n{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/BadCharacterWarning}}\n\n</div>\n\n</$list>\n\n</$vars>\n\n<$reveal state=\"!!draft.title\" type=\"nomatch\" text={{!!draft.of}} tag=\"div\">\n\n<$list filter=\"[{!!draft.title}!is[missing]]\" variable=\"listItem\">\n\n<div class=\"tc-message-box\">\n\n{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/Exists/Prompt}}: <$link to={{!!draft.title}} />\n\n</div>\n\n</$list>\n\n<$list filter=\"[{!!draft.of}!is[missing]]\" variable=\"listItem\">\n\n<$vars fromTitle={{!!draft.of}} toTitle={{!!draft.title}}>\n\n<$checkbox tiddler=\"$:/config/RelinkOnRename\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"no\"> {{$:/language/EditTemplate/Title/Relink/Prompt}}</$checkbox>\n\n<$list filter=\"[title<fromTitle>backlinks[]limit[1]]\" variable=\"listItem\">\n\n<$vars stateTiddler=<<qualify \"$:/state/edit/references\">> >\n\n<$reveal type=\"nomatch\" state=<<stateTiddler>> text=\"show\">\n<$button set=<<stateTiddler>> setTo=\"show\" class=\"tc-btn-invisible\">{{$:/core/images/right-arrow}} \n<<lingo EditTemplate/Title/References/Prompt>></$button>\n</$reveal>\n<$reveal type=\"match\" state=<<stateTiddler>> text=\"show\">\n<$button set=<<stateTiddler>> setTo=\"hide\" class=\"tc-btn-invisible\">{{$:/core/images/down-arrow}} \n<<lingo EditTemplate/Title/References/Prompt>></$button>\n</$reveal>\n\n<$reveal type=\"match\" state=<<stateTiddler>> text=\"show\">\n<$tiddler tiddler=<<fromTitle>> >\n<$transclude tiddler=\"$:/core/ui/TiddlerInfo/References\"/>\n</$tiddler>\n</$reveal>\n\n</$vars>\n\n</$list>\n\n</$vars>\n\n</$list>\n\n</$reveal>\n"
},
"$:/core/ui/EditTemplate/type": {
"title": "$:/core/ui/EditTemplate/type",
"tags": "$:/tags/EditTemplate",
"first-search-filter": "[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]sort[description]sort[group-sort]removeprefix[$:/language/Docs/Types/]search<userInput>]",
"text": "\\define lingo-base() $:/language/EditTemplate/\n\\define input-cancel-actions() <$list filter=\"[<storeTitle>get[text]] [<currentTiddler>get[type]] +[limit[1]]\" emptyMessage=\"\"\"<<cancel-delete-tiddler-actions \"cancel\">>\"\"\"><$action-sendmessage $message=\"tm-remove-field\" $param=\"type\"/><$action-deletetiddler $filter=\"[<typeInputTiddler>] [<refreshTitle>] [<typeSelectionTiddler>]\"/></$list>\n\\whitespace trim\n<$set name=\"refreshTitle\" value=<<qualify \"$:/temp/type-search/refresh\">>>\n<div class=\"tc-edit-type-selector-wrapper\">\n<em class=\"tc-edit tc-small-gap-right\"><<lingo Type/Prompt>></em>\n<div class=\"tc-type-selector-dropdown-wrapper\">\n<div class=\"tc-type-selector\"><$fieldmangler>\n<$macrocall $name=\"keyboard-driven-input\" tiddler=<<currentTiddler>> storeTitle=<<typeInputTiddler>> refreshTitle=<<refreshTitle>> selectionStateTitle=<<typeSelectionTiddler>> field=\"type\" tag=\"input\" default=\"\" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<<qualify \"$:/state/popup/type-dropdown\">> class=\"tc-edit-typeeditor tc-edit-texteditor tc-popup-handle\" tabindex={{$:/config/EditTabIndex}} focus={{{ [{$:/config/AutoFocus}match[type]then[true]] ~[[false]] }}} cancelPopups=\"yes\" configTiddlerFilter=\"[[$:/core/ui/EditTemplate/type]]\" inputCancelActions=<<input-cancel-actions>>/><$button popup=<<qualify \"$:/state/popup/type-dropdown\">> class=\"tc-btn-invisible tc-btn-dropdown tc-small-gap\" tooltip={{$:/language/EditTemplate/Type/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Type/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button><$button message=\"tm-remove-field\" param=\"type\" class=\"tc-btn-invisible tc-btn-icon\" tooltip={{$:/language/EditTemplate/Type/Delete/Hint}} aria-label={{$:/language/EditTemplate/Type/Delete/Caption}}>{{$:/core/images/delete-button}}<$action-deletetiddler $filter=\"[<storeTitle>] [<refreshTitle>] [<selectionStateTitle>]\"/></$button>\n</$fieldmangler></div>\n\n<div class=\"tc-block-dropdown-wrapper\">\n<$set name=\"tv-show-missing-links\" value=\"yes\">\n<$reveal state=<<qualify \"$:/state/popup/type-dropdown\">> type=\"nomatch\" text=\"\" default=\"\">\n<div class=\"tc-block-dropdown tc-edit-type-dropdown\">\n<$linkcatcher to=\"!!type\">\n<$list filter='[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]each[group]sort[group-sort]]'>\n<div class=\"tc-dropdown-item\">\n<$text text={{!!group}}/>\n</div>\n<$set name=\"userInput\" value={{{ [<typeInputTiddler>get[text]] }}}>\n<$list filter=\"[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]group{!!group}] +[sort[description]] +[removeprefix[$:/language/Docs/Types/]] +[search<userInput>]\"><span class={{{ [<currentTiddler>addsuffix[-primaryList]] -[<typeSelectionTiddler>get[text]] +[then[]else[tc-list-item-selected]] }}}><$link to={{{ [<currentTiddler>addprefix[$:/language/Docs/Types/]get[name]] }}}><$view tiddler={{{ [<currentTiddler>addprefix[$:/language/Docs/Types/]] }}} field=\"description\"/> (<$view tiddler={{{ [<currentTiddler>addprefix[$:/language/Docs/Types/]] }}} field=\"name\"/>)</$link></span>\n</$list>\n</$set>\n</$list>\n</$linkcatcher>\n</div>\n</$reveal>\n</$set>\n</div>\n</div>\n</div>\n</$set>\n"
},
"$:/core/ui/EditTemplate": {
"title": "$:/core/ui/EditTemplate",
"text": "\\define delete-edittemplate-state-tiddlers() <$action-deletetiddler $filter=\"[<newFieldNameTiddler>] [<newFieldValueTiddler>] [<newFieldNameInputTiddler>] [<newFieldNameSelectionTiddler>] [<newTagNameTiddler>] [<newTagNameInputTiddler>] [<newTagNameSelectionTiddler>] [<typeInputTiddler>] [<typeSelectionTiddler>]\"/>\n\\define save-tiddler-actions()\n<$action-sendmessage $message=\"tm-add-tag\" $param={{{ [<newTagNameTiddler>get[text]] }}}/>\n<$action-sendmessage $message=\"tm-add-field\" $name={{{ [<newFieldNameTiddler>get[text]] }}} $value={{{ [<newFieldValueTiddler>get[text]] }}}/>\n<<delete-edittemplate-state-tiddlers>>\n<$action-sendmessage $message=\"tm-save-tiddler\"/>\n\\end\n\\define cancel-delete-tiddler-actions(message)\n<<delete-edittemplate-state-tiddlers>>\n<$action-sendmessage $message=\"tm-$message$-tiddler\"/>\n\\end\n<div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ tc-tiddler-frame tc-tiddler-edit-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}}>\n<$fieldmangler>\n<$vars storyTiddler=<<currentTiddler>> newTagNameTiddler=<<qualify \"$:/temp/NewTagName\">> newFieldNameTiddler=<<qualify \"$:/temp/NewFieldName\">> newFieldValueTiddler=<<qualify \"$:/temp/NewFieldValue\">> newFieldNameInputTiddler=<<qualify \"$:/temp/NewFieldName/input\">> newFieldNameSelectionTiddler=<<qualify \"$:/temp/NewFieldName/selected-item\">> newTagNameInputTiddler=<<qualify \"$:/temp/NewTagName/input\">> newTagNameSelectionTiddler=<<qualify \"$:/temp/NewTagName/selected-item\">> typeInputTiddler=<<qualify \"$:/temp/Type/input\">> typeSelectionTiddler=<<qualify \"$:/temp/Type/selected-item\">>>\n<$keyboard key=\"((cancel-edit-tiddler))\" actions=<<cancel-delete-tiddler-actions \"cancel\">>>\n<$keyboard key=\"((save-tiddler))\" actions=<<save-tiddler-actions>>>\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]]\" variable=\"listItem\">\n<$set name=\"tv-config-toolbar-class\" filter=\"[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]\">\n<$transclude tiddler=<<listItem>>/>\n</$set>\n</$list>\n</$keyboard>\n</$keyboard>\n</$vars>\n</$fieldmangler>\n</div>\n"
},
"$:/core/ui/Buttons/cancel": {
"title": "$:/core/ui/Buttons/cancel",
"tags": "$:/tags/EditToolbar",
"caption": "{{$:/core/images/cancel-button}} {{$:/language/Buttons/Cancel/Caption}}",
"description": "{{$:/language/Buttons/Cancel/Hint}}",
"text": "\\whitespace trim\n<$button actions=<<cancel-delete-tiddler-actions \"cancel\">> tooltip={{$:/language/Buttons/Cancel/Hint}} aria-label={{$:/language/Buttons/Cancel/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/cancel-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Cancel/Caption}}/></span>\n</$list>\n</$button>\n"
},
"$:/core/ui/Buttons/delete": {
"title": "$:/core/ui/Buttons/delete",
"tags": "$:/tags/EditToolbar $:/tags/ViewToolbar",
"caption": "{{$:/core/images/delete-button}} {{$:/language/Buttons/Delete/Caption}}",
"description": "{{$:/language/Buttons/Delete/Hint}}",
"text": "\\whitespace trim\n<$button actions=<<cancel-delete-tiddler-actions \"delete\">> tooltip={{$:/language/Buttons/Delete/Hint}} aria-label={{$:/language/Buttons/Delete/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/delete-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Delete/Caption}}/></span>\n</$list>\n</$button>\n"
},
"$:/core/ui/Buttons/save": {
"title": "$:/core/ui/Buttons/save",
"tags": "$:/tags/EditToolbar",
"caption": "{{$:/core/images/done-button}} {{$:/language/Buttons/Save/Caption}}",
"description": "{{$:/language/Buttons/Save/Hint}}",
"text": "\\define save-tiddler-button()\n\\whitespace trim\n<$fieldmangler><$button tooltip={{$:/language/Buttons/Save/Hint}} aria-label={{$:/language/Buttons/Save/Caption}} class=<<tv-config-toolbar-class>>>\n<<save-tiddler-actions>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/done-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Save/Caption}}/></span>\n</$list>\n</$button></$fieldmangler>\n\\end\n<<save-tiddler-button>>\n"
},
"$:/core/ui/EditorToolbar/bold": {
"title": "$:/core/ui/EditorToolbar/bold",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/bold",
"caption": "{{$:/language/Buttons/Bold/Caption}}",
"description": "{{$:/language/Buttons/Bold/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((bold))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"''\"\n\tsuffix=\"''\"\n/>\n"
},
"$:/core/ui/EditorToolbar/clear-dropdown": {
"title": "$:/core/ui/EditorToolbar/clear-dropdown",
"text": "''{{$:/language/Buttons/Clear/Hint}}''\n\n<div class=\"tc-colour-chooser\">\n\n<$macrocall $name=\"colour-picker\" actions=\"\"\"\n\n<$action-sendmessage\n\t$message=\"tm-edit-bitmap-operation\"\n\t$param=\"clear\"\n\tcolour=<<colour-picker-value>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n\"\"\"/>\n\n</div>\n"
},
"$:/core/ui/EditorToolbar/clear": {
"title": "$:/core/ui/EditorToolbar/clear",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/erase",
"caption": "{{$:/language/Buttons/Clear/Caption}}",
"description": "{{$:/language/Buttons/Clear/Hint}}",
"condition": "[<targetTiddler>is[image]] -[<targetTiddler>type[image/svg+xml]]",
"dropdown": "$:/core/ui/EditorToolbar/clear-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/editor-height-dropdown": {
"title": "$:/core/ui/EditorToolbar/editor-height-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/EditorHeight/\n''<<lingo Hint>>''\n\n<$radio tiddler=\"$:/config/TextEditor/EditorHeight/Mode\" value=\"auto\"> {{$:/core/images/auto-height}} <<lingo Caption/Auto>></$radio>\n\n<$radio tiddler=\"$:/config/TextEditor/EditorHeight/Mode\" value=\"fixed\"> {{$:/core/images/fixed-height}} <<lingo Caption/Fixed>> <$edit-text tag=\"input\" tiddler=\"$:/config/TextEditor/EditorHeight/Height\" default=\"100px\"/></$radio>\n"
},
"$:/core/ui/EditorToolbar/editor-height": {
"title": "$:/core/ui/EditorToolbar/editor-height",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/fixed-height",
"custom-icon": "yes",
"caption": "{{$:/language/Buttons/EditorHeight/Caption}}",
"description": "{{$:/language/Buttons/EditorHeight/Hint}}",
"condition": "[<targetTiddler>type[]] [<targetTiddler>get[type]prefix[text/]] [<targetTiddler>get[type]match[application/javascript]] [<targetTiddler>get[type]match[application/json]] [<targetTiddler>get[type]match[application/x-tiddler-dictionary]] [<targetTiddler>get[type]match[image/svg+xml]] +[first[]]",
"dropdown": "$:/core/ui/EditorToolbar/editor-height-dropdown",
"text": "<$reveal tag=\"span\" state=\"$:/config/TextEditor/EditorHeight/Mode\" type=\"match\" text=\"fixed\">\n{{$:/core/images/fixed-height}}\n</$reveal>\n<$reveal tag=\"span\" state=\"$:/config/TextEditor/EditorHeight/Mode\" type=\"match\" text=\"auto\">\n{{$:/core/images/auto-height}}\n</$reveal>\n"
},
"$:/core/ui/EditorToolbar/excise-dropdown": {
"title": "$:/core/ui/EditorToolbar/excise-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/Excise/\n\n\\define body(config-title)\n''<<lingo Hint>>''\n\n<<lingo Caption/NewTitle>> <$edit-text tag=\"input\" tiddler=\"$config-title$/new-title\" default=\"\" focus=\"true\"/>\n\n<$set name=\"new-title\" value={{$config-title$/new-title}}>\n<$list filter=\"\"\"[<new-title>is[tiddler]]\"\"\">\n<div class=\"tc-error\">\n<<lingo Caption/TiddlerExists>>\n</div>\n</$list>\n</$set>\n\n<$checkbox tiddler=\"\"\"$config-title$/tagnew\"\"\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"false\"> <<lingo Caption/Tag>></$checkbox>\n\n<<lingo Caption/Replace>> <$select tiddler=\"\"\"$config-title$/type\"\"\" default=\"transclude\">\n<option value=\"link\"><<lingo Caption/Replace/Link>></option>\n<option value=\"transclude\"><<lingo Caption/Replace/Transclusion>></option>\n<option value=\"macro\"><<lingo Caption/Replace/Macro>></option>\n</$select>\n\n<$reveal state=\"\"\"$config-title$/type\"\"\" type=\"match\" text=\"macro\">\n<<lingo Caption/MacroName>> <$edit-text tag=\"input\" tiddler=\"\"\"$config-title$/macro-title\"\"\" default=\"translink\"/>\n</$reveal>\n\n<$button>\n<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"excise\"\n\ttitle={{$config-title$/new-title}}\n\ttype={{$config-title$/type}}\n\tmacro={{$config-title$/macro-title}}\n\ttagnew={{$config-title$/tagnew}}\n/>\n<$action-deletetiddler\n\t$tiddler=\"$config-title$/new-title\"\n/>\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n<<lingo Caption/Excise>>\n</$button>\n\\end\n\n<$macrocall $name=\"body\" config-title=<<qualify \"$:/state/Excise/\">>/>\n"
},
"$:/core/ui/EditorToolbar/excise": {
"title": "$:/core/ui/EditorToolbar/excise",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/excise",
"caption": "{{$:/language/Buttons/Excise/Caption}}",
"description": "{{$:/language/Buttons/Excise/Hint}}",
"condition": "[<targetTiddler>type[]] [<targetTiddler>type[text/vnd.tiddlywiki]] +[first[]]",
"shortcuts": "((excise))",
"dropdown": "$:/core/ui/EditorToolbar/excise-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/file-import": {
"title": "$:/core/ui/EditorToolbar/file-import",
"tags": "$:/tags/EditorTools",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"text": "\\define lingo-base() $:/language/Import/\n\n\\define closePopupActions()\n<$action-deletetiddler $filter=\"[title<importState>] [title<importTitle>]\"/>\n\\end\n\n\\define replacement-text-image() [img[$title$]]\n\n\\define replacement-text-file() [[$title$]]\n\n\\define postImportActions()\n<$list filter=\"[<importTitle>links[]] :reduce[get[type]prefix[image]then<replacement-text-image>else<replacement-text-file>search-replace[$title$],<currentTiddler>addprefix<accumulator>]\" variable=\"imageTitle\">\n<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"insert-text\"\n\ttext=<<imageTitle>>\n/>\n</$list>\n<<closePopupActions>>\n\\end\n\n\\define buttons()\n<$button class=\"tc-btn-invisible\" actions=<<closePopupActions>> ><<lingo Listing/Cancel/Caption>></$button>\n<$button class=\"tc-btn-invisible\" message=\"tm-perform-import\" param=<<importTitle>> actions=<<postImportActions>> ><<lingo Listing/Import/Caption>></$button>\n\\end\n\n<$reveal type=\"popup\" state=<<importState>> tag=\"div\" class=\"tc-editor-importpopup\">\n<div class=\"tc-editor-import\">\n<$list filter=\"[<importTitle>field:plugin-type[import]]\">\n<h2><<lingo Editor/Import/Heading>></h2>\n<$tiddler tiddler=<<importTitle>>>\n{{||$:/core/ui/ImportListing}}\n<<buttons>>\n</$tiddler>\n</$list>\n</div>\n</$reveal>\n"
},
"$:/core/ui/EditorToolbar/heading-1": {
"title": "$:/core/ui/EditorToolbar/heading-1",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-1",
"caption": "{{$:/language/Buttons/Heading1/Caption}}",
"description": "{{$:/language/Buttons/Heading1/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"button-classes": "tc-text-editor-toolbar-item-start-group",
"shortcuts": "((heading-1))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"1\"\n/>\n"
},
"$:/core/ui/EditorToolbar/heading-2": {
"title": "$:/core/ui/EditorToolbar/heading-2",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-2",
"caption": "{{$:/language/Buttons/Heading2/Caption}}",
"description": "{{$:/language/Buttons/Heading2/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((heading-2))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"2\"\n/>\n"
},
"$:/core/ui/EditorToolbar/heading-3": {
"title": "$:/core/ui/EditorToolbar/heading-3",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-3",
"caption": "{{$:/language/Buttons/Heading3/Caption}}",
"description": "{{$:/language/Buttons/Heading3/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((heading-3))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"3\"\n/>\n"
},
"$:/core/ui/EditorToolbar/heading-4": {
"title": "$:/core/ui/EditorToolbar/heading-4",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-4",
"caption": "{{$:/language/Buttons/Heading4/Caption}}",
"description": "{{$:/language/Buttons/Heading4/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((heading-4))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"4\"\n/>\n"
},
"$:/core/ui/EditorToolbar/heading-5": {
"title": "$:/core/ui/EditorToolbar/heading-5",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-5",
"caption": "{{$:/language/Buttons/Heading5/Caption}}",
"description": "{{$:/language/Buttons/Heading5/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((heading-5))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"5\"\n/>\n"
},
"$:/core/ui/EditorToolbar/heading-6": {
"title": "$:/core/ui/EditorToolbar/heading-6",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/heading-6",
"caption": "{{$:/language/Buttons/Heading6/Caption}}",
"description": "{{$:/language/Buttons/Heading6/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((heading-6))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"!\"\n\tcount=\"6\"\n/>\n"
},
"$:/core/ui/EditorToolbar/italic": {
"title": "$:/core/ui/EditorToolbar/italic",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/italic",
"caption": "{{$:/language/Buttons/Italic/Caption}}",
"description": "{{$:/language/Buttons/Italic/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((italic))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"//\"\n\tsuffix=\"//\"\n/>\n"
},
"$:/core/ui/EditorToolbar/line-width-dropdown": {
"title": "$:/core/ui/EditorToolbar/line-width-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/LineWidth/\n\n\\define toolbar-line-width-inner()\n<$button tag=\"a\" tooltip=\"\"\"$(line-width)$\"\"\">\n\n<$action-setfield\n\t$tiddler=\"$:/config/BitmapEditor/LineWidth\"\n\t$value=\"$(line-width)$\"\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<div style=\"display: inline-block; margin: 4px calc(80px - $(line-width)$); background-color: #000; width: calc(100px + $(line-width)$ * 2); height: $(line-width)$; border-radius: 120px; vertical-align: middle;\"/>\n\n<span style=\"margin-left: 8px;\">\n\n<$text text=\"\"\"$(line-width)$\"\"\"/>\n\n<$reveal state=\"$:/config/BitmapEditor/LineWidth\" type=\"match\" text=\"\"\"$(line-width)$\"\"\" tag=\"span\">\n\n<$entity entity=\" \"/>\n\n<$entity entity=\"✓\"/>\n\n</$reveal>\n\n</span>\n\n</$button>\n\\end\n\n''<<lingo Hint>>''\n\n<$list filter={{$:/config/BitmapEditor/LineWidths}} variable=\"line-width\">\n\n<<toolbar-line-width-inner>>\n\n</$list>\n"
},
"$:/core/ui/EditorToolbar/line-width": {
"title": "$:/core/ui/EditorToolbar/line-width",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/line-width",
"caption": "{{$:/language/Buttons/LineWidth/Caption}}",
"description": "{{$:/language/Buttons/LineWidth/Hint}}",
"condition": "[<targetTiddler>is[image]] -[<targetTiddler>type[image/svg+xml]]",
"dropdown": "$:/core/ui/EditorToolbar/line-width-dropdown",
"text": "<$text text={{$:/config/BitmapEditor/LineWidth}}/>\n"
},
"$:/core/ui/EditorToolbar/link-dropdown": {
"title": "$:/core/ui/EditorToolbar/link-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/Link/\n\n\\define add-link-actions()\n<$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"make-link\" text={{$(linkTiddler)$}} />\n<$action-deletetiddler $filter=\"[<dropdown-state>] [<searchTiddler>] [<linkTiddler>] [<storeTitle>] [<searchListState>]\"/>\n\\end\n\n\\define get-focus-selector() [data-tiddler-title=\"$(cssEscapedTitle)$\"] .tc-create-wikitext-link input\n\n\\define cancel-search-actions-inner()\n<$set name=\"userInput\" value={{{ [<storeTitle>get[text]] }}}><$list filter=\"[<searchTiddler>get[text]!match<userInput>]\" emptyMessage=\"\"\"<$action-deletetiddler $filter=\"[<searchTiddler>] [<linkTiddler>] [<storeTitle>] [<searchListState>]\"/>\"\"\"><$action-setfield $tiddler=<<searchTiddler>> text=<<userInput>>/><$action-setfield $tiddler=<<refreshTitle>> text=\"yes\"/></$list></$set>\n\\end\n\n\\define cancel-search-actions() <$list filter=\"[<storeTitle>!has[text]] +[<searchTiddler>!has[text]]\" emptyMessage=\"\"\"<<cancel-search-actions-inner>>\"\"\"><$action-sendmessage $message=\"tm-edit-text-operation\" $param=\"wrap-selection\" prefix=\"\" suffix=\"\"/></$list>\n\n\\define external-link()\n<$button class=\"tc-btn-invisible\" style=\"width: auto; display: inline-block; background-colour: inherit;\" actions=<<add-link-actions>>>\n{{$:/core/images/chevron-right}}\n</$button>\n\\end\n\n\\define set-next-input-tab(beforeafter:\"after\") <$macrocall $name=\"change-input-tab\" stateTitle=\"$:/state/tab/search-results/sidebar\" tag=\"$:/tags/SearchResults\" beforeafter=\"$beforeafter$\" defaultState={{$:/config/SearchResults/Default}} actions=\"\"\"<$action-setfield $tiddler=\"$:/state/search/currentTab\" text=<<nextTab>>/>\"\"\"/>\n\n\\define body(config-title)\n''<<lingo Hint>>''\n\n<$vars searchTiddler=\"\"\"$config-title$/search\"\"\" linkTiddler=\"\"\"$config-title$/link\"\"\" linktext=\"\" searchListState=<<qualify \"$:/temp/link-search/selected-item\">> refreshTitle=<<qualify \"$:/temp/link-search/refresh\">> storeTitle=<<qualify \"$:/temp/link-search/input\">>>\n\n<$vars linkTiddler=<<searchTiddler>>>\n<$keyboard key=\"((input-tab-right))\" actions=<<set-next-input-tab>>>\n<$keyboard key=\"((input-tab-left))\" actions=<<set-next-input-tab \"before\">> class=\"tc-create-wikitext-link\">\n<$macrocall $name=\"keyboard-driven-input\" tiddler=<<searchTiddler>> storeTitle=<<storeTitle>>\n\t\tselectionStateTitle=<<searchListState>> refreshTitle=<<refreshTitle>> type=\"search\" filterMinLength=\"1\"\n\t\ttag=\"input\" focus=\"true\" class=\"tc-popup-handle\" inputCancelActions=<<cancel-search-actions>> \n\t\tinputAcceptActions=<<add-link-actions>> placeholder={{$:/language/Search/Search}} default=\"\" \n\t\tconfigTiddlerFilter=\"[[$:/state/search/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}]\" />\n</$keyboard>\n</$keyboard>\n<$reveal tag=\"span\" state=<<storeTitle>> type=\"nomatch\" text=\"\">\n<<external-link>>\n<$button class=\"tc-btn-invisible\" style=\"width: auto; display: inline-block; background-colour: inherit;\">\n<<cancel-search-actions>><$set name=\"cssEscapedTitle\" value={{{ [<storyTiddler>escapecss[]] }}}><$action-sendmessage $message=\"tm-focus-selector\" $param=<<get-focus-selector>>/></$set>\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n</$vars>\n\n<$reveal tag=\"div\" state=<<storeTitle>> type=\"nomatch\" text=\"\">\n\n<$linkcatcher actions=<<add-link-actions>> to=<<linkTiddler>>>\n\n<$vars userInput={{{ [<storeTitle>get[text]] }}} configTiddler={{{ [[$:/state/search/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}] }}}>\n\n{{$:/core/ui/SearchResults}}\n\n</$vars>\n\n</$linkcatcher>\n\n</$reveal>\n\n</$vars>\n\n\\end\n\n<$macrocall $name=\"body\" config-title=<<qualify \"$:/state/Link/\">>/>\n"
},
"$:/core/ui/EditorToolbar/link": {
"title": "$:/core/ui/EditorToolbar/link",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/link",
"caption": "{{$:/language/Buttons/Link/Caption}}",
"description": "{{$:/language/Buttons/Link/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"button-classes": "tc-text-editor-toolbar-item-start-group",
"shortcuts": "((link))",
"dropdown": "$:/core/ui/EditorToolbar/link-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/linkify": {
"title": "$:/core/ui/EditorToolbar/linkify",
"caption": "{{$:/language/Buttons/Linkify/Caption}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"description": "{{$:/language/Buttons/Linkify/Hint}}",
"icon": "$:/core/images/linkify",
"list-before": "$:/core/ui/EditorToolbar/mono-block",
"shortcuts": "((linkify))",
"tags": "$:/tags/EditorToolbar",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"[[\"\n\tsuffix=\"]]\"\n/>\n"
},
"$:/core/ui/EditorToolbar/list-bullet": {
"title": "$:/core/ui/EditorToolbar/list-bullet",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/list-bullet",
"caption": "{{$:/language/Buttons/ListBullet/Caption}}",
"description": "{{$:/language/Buttons/ListBullet/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((list-bullet))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"*\"\n\tcount=\"1\"\n/>\n"
},
"$:/core/ui/EditorToolbar/list-number": {
"title": "$:/core/ui/EditorToolbar/list-number",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/list-number",
"caption": "{{$:/language/Buttons/ListNumber/Caption}}",
"description": "{{$:/language/Buttons/ListNumber/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((list-number))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"prefix-lines\"\n\tcharacter=\"#\"\n\tcount=\"1\"\n/>\n"
},
"$:/core/ui/EditorToolbar/mono-block": {
"title": "$:/core/ui/EditorToolbar/mono-block",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/mono-block",
"caption": "{{$:/language/Buttons/MonoBlock/Caption}}",
"description": "{{$:/language/Buttons/MonoBlock/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"button-classes": "tc-text-editor-toolbar-item-start-group",
"shortcuts": "((mono-block))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-lines\"\n\tprefix=\"\n```\"\n\tsuffix=\"```\"\n/>\n"
},
"$:/core/ui/EditorToolbar/mono-line": {
"title": "$:/core/ui/EditorToolbar/mono-line",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/mono-line",
"caption": "{{$:/language/Buttons/MonoLine/Caption}}",
"description": "{{$:/language/Buttons/MonoLine/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((mono-line))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"`\"\n\tsuffix=\"`\"\n/>\n"
},
"$:/core/ui/EditorToolbar/more-dropdown": {
"title": "$:/core/ui/EditorToolbar/more-dropdown",
"text": "\\define config-title()\n$:/config/EditorToolbarButtons/Visibility/$(toolbarItem)$\n\\end\n\n\\define conditional-button()\n<$list filter={{$(toolbarItem)$!!condition}} variable=\"condition\">\n<$transclude tiddler=\"$:/core/ui/EditTemplate/body/toolbar/button\" mode=\"inline\"/> <$transclude tiddler=<<toolbarItem>> field=\"description\"/>\n</$list>\n\\end\n\n<div class=\"tc-text-editor-toolbar-more\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]] -[[$:/core/ui/EditorToolbar/more]]\">\n<$reveal type=\"match\" state=<<config-visibility-title>> text=\"hide\" tag=\"div\">\n<<conditional-button>>\n</$reveal>\n</$list>\n</div>\n"
},
"$:/core/ui/EditorToolbar/more": {
"title": "$:/core/ui/EditorToolbar/more",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/down-arrow",
"caption": "{{$:/language/Buttons/More/Caption}}",
"description": "{{$:/language/Buttons/More/Hint}}",
"condition": "[<targetTiddler>]",
"dropdown": "$:/core/ui/EditorToolbar/more-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/opacity-dropdown": {
"title": "$:/core/ui/EditorToolbar/opacity-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/Opacity/\n\n\\define toolbar-opacity-inner()\n<$button tag=\"a\" tooltip=\"\"\"$(opacity)$\"\"\">\n\n<$action-setfield\n\t$tiddler=\"$:/config/BitmapEditor/Opacity\"\n\t$value=\"$(opacity)$\"\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<div style=\"display: inline-block; vertical-align: middle; background-color: $(current-paint-colour)$; opacity: $(opacity)$; width: 1em; height: 1em; border-radius: 50%;\"/>\n\n<span style=\"margin-left: 8px;\">\n\n<$text text=\"\"\"$(opacity)$\"\"\"/>\n\n<$reveal state=\"$:/config/BitmapEditor/Opacity\" type=\"match\" text=\"\"\"$(opacity)$\"\"\" tag=\"span\">\n\n<$entity entity=\" \"/>\n\n<$entity entity=\"✓\"/>\n\n</$reveal>\n\n</span>\n\n</$button>\n\\end\n\n\\define toolbar-opacity()\n''<<lingo Hint>>''\n\n<$list filter={{$:/config/BitmapEditor/Opacities}} variable=\"opacity\">\n\n<<toolbar-opacity-inner>>\n\n</$list>\n\\end\n\n<$set name=\"current-paint-colour\" value={{$:/config/BitmapEditor/Colour}}>\n\n<$set name=\"current-opacity\" value={{$:/config/BitmapEditor/Opacity}}>\n\n<<toolbar-opacity>>\n\n</$set>\n\n</$set>\n"
},
"$:/core/ui/EditorToolbar/opacity": {
"title": "$:/core/ui/EditorToolbar/opacity",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/opacity",
"caption": "{{$:/language/Buttons/Opacity/Caption}}",
"description": "{{$:/language/Buttons/Opacity/Hint}}",
"condition": "[<targetTiddler>is[image]] -[<targetTiddler>type[image/svg+xml]]",
"dropdown": "$:/core/ui/EditorToolbar/opacity-dropdown",
"text": "<$text text={{$:/config/BitmapEditor/Opacity}}/>\n"
},
"$:/core/ui/EditorToolbar/paint-dropdown": {
"title": "$:/core/ui/EditorToolbar/paint-dropdown",
"text": "''{{$:/language/Buttons/Paint/Hint}}''\n\n<$macrocall $name=\"colour-picker\" actions=\"\"\"\n\n<$action-setfield\n\t$tiddler=\"$:/config/BitmapEditor/Colour\"\n\t$value=<<colour-picker-value>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n\"\"\"/>\n"
},
"$:/core/ui/EditorToolbar/paint": {
"title": "$:/core/ui/EditorToolbar/paint",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/paint",
"caption": "{{$:/language/Buttons/Paint/Caption}}",
"description": "{{$:/language/Buttons/Paint/Hint}}",
"condition": "[<targetTiddler>is[image]] -[<targetTiddler>type[image/svg+xml]]",
"dropdown": "$:/core/ui/EditorToolbar/paint-dropdown",
"text": "\\define toolbar-paint()\n<div style=\"display: inline-block; vertical-align: middle; background-color: $(colour-picker-value)$; width: 1em; height: 1em; border-radius: 50%;\"/>\n\\end\n<$set name=\"colour-picker-value\" value={{$:/config/BitmapEditor/Colour}}>\n<<toolbar-paint>>\n</$set>\n"
},
"$:/core/ui/EditorToolbar/picture-dropdown": {
"title": "$:/core/ui/EditorToolbar/picture-dropdown",
"text": "\\define replacement-text()\n[img[$(imageTitle)$]]\n\\end\n\n''{{$:/language/Buttons/Picture/Hint}}''\n\n<$macrocall $name=\"image-picker\" actions=\"\"\"\n\n<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"replace-selection\"\n\ttext=<<replacement-text>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n\"\"\"/>\n"
},
"$:/core/ui/EditorToolbar/picture": {
"title": "$:/core/ui/EditorToolbar/picture",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/picture",
"caption": "{{$:/language/Buttons/Picture/Caption}}",
"description": "{{$:/language/Buttons/Picture/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((picture))",
"dropdown": "$:/core/ui/EditorToolbar/picture-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/preview-type-dropdown": {
"title": "$:/core/ui/EditorToolbar/preview-type-dropdown",
"text": "\\define preview-type-button()\n<$button tag=\"a\">\n\n<$action-setfield $tiddler=\"$:/state/editpreviewtype\" $value=\"$(previewType)$\"/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<$transclude tiddler=<<previewType>> field=\"caption\" mode=\"inline\">\n\n<$view tiddler=<<previewType>> field=\"title\" mode=\"inline\"/>\n\n</$transclude> \n\n<$reveal tag=\"span\" state=\"$:/state/editpreviewtype\" type=\"match\" text=<<previewType>> default=\"$:/core/ui/EditTemplate/body/preview/output\">\n\n<$entity entity=\" \"/>\n\n<$entity entity=\"✓\"/>\n\n</$reveal>\n\n</$button>\n\\end\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/EditPreview]!has[draft.of]]\" variable=\"previewType\">\n\n<<preview-type-button>>\n\n</$list>\n"
},
"$:/core/ui/EditorToolbar/preview-type": {
"title": "$:/core/ui/EditorToolbar/preview-type",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/chevron-down",
"caption": "{{$:/language/Buttons/PreviewType/Caption}}",
"description": "{{$:/language/Buttons/PreviewType/Hint}}",
"condition": "[all[shadows+tiddlers]tag[$:/tags/EditPreview]!has[draft.of]butfirst[]limit[1]]",
"button-classes": "tc-text-editor-toolbar-item-adjunct",
"dropdown": "$:/core/ui/EditorToolbar/preview-type-dropdown"
},
"$:/core/ui/EditorToolbar/preview": {
"title": "$:/core/ui/EditorToolbar/preview",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/preview-open",
"custom-icon": "yes",
"caption": "{{$:/language/Buttons/Preview/Caption}}",
"description": "{{$:/language/Buttons/Preview/Hint}}",
"condition": "[<targetTiddler>]",
"button-classes": "tc-text-editor-toolbar-item-start-group",
"shortcuts": "((preview))",
"text": "<$reveal state=\"$:/state/showeditpreview\" type=\"match\" text=\"yes\" tag=\"span\">\n{{$:/core/images/preview-open}}\n<$action-setfield $tiddler=\"$:/state/showeditpreview\" $value=\"no\"/>\n</$reveal>\n<$reveal state=\"$:/state/showeditpreview\" type=\"nomatch\" text=\"yes\" tag=\"span\">\n{{$:/core/images/preview-closed}}\n<$action-setfield $tiddler=\"$:/state/showeditpreview\" $value=\"yes\"/>\n</$reveal>\n"
},
"$:/core/ui/EditorToolbar/quote": {
"title": "$:/core/ui/EditorToolbar/quote",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/quote",
"caption": "{{$:/language/Buttons/Quote/Caption}}",
"description": "{{$:/language/Buttons/Quote/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((quote))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-lines\"\n\tprefix=\"\n<<<\"\n\tsuffix=\"<<<\"\n/>\n"
},
"$:/core/ui/EditorToolbar/rotate-left": {
"title": "$:/core/ui/EditorToolbar/rotate-left",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/rotate-left",
"caption": "{{$:/language/Buttons/RotateLeft/Caption}}",
"description": "{{$:/language/Buttons/RotateLeft/Hint}}",
"condition": "[<targetTiddler>is[image]] -[<targetTiddler>type[image/svg+xml]]",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-bitmap-operation\"\n\t$param=\"rotate-left\"\n/>\n"
},
"$:/core/ui/EditorToolbar/size-dropdown": {
"title": "$:/core/ui/EditorToolbar/size-dropdown",
"text": "\\define lingo-base() $:/language/Buttons/Size/\n\n\\define toolbar-button-size-preset(config-title)\n<$set name=\"width\" filter=\"$(sizePair)$ +[first[]]\">\n\n<$set name=\"height\" filter=\"$(sizePair)$ +[last[]]\">\n\n<$button tag=\"a\">\n\n<$action-setfield\n\t$tiddler=\"\"\"$config-title$/new-width\"\"\"\n\t$value=<<width>>\n/>\n\n<$action-setfield\n\t$tiddler=\"\"\"$config-title$/new-height\"\"\"\n\t$value=<<height>>\n/>\n\n<$action-deletetiddler\n\t$tiddler=\"\"\"$config-title$/presets-popup\"\"\"\n/>\n\n<$text text=<<width>>/> × <$text text=<<height>>/>\n\n</$button>\n\n</$set>\n\n</$set>\n\\end\n\n\\define toolbar-button-size(config-title)\n''{{$:/language/Buttons/Size/Hint}}''\n\n<<lingo Caption/Width>> <$edit-text tag=\"input\" tiddler=\"\"\"$config-title$/new-width\"\"\" default=<<tv-bitmap-editor-width>> focus=\"true\" size=\"8\"/> <<lingo Caption/Height>> <$edit-text tag=\"input\" tiddler=\"\"\"$config-title$/new-height\"\"\" default=<<tv-bitmap-editor-height>> size=\"8\"/> <$button popup=\"\"\"$config-title$/presets-popup\"\"\" class=\"tc-btn-invisible tc-popup-keep\" style=\"width: auto; display: inline-block; background-colour: inherit;\" selectedClass=\"tc-selected\">\n{{$:/core/images/down-arrow}}\n</$button>\n\n<$reveal tag=\"span\" state=\"\"\"$config-title$/presets-popup\"\"\" type=\"popup\" position=\"belowleft\" animate=\"yes\">\n\n<div class=\"tc-drop-down tc-popup-keep\">\n\n<$list filter={{$:/config/BitmapEditor/ImageSizes}} variable=\"sizePair\">\n\n<$macrocall $name=\"toolbar-button-size-preset\" config-title=\"$config-title$\"/>\n\n</$list>\n\n</div>\n\n</$reveal>\n\n<$button>\n<$action-sendmessage\n\t$message=\"tm-edit-bitmap-operation\"\n\t$param=\"resize\"\n\twidth={{$config-title$/new-width}}\n\theight={{$config-title$/new-height}}\n/>\n<$action-deletetiddler\n\t$tiddler=\"\"\"$config-title$/new-width\"\"\"\n/>\n<$action-deletetiddler\n\t$tiddler=\"\"\"$config-title$/new-height\"\"\"\n/>\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n<<lingo Caption/Resize>>\n</$button>\n\\end\n\n<$macrocall $name=\"toolbar-button-size\" config-title=<<qualify \"$:/state/Size/\">>/>\n"
},
"$:/core/ui/EditorToolbar/size": {
"title": "$:/core/ui/EditorToolbar/size",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/size",
"caption": "{{$:/language/Buttons/Size/Caption}}",
"description": "{{$:/language/Buttons/Size/Hint}}",
"condition": "[<targetTiddler>is[image]] -[<targetTiddler>type[image/svg+xml]]",
"dropdown": "$:/core/ui/EditorToolbar/size-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/stamp-dropdown": {
"title": "$:/core/ui/EditorToolbar/stamp-dropdown",
"text": "\\define toolbar-button-stamp-inner()\n<$button tag=\"a\">\n\n<$list filter=\"[[$(snippetTitle)$]addsuffix[/prefix]is[missing]removesuffix[/prefix]addsuffix[/suffix]is[missing]]\">\n\n<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"replace-selection\"\n\ttext={{$(snippetTitle)$}}\n/>\n\n</$list>\n\n\n<$list filter=\"[[$(snippetTitle)$]addsuffix[/prefix]is[missing]removesuffix[/prefix]addsuffix[/suffix]!is[missing]] [[$(snippetTitle)$]addsuffix[/prefix]!is[missing]removesuffix[/prefix]addsuffix[/suffix]is[missing]] [[$(snippetTitle)$]addsuffix[/prefix]!is[missing]removesuffix[/prefix]addsuffix[/suffix]!is[missing]]\">\n\n<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix={{{ [[$(snippetTitle)$]addsuffix[/prefix]get[text]] }}}\nsuffix={{{ [[$(snippetTitle)$]addsuffix[/suffix]get[text]] }}}\n/>\n\n</$list>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<$transclude tiddler=<<snippetTitle>> field=\"caption\" mode=\"inline\">\n\n<$view tiddler=<<snippetTitle>> field=\"title\" />\n\n</$transclude>\n\n</$button>\n\\end\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/TextEditor/Snippet]!has[draft.of]sort[caption]]\" variable=\"snippetTitle\">\n\n<<toolbar-button-stamp-inner>>\n\n</$list>\n\n----\n\n<$button tag=\"a\">\n\n<$action-sendmessage\n\t$message=\"tm-new-tiddler\"\n\ttags=\"$:/tags/TextEditor/Snippet\"\n\tcaption={{$:/language/Buttons/Stamp/New/Title}}\n\ttext={{$:/language/Buttons/Stamp/New/Text}}\n/>\n\n<$action-deletetiddler\n\t$tiddler=<<dropdown-state>>\n/>\n\n<em>\n\n<$text text={{$:/language/Buttons/Stamp/Caption/New}}/>\n\n</em>\n\n</$button>\n"
},
"$:/core/ui/EditorToolbar/stamp": {
"title": "$:/core/ui/EditorToolbar/stamp",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/stamp",
"caption": "{{$:/language/Buttons/Stamp/Caption}}",
"description": "{{$:/language/Buttons/Stamp/Hint}}",
"condition": "[<targetTiddler>type[]] [<targetTiddler>get[type]prefix[text/]] [<targetTiddler>get[type]match[application/javascript]] [<targetTiddler>get[type]match[application/json]] [<targetTiddler>get[type]match[application/x-tiddler-dictionary]] [<targetTiddler>get[type]match[image/svg+xml]] +[first[]]",
"shortcuts": "((stamp))",
"dropdown": "$:/core/ui/EditorToolbar/stamp-dropdown",
"text": ""
},
"$:/core/ui/EditorToolbar/strikethrough": {
"title": "$:/core/ui/EditorToolbar/strikethrough",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/strikethrough",
"caption": "{{$:/language/Buttons/Strikethrough/Caption}}",
"description": "{{$:/language/Buttons/Strikethrough/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((strikethrough))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"~~\"\n\tsuffix=\"~~\"\n/>\n"
},
"$:/core/ui/EditorToolbar/subscript": {
"title": "$:/core/ui/EditorToolbar/subscript",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/subscript",
"caption": "{{$:/language/Buttons/Subscript/Caption}}",
"description": "{{$:/language/Buttons/Subscript/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((subscript))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\",,\"\n\tsuffix=\",,\"\n/>\n"
},
"$:/core/ui/EditorToolbar/superscript": {
"title": "$:/core/ui/EditorToolbar/superscript",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/superscript",
"caption": "{{$:/language/Buttons/Superscript/Caption}}",
"description": "{{$:/language/Buttons/Superscript/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((superscript))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"^^\"\n\tsuffix=\"^^\"\n/>\n"
},
"$:/core/ui/EditorToolbar/transcludify": {
"title": "$:/core/ui/EditorToolbar/transcludify",
"caption": "{{$:/language/Buttons/Transcludify/Caption}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"description": "{{$:/language/Buttons/Transcludify/Hint}}",
"icon": "$:/core/images/transcludify",
"list-before": "$:/core/ui/EditorToolbar/mono-block",
"shortcuts": "((transcludify))",
"tags": "$:/tags/EditorToolbar",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"{{\"\n\tsuffix=\"}}\"\n/>\n"
},
"$:/core/ui/EditorToolbar/underline": {
"title": "$:/core/ui/EditorToolbar/underline",
"tags": "$:/tags/EditorToolbar",
"icon": "$:/core/images/underline",
"caption": "{{$:/language/Buttons/Underline/Caption}}",
"description": "{{$:/language/Buttons/Underline/Hint}}",
"condition": "[<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]",
"shortcuts": "((underline))",
"text": "<$action-sendmessage\n\t$message=\"tm-edit-text-operation\"\n\t$param=\"wrap-selection\"\n\tprefix=\"__\"\n\tsuffix=\"__\"\n/>\n"
},
"$:/core/Filters/AllTags": {
"title": "$:/core/Filters/AllTags",
"tags": "$:/tags/Filter",
"filter": "[tags[]!is[system]sort[title]]",
"description": "{{$:/language/Filters/AllTags}}",
"text": ""
},
"$:/core/Filters/AllTiddlers": {
"title": "$:/core/Filters/AllTiddlers",
"tags": "$:/tags/Filter",
"filter": "[!is[system]sort[title]]",
"description": "{{$:/language/Filters/AllTiddlers}}",
"text": ""
},
"$:/core/Filters/Drafts": {
"title": "$:/core/Filters/Drafts",
"tags": "$:/tags/Filter",
"filter": "[has[draft.of]sort[title]]",
"description": "{{$:/language/Filters/Drafts}}",
"text": ""
},
"$:/core/Filters/Missing": {
"title": "$:/core/Filters/Missing",
"tags": "$:/tags/Filter",
"filter": "[all[missing]sort[title]]",
"description": "{{$:/language/Filters/Missing}}",
"text": ""
},
"$:/core/Filters/Orphans": {
"title": "$:/core/Filters/Orphans",
"tags": "$:/tags/Filter",
"filter": "[all[orphans]sort[title]]",
"description": "{{$:/language/Filters/Orphans}}",
"text": ""
},
"$:/core/Filters/OverriddenShadowTiddlers": {
"title": "$:/core/Filters/OverriddenShadowTiddlers",
"tags": "$:/tags/Filter",
"filter": "[is[shadow]]",
"description": "{{$:/language/Filters/OverriddenShadowTiddlers}}",
"text": ""
},
"$:/core/Filters/RecentSystemTiddlers": {
"title": "$:/core/Filters/RecentSystemTiddlers",
"tags": "$:/tags/Filter",
"filter": "[has[modified]!sort[modified]limit[50]]",
"description": "{{$:/language/Filters/RecentSystemTiddlers}}",
"text": ""
},
"$:/core/Filters/RecentTiddlers": {
"title": "$:/core/Filters/RecentTiddlers",
"tags": "$:/tags/Filter",
"filter": "[!is[system]has[modified]!sort[modified]limit[50]]",
"description": "{{$:/language/Filters/RecentTiddlers}}",
"text": ""
},
"$:/core/Filters/SessionTiddlers": {
"title": "$:/core/Filters/SessionTiddlers",
"tags": "$:/tags/Filter",
"filter": "[haschanged[]]",
"description": "{{$:/language/Filters/SessionTiddlers}}",
"text": ""
},
"$:/core/Filters/ShadowTiddlers": {
"title": "$:/core/Filters/ShadowTiddlers",
"tags": "$:/tags/Filter",
"filter": "[all[shadows]sort[title]]",
"description": "{{$:/language/Filters/ShadowTiddlers}}",
"text": ""
},
"$:/core/Filters/StoryList": {
"title": "$:/core/Filters/StoryList",
"tags": "$:/tags/Filter",
"filter": "[list[$:/StoryList]] -$:/AdvancedSearch",
"description": "{{$:/language/Filters/StoryList}}",
"text": ""
},
"$:/core/Filters/SystemTags": {
"title": "$:/core/Filters/SystemTags",
"tags": "$:/tags/Filter",
"filter": "[all[shadows+tiddlers]tags[]is[system]sort[title]]",
"description": "{{$:/language/Filters/SystemTags}}",
"text": ""
},
"$:/core/Filters/SystemTiddlers": {
"title": "$:/core/Filters/SystemTiddlers",
"tags": "$:/tags/Filter",
"filter": "[is[system]sort[title]]",
"description": "{{$:/language/Filters/SystemTiddlers}}",
"text": ""
},
"$:/core/Filters/TypedTiddlers": {
"title": "$:/core/Filters/TypedTiddlers",
"tags": "$:/tags/Filter",
"filter": "[!is[system]has[type]each[type]sort[type]] -[type[text/vnd.tiddlywiki]]",
"description": "{{$:/language/Filters/TypedTiddlers}}",
"text": ""
},
"$:/core/ui/ImportListing": {
"title": "$:/core/ui/ImportListing",
"text": "\\define lingo-base() $:/language/Import/\n\n\\define messageField() message-$(payloadTiddler)$\n\n\\define payloadTitleFilter() [<currentTiddler>get<renameField>minlength[1]else<payloadTiddler>]\n\n\\define overWriteWarning()\n<$list filter=\"[<currentTiddler>!has<suppressedField>]\">\n<$text text={{{[subfilter<payloadTitleFilter>!is[tiddler]then[]] ~[<lingo-base>addsuffix[Listing/Rename/OverwriteWarning]get[text]]}}}/>\n</$list>\n\\end\n\n\\define selectionInfo()\n\\whitespace trim\n<$set name=\"escUnselected\" value={{{[{$:/language/Import/Upgrader/Tiddler/Unselected}escaperegexp[]addprefix[(?g)]]}}}>\n\t<$list filter=\"[all[current]get<messageField>regexp<escUnselected>]\" variable=\"ignore\">\n\t\t<$text text={{{[all[current]get<selectionField>match[checked]then{$:/language/Import/Upgrader/Tiddler/Selected}else[]]}}}/>\n\t</$list>\n</$set>\n\\end\n\n\\define libraryInfo()\n\\whitespace trim\n<$set name=\"escUnselected\" value={{{[{$:/language/Import/Upgrader/Tiddler/Unselected}escaperegexp[]addprefix[(?g)]]}}}>\n\t<$list filter=\"[all[current]get<messageField>!regexp<escUnselected>]\" variable=\"ignore\">\n\t\t<$text text={{{[all[current]get<messageField>]}}}/>\n\t</$list>\n</$set>\n\\end\n\n\\define selectionField() selection-$(payloadTiddler)$\n\n\\define renameField() rename-$(payloadTiddler)$\n\n\\define suppressedField() suppressed-$(payloadTiddler)$\n\n\\define newImportTitleTiddler() $:/temp/NewImportTitle-$(payloadTiddler)$\n\n\\define previewPopupState() $(currentTiddler)$!!popup-$(payloadTiddler)$\n\n\\define renameFieldState() $(currentTiddler)$!!state-rename-$(payloadTiddler)$\n\n\\define select-all-actions()\n<$list filter=\"[all[current]plugintiddlers[]sort[title]]\" variable=\"payloadTiddler\">\n<$action-setfield $field={{{ [<payloadTiddler>addprefix[selection-]] }}} $value={{$:/state/import/select-all}}/>\n</$list>\n\\end\n\n<table class=\"tc-import-table\">\n<tbody>\n<tr>\n<th align=\"left\">\n<$checkbox tiddler=\"$:/state/import/select-all\" field=\"text\" checked=\"checked\" unchecked=\"unchecked\" default=\"checked\" actions=<<select-all-actions>>>\n<<lingo Listing/Select/Caption>>\n</$checkbox>\n</th>\n<th>\n<<lingo Listing/Title/Caption>>\n</th>\n<th>\n<<lingo Listing/Status/Caption>>\n</th>\n</tr>\n<$list filter=\"[all[current]plugintiddlers[]sort[title]]\" variable=\"payloadTiddler\">\n<tr class={{{[<currentTiddler>has<suppressedField>then[tc-row-disabled]] ~[subfilter<payloadTitleFilter>is[tiddler]then[tc-row-warning]] }}}>\n<td>\n<$checkbox field=<<selectionField>> checked=\"checked\" unchecked=\"unchecked\" default=\"checked\" disabled={{{[<currentTiddler>has<suppressedField>then[yes]else[no]]}}}/>\n</td>\n<td>\n<$reveal type=\"nomatch\" state=<<renameFieldState>> text=\"yes\" tag=\"div\">\n<$reveal type=\"nomatch\" state=<<previewPopupState>> text=\"yes\" tag=\"div\" class=\"tc-flex\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown tc-flex-grow-1 tc-word-break\" set=<<previewPopupState>> setTo=\"yes\" disabled={{{[<currentTiddler>has<suppressedField>then[yes]else[no]]}}}>\n<span class=\"tc-small-gap-right\">{{$:/core/images/right-arrow}}</span><$text text={{{[subfilter<payloadTitleFilter>]}}}/>\n</$button>\n<$list filter=\"[<currentTiddler>!has<suppressedField>]\"><$button class=\"tc-btn-invisible\" set=<<renameFieldState>> setTo=\"yes\" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/Tooltip]get[text]]}}}>{{$:/core/images/edit-button}}</$button></$list>\n</$reveal>\n<$reveal type=\"match\" state=<<previewPopupState>> text=\"yes\" tag=\"div\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<<previewPopupState>> setTo=\"no\">\n<span class=\"tc-small-gap-right\">{{$:/core/images/down-arrow}}</span><$text text={{{[subfilter<payloadTitleFilter>]}}}/>\n</$button>\n</$reveal>\n</$reveal>\n<$reveal type=\"match\" state=<<renameFieldState>> text=\"yes\" tag=\"div\">\n<$text text={{{[<lingo-base>addsuffix[Listing/Rename/Prompt]get[text]]}}}/>\n</$reveal>\n</td>\n<td>\n<<selectionInfo>>\n<<libraryInfo>>\n<<overWriteWarning>>\n</td>\n</tr>\n<$reveal type=\"match\" state=<<renameFieldState>> text=\"yes\" tag=\"tr\">\n<td colspan=\"3\">\n<div class=\"tc-flex\">\n<$edit-text tiddler=<<newImportTitleTiddler>> default={{{[subfilter<payloadTitleFilter>]}}} tag=\"input\" class=\"tc-import-rename tc-flex-grow-1\"/><span class=\"tc-small-gap-left\"><$button class=\"tc-btn-invisible\" set=<<renameFieldState>> setTo=\"no\" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/CancelRename]get[text]]}}}>{{$:/core/images/close-button}}<$action-deletetiddler $tiddler=<<newImportTitleTiddler>>/></$button><span class=\"tc-small-gap-right\"/></span><$button class=\"tc-btn-invisible\" set=<<renameFieldState>> setTo=\"no\" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/ConfirmRename]get[text]]}}}>{{$:/core/images/done-button}}<$action-setfield $field=<<renameField>> $value={{{[<newImportTitleTiddler>get[text]minlength[1]else<payloadTiddler>]}}} /><$action-deletetiddler $tiddler=<<newImportTitleTiddler>>/></$button>\n</div>\n</td>\n</$reveal>\n<tr>\n<td colspan=\"3\">\n<$reveal type=\"match\" text=\"yes\" state=<<previewPopupState>> tag=\"div\">\n<$list filter=\"[{$:/state/importpreviewtype}has[text]]\" variable=\"listItem\" emptyMessage={{$:/core/ui/ImportPreviews/Text}}>\n<$transclude tiddler={{$:/state/importpreviewtype}}/>\n</$list>\n</$reveal>\n</td>\n</tr>\n</$list>\n</tbody>\n</table>\n"
},
"$:/core/ui/ImportPreviews/Diff": {
"title": "$:/core/ui/ImportPreviews/Diff",
"tags": "$:/tags/ImportPreview",
"caption": "{{$:/language/Import/Listing/Preview/Diff}}",
"text": "<$macrocall $name=\"compareTiddlerText\" sourceTiddlerTitle=<<payloadTiddler>> destTiddlerTitle=<<currentTiddler>> destSubTiddlerTitle=<<payloadTiddler>>/>\n"
},
"$:/core/ui/ImportPreviews/DiffFields": {
"title": "$:/core/ui/ImportPreviews/DiffFields",
"tags": "$:/tags/ImportPreview",
"caption": "{{$:/language/Import/Listing/Preview/DiffFields}}",
"text": "<$macrocall $name=\"compareTiddlers\" sourceTiddlerTitle=<<payloadTiddler>> destTiddlerTitle=<<currentTiddler>> destSubTiddlerTitle=<<payloadTiddler>> exclude=\"text\"/>\n"
},
"$:/core/ui/ImportPreviews/Fields": {
"title": "$:/core/ui/ImportPreviews/Fields",
"tags": "$:/tags/ImportPreview",
"caption": "{{$:/language/Import/Listing/Preview/Fields}}",
"text": "<table class=\"tc-view-field-table\">\n<tbody>\n<$list filter=\"[<payloadTiddler>subtiddlerfields<currentTiddler>sort[]] -text\" variable=\"fieldName\">\n<tr class=\"tc-view-field\">\n<td class=\"tc-view-field-name\">\n<$text text=<<fieldName>>/>\n</td>\n<td class=\"tc-view-field-value\">\n<$view field=<<fieldName>> tiddler=<<currentTiddler>> subtiddler=<<payloadTiddler>>/>\n</td>\n</tr>\n</$list>\n</tbody>\n</table>\n"
},
"$:/core/ui/ImportPreviews/Text": {
"title": "$:/core/ui/ImportPreviews/Text",
"tags": "$:/tags/ImportPreview",
"caption": "{{$:/language/Import/Listing/Preview/Text}}",
"text": "<$transclude tiddler=<<currentTiddler>> subtiddler=<<payloadTiddler>> mode=\"block\"/>\n"
},
"$:/core/ui/ImportPreviews/TextRaw": {
"title": "$:/core/ui/ImportPreviews/TextRaw",
"tags": "$:/tags/ImportPreview",
"caption": "{{$:/language/Import/Listing/Preview/TextRaw}}",
"text": "<pre><code><$view tiddler=<<currentTiddler>> subtiddler=<<payloadTiddler>> /></code></pre>"
},
"$:/core/ui/KeyboardShortcuts/advanced-search": {
"title": "$:/core/ui/KeyboardShortcuts/advanced-search",
"tags": "$:/tags/KeyboardShortcut",
"key": "((advanced-search))",
"text": "<$navigator story=\"$:/StoryList\" history=\"$:/HistoryList\">\n<$action-navigate $to=\"$:/AdvancedSearch\"/>\n<$action-sendmessage $message=\"tm-focus-selector\" $param=\"\"\"[data-tiddler-title=\"$:/AdvancedSearch\"] .tc-search input\"\"\" preventScroll=\"true\"/>\n</$navigator>\n"
},
"$:/core/ui/KeyboardShortcuts/change-sidebar-layout": {
"title": "$:/core/ui/KeyboardShortcuts/change-sidebar-layout",
"tags": "$:/tags/KeyboardShortcut",
"key": "((change-sidebar-layout))",
"text": "<$list filter=\"[{$:/themes/tiddlywiki/vanilla/options/sidebarlayout}match[fixed-fluid]]\" \nemptyMessage=\"\"\"<$action-setfield $tiddler=\"$:/themes/tiddlywiki/vanilla/options/sidebarlayout\" text=\"fixed-fluid\"/>\"\"\">\n<$action-setfield $tiddler=\"$:/themes/tiddlywiki/vanilla/options/sidebarlayout\" text=\"fluid-fixed\"/>\n</$list>\n"
},
"$:/core/ui/KeyboardShortcuts/new-image": {
"title": "$:/core/ui/KeyboardShortcuts/new-image",
"tags": "$:/tags/KeyboardShortcut",
"key": "((new-image))",
"text": "<$navigator story=\"$:/StoryList\" history=\"$:/HistoryList\" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>\n{{$:/core/ui/Actions/new-image}}\n</$navigator>\n"
},
"$:/core/ui/KeyboardShortcuts/new-journal": {
"title": "$:/core/ui/KeyboardShortcuts/new-journal",
"tags": "$:/tags/KeyboardShortcut",
"key": "((new-journal))",
"text": "<$navigator story=\"$:/StoryList\" history=\"$:/HistoryList\" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>\n{{$:/core/ui/Actions/new-journal}}\n</$navigator>\n"
},
"$:/core/ui/KeyboardShortcuts/new-tiddler": {
"title": "$:/core/ui/KeyboardShortcuts/new-tiddler",
"tags": "$:/tags/KeyboardShortcut",
"key": "((new-tiddler))",
"text": "<$navigator story=\"$:/StoryList\" history=\"$:/HistoryList\" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>\n{{$:/core/ui/Actions/new-tiddler}}\n</$navigator>\n"
},
"$:/core/ui/KeyboardShortcuts/save-wiki": {
"title": "$:/core/ui/KeyboardShortcuts/save-wiki",
"tags": "$:/tags/KeyboardShortcut",
"key": "((save-wiki))",
"text": "<$wikify name=\"site-title\" text={{$:/config/SaveWikiButton/Filename}}>\n<$action-sendmessage $message=\"tm-save-wiki\" $param={{$:/config/SaveWikiButton/Template}} filename=<<site-title>>/>\n</$wikify>\n"
},
"$:/core/ui/KeyboardShortcuts/sidebar-search": {
"title": "$:/core/ui/KeyboardShortcuts/sidebar-search",
"tags": "$:/tags/KeyboardShortcut",
"key": "((sidebar-search))",
"text": "<$action-sendmessage $message=\"tm-focus-selector\" $param=\".tc-search input\"/>\n"
},
"$:/core/ui/KeyboardShortcuts/switcher": {
"title": "$:/core/ui/KeyboardShortcuts/switcher",
"tags": "$:/tags/KeyboardShortcut",
"key": "((layout-switcher))",
"text": "<$action-sendmessage $message=\"tm-show-switcher\" switch=\"layout\"/>"
},
"$:/core/ui/KeyboardShortcuts/toggle-sidebar": {
"title": "$:/core/ui/KeyboardShortcuts/toggle-sidebar",
"tags": "$:/tags/KeyboardShortcut",
"key": "((toggle-sidebar))",
"text": "<$list filter=\"[[$:/state/sidebar]is[missing]] [{$:/state/sidebar}removeprefix[yes]]\" emptyMessage=\"\"\"\n<$action-setfield $tiddler=\"$:/state/sidebar\" text=\"yes\"/>\n\"\"\">\n<$action-setfield $tiddler=\"$:/state/sidebar\" text=\"no\"/>\n</$list>\n"
},
"$:/snippets/LayoutSwitcher": {
"title": "$:/snippets/LayoutSwitcher",
"tags": "$:/tags/ControlPanel/Appearance",
"caption": "{{$:/language/ControlPanel/LayoutSwitcher/Caption}}",
"text": "<$linkcatcher to=\"$:/layout\">\n<div class=\"tc-chooser\">\n<$list filter=\"[all[tiddlers+shadows]tag[$:/tags/Layout]] [[$:/core/ui/PageTemplate]] +[!is[draft]sort[name]]\">\n<$list filter=\"[{$:/layout}!has[text]]\" variable=\"ignore\" emptyMessage=\"\"\"\n<$set name=\"cls\" filter=\"[all[current]field:title{$:/layout}]\" value=\"tc-chooser-item tc-chosen\" emptyValue=\"tc-chooser-item\"><div class=<<cls>>><$link to={{!!title}}>''<$transclude field=\"name\"/>'' - <$transclude field=\"description\"/></$link></div>\n</$set>\n\"\"\">\n<$set name=\"cls\" filter=\"[all[current]field:title[$:/core/ui/PageTemplate]]\" value=\"tc-chooser-item tc-chosen\" emptyValue=\"tc-chooser-item\"><div class=<<cls>>><$link to={{!!title}}>''<$transclude field=\"name\"/>'' - <$transclude field=\"description\"/></$link></div>\n</$set>\n</$list>\n</$list>\n</div>\n</$linkcatcher>\n"
},
"$:/core/ui/ListItemTemplate": {
"title": "$:/core/ui/ListItemTemplate",
"text": "<div class=\"tc-menu-list-item\">\n<$link />\n</div>"
},
"$:/Manager/ItemMain/Fields": {
"title": "$:/Manager/ItemMain/Fields",
"tags": "$:/tags/Manager/ItemMain",
"caption": "{{$:/language/Manager/Item/Fields}}",
"text": "<table>\n<tbody>\n<$list filter=\"[all[current]fields[]sort[title]] -text\" template=\"$:/core/ui/TiddlerFieldTemplate\" variable=\"listItem\"/>\n</tbody>\n</table>\n"
},
"$:/Manager/ItemMain/RawText": {
"title": "$:/Manager/ItemMain/RawText",
"tags": "$:/tags/Manager/ItemMain",
"caption": "{{$:/language/Manager/Item/RawText}}",
"text": "<pre><code><$view/></code></pre>\n"
},
"$:/Manager/ItemMain/WikifiedText": {
"title": "$:/Manager/ItemMain/WikifiedText",
"tags": "$:/tags/Manager/ItemMain",
"caption": "{{$:/language/Manager/Item/WikifiedText}}",
"text": "<$transclude mode=\"block\"/>\n"
},
"$:/Manager/ItemSidebar/Colour": {
"title": "$:/Manager/ItemSidebar/Colour",
"tags": "$:/tags/Manager/ItemSidebar",
"caption": "{{$:/language/Manager/Item/Colour}}",
"text": "\\define swatch-styles()\nheight: 1em;\nbackground-color: $(colour)$\n\\end\n\n<$vars colour={{!!color}}>\n<p style=<<swatch-styles>>/>\n</$vars>\n<p>\n<$edit-text field=\"color\" tag=\"input\" type=\"color\"/> / <$edit-text field=\"color\" tag=\"input\" type=\"text\" size=\"9\"/>\n</p>\n"
},
"$:/Manager/ItemSidebar/Icon": {
"title": "$:/Manager/ItemSidebar/Icon",
"tags": "$:/tags/Manager/ItemSidebar",
"caption": "{{$:/language/Manager/Item/Icon}}",
"text": "<p>\n<div class=\"tc-manager-icon-editor\">\n<$button popup=<<qualify \"$:/state/popup/image-picker\">> class=\"tc-btn-invisible\">\n<$transclude tiddler={{!!icon}}>\n{{$:/language/Manager/Item/Icon/None}}\n</$transclude>\n</$button>\n<div class=\"tc-block-dropdown-wrapper\" style=\"position: static;\">\n<$reveal state=<<qualify \"$:/state/popup/image-picker\">> type=\"nomatch\" text=\"\" default=\"\" tag=\"div\" class=\"tc-popup\">\n<div class=\"tc-block-dropdown tc-popup-keep\" style=\"width: 80%; left: 10%; right: 10%; padding: 0.5em;\">\n<$macrocall $name=\"image-picker-include-tagged-images\" actions=\"\"\"\n<$action-setfield $field=\"icon\" $value=<<imageTitle>>/>\n<$action-deletetiddler $tiddler=<<qualify \"$:/state/popup/image-picker\">>/>\n\"\"\"/>\n</div>\n</$reveal>\n</div>\n</div>\n</p>\n"
},
"$:/Manager/ItemSidebar/Tags": {
"title": "$:/Manager/ItemSidebar/Tags",
"tags": "$:/tags/Manager/ItemSidebar",
"caption": "{{$:/language/Manager/Item/Tags}}",
"text": "\\whitespace trim\n\\define tag-checkbox-actions()\n<$action-listops\n\t$tiddler=\"$:/config/Manager/RecentTags\"\n\t$subfilter=\"[<tag>] [list[$:/config/Manager/RecentTags]] +[limit[12]]\"\n/>\n\\end\n\n\\define tag-picker-actions()\n<<tag-checkbox-actions>>\n\\end\n\n<p>\n<$list filter=\"[all[current]tags[]] [list[$:/config/Manager/RecentTags]] +[sort[title]] \" variable=\"tag\" storyview=\"pop\">\n<div>\n<$checkbox tiddler=<<currentTiddler>> tag=<<tag>> actions=<<tag-checkbox-actions>>>\n<$macrocall $name=\"tag-pill\" tag=<<tag>>/>\n</$checkbox>\n</div>\n</$list>\n</p>\n<p>\n<$fieldmangler>\n<$macrocall $name=\"tag-picker\" actions=<<tag-picker-actions>>/>\n</$fieldmangler>\n</p>\n"
},
"$:/Manager/ItemSidebar/Tools": {
"title": "$:/Manager/ItemSidebar/Tools",
"tags": "$:/tags/Manager/ItemSidebar",
"caption": "{{$:/language/Manager/Item/Tools}}",
"text": "<p>\n<$button to=<<currentTiddler>>>{{$:/core/images/link}} open</$button>\n</p>\n<p>\n<$button message=\"tm-edit-tiddler\" param=<<currentTiddler>>>{{$:/core/images/edit-button}} edit</$button>\n</p>\n"
},
"$:/Manager": {
"title": "$:/Manager",
"icon": "$:/core/images/list",
"color": "#bbb",
"text": "\\define lingo-base() $:/language/Manager/\n\n\\define list-item-content-item()\n<div class=\"tc-manager-list-item-content-item\">\n\t<$vars state-title=\"\"\"$:/state/popup/manager/item/$(listItem)$\"\"\">\n\t\t<$reveal state=<<state-title>> type=\"match\" text=\"show\" default=\"show\" tag=\"div\">\n\t\t\t<$button set=<<state-title>> setTo=\"hide\" class=\"tc-btn-invisible tc-manager-list-item-content-item-heading\">\n\t\t\t\t{{$:/core/images/down-arrow}} <$transclude tiddler=<<listItem>> field=\"caption\"/>\n\t\t\t</$button>\n\t\t</$reveal>\n\t\t<$reveal state=<<state-title>> type=\"nomatch\" text=\"show\" default=\"show\" tag=\"div\">\n\t\t\t<$button set=<<state-title>> setTo=\"show\" class=\"tc-btn-invisible tc-manager-list-item-content-item-heading\">\n\t\t\t\t{{$:/core/images/right-arrow}} <$transclude tiddler=<<listItem>> field=\"caption\"/>\n\t\t\t</$button>\n\t\t</$reveal>\n\t\t<$reveal state=<<state-title>> type=\"match\" text=\"show\" default=\"show\" tag=\"div\" class=\"tc-manager-list-item-content-item-body\">\n\t\t\t<$transclude tiddler=<<listItem>>/>\n\t\t</$reveal>\n\t</$vars>\n</div>\n\\end\n\n<div class=\"tc-manager-wrapper\">\n\t<div class=\"tc-manager-controls\">\n\t\t<div class=\"tc-manager-control\">\n\t\t\t<<lingo Controls/Show/Prompt>> <$select tiddler=\"$:/config/Manager/Show\" default=\"tiddlers\">\n\t\t\t\t<option value=\"tiddlers\"><<lingo Controls/Show/Option/Tiddlers>></option>\n\t\t\t\t<option value=\"tags\"><<lingo Controls/Show/Option/Tags>></option>\n\t\t\t</$select>\n\t\t</div>\n\t\t<div class=\"tc-manager-control\">\n\t\t\t<<lingo Controls/Search/Prompt>> <$edit-text tiddler=\"$:/config/Manager/Filter\" tag=\"input\" default=\"\" placeholder={{$:/language/Manager/Controls/Search/Placeholder}}/>\n\t\t</div>\n\t\t<div class=\"tc-manager-control\">\n\t\t\t<<lingo Controls/FilterByTag/Prompt>> <$select tiddler=\"$:/config/Manager/Tag\" default=\"\">\n\t\t\t\t<option value=\"\"><<lingo Controls/FilterByTag/None>></option>\n\t\t\t\t<$list filter=\"[!is{$:/config/Manager/System}tags[]!is[system]sort[title]]\" variable=\"tag\">\n\t\t\t\t\t<option value=<<tag>>><$text text=<<tag>>/></option>\n\t\t\t\t</$list>\n\t\t\t</$select>\n\t\t</div>\n\t\t<div class=\"tc-manager-control\">\n\t\t\t<<lingo Controls/Sort/Prompt>> <$select tiddler=\"$:/config/Manager/Sort\" default=\"title\">\n\t\t\t\t<optgroup label=\"Common\">\n\t\t\t\t\t<$list filter=\"title modified modifier created creator created\" variable=\"field\">\n\t\t\t\t\t\t<option value=<<field>>><$text text=<<field>>/></option>\n\t\t\t\t\t</$list>\n\t\t\t\t</optgroup>\n\t\t\t\t<optgroup label=\"All\">\n\t\t\t\t\t<$list filter=\"[all{$:/config/Manager/Show}!is{$:/config/Manager/System}fields[]sort[title]] -title -modified -modifier -created -creator -created\" variable=\"field\">\n\t\t\t\t\t\t<option value=<<field>>><$text text=<<field>>/></option>\n\t\t\t\t\t</$list>\n\t\t\t\t</optgroup>\n\t\t\t</$select>\n\t\t\t<$checkbox tiddler=\"$:/config/Manager/Order\" field=\"text\" checked=\"reverse\" unchecked=\"forward\" default=\"forward\">\n\t\t\t\t<<lingo Controls/Order/Prompt>>\n\t\t\t</$checkbox>\n\t\t</div>\n\t\t<div class=\"tc-manager-control\">\n\t\t\t<$checkbox tiddler=\"$:/config/Manager/System\" field=\"text\" checked=\"\" unchecked=\"system\" default=\"system\">\n\t\t\t\t{{$:/language/SystemTiddlers/Include/Prompt}}\n\t\t\t</$checkbox>\n\t\t</div>\n\t</div>\n\t<div class=\"tc-manager-list\">\n\t\t<$list filter=\"[all{$:/config/Manager/Show}!is{$:/config/Manager/System}search{$:/config/Manager/Filter}tag:strict{$:/config/Manager/Tag}sort{$:/config/Manager/Sort}order{$:/config/Manager/Order}]\">\n\t\t\t<$vars transclusion=<<currentTiddler>>>\n\t\t\t\t<div style=\"tc-manager-list-item\">\n\t\t\t\t\t<$button popup=<<qualify \"$:/state/manager/popup\">> class=\"tc-btn-invisible tc-manager-list-item-heading\" selectedClass=\"tc-manager-list-item-heading-selected\">\n\t\t\t\t\t\t<$text text=<<currentTiddler>>/>\n\t\t\t\t\t</$button>\n\t\t\t\t\t<$reveal state=<<qualify \"$:/state/manager/popup\">> type=\"nomatch\" text=\"\" default=\"\" tag=\"div\" class=\"tc-manager-list-item-content tc-popup-handle\">\n\t\t\t\t\t\t<div class=\"tc-manager-list-item-content-tiddler\">\n\t\t\t\t\t\t\t<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Manager/ItemMain]!has[draft.of]]\" variable=\"listItem\">\n\t\t\t\t\t\t\t\t<<list-item-content-item>>\n\t\t\t\t\t\t\t</$list>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"tc-manager-list-item-content-sidebar\">\n\t\t\t\t\t\t\t<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Manager/ItemSidebar]!has[draft.of]]\" variable=\"listItem\">\n\t\t\t\t\t\t\t\t<<list-item-content-item>>\n\t\t\t\t\t\t\t</$list>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</$reveal>\n\t\t\t\t</div>\n\t\t\t</$vars>\n\t\t</$list>\n\t</div>\n</div>\n"
},
"$:/core/ui/MissingTemplate": {
"title": "$:/core/ui/MissingTemplate",
"text": "<div class=\"tc-tiddler-missing\">\n<$button popup=<<qualify \"$:/state/popup/missing\">> class=\"tc-btn-invisible tc-missing-tiddler-label\">\n<$view field=\"title\" format=\"text\" />\n</$button>\n<$reveal state=<<qualify \"$:/state/popup/missing\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down\">\n<$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n<hr>\n<$list filter=\"[all[current]backlinks[]sort[title]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n</div>\n</$reveal>\n</div>\n"
},
"$:/core/ui/MoreSideBar/All": {
"title": "$:/core/ui/MoreSideBar/All",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/All/Caption}}",
"text": "<$list filter={{$:/core/Filters/AllTiddlers!!filter}} template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/Drafts": {
"title": "$:/core/ui/MoreSideBar/Drafts",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Drafts/Caption}}",
"text": "<$list filter={{$:/core/Filters/Drafts!!filter}} template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/Explorer": {
"title": "$:/core/ui/MoreSideBar/Explorer",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Explorer/Caption}}",
"text": "<<tree \"$:/\">>\n"
},
"$:/core/ui/MoreSideBar/Missing": {
"title": "$:/core/ui/MoreSideBar/Missing",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Missing/Caption}}",
"text": "<$list filter={{$:/core/Filters/Missing!!filter}} template=\"$:/core/ui/MissingTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/Orphans": {
"title": "$:/core/ui/MoreSideBar/Orphans",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Orphans/Caption}}",
"text": "<$list filter={{$:/core/Filters/Orphans!!filter}} template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/Plugins": {
"title": "$:/core/ui/MoreSideBar/Plugins",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/ControlPanel/Plugins/Caption}}",
"text": "\n{{$:/language/ControlPanel/Plugins/Installed/Hint}}\n\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/MoreSideBar/Plugins]!has[draft.of]]\" default=\"$:/core/ui/MoreSideBar/Plugins/Plugins\" explicitState=\"$:/state/tab-1163638994\"/>\n"
},
"$:/core/ui/MoreSideBar/Recent": {
"title": "$:/core/ui/MoreSideBar/Recent",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Recent/Caption}}",
"text": "<$macrocall $name=\"timeline\" format={{$:/language/RecentChanges/DateFormat}}/>\n"
},
"$:/core/ui/MoreSideBar/Shadows": {
"title": "$:/core/ui/MoreSideBar/Shadows",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Shadows/Caption}}",
"text": "<$list filter={{$:/core/Filters/ShadowTiddlers!!filter}} template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/System": {
"title": "$:/core/ui/MoreSideBar/System",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/System/Caption}}",
"text": "<$list filter={{$:/core/Filters/SystemTiddlers!!filter}} template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/MoreSideBar/Tags": {
"title": "$:/core/ui/MoreSideBar/Tags",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Tags/Caption}}",
"text": "<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"\">\n\n{{$:/core/ui/Buttons/tag-manager}}\n\n</$set>\n\n</$set>\n\n</$set>\n\n<$list filter={{$:/core/Filters/AllTags!!filter}}>\n\n<$transclude tiddler=\"$:/core/ui/TagTemplate\"/>\n\n</$list>\n\n<hr class=\"tc-untagged-separator\">\n\n{{$:/core/ui/UntaggedTemplate}}\n"
},
"$:/core/ui/MoreSideBar/Types": {
"title": "$:/core/ui/MoreSideBar/Types",
"tags": "$:/tags/MoreSideBar",
"caption": "{{$:/language/SideBar/Types/Caption}}",
"text": "<$list filter={{$:/core/Filters/TypedTiddlers!!filter}}>\n<div class=\"tc-menu-list-item\">\n<$view field=\"type\"/>\n<$list filter=\"[type{!!type}!is[system]sort[title]]\">\n<div class=\"tc-menu-list-subitem\">\n<$link to={{!!title}}><$view field=\"title\"/></$link>\n</div>\n</$list>\n</div>\n</$list>\n"
},
"$:/core/ui/MoreSideBar/Plugins/Languages": {
"title": "$:/core/ui/MoreSideBar/Plugins/Languages",
"tags": "$:/tags/MoreSideBar/Plugins",
"caption": "{{$:/language/ControlPanel/Plugins/Languages/Caption}}",
"text": "<$list filter=\"[!has[draft.of]plugin-type[language]sort[description]]\" template=\"$:/core/ui/PluginListItemTemplate\" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}/>\n"
},
"$:/core/ui/MoreSideBar/Plugins/Plugins": {
"title": "$:/core/ui/MoreSideBar/Plugins/Plugins",
"tags": "$:/tags/MoreSideBar/Plugins",
"caption": "{{$:/language/ControlPanel/Plugins/Plugins/Caption}}",
"text": "<$list filter=\"[!has[draft.of]plugin-type[plugin]sort[description]]\" template=\"$:/core/ui/PluginListItemTemplate\" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}>>/>\n"
},
"$:/core/ui/MoreSideBar/Plugins/Theme": {
"title": "$:/core/ui/MoreSideBar/Plugins/Theme",
"tags": "$:/tags/MoreSideBar/Plugins",
"caption": "{{$:/language/ControlPanel/Plugins/Themes/Caption}}",
"text": "<$list filter=\"[!has[draft.of]plugin-type[theme]sort[description]]\" template=\"$:/core/ui/PluginListItemTemplate\" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}/>\n"
},
"$:/core/ui/Buttons/advanced-search": {
"title": "$:/core/ui/Buttons/advanced-search",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/advanced-search-button}} {{$:/language/Buttons/AdvancedSearch/Caption}}",
"description": "{{$:/language/Buttons/AdvancedSearch/Hint}}",
"text": "\\whitespace trim\n\\define advanced-search-button(class)\n\\whitespace trim\n<$button to=\"$:/AdvancedSearch\" tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class=\"\"\"$(tv-config-toolbar-class)$ $class$\"\"\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/advanced-search-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/AdvancedSearch/Caption}}/></span>\n</$list>\n</$button>\n\\end\n\n<$list filter=\"[list[$:/StoryList]] +[field:title[$:/AdvancedSearch]]\" emptyMessage=<<advanced-search-button>>>\n<<advanced-search-button \"tc-selected\">>\n</$list>\n"
},
"$:/core/ui/Buttons/close-all": {
"title": "$:/core/ui/Buttons/close-all",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/close-all-button}} {{$:/language/Buttons/CloseAll/Caption}}",
"description": "{{$:/language/Buttons/CloseAll/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-close-all-tiddlers\" tooltip={{$:/language/Buttons/CloseAll/Hint}} aria-label={{$:/language/Buttons/CloseAll/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/close-all-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/CloseAll/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/control-panel": {
"title": "$:/core/ui/Buttons/control-panel",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/options-button}} {{$:/language/Buttons/ControlPanel/Caption}}",
"description": "{{$:/language/Buttons/ControlPanel/Hint}}",
"text": "\\whitespace trim\n\\define control-panel-button(class)\n\\whitespace trim\n<$button to=\"$:/ControlPanel\" tooltip={{$:/language/Buttons/ControlPanel/Hint}} aria-label={{$:/language/Buttons/ControlPanel/Caption}} class=\"\"\"$(tv-config-toolbar-class)$ $class$\"\"\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/options-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/ControlPanel/Caption}}/></span>\n</$list>\n</$button>\n\\end\n\n<$list filter=\"[list[$:/StoryList]] +[field:title[$:/ControlPanel]]\" emptyMessage=<<control-panel-button>>>\n<<control-panel-button \"tc-selected\">>\n</$list>\n"
},
"$:/core/ui/Buttons/encryption": {
"title": "$:/core/ui/Buttons/encryption",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/locked-padlock}} {{$:/language/Buttons/Encryption/Caption}}",
"description": "{{$:/language/Buttons/Encryption/Hint}}",
"text": "\\whitespace trim\n<$reveal type=\"match\" state=\"$:/isEncrypted\" text=\"yes\">\n<$button message=\"tm-clear-password\" tooltip={{$:/language/Buttons/Encryption/ClearPassword/Hint}} aria-label={{$:/language/Buttons/Encryption/ClearPassword/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/locked-padlock}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Encryption/ClearPassword/Caption}}/>\n</span>\n</$list>\n</$button>\n</$reveal>\n<$reveal type=\"nomatch\" state=\"$:/isEncrypted\" text=\"yes\">\n<$button message=\"tm-set-password\" tooltip={{$:/language/Buttons/Encryption/SetPassword/Hint}} aria-label={{$:/language/Buttons/Encryption/SetPassword/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/unlocked-padlock}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Encryption/SetPassword/Caption}}/>\n</span>\n</$list>\n</$button>\n</$reveal>\n"
},
"$:/core/ui/Buttons/export-page": {
"title": "$:/core/ui/Buttons/export-page",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/export-button}} {{$:/language/Buttons/ExportPage/Caption}}",
"description": "{{$:/language/Buttons/ExportPage/Hint}}",
"text": "<$macrocall $name=\"exportButton\" exportFilter=\"[!is[system]sort[title]]\" lingoBase=\"$:/language/Buttons/ExportPage/\"/>"
},
"$:/core/ui/Buttons/fold-all": {
"title": "$:/core/ui/Buttons/fold-all",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/fold-all-button}} {{$:/language/Buttons/FoldAll/Caption}}",
"description": "{{$:/language/Buttons/FoldAll/Hint}}",
"text": "\\whitespace trim\n<$button tooltip={{$:/language/Buttons/FoldAll/Hint}} aria-label={{$:/language/Buttons/FoldAll/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-fold-all-tiddlers\" $param=<<currentTiddler>> foldedStatePrefix=\"$:/state/folded/\"/>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\" variable=\"listItem\">\n{{$:/core/images/fold-all-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/FoldAll/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/full-screen": {
"title": "$:/core/ui/Buttons/full-screen",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/full-screen-button}} {{$:/language/Buttons/FullScreen/Caption}}",
"description": "{{$:/language/Buttons/FullScreen/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-full-screen\" tooltip={{$:/language/Buttons/FullScreen/Hint}} aria-label={{$:/language/Buttons/FullScreen/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/full-screen-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/FullScreen/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/home": {
"title": "$:/core/ui/Buttons/home",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/home-button}} {{$:/language/Buttons/Home/Caption}}",
"description": "{{$:/language/Buttons/Home/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-home\" tooltip={{$:/language/Buttons/Home/Hint}} aria-label={{$:/language/Buttons/Home/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/home-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Home/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/import": {
"title": "$:/core/ui/Buttons/import",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/import-button}} {{$:/language/Buttons/Import/Caption}}",
"description": "{{$:/language/Buttons/Import/Hint}}",
"text": "\\whitespace trim\n<div class=\"tc-file-input-wrapper\">\n<$button tooltip={{$:/language/Buttons/Import/Hint}} aria-label={{$:/language/Buttons/Import/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/import-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Import/Caption}}/>\n</span>\n</$list>\n</$button>\n<$browse tooltip={{$:/language/Buttons/Import/Hint}}/>\n</div>"
},
"$:/core/ui/Buttons/language": {
"title": "$:/core/ui/Buttons/language",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/globe}} {{$:/language/Buttons/Language/Caption}}",
"description": "{{$:/language/Buttons/Language/Hint}}",
"text": "\\whitespace trim\n\\define flag-title()\n$(languagePluginTitle)$/icon\n\\end\n<span class=\"tc-popup-keep\">\n<$button popup=<<qualify \"$:/state/popup/language\">> tooltip={{$:/language/Buttons/Language/Hint}} aria-label={{$:/language/Buttons/Language/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n<span class=\"tc-image-button\">\n<$set name=\"languagePluginTitle\" value={{$:/language}}>\n<$image source=<<flag-title>>/>\n</$set>\n</span>\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Language/Caption}}/></span>\n</$list>\n</$button>\n</span>\n<$reveal state=<<qualify \"$:/state/popup/language\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down\">\n{{$:/snippets/languageswitcher}}\n</div>\n</$reveal>\n"
},
"$:/core/ui/Buttons/manager": {
"title": "$:/core/ui/Buttons/manager",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/list}} {{$:/language/Buttons/Manager/Caption}}",
"description": "{{$:/language/Buttons/Manager/Hint}}",
"text": "\\whitespace trim\n\\define manager-button(class)\n\\whitespace trim\n<$button to=\"$:/Manager\" tooltip={{$:/language/Buttons/Manager/Hint}} aria-label={{$:/language/Buttons/Manager/Caption}} class=\"\"\"$(tv-config-toolbar-class)$ $class$\"\"\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/list}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Manager/Caption}}/>\n</span>\n</$list>\n</$button>\n\\end\n\n<$list filter=\"[list[$:/StoryList]] +[field:title[$:/Manager]]\" emptyMessage=<<manager-button>>>\n<<manager-button \"tc-selected\">>\n</$list>\n"
},
"$:/core/ui/Buttons/more-page-actions": {
"title": "$:/core/ui/Buttons/more-page-actions",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/down-arrow}} {{$:/language/Buttons/More/Caption}}",
"description": "{{$:/language/Buttons/More/Hint}}",
"text": "\\whitespace trim\n\\define config-title()\n$:/config/PageControlButtons/Visibility/$(listItem)$\n\\end\n<$button popup=<<qualify \"$:/state/popup/more\">> tooltip={{$:/language/Buttons/More/Hint}} aria-label={{$:/language/Buttons/More/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/down-arrow}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/More/Caption}}/>\n</span>\n</$list>\n</$button><$reveal state=<<qualify \"$:/state/popup/more\">> type=\"popup\" position=\"below\" animate=\"yes\">\n\n<div class=\"tc-drop-down\">\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"tc-btn-invisible\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]] -[[$:/core/ui/Buttons/more-page-actions]]\" variable=\"listItem\">\n\n<$reveal type=\"match\" state=<<config-title>> text=\"hide\">\n\n<$set name=\"tv-config-toolbar-class\" filter=\"[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]\">\n\n<$transclude tiddler=<<listItem>> mode=\"inline\"/>\n\n</$set>\n\n</$reveal>\n\n</$list>\n\n</$set>\n\n</$set>\n\n</$set>\n\n</div>\n\n</$reveal>"
},
"$:/core/ui/Buttons/new-image": {
"title": "$:/core/ui/Buttons/new-image",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/new-image-button}} {{$:/language/Buttons/NewImage/Caption}}",
"description": "{{$:/language/Buttons/NewImage/Hint}}",
"text": "\\whitespace trim\n<$button tooltip={{$:/language/Buttons/NewImage/Hint}} aria-label={{$:/language/Buttons/NewImage/Caption}} class=<<tv-config-toolbar-class>> actions={{$:/core/ui/Actions/new-image}}>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/new-image-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/NewImage/Caption}}/>\n</span>\n</$list>\n</$button>\n"
},
"$:/core/ui/Buttons/new-journal": {
"title": "$:/core/ui/Buttons/new-journal",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/new-journal-button}} {{$:/language/Buttons/NewJournal/Caption}}",
"description": "{{$:/language/Buttons/NewJournal/Hint}}",
"text": "\\whitespace trim\n\\define journalButton()\n\\whitespace trim\n<$button tooltip={{$:/language/Buttons/NewJournal/Hint}} aria-label={{$:/language/Buttons/NewJournal/Caption}} class=<<tv-config-toolbar-class>> actions={{$:/core/ui/Actions/new-journal}}>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/new-journal-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/NewJournal/Caption}}/>\n</span>\n</$list>\n</$button>\n\\end\n<<journalButton>>\n"
},
"$:/core/ui/Buttons/new-tiddler": {
"title": "$:/core/ui/Buttons/new-tiddler",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/new-button}} {{$:/language/Buttons/NewTiddler/Caption}}",
"description": "{{$:/language/Buttons/NewTiddler/Hint}}",
"text": "\\whitespace trim\n<$button actions={{$:/core/ui/Actions/new-tiddler}} tooltip={{$:/language/Buttons/NewTiddler/Hint}} aria-label={{$:/language/Buttons/NewTiddler/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/new-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/NewTiddler/Caption}}/>\n</span>\n</$list>\n</$button>\n"
},
"$:/core/ui/Buttons/palette": {
"title": "$:/core/ui/Buttons/palette",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/palette}} {{$:/language/Buttons/Palette/Caption}}",
"description": "{{$:/language/Buttons/Palette/Hint}}",
"text": "\\whitespace trim\n<span class=\"tc-popup-keep\">\n<$button popup=<<qualify \"$:/state/popup/palette\">> tooltip={{$:/language/Buttons/Palette/Hint}} aria-label={{$:/language/Buttons/Palette/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/palette}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Palette/Caption}}/></span>\n</$list>\n</$button>\n</span>\n<$reveal state=<<qualify \"$:/state/popup/palette\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down\" style=\"font-size:0.7em;\">\n{{$:/snippets/paletteswitcher}}\n</div>\n</$reveal>\n"
},
"$:/core/ui/Buttons/print": {
"title": "$:/core/ui/Buttons/print",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/print-button}} {{$:/language/Buttons/Print/Caption}}",
"description": "{{$:/language/Buttons/Print/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-print\" tooltip={{$:/language/Buttons/Print/Hint}} aria-label={{$:/language/Buttons/Print/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/print-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Print/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/publish": {
"title": "$:/core/ui/Buttons/publish",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/publish}} {{$:/language/Buttons/Publish/Caption}}",
"description": "{{$:/language/Buttons/Publish/Hint}}",
"text": "\\define publish-actions()\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/PublishingJob]has[enabled]field:enabled[yes]]\" variable=\"job\">\n\t<$action-sendmessage $message=\"tm-publish\" job=<<job>>/>\n</$list>\n\\end\n\n<$button actions=<<publish-actions>> tooltip={{$:/language/Buttons/Publish/Hint}} aria-label={{$:/language/Buttons/Publish/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/publish}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Publish/Caption}}/></span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/refresh": {
"title": "$:/core/ui/Buttons/refresh",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/refresh-button}} {{$:/language/Buttons/Refresh/Caption}}",
"description": "{{$:/language/Buttons/Refresh/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-browser-refresh\" tooltip={{$:/language/Buttons/Refresh/Hint}} aria-label={{$:/language/Buttons/Refresh/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/refresh-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Refresh/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/save-wiki": {
"title": "$:/core/ui/Buttons/save-wiki",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/save-button}} {{$:/language/Buttons/SaveWiki/Caption}}",
"description": "{{$:/language/Buttons/SaveWiki/Hint}}",
"text": "\\whitespace trim\n<$button tooltip={{$:/language/Buttons/SaveWiki/Hint}} aria-label={{$:/language/Buttons/SaveWiki/Caption}} class=<<tv-config-toolbar-class>>>\n<$wikify name=\"site-title\" text={{$:/config/SaveWikiButton/Filename}}>\n<$action-sendmessage $message=\"tm-save-wiki\" $param={{$:/config/SaveWikiButton/Template}} filename=<<site-title>>/>\n</$wikify>\n<span class=\"tc-dirty-indicator\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/save-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/SaveWiki/Caption}}/>\n</span>\n</$list>\n</span>\n</$button>"
},
"$:/core/ui/Buttons/storyview": {
"title": "$:/core/ui/Buttons/storyview",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/storyview-classic}} {{$:/language/Buttons/StoryView/Caption}}",
"description": "{{$:/language/Buttons/StoryView/Hint}}",
"text": "\\whitespace trim\n\\define icon()\n$:/core/images/storyview-$(storyview)$\n\\end\n<span class=\"tc-popup-keep\">\n<$button popup=<<qualify \"$:/state/popup/storyview\">> tooltip={{$:/language/Buttons/StoryView/Hint}} aria-label={{$:/language/Buttons/StoryView/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n<$set name=\"storyview\" value={{$:/view}}>\n<$transclude tiddler=<<icon>>/>\n</$set>\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/StoryView/Caption}}/></span>\n</$list>\n</$button>\n</span>\n<$reveal state=<<qualify \"$:/state/popup/storyview\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down\">\n{{$:/snippets/viewswitcher}}\n</div>\n</$reveal>\n"
},
"$:/core/ui/Buttons/tag-manager": {
"title": "$:/core/ui/Buttons/tag-manager",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/tag-button}} {{$:/language/Buttons/TagManager/Caption}}",
"description": "{{$:/language/Buttons/TagManager/Hint}}",
"text": "\\whitespace trim\n\\define control-panel-button(class)\n\\whitespace trim\n<$button to=\"$:/TagManager\" tooltip={{$:/language/Buttons/TagManager/Hint}} aria-label={{$:/language/Buttons/TagManager/Caption}} class=\"\"\"$(tv-config-toolbar-class)$ $class$\"\"\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/tag-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/TagManager/Caption}}/>\n</span>\n</$list>\n</$button>\n\\end\n\n<$list filter=\"[list[$:/StoryList]] +[field:title[$:/TagManager]]\" emptyMessage=<<control-panel-button>>>\n<<control-panel-button \"tc-selected\">>\n</$list>\n"
},
"$:/core/ui/Buttons/theme": {
"title": "$:/core/ui/Buttons/theme",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/theme-button}} {{$:/language/Buttons/Theme/Caption}}",
"description": "{{$:/language/Buttons/Theme/Hint}}",
"text": "\\whitespace trim\n<span class=\"tc-popup-keep\">\n<$button popup=<<qualify \"$:/state/popup/theme\">> tooltip={{$:/language/Buttons/Theme/Hint}} aria-label={{$:/language/Buttons/Theme/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/theme-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\"><$text text={{$:/language/Buttons/Theme/Caption}}/></span>\n</$list>\n</$button>\n</span>\n<$reveal state=<<qualify \"$:/state/popup/theme\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down\">\n<$linkcatcher to=\"$:/theme\">\n{{$:/snippets/themeswitcher}}\n</$linkcatcher>\n</div>\n</$reveal>\n"
},
"$:/core/ui/Buttons/timestamp": {
"title": "$:/core/ui/Buttons/timestamp",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/timestamp-on}} {{$:/language/Buttons/Timestamp/Caption}}",
"description": "{{$:/language/Buttons/Timestamp/Hint}}",
"text": "\\whitespace trim\n<$reveal type=\"nomatch\" state=\"$:/config/TimestampDisable\" text=\"yes\">\n<$button tooltip={{$:/language/Buttons/Timestamp/On/Hint}} aria-label={{$:/language/Buttons/Timestamp/On/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-setfield $tiddler=\"$:/config/TimestampDisable\" $value=\"yes\"/>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/timestamp-on}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Timestamp/On/Caption}}/>\n</span>\n</$list>\n</$button>\n</$reveal>\n<$reveal type=\"match\" state=\"$:/config/TimestampDisable\" text=\"yes\">\n<$button tooltip={{$:/language/Buttons/Timestamp/Off/Hint}} aria-label={{$:/language/Buttons/Timestamp/Off/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-setfield $tiddler=\"$:/config/TimestampDisable\" $value=\"no\"/>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/timestamp-off}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Timestamp/Off/Caption}}/>\n</span>\n</$list>\n</$button>\n</$reveal>\n"
},
"$:/core/ui/Buttons/unfold-all": {
"title": "$:/core/ui/Buttons/unfold-all",
"tags": "$:/tags/PageControls",
"caption": "{{$:/core/images/unfold-all-button}} {{$:/language/Buttons/UnfoldAll/Caption}}",
"description": "{{$:/language/Buttons/UnfoldAll/Hint}}",
"text": "\\whitespace trim\n<$button tooltip={{$:/language/Buttons/UnfoldAll/Hint}} aria-label={{$:/language/Buttons/UnfoldAll/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-unfold-all-tiddlers\" $param=<<currentTiddler>> foldedStatePrefix=\"$:/state/folded/\"/>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\" variable=\"listItem\">\n{{$:/core/images/unfold-all-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/UnfoldAll/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/PageTemplate/pagecontrols": {
"title": "$:/core/ui/PageTemplate/pagecontrols",
"text": "\\whitespace trim\n\\define config-title()\n$:/config/PageControlButtons/Visibility/$(listItem)$\n\\end\n<div class=\"tc-page-controls\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]]\" variable=\"listItem\">\n<$set name=\"hidden\" value=<<config-title>>>\n<$list filter=\"[<hidden>!text[hide]]\" storyview=\"pop\" variable=\"ignore\">\n<$set name=\"tv-config-toolbar-class\" filter=\"[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]\">\n<$transclude tiddler=<<listItem>> mode=\"inline\"/>\n</$set>\n</$list>\n</$set>\n</$list>\n</div>\n"
},
"$:/core/ui/PageStylesheet": {
"title": "$:/core/ui/PageStylesheet",
"text": "\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n\n<$set name=\"currentTiddler\" value={{$:/language}}>\n\n<$set name=\"languageTitle\" value={{!!name}}>\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Stylesheet]!has[draft.of]]\">\n<$transclude mode=\"block\"/>\n</$list>\n\n</$set>\n\n</$set>\n"
},
"$:/core/ui/PageTemplate/alerts": {
"title": "$:/core/ui/PageTemplate/alerts",
"tags": "$:/tags/PageTemplate",
"text": "<div class=\"tc-alerts\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Alert]!has[draft.of]]\" template=\"$:/core/ui/AlertTemplate\" storyview=\"pop\"/>\n\n</div>\n"
},
"$:/core/ui/PageTemplate/drafts": {
"title": "$:/core/ui/PageTemplate/drafts",
"tags": "$:/tags/PageTemplate",
"text": "\\whitespace trim\n<$reveal state=\"$:/status/IsReadOnly\" type=\"nomatch\" text=\"yes\" tag=\"div\" class=\"tc-drafts-list\">\n<$list filter=\"[has[draft.of]!sort[modified]] -[list[$:/StoryList]]\">\n<$link>\n{{$:/core/images/edit-button}} <$text text=<<currentTiddler>>/>\n</$link>\n</$list>\n</$reveal>\n"
},
"$:/core/ui/PageTemplate/pluginreloadwarning": {
"title": "$:/core/ui/PageTemplate/pluginreloadwarning",
"tags": "$:/tags/PageTemplate",
"text": "\\define lingo-base() $:/language/\n\n<$list filter=\"[{$:/status/RequireReloadDueToPluginChange}match[yes]]\">\n\n<$reveal type=\"nomatch\" state=\"$:/temp/HidePluginWarning\" text=\"yes\">\n\n<div class=\"tc-plugin-reload-warning\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"\">\n\n<<lingo PluginReloadWarning>> <$button set=\"$:/temp/HidePluginWarning\" setTo=\"yes\" class=\"tc-btn-invisible\">{{$:/core/images/close-button}}</$button>\n\n</$set>\n\n</div>\n\n</$reveal>\n\n</$list>\n"
},
"$:/core/ui/PageTemplate/sidebar": {
"title": "$:/core/ui/PageTemplate/sidebar",
"tags": "$:/tags/PageTemplate",
"text": "\\whitespace trim\n\\define config-title()\n$:/config/SideBarSegments/Visibility/$(listItem)$\n\\end\n\n<$scrollable fallthrough=\"no\" class=\"tc-sidebar-scrollable\">\n\n<div class=\"tc-sidebar-header\">\n\n<$reveal state=\"$:/state/sidebar\" type=\"match\" text=\"yes\" default=\"yes\" retain=\"yes\" animate=\"yes\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/SideBarSegment]!has[draft.of]]\" variable=\"listItem\">\n\n<$reveal type=\"nomatch\" state=<<config-title>> text=\"hide\" tag=\"div\">\n\n<$transclude tiddler=<<listItem>> mode=\"block\"/>\n\n</$reveal>\n\n</$list>\n\n</$reveal>\n\n</div>\n\n</$scrollable>\n"
},
"$:/core/ui/PageTemplate/story": {
"title": "$:/core/ui/PageTemplate/story",
"tags": "$:/tags/PageTemplate",
"text": "\\whitespace trim\n<section class=\"tc-story-river\">\n\n<section class=\"story-backdrop\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/AboveStory]!has[draft.of]]\">\n\n<$transclude/>\n\n</$list>\n\n</section>\n\n<$list filter=\"[list[$:/StoryList]]\" history=\"$:/HistoryList\" template={{$:/config/ui/ViewTemplate}} editTemplate={{$:/config/ui/EditTemplate}} storyview={{$:/view}} emptyMessage={{$:/config/EmptyStoryMessage}}/>\n\n<section class=\"story-frontdrop\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/BelowStory]!has[draft.of]]\">\n\n<$transclude/>\n\n</$list>\n\n</section>\n\n</section>\n"
},
"$:/core/ui/PageTemplate/topleftbar": {
"title": "$:/core/ui/PageTemplate/topleftbar",
"tags": "$:/tags/PageTemplate",
"text": "<span class=\"tc-topbar tc-topbar-left\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/TopLeftBar]!has[draft.of]]\" variable=\"listItem\" storyview=\"pop\">\n\n<$transclude tiddler=<<listItem>> mode=\"inline\"/>\n\n</$list>\n\n</span>\n"
},
"$:/core/ui/PageTemplate/toprightbar": {
"title": "$:/core/ui/PageTemplate/toprightbar",
"tags": "$:/tags/PageTemplate",
"text": "<span class=\"tc-topbar tc-topbar-right\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/TopRightBar]!has[draft.of]]\" variable=\"listItem\" storyview=\"pop\">\n\n<$transclude tiddler=<<listItem>> mode=\"inline\"/>\n\n</$list>\n\n</span>\n"
},
"$:/core/ui/PageTemplate": {
"title": "$:/core/ui/PageTemplate",
"name": "{{$:/language/PageTemplate/Name}}",
"description": "{{$:/language/PageTemplate/Description}}",
"text": "\\whitespace trim\n\\define containerClasses()\ntc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$\n\\end\n\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n\n<$vars\n\ttv-config-toolbar-icons={{$:/config/Toolbar/Icons}}\n\ttv-config-toolbar-text={{$:/config/Toolbar/Text}}\n\ttv-config-toolbar-class={{$:/config/Toolbar/ButtonClass}}\n\ttv-enable-drag-and-drop={{$:/config/DragAndDrop/Enable}}\n\ttv-show-missing-links={{$:/config/MissingLinks}}\n\tstoryviewTitle={{$:/view}}\n\tlanguageTitle={{{ [{$:/language}get[name]] }}}>\n\n<div class=<<containerClasses>>>\n\n<$navigator story=\"$:/StoryList\" history=\"$:/HistoryList\" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>\n\n<$dropzone enable=<<tv-enable-drag-and-drop>>>\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/PageTemplate]!has[draft.of]]\" variable=\"listItem\">\n\n<$transclude tiddler=<<listItem>>/>\n\n</$list>\n\n</$dropzone>\n\n</$navigator>\n\n</div>\n\n</$vars>\n"
},
"$:/PaletteManager": {
"title": "$:/PaletteManager",
"text": "\\define lingo-base() $:/language/ControlPanel/Palette/Editor/\n\\define describePaletteColour(colour)\n<$transclude tiddler=\"$:/language/Docs/PaletteColours/$colour$\"><$text text=\"$colour$\"/></$transclude>\n\\end\n\\define edit-colour-placeholder()\n edit $(colourName)$\n\\end\n\\define colour-tooltip(showhide) $showhide$ editor for $(newColourName)$ \n\\define resolve-colour(macrocall)\n\\import $:/core/macros/utils\n\\whitespace trim\n<$wikify name=\"name\" text=\"\"\"$macrocall$\"\"\">\n<<name>>\n</$wikify>\n\\end\n\\define delete-colour-index-actions() <$action-setfield $index=<<colourName>>/>\n\\define palette-manager-colour-row-segment()\n\\whitespace trim\n<$edit-text index=<<colourName>> tag=\"input\" placeholder=<<edit-colour-placeholder>> default=\"\"/>\n<br>\n<$edit-text index=<<colourName>> type=\"color\" tag=\"input\" class=\"tc-palette-manager-colour-input\"/>\n<$list filter=\"[<currentTiddler>getindex<colourName>removeprefix[<<]removesuffix[>>]] [<currentTiddler>getindex<colourName>removeprefix[<$]removesuffix[/>]]\" variable=\"ignore\">\n<$set name=\"state\" value={{{ [[$:/state/palettemanager/]addsuffix<currentTiddler>addsuffix[/]addsuffix<colourName>] }}}>\n<$wikify name=\"newColourName\" text=\"\"\"<$macrocall $name=\"resolve-colour\" macrocall={{{ [<currentTiddler>getindex<colourName>] }}}/>\"\"\">\n<$reveal state=<<state>> type=\"nomatch\" text=\"show\">\n<$button tooltip=<<colour-tooltip show>> aria-label=<<colour-tooltip show>> class=\"tc-btn-invisible\" set=<<state>> setTo=\"show\">{{$:/core/images/down-arrow}}<$text text=<<newColourName>> class=\"tc-small-gap-left\"/></$button><br>\n</$reveal>\n<$reveal state=<<state>> type=\"match\" text=\"show\">\n<$button tooltip=<<colour-tooltip hide>> aria-label=<<colour-tooltip show>> class=\"tc-btn-invisible\" actions=\"\"\"<$action-deletetiddler $tiddler=<<state>>/>\"\"\">{{$:/core/images/up-arrow}}<$text text=<<newColourName>> class=\"tc-small-gap-left\"/></$button><br>\n</$reveal>\n<$reveal state=<<state>> type=\"match\" text=\"show\">\n<$set name=\"colourName\" value=<<newColourName>>>\n<br>\n<<palette-manager-colour-row-segment>>\n<br><br>\n</$set>\n</$reveal>\n</$wikify>\n</$set>\n</$list>\n\\end\n\\define palette-manager-colour-row()\n\\whitespace trim\n<tr>\n<td>\n<span style=\"float:right;\">\n<$button tooltip={{$:/language/ControlPanel/Palette/Editor/Delete/Hint}} aria-label={{$:/language/ControlPanel/Palette/Editor/Delete/Hint}} class=\"tc-btn-invisible\" actions=<<delete-colour-index-actions>>>\n{{$:/core/images/delete-button}}</$button>\n</span>\n''<$macrocall $name=\"describePaletteColour\" colour=<<colourName>>/>''<br/>\n<$macrocall $name=\"colourName\" $output=\"text/plain\"/>\n</td>\n<td>\n<<palette-manager-colour-row-segment>>\n</td>\n</tr>\n\\end\n\\define palette-manager-table()\n\\whitespace trim\n<table>\n<tbody>\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Palette]indexes[]]\" variable=\"colourName\">\n<$list filter=\"[<currentTiddler>indexes[]removeprefix<colourName>suffix[]]\" variable=\"ignore\" emptyMessage=\"\"\"\n<$list filter=\"[{$:/state/palettemanager/showexternal}removeprefix[yes]suffix[]]\" variable=\"ignore\">\n<<palette-manager-colour-row>>\n</$list>\n\"\"\">\n<<palette-manager-colour-row>>\n</$list>\n</$list>\n</tbody>\n</table>\n\\end\n<$set name=\"currentTiddler\" value={{$:/palette}}>\n\n<<lingo Prompt>> <$link to={{$:/palette}}><$macrocall $name=\"currentTiddler\" $output=\"text/plain\"/></$link>\n\n<$list filter=\"[all[current]is[shadow]is[tiddler]]\" variable=\"listItem\">\n<<lingo Prompt/Modified>>\n<$button message=\"tm-delete-tiddler\" param={{$:/palette}}><<lingo Reset/Caption>></$button>\n</$list>\n\n<$list filter=\"[all[current]is[shadow]!is[tiddler]]\" variable=\"listItem\">\n<<lingo Clone/Prompt>>\n</$list>\n\n<$button message=\"tm-new-tiddler\" param={{$:/palette}}><<lingo Clone/Caption>></$button>\n\n<$checkbox tiddler=\"$:/state/palettemanager/showexternal\" field=\"text\" checked=\"yes\" unchecked=\"no\"><span class=\"tc-small-gap-left\"><<lingo Names/External/Show>></span></$checkbox>\n\n<<palette-manager-table>>\n"
},
"$:/core/ui/PluginInfo": {
"title": "$:/core/ui/PluginInfo",
"text": "\\define localised-info-tiddler-title()\n$(currentTiddler)$/$(languageTitle)$/$(currentTab)$\n\\end\n\\define info-tiddler-title()\n$(currentTiddler)$/$(currentTab)$\n\\end\n\\define default-tiddler-title()\n$:/core/ui/PluginInfo/Default/$(currentTab)$\n\\end\n<$transclude tiddler=<<localised-info-tiddler-title>> mode=\"block\">\n<$transclude tiddler=<<currentTiddler>> subtiddler=<<localised-info-tiddler-title>> mode=\"block\">\n<$transclude tiddler=<<currentTiddler>> subtiddler=<<info-tiddler-title>> mode=\"block\">\n<$transclude tiddler=<<default-tiddler-title>> mode=\"block\">\n{{$:/language/ControlPanel/Plugin/NoInfoFound/Hint}}\n</$transclude>\n</$transclude>\n</$transclude>\n</$transclude>\n"
},
"$:/core/ui/PluginInfo/Default/contents": {
"title": "$:/core/ui/PluginInfo/Default/contents",
"text": "\\define lingo-base() $:/language/TiddlerInfo/Advanced/PluginInfo/\n<<lingo Hint>>\n<ul>\n<$list filter=\"[all[current]plugintiddlers[]sort[title]]\" emptyMessage=<<lingo Empty/Hint>>>\n<li>\n<$link />\n</li>\n</$list>\n</ul>\n"
},
"$:/core/ui/PluginListItemTemplate": {
"title": "$:/core/ui/PluginListItemTemplate",
"text": "<div class=\"tc-menu-list-item\">\n<$link to={{!!title}}><$view field=\"description\"><$view field=\"title\"/></$view></$link>\n</div>"
},
"$:/core/ui/RootTemplate": {
"title": "$:/core/ui/RootTemplate",
"text": "<$transclude tiddler={{{ [{$:/layout}has[text]] ~[[$:/core/ui/PageTemplate]] }}} mode=\"inline\"/>\n\n"
},
"$:/core/ui/SearchResults": {
"title": "$:/core/ui/SearchResults",
"text": "<div class=\"tc-search-results\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]butfirst[]limit[1]]\" emptyMessage=\"\"\"\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]\">\n<$transclude mode=\"block\"/>\n</$list>\n\"\"\">\n\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]\" default={{$:/config/SearchResults/Default}} actions=\"\"\"<$action-setfield $tiddler=\"$:/state/search/currentTab\" text=<<currentTab>>/>\"\"\" explicitState=\"$:/state/tab/search-results/sidebar\"/>\n\n</$list>\n\n</div>\n"
},
"$:/core/ui/SideBar/More": {
"title": "$:/core/ui/SideBar/More",
"tags": "$:/tags/SideBar",
"caption": "{{$:/language/SideBar/More/Caption}}",
"text": "<div class=\"tc-more-sidebar\">\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/MoreSideBar]!has[draft.of]]\" default={{$:/config/DefaultMoreSidebarTab}} state=\"$:/state/tab/moresidebar\" class=\"tc-vertical tc-sidebar-tabs-more\" explicitState=\"$:/state/tab/moresidebar-1850697562\"/>\n</div>\n"
},
"$:/core/ui/SideBar/Open": {
"title": "$:/core/ui/SideBar/Open",
"tags": "$:/tags/SideBar",
"caption": "{{$:/language/SideBar/Open/Caption}}",
"text": "\\whitespace trim\n\\define lingo-base() $:/language/CloseAll/\n\n\\define drop-actions()\n<$action-listops $tiddler=<<tv-story-list>> $subfilter=\"+[insertbefore:currentTiddler<actionTiddler>]\"/>\n\\end\n\n\\define placeholder()\n<div class=\"tc-droppable-placeholder\"/>\n\\end\n\n\\define droppable-item(button)\n\\whitespace trim\n<$droppable actions=<<drop-actions>> enable=<<tv-allow-drag-and-drop>>>\n<<placeholder>>\n<div>\n$button$\n</div>\n</$droppable>\n\\end\n\n<div class=\"tc-sidebar-tab-open\">\n<$list filter=\"[list<tv-story-list>]\" history=<<tv-history-list>> storyview=\"pop\">\n<div class=\"tc-sidebar-tab-open-item\">\n<$macrocall $name=\"droppable-item\" button=\"\"\"<$button message=\"tm-close-tiddler\" tooltip={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class=\"tc-btn-invisible tc-btn-mini tc-small-gap-right\">{{$:/core/images/close-button}}</$button><$link to={{!!title}}><$view field=\"title\"/></$link>\"\"\"/>\n</div>\n</$list>\n<$tiddler tiddler=\"\">\n<div>\n<$macrocall $name=\"droppable-item\" button=\"\"\"<$button message=\"tm-close-all-tiddlers\" class=\"tc-btn-invisible tc-btn-mini\"><<lingo Button>></$button>\"\"\"/>\n</div>\n</$tiddler>\n</div>\n"
},
"$:/core/ui/SideBar/Recent": {
"title": "$:/core/ui/SideBar/Recent",
"tags": "$:/tags/SideBar",
"caption": "{{$:/language/SideBar/Recent/Caption}}",
"text": "<$macrocall $name=\"timeline\" format={{$:/language/RecentChanges/DateFormat}}/>\n"
},
"$:/core/ui/SideBar/Tools": {
"title": "$:/core/ui/SideBar/Tools",
"tags": "$:/tags/SideBar",
"caption": "{{$:/language/SideBar/Tools/Caption}}",
"text": "\\define lingo-base() $:/language/ControlPanel/\n\\define config-title()\n$:/config/PageControlButtons/Visibility/$(listItem)$\n\\end\n\n<<lingo Basics/Version/Prompt>> <<version>>\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]]\" variable=\"listItem\">\n\n<div style=\"position:relative;\" class={{{ [<listItem>encodeuricomponent[]addprefix[tc-btn-]] }}}>\n\n<$checkbox tiddler=<<config-title>> field=\"text\" checked=\"show\" unchecked=\"hide\" default=\"show\"/> <$transclude tiddler=<<listItem>>/> <i class=\"tc-muted\"><$transclude tiddler=<<listItem>> field=\"description\"/></i>\n\n</div>\n\n</$list>\n\n</$set>\n\n</$set>\n\n</$set>\n"
},
"$:/core/ui/SideBarLists": {
"title": "$:/core/ui/SideBarLists",
"text": "<$transclude tiddler=\"$:/core/ui/SideBarSegments/search\"/>\n\n<$transclude tiddler=\"$:/core/ui/SideBarSegments/tabs\"/>\n\n"
},
"$:/core/ui/SideBarSegments/page-controls": {
"title": "$:/core/ui/SideBarSegments/page-controls",
"tags": "$:/tags/SideBarSegment",
"text": "{{||$:/core/ui/PageTemplate/pagecontrols}}\n"
},
"$:/core/ui/SideBarSegments/search": {
"title": "$:/core/ui/SideBarSegments/search",
"tags": "$:/tags/SideBarSegment",
"text": "\\whitespace trim\n\n\\define count-popup-button()\n\\whitespace trim\n<$button popup=<<qualify \"$:/state/popup/search-dropdown\">> class=\"tc-btn-invisible\">\n{{$:/core/images/down-arrow}}\n<$list filter=\"[{$(searchTiddler)$}minlength{$:/config/Search/MinLength}limit[1]]\" variable=\"listItem\">\n<$vars userInput={{{ [<searchTiddler>get[text]] }}} configTiddler={{{ [[$:/state/search/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}] }}} replaceRegexp=\"limit\\[\\d+\\]\">\n<$vars primaryListFilter={{{ [<configTiddler>get[first-search-filter]search-replace:g:regexp<replaceRegexp>,[]] }}} secondaryListFilter={{{ [<configTiddler>get[second-search-filter]search-replace:g:regexp<replaceRegexp>,[]] }}}>\n<$set name=\"resultCount\" value=\"\"\"<$count filter=\"[subfilter<primaryListFilter>] [subfilter<secondaryListFilter>]\"/>\"\"\">\n{{$:/language/Search/Matches}}\n</$set>\n</$vars>\n</$vars>\n</$list>\n</$button>\n\\end\n\n\\define search-results-list()\n\\whitespace trim\n<$vars userInput={{$(searchTiddler)$}} configTiddler={{{ [[$:/state/search/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}] }}}>\n<$list filter=\"[<userInput>minlength{$:/config/Search/MinLength}limit[1]]\" emptyMessage=\"\"\"<div class=\"tc-search-results\">{{$:/language/Search/Search/TooShort}}</div>\"\"\" variable=\"listItem\">\n\n<$tiddler tiddler=<<configTiddler>>>\n\n{{$:/core/ui/SearchResults}}\n\n</$tiddler>\n\n</$list>\n</$vars>\n\\end\n\n\\define cancel-search-actions() <$list filter=\"[<searchTiddler>get[text]!match{$:/temp/search}]\" emptyMessage=\"\"\"<$action-deletetiddler $filter=\"[[$:/temp/search]] [<searchTiddler>] [<searchListState>]\"/>\"\"\"><$action-setfield $tiddler=\"$:/temp/search\" text={{{ [<searchTiddler>get[text]] }}}/><$action-setfield $tiddler=\"$:/temp/search/refresh\" text=\"yes\"/></$list>\n\n\\define input-accept-actions() <$list filter=\"[{$:/config/Search/NavigateOnEnter/enable}match[yes]]\" emptyMessage=\"\"\"<$list filter=\"[<__tiddler__>get[text]!is[missing]] ~[<__tiddler__>get[text]is[shadow]]\"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/></$list>\"\"\"><$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/></$list>\n\n\\define input-accept-variant-actions() <$list filter=\"[{$:/config/Search/NavigateOnEnter/enable}match[yes]]\" emptyMessage=\"\"\"<$list filter=\"[<__tiddler__>get[text]!is[missing]] ~[<__tiddler__>get[text]is[shadow]]\"><$list filter=\"[<__tiddler__>get[text]minlength[1]]\"><$action-sendmessage $message=\"tm-edit-tiddler\" $param={{{ [<__tiddler__>get[text]] }}}/></$list></$list>\"\"\"><$list filter=\"[<__tiddler__>get[text]minlength[1]]\"><$action-sendmessage $message=\"tm-edit-tiddler\" $param={{{ [<__tiddler__>get[text]] }}}/></$list></$list>\n\n\\define set-next-input-tab(beforeafter:\"after\") <$macrocall $name=\"change-input-tab\" stateTitle=\"$:/state/tab/search-results/sidebar\" tag=\"$:/tags/SearchResults\" beforeafter=\"$beforeafter$\" defaultState={{$:/config/SearchResults/Default}} actions=\"\"\"<$action-setfield $tiddler=\"$:/state/search/currentTab\" text=<<nextTab>>/>\"\"\"/>\n\n\\define advanced-search-actions() <$action-setfield $tiddler=\"$:/temp/advancedsearch\" text={{$:/temp/search/input}}/><$action-setfield $tiddler=\"$:/temp/advancedsearch/input\" text={{$:/temp/search/input}}/><<delete-state-tiddlers>><$action-navigate $to=\"$:/AdvancedSearch\"/><$action-setfield $tiddler=\"$:/temp/advancedsearch/refresh\" text=\"yes\"/><$action-sendmessage $message=\"tm-focus-selector\" $param=\"\"\"[data-tiddler-title=\"$:/AdvancedSearch\"] .tc-search input\"\"\" preventScroll=\"true\"/><$action-deletetiddler $filter=\"$:/temp/search $:/temp/search/input $:/temp/search/refresh [<searchListState>]\"/>\n\n<div class=\"tc-sidebar-lists tc-sidebar-search\">\n\n<$vars editTiddler=\"$:/temp/search\" searchTiddler=\"$:/temp/search/input\" searchListState=<<qualify \"$:/state/search-list/selected-item\">>>\n<div class=\"tc-search\">\n<$keyboard key=\"((input-tab-right))\" actions=<<set-next-input-tab>>>\n<$keyboard key=\"((input-tab-left))\" actions=<<set-next-input-tab \"before\">>>\n<$keyboard key=\"((advanced-search-sidebar))\" actions=<<advanced-search-actions>>>\n<$macrocall $name=\"keyboard-driven-input\" tiddler=<<editTiddler>> storeTitle=<<searchTiddler>> \n\t\tselectionStateTitle=<<searchListState>> refreshTitle=\"$:/temp/search/refresh\" type=\"search\" \n\t\ttag=\"input\" focus={{$:/config/Search/AutoFocus}} focusPopup=<<qualify \"$:/state/popup/search-dropdown\">> \n\t\tclass=\"tc-popup-handle\" filterMinLength={{$:/config/Search/MinLength}} inputCancelActions=<<cancel-search-actions>> \n\t\tinputAcceptActions=<<input-accept-actions>> inputAcceptVariantActions=<<input-accept-variant-actions>> cancelPopups=\"yes\" \n\t\tconfigTiddlerFilter=\"[[$:/state/search/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}]\"/>\n</$keyboard>\n</$keyboard>\n</$keyboard>\n<$reveal state=<<searchTiddler>> type=\"nomatch\" text=\"\">\n<$button tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class=\"tc-btn-invisible\">\n<<advanced-search-actions>>\n{{$:/core/images/advanced-search-button}}\n</$button>\n<$button class=\"tc-btn-invisible\">\n<<cancel-search-actions>><$action-sendmessage $message=\"tm-focus-selector\" $param=\".tc-search input\"/>\n{{$:/core/images/close-button}}\n</$button>\n<<count-popup-button>>\n</$reveal>\n<$reveal state=<<searchTiddler>> type=\"match\" text=\"\">\n<$button to=\"$:/AdvancedSearch\" tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class=\"tc-btn-invisible\">\n{{$:/core/images/advanced-search-button}}\n</$button>\n</$reveal>\n</div>\n\n<$reveal tag=\"div\" class=\"tc-block-dropdown-wrapper\" state=<<searchTiddler>> type=\"nomatch\" text=\"\">\n\n<$reveal tag=\"div\" class=\"tc-block-dropdown tc-search-drop-down tc-popup-handle\" state=<<qualify \"$:/state/popup/search-dropdown\">> type=\"nomatch\" text=\"\" default=\"\">\n\n<<search-results-list>>\n\n</$reveal>\n\n</$reveal>\n\n</$vars>\n\n</div>\n"
},
"$:/core/ui/SideBarSegments/site-subtitle": {
"title": "$:/core/ui/SideBarSegments/site-subtitle",
"tags": "$:/tags/SideBarSegment",
"text": "<div class=\"tc-site-subtitle\">\n\n<$transclude tiddler=\"$:/SiteSubtitle\" mode=\"inline\"/>\n\n</div>\n"
},
"$:/core/ui/SideBarSegments/site-title": {
"title": "$:/core/ui/SideBarSegments/site-title",
"tags": "$:/tags/SideBarSegment",
"text": "<h1 class=\"tc-site-title\">\n\n<$transclude tiddler=\"$:/SiteTitle\" mode=\"inline\"/>\n\n</h1>\n"
},
"$:/core/ui/SideBarSegments/tabs": {
"title": "$:/core/ui/SideBarSegments/tabs",
"tags": "$:/tags/SideBarSegment",
"text": "<div class=\"tc-sidebar-lists tc-sidebar-tabs\">\n\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]\" default={{$:/config/DefaultSidebarTab}} state=\"$:/state/tab/sidebar\" class=\"tc-sidebar-tabs-main\" explicitState=\"$:/state/tab/sidebar--595412856\"/>\n\n</div>\n"
},
"$:/core/ui/SwitcherModal": {
"title": "$:/core/ui/SwitcherModal",
"subtitle": "<$text text={{{[<switch>lookup[$:/language/Switcher/Subtitle/]]}}}/>",
"class": "tc-modal-centered",
"text": "<$tiddler tiddler={{{[<switch>lookup[$:/config/SwitcherTargets/]]}}}>\n\n\n<$transclude/>\n\n\n</$tiddler>"
},
"$:/TagManager": {
"title": "$:/TagManager",
"icon": "$:/core/images/tag-button",
"color": "#bbb",
"text": "\\define lingo-base() $:/language/TagManager/\n\\define iconEditorTab(type)\n\\whitespace trim\n<$link to=\"\"><<lingo Icons/None>></$link>\n<$list filter=\"[all[shadows+tiddlers]is[image]] [all[shadows+tiddlers]tag[$:/tags/Image]] -[type[application/pdf]] +[sort[title]] +[$type$is[system]]\">\n<$link to={{!!title}}>\n<$transclude/> <$view field=\"title\"/>\n</$link>\n</$list>\n\\end\n\\define iconEditor(title)\n\\whitespace trim\n<div class=\"tc-drop-down-wrapper\">\n<$button popupTitle={{{ [[$:/state/popup/icon/]addsuffix<__title__>] }}} class=\"tc-btn-invisible tc-btn-dropdown\">{{$:/core/images/down-arrow}}</$button>\n<$reveal stateTitle={{{ [[$:/state/popup/icon/]addsuffix<__title__>] }}} type=\"popup\" position=\"belowleft\" text=\"\" default=\"\">\n<div class=\"tc-drop-down\">\n<$linkcatcher actions=\"\"\"<$action-setfield $tiddler=<<__title__>> icon=<<navigateTo>>/>\"\"\">\n<<iconEditorTab type:\"!\">>\n<hr/>\n<<iconEditorTab type:\"\">>\n</$linkcatcher>\n</div>\n</$reveal>\n</div>\n\\end\n\\define toggleButton(state)\n\\whitespace trim\n<$reveal stateTitle=<<__state__>> type=\"match\" text=\"closed\" default=\"closed\">\n<$button setTitle=<<__state__>> setTo=\"open\" class=\"tc-btn-invisible tc-btn-dropdown\" selectedClass=\"tc-selected\">\n{{$:/core/images/info-button}}\n</$button>\n</$reveal>\n<$reveal stateTitle=<<__state__>> type=\"match\" text=\"open\" default=\"closed\">\n<$button setTitle=<<__state__>> setTo=\"closed\" class=\"tc-btn-invisible tc-btn-dropdown\" selectedClass=\"tc-selected\">\n{{$:/core/images/info-button}}\n</$button>\n</$reveal>\n\\end\n\\whitespace trim\n<table class=\"tc-tag-manager-table\">\n<tbody>\n<tr>\n<th><<lingo Colour/Heading>></th>\n<th class=\"tc-tag-manager-tag\"><<lingo Tag/Heading>></th>\n<th><<lingo Count/Heading>></th>\n<th><<lingo Icon/Heading>></th>\n<th><<lingo Info/Heading>></th>\n</tr>\n<$list filter=\"[tags[]!is[system]sort[title]]\">\n<tr>\n<td><$edit-text field=\"color\" tag=\"input\" type=\"color\"/></td>\n<td>{{||$:/core/ui/TagTemplate}}</td>\n<td><$count filter=\"[all[current]tagging[]]\"/></td>\n<td>\n<$macrocall $name=\"iconEditor\" title={{!!title}}/>\n</td>\n<td>\n<$macrocall $name=\"toggleButton\" state={{{ [[$:/state/tag-manager/]addsuffix<currentTiddler>] }}} /> \n</td>\n</tr>\n<tr>\n<td></td>\n<td colspan=\"4\">\n<$reveal stateTitle={{{ [[$:/state/tag-manager/]addsuffix<currentTiddler>] }}} type=\"match\" text=\"open\" default=\"\">\n<table>\n<tbody>\n<tr><td><<lingo Colour/Heading>></td><td><$edit-text field=\"color\" tag=\"input\" type=\"text\" size=\"9\"/></td></tr>\n<tr><td><<lingo Icon/Heading>></td><td><$edit-text field=\"icon\" tag=\"input\" size=\"45\"/></td></tr>\n</tbody>\n</table>\n</$reveal>\n</td>\n</tr>\n</$list>\n<tr>\n<td></td>\n<td style=\"position:relative;\">\n{{$:/core/ui/UntaggedTemplate}}\n</td>\n<td>\n<small class=\"tc-menu-list-count\"><$count filter=\"[untagged[]!is[system]] -[tags[]]\"/></small>\n</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n"
},
"$:/core/ui/TagPickerTagTemplate": {
"title": "$:/core/ui/TagPickerTagTemplate",
"text": "\\whitespace trim\n<$button class=<<button-classes>> tag=\"a\" tooltip={{$:/language/EditTemplate/Tags/Add/Button/Hint}}>\n<$list filter=\"[<saveTiddler>minlength[1]]\">\n<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter=\"[<tag>]\"/>\n</$list>\n<$set name=\"currentTiddlerCSSEscaped\" value={{{ [<saveTiddler>escapecss[]] }}}>\n<$action-sendmessage $message=\"tm-focus-selector\" $param=<<get-tagpicker-focus-selector>> preventScroll=\"true\"/>\n</$set>\n<<delete-tag-state-tiddlers>>\n<$list filter=\"[<refreshTitle>minlength[1]]\">\n<$action-setfield $tiddler=<<refreshTitle>> text=\"yes\"/>\n</$list>\n<<actions>>\n<$set name=\"backgroundColor\" value={{!!color}}>\n<$wikify name=\"foregroundColor\" text=\"\"\"<$macrocall $name=\"contrastcolour\" target={{!!color}} fallbackTarget=<<fallbackTarget>> colourA=<<colourA>> colourB=<<colourB>>/>\"\"\">\n<span class=\"tc-tag-label tc-btn-invisible\" style=<<tag-pill-styles>>>\n<$transclude tiddler={{!!icon}}/><$view field=\"title\" format=\"text\"/>\n</span>\n</$wikify>\n</$set>\n</$button>\n"
},
"$:/core/ui/TagTemplate": {
"title": "$:/core/ui/TagTemplate",
"text": "\\whitespace trim\n<span class=\"tc-tag-list-item\" data-tag-title=<<currentTiddler>>>\n<$set name=\"transclusion\" value=<<currentTiddler>>>\n<$macrocall $name=\"tag-pill-body\" tag=<<currentTiddler>> icon={{!!icon}} colour={{!!color}} palette={{$:/palette}} element-tag=\"\"\"$button\"\"\" element-attributes=\"\"\"popup=<<qualify \"$:/state/popup/tag\">> dragFilter='[all[current]tagging[]]' tag='span'\"\"\"/>\n<$reveal state=<<qualify \"$:/state/popup/tag\">> type=\"popup\" position=\"below\" animate=\"yes\" class=\"tc-drop-down\">\n<$set name=\"tv-show-missing-links\" value=\"yes\">\n<$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n</$set>\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]]\" variable=\"listItem\"> \n<$transclude tiddler=<<listItem>>/> \n</$list>\n<hr>\n<$macrocall $name=\"list-tagged-draggable\" tag=<<currentTiddler>>/>\n</$reveal>\n</$set>\n</span>\n"
},
"$:/core/ui/TiddlerFieldTemplate": {
"title": "$:/core/ui/TiddlerFieldTemplate",
"text": "<tr class=\"tc-view-field\">\n<td class=\"tc-view-field-name\">\n<$text text=<<listItem>>/>\n</td>\n<td class=\"tc-view-field-value\">\n<$view field=<<listItem>>/>\n</td>\n</tr>"
},
"$:/core/ui/TiddlerFields": {
"title": "$:/core/ui/TiddlerFields",
"text": "<table class=\"tc-view-field-table\">\n<tbody>\n<$list filter=\"[all[current]fields[]sort[title]] -text\" template=\"$:/core/ui/TiddlerFieldTemplate\" variable=\"listItem\"/>\n</tbody>\n</table>\n"
},
"$:/core/ui/TiddlerInfo/Advanced/PluginInfo": {
"title": "$:/core/ui/TiddlerInfo/Advanced/PluginInfo",
"tags": "$:/tags/TiddlerInfo/Advanced",
"text": "\\define lingo-base() $:/language/TiddlerInfo/Advanced/PluginInfo/\n<$list filter=\"[all[current]has[plugin-type]]\">\n\n! <<lingo Heading>>\n\n<<lingo Hint>>\n<ul>\n<$list filter=\"[all[current]plugintiddlers[]sort[title]]\" emptyMessage=<<lingo Empty/Hint>>>\n<li>\n<$link to={{!!title}}>\n<$view field=\"title\"/>\n</$link>\n</li>\n</$list>\n</ul>\n\n</$list>\n"
},
"$:/core/ui/TiddlerInfo/Advanced/ShadowInfo": {
"title": "$:/core/ui/TiddlerInfo/Advanced/ShadowInfo",
"tags": "$:/tags/TiddlerInfo/Advanced",
"text": "\\define lingo-base() $:/language/TiddlerInfo/Advanced/ShadowInfo/\n<$set name=\"infoTiddler\" value=<<currentTiddler>>>\n\n''<<lingo Heading>>''\n\n<$list filter=\"[all[current]!is[shadow]]\">\n\n<<lingo NotShadow/Hint>>\n\n</$list>\n\n<$list filter=\"[all[current]is[shadow]]\">\n\n<<lingo Shadow/Hint>>\n\n<$list filter=\"[all[current]shadowsource[]]\">\n\n<$set name=\"pluginTiddler\" value=<<currentTiddler>>>\n<<lingo Shadow/Source>>\n</$set>\n\n</$list>\n\n<$list filter=\"[all[current]is[shadow]is[tiddler]]\">\n\n<<lingo OverriddenShadow/Hint>>\n\n</$list>\n\n\n</$list>\n</$set>\n"
},
"$:/core/ui/TiddlerInfo/Advanced": {
"title": "$:/core/ui/TiddlerInfo/Advanced",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/Advanced/Caption}}",
"text": "<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/TiddlerInfo/Advanced]!has[draft.of]]\" variable=\"listItem\">\n\n<$transclude tiddler=<<listItem>> mode=\"block\"/>\n</$list>\n"
},
"$:/core/ui/TiddlerInfo/Fields": {
"title": "$:/core/ui/TiddlerInfo/Fields",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/Fields/Caption}}",
"text": "<$transclude tiddler=\"$:/core/ui/TiddlerFields\"/>\n"
},
"$:/core/ui/TiddlerInfo/List": {
"title": "$:/core/ui/TiddlerInfo/List",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/List/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n<$list filter=\"[list{!!title}]\" emptyMessage=<<lingo List/Empty>> template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/TiddlerInfo/Listed": {
"title": "$:/core/ui/TiddlerInfo/Listed",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/Listed/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n<$list filter=\"[all[current]listed[]!is[system]]\" emptyMessage=<<lingo Listed/Empty>> template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/TiddlerInfo/References": {
"title": "$:/core/ui/TiddlerInfo/References",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/References/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n<$list filter=\"[all[current]backlinks[]sort[title]]\" emptyMessage=<<lingo References/Empty>> template=\"$:/core/ui/ListItemTemplate\">\n</$list>"
},
"$:/core/ui/TiddlerInfo/Tagging": {
"title": "$:/core/ui/TiddlerInfo/Tagging",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/Tagging/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n<$list filter=\"[all[current]tagging[]]\" emptyMessage=<<lingo Tagging/Empty>> template=\"$:/core/ui/ListItemTemplate\"/>\n"
},
"$:/core/ui/TiddlerInfo/Tools": {
"title": "$:/core/ui/TiddlerInfo/Tools",
"tags": "$:/tags/TiddlerInfo",
"caption": "{{$:/language/TiddlerInfo/Tools/Caption}}",
"text": "\\define lingo-base() $:/language/TiddlerInfo/\n\\define config-title()\n$:/config/ViewToolbarButtons/Visibility/$(listItem)$\n\\end\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]]\" variable=\"listItem\">\n\n<$checkbox tiddler=<<config-title>> field=\"text\" checked=\"show\" unchecked=\"hide\" default=\"show\"/> <$transclude tiddler=<<listItem>>/> <i class=\"tc-muted\"><$transclude tiddler=<<listItem>> field=\"description\"/></i>\n\n</$list>\n\n</$set>\n\n</$set>\n\n</$set>\n"
},
"$:/core/ui/TiddlerInfo": {
"title": "$:/core/ui/TiddlerInfo",
"text": "<div style=\"position:relative;\">\n<div class=\"tc-tiddler-controls\" style=\"position:absolute;right:0;\">\n<$reveal state=\"$:/config/TiddlerInfo/Mode\" type=\"match\" text=\"sticky\">\n<$button set=<<tiddlerInfoState>> setTo=\"\" tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=\"tc-btn-invisible\">\n{{$:/core/images/close-button}}\n</$button>\n</$reveal>\n</div>\n</div>\n\n<$macrocall $name=\"tabs\" tabsList=\"[all[shadows+tiddlers]tag[$:/tags/TiddlerInfo]!has[draft.of]]\" default={{$:/config/TiddlerInfo/Default}}/>\n"
},
"$:/core/ui/TopBar/menu": {
"title": "$:/core/ui/TopBar/menu",
"tags": "$:/tags/TopRightBar",
"text": "<$list filter=\"[[$:/state/sidebar]get[text]] +[else[yes]!match[no]]\" variable=\"ignore\">\n<$button set=\"$:/state/sidebar\" setTo=\"no\" tooltip={{$:/language/Buttons/HideSideBar/Hint}} aria-label={{$:/language/Buttons/HideSideBar/Caption}} class=\"tc-btn-invisible tc-hide-sidebar-btn\">{{$:/core/images/chevron-right}}</$button>\n</$list>\n<$list filter=\"[[$:/state/sidebar]get[text]] +[else[yes]match[no]]\" variable=\"ignore\">\n<$button set=\"$:/state/sidebar\" setTo=\"yes\" tooltip={{$:/language/Buttons/ShowSideBar/Hint}} aria-label={{$:/language/Buttons/ShowSideBar/Caption}} class=\"tc-btn-invisible tc-show-sidebar-btn\">{{$:/core/images/chevron-left}}</$button>\n</$list>\n"
},
"$:/core/ui/UntaggedTemplate": {
"title": "$:/core/ui/UntaggedTemplate",
"text": "\\define lingo-base() $:/language/SideBar/\n<$button popup=<<qualify \"$:/state/popup/tag\">> class=\"tc-btn-invisible tc-untagged-label tc-tag-label\">\n<<lingo Tags/Untagged/Caption>>\n</$button>\n<$reveal state=<<qualify \"$:/state/popup/tag\">> type=\"popup\" position=\"below\">\n<div class=\"tc-drop-down\">\n<$list filter=\"[untagged[]!is[system]] -[tags[]] +[sort[title]]\" template=\"$:/core/ui/ListItemTemplate\"/>\n</div>\n</$reveal>\n"
},
"$:/core/ui/ViewTemplate/body": {
"title": "$:/core/ui/ViewTemplate/body",
"tags": "$:/tags/ViewTemplate",
"text": "<$reveal tag=\"div\" class=\"tc-tiddler-body\" type=\"nomatch\" stateTitle=<<folded-state>> text=\"hide\" retain=\"yes\" animate=\"yes\">\n\n<$list filter=\"[all[current]!has[plugin-type]!field:hide-body[yes]]\">\n\n<$transclude>\n\n<$transclude tiddler=\"$:/language/MissingTiddler/Hint\"/>\n\n</$transclude>\n\n</$list>\n\n</$reveal>\n"
},
"$:/core/ui/ViewTemplate/classic": {
"title": "$:/core/ui/ViewTemplate/classic",
"tags": "$:/tags/ViewTemplate $:/tags/EditTemplate",
"text": "\\define lingo-base() $:/language/ClassicWarning/\n<$list filter=\"[all[current]type[text/x-tiddlywiki]]\">\n<div class=\"tc-message-box\">\n\n<<lingo Hint>>\n\n<$button set=\"!!type\" setTo=\"text/vnd.tiddlywiki\"><<lingo Upgrade/Caption>></$button>\n\n</div>\n</$list>\n"
},
"$:/core/ui/ViewTemplate/import": {
"title": "$:/core/ui/ViewTemplate/import",
"tags": "$:/tags/ViewTemplate",
"text": "\\define lingo-base() $:/language/Import/\n\n\\define buttons()\n<$button message=\"tm-delete-tiddler\" param=<<currentTiddler>>><<lingo Listing/Cancel/Caption>></$button>\n<$button message=\"tm-perform-import\" param=<<currentTiddler>>><<lingo Listing/Import/Caption>></$button>\n<<lingo Listing/Preview>> <$select tiddler=\"$:/state/importpreviewtype\" default=\"$:/core/ui/ImportPreviews/Text\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ImportPreview]!has[draft.of]]\">\n<option value=<<currentTiddler>>>{{!!caption}}</option>\n</$list>\n</$select>\n\\end\n\n<$list filter=\"[all[current]field:plugin-type[import]]\">\n\n<div class=\"tc-import\">\n\n<<lingo Listing/Hint>>\n\n<<buttons>>\n\n{{||$:/core/ui/ImportListing}}\n\n<<buttons>>\n\n</div>\n\n</$list>\n"
},
"$:/core/ui/ViewTemplate/plugin": {
"title": "$:/core/ui/ViewTemplate/plugin",
"tags": "$:/tags/ViewTemplate",
"text": "<$reveal tag=\"div\" class=\"tc-tiddler-plugin-info\" type=\"nomatch\" stateTitle=<<folded-state>> text=\"hide\" retain=\"yes\" animate=\"yes\">\n\n<$list filter=\"[all[current]has[plugin-type]] -[all[current]field:plugin-type[import]]\">\n<$set name=\"plugin-type\" value={{!!plugin-type}}>\n<$set name=\"default-popup-state\" value=\"yes\">\n<$set name=\"qualified-state\" value=<<qualify \"$:/state/plugin-info\">>>\n{{||$:/core/ui/Components/plugin-info}}\n</$set>\n</$set>\n</$set>\n</$list>\n</$reveal>"
},
"$:/core/ui/ViewTemplate/subtitle": {
"title": "$:/core/ui/ViewTemplate/subtitle",
"tags": "$:/tags/ViewTemplate",
"text": "\\whitespace trim\n<$reveal type=\"nomatch\" stateTitle=<<folded-state>> text=\"hide\" tag=\"div\" retain=\"yes\" animate=\"yes\">\n<div class=\"tc-subtitle\">\n<$link to={{!!modifier}} />\n<$view field=\"modified\" format=\"date\" template={{$:/language/Tiddler/DateFormat}}/>\n</div>\n</$reveal>\n"
},
"$:/core/ui/ViewTemplate/tags": {
"title": "$:/core/ui/ViewTemplate/tags",
"tags": "$:/tags/ViewTemplate",
"text": "<$reveal type=\"nomatch\" stateTitle=<<folded-state>> text=\"hide\" tag=\"div\" retain=\"yes\" animate=\"yes\">\n<div class=\"tc-tags-wrapper\"><$list filter=\"[all[current]tags[]sort[title]]\" template=\"$:/core/ui/TagTemplate\" storyview=\"pop\"/></div>\n</$reveal>\n"
},
"$:/core/ui/ViewTemplate/title": {
"title": "$:/core/ui/ViewTemplate/title",
"tags": "$:/tags/ViewTemplate",
"text": "\\whitespace trim\n\\define title-styles()\nfill:$(foregroundColor)$;\n\\end\n\\define config-title()\n$:/config/ViewToolbarButtons/Visibility/$(listItem)$\n\\end\n<div class=\"tc-tiddler-title\">\n<div class=\"tc-titlebar\">\n<span class=\"tc-tiddler-controls\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]]\" variable=\"listItem\"><$reveal type=\"nomatch\" state=<<config-title>> text=\"hide\"><$set name=\"tv-config-toolbar-class\" filter=\"[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]\"><$transclude tiddler=<<listItem>>/></$set></$reveal></$list>\n</span>\n<$set name=\"tv-wikilinks\" value={{$:/config/Tiddlers/TitleLinks}}>\n<$link>\n<$set name=\"foregroundColor\" value={{!!color}}>\n<$list filter=\"[all[current]has[icon]]~[[$:/config/DefaultTiddlerIcon]has[text]]\">\n<span class=\"tc-tiddler-title-icon\" style=<<title-styles>>>\n<$transclude tiddler={{!!icon}}>\n<$transclude tiddler={{$:/config/DefaultTiddlerIcon}}/>\n</$transclude>\n</span>\n</$list>\n</$set>\n<$list filter=\"[all[current]removeprefix[$:/]]\">\n<h2 class=\"tc-title\" title={{$:/language/SystemTiddler/Tooltip}}>\n<span class=\"tc-system-title-prefix\">$:/</span><$text text=<<currentTiddler>>/>\n</h2>\n</$list>\n<$list filter=\"[all[current]!prefix[$:/]]\">\n<h2 class=\"tc-title\">\n<$view field=\"title\"/>\n</h2>\n</$list>\n</$link>\n</$set>\n</div>\n\n<$reveal type=\"nomatch\" text=\"\" default=\"\" state=<<tiddlerInfoState>> class=\"tc-tiddler-info tc-popup-handle\" animate=\"yes\" retain=\"yes\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/TiddlerInfoSegment]!has[draft.of]] [[$:/core/ui/TiddlerInfo]]\" variable=\"listItem\"><$transclude tiddler=<<listItem>> mode=\"block\"/></$list>\n\n</$reveal>\n</div>"
},
"$:/core/ui/ViewTemplate/unfold": {
"title": "$:/core/ui/ViewTemplate/unfold",
"tags": "$:/tags/ViewTemplate",
"text": "<$reveal tag=\"div\" type=\"nomatch\" state=\"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold-bar\" text=\"hide\">\n<$reveal tag=\"div\" type=\"nomatch\" stateTitle=<<folded-state>> text=\"hide\" default=\"show\" retain=\"yes\" animate=\"yes\">\n<$button tooltip={{$:/language/Buttons/Fold/Hint}} aria-label={{$:/language/Buttons/Fold/Caption}} class=\"tc-fold-banner\">\n<$action-sendmessage $message=\"tm-fold-tiddler\" $param=<<currentTiddler>> foldedState=<<folded-state>>/>\n{{$:/core/images/chevron-up}}\n</$button>\n</$reveal>\n<$reveal tag=\"div\" type=\"nomatch\" stateTitle=<<folded-state>> text=\"show\" default=\"show\" retain=\"yes\" animate=\"yes\">\n<$button tooltip={{$:/language/Buttons/Unfold/Hint}} aria-label={{$:/language/Buttons/Unfold/Caption}} class=\"tc-unfold-banner\">\n<$action-sendmessage $message=\"tm-fold-tiddler\" $param=<<currentTiddler>> foldedState=<<folded-state>>/>\n{{$:/core/images/chevron-down}}\n</$button>\n</$reveal>\n</$reveal>\n"
},
"$:/core/ui/ViewTemplate": {
"title": "$:/core/ui/ViewTemplate",
"text": "\\define folded-state()\n$:/state/folded/$(currentTiddler)$\n\\end\n\\define cancel-delete-tiddler-actions(message) <$action-sendmessage $message=\"tm-$message$-tiddler\"/>\n\\import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!has[draft.of]]\n<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify \"$:/state/popup/tiddler-info\">>><div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ tc-tiddler-frame tc-tiddler-view-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[shadow]is[tiddler]then[tc-tiddler-overridden-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}}><$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]\" variable=\"listItem\"><$transclude tiddler=<<listItem>>/></$list>\n</div>\n</$vars>\n"
},
"$:/core/ui/Buttons/clone": {
"title": "$:/core/ui/Buttons/clone",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/clone-button}} {{$:/language/Buttons/Clone/Caption}}",
"description": "{{$:/language/Buttons/Clone/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-new-tiddler\" param=<<currentTiddler>> tooltip={{$:/language/Buttons/Clone/Hint}} aria-label={{$:/language/Buttons/Clone/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/clone-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Clone/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/close-others": {
"title": "$:/core/ui/Buttons/close-others",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/close-others-button}} {{$:/language/Buttons/CloseOthers/Caption}}",
"description": "{{$:/language/Buttons/CloseOthers/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-close-other-tiddlers\" param=<<currentTiddler>> tooltip={{$:/language/Buttons/CloseOthers/Hint}} aria-label={{$:/language/Buttons/CloseOthers/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/close-others-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/CloseOthers/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/close": {
"title": "$:/core/ui/Buttons/close",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/close-button}} {{$:/language/Buttons/Close/Caption}}",
"description": "{{$:/language/Buttons/Close/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-close-tiddler\" tooltip={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/close-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Close/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/edit": {
"title": "$:/core/ui/Buttons/edit",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/edit-button}} {{$:/language/Buttons/Edit/Caption}}",
"description": "{{$:/language/Buttons/Edit/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-edit-tiddler\" tooltip={{$:/language/Buttons/Edit/Hint}} aria-label={{$:/language/Buttons/Edit/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/edit-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Edit/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/export-tiddler": {
"title": "$:/core/ui/Buttons/export-tiddler",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/export-button}} {{$:/language/Buttons/ExportTiddler/Caption}}",
"description": "{{$:/language/Buttons/ExportTiddler/Hint}}",
"text": "\\define makeExportFilter()\n[[$(currentTiddler)$]]\n\\end\n<$macrocall $name=\"exportButton\" exportFilter=<<makeExportFilter>> lingoBase=\"$:/language/Buttons/ExportTiddler/\" baseFilename=<<currentTiddler>>/>"
},
"$:/core/ui/Buttons/fold-bar": {
"title": "$:/core/ui/Buttons/fold-bar",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/chevron-up}} {{$:/language/Buttons/Fold/FoldBar/Caption}}",
"description": "{{$:/language/Buttons/Fold/FoldBar/Hint}}",
"text": "<!-- This dummy toolbar button is here to allow visibility of the fold-bar to be controlled as if it were a toolbar button -->"
},
"$:/core/ui/Buttons/fold-others": {
"title": "$:/core/ui/Buttons/fold-others",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/fold-others-button}} {{$:/language/Buttons/FoldOthers/Caption}}",
"description": "{{$:/language/Buttons/FoldOthers/Hint}}",
"text": "\\whitespace trim\n<$button tooltip={{$:/language/Buttons/FoldOthers/Hint}} aria-label={{$:/language/Buttons/FoldOthers/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-fold-other-tiddlers\" $param=<<currentTiddler>> foldedStatePrefix=\"$:/state/folded/\"/>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\" variable=\"listItem\">\n{{$:/core/images/fold-others-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/FoldOthers/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/fold": {
"title": "$:/core/ui/Buttons/fold",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/fold-button}} {{$:/language/Buttons/Fold/Caption}}",
"description": "{{$:/language/Buttons/Fold/Hint}}",
"text": "\\whitespace trim\n<$reveal type=\"nomatch\" stateTitle=<<folded-state>> text=\"hide\" default=\"show\">\n<$button tooltip={{$:/language/Buttons/Fold/Hint}} aria-label={{$:/language/Buttons/Fold/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-fold-tiddler\" $param=<<currentTiddler>> foldedState=<<folded-state>>/>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\" variable=\"listItem\">\n{{$:/core/images/fold-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Fold/Caption}}/>\n</span>\n</$list>\n</$button>\n</$reveal>\n<$reveal type=\"match\" stateTitle=<<folded-state>> text=\"hide\" default=\"show\">\n<$button tooltip={{$:/language/Buttons/Unfold/Hint}} aria-label={{$:/language/Buttons/Unfold/Caption}} class=<<tv-config-toolbar-class>>>\n<$action-sendmessage $message=\"tm-fold-tiddler\" $param=<<currentTiddler>> foldedState=<<folded-state>>/>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\" variable=\"listItem\">\n{{$:/core/images/unfold-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Unfold/Caption}}/>\n</span>\n</$list>\n</$button>\n</$reveal>\n"
},
"$:/core/ui/Buttons/info": {
"title": "$:/core/ui/Buttons/info",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/info-button}} {{$:/language/Buttons/Info/Caption}}",
"description": "{{$:/language/Buttons/Info/Hint}}",
"text": "\\whitespace trim\n\\define button-content()\n\\whitespace trim\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/info-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Info/Caption}}/>\n</span>\n</$list>\n\\end\n<$reveal state=\"$:/config/TiddlerInfo/Mode\" type=\"match\" text=\"popup\">\n<$button popup=<<tiddlerInfoState>> tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$macrocall $name=\"button-content\" mode=\"inline\"/>\n</$button>\n</$reveal>\n<$reveal state=\"$:/config/TiddlerInfo/Mode\" type=\"match\" text=\"sticky\">\n<$reveal state=<<tiddlerInfoState>> type=\"match\" text=\"\" default=\"\">\n<$button set=<<tiddlerInfoState>> setTo=\"yes\" tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$macrocall $name=\"button-content\" mode=\"inline\"/>\n</$button>\n</$reveal>\n<$reveal state=<<tiddlerInfoState>> type=\"nomatch\" text=\"\" default=\"\">\n<$button set=<<tiddlerInfoState>> setTo=\"\" tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$macrocall $name=\"button-content\" mode=\"inline\"/>\n</$button>\n</$reveal>\n</$reveal>"
},
"$:/core/ui/Buttons/more-tiddler-actions": {
"title": "$:/core/ui/Buttons/more-tiddler-actions",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/down-arrow}} {{$:/language/Buttons/More/Caption}}",
"description": "{{$:/language/Buttons/More/Hint}}",
"text": "\\whitespace trim\n\\define config-title()\n$:/config/ViewToolbarButtons/Visibility/$(listItem)$\n\\end\n<$button popup=<<qualify \"$:/state/popup/more\">> tooltip={{$:/language/Buttons/More/Hint}} aria-label={{$:/language/Buttons/More/Caption}} class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/down-arrow}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/More/Caption}}/>\n</span>\n</$list>\n</$button>\n<$reveal state=<<qualify \"$:/state/popup/more\">> type=\"popup\" position=\"belowleft\" animate=\"yes\">\n\n<div class=\"tc-drop-down\">\n\n<$set name=\"tv-config-toolbar-icons\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-text\" value=\"yes\">\n\n<$set name=\"tv-config-toolbar-class\" value=\"tc-btn-invisible\">\n\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]] -[[$:/core/ui/Buttons/more-tiddler-actions]]\" variable=\"listItem\">\n\n<$reveal type=\"match\" state=<<config-title>> text=\"hide\">\n\n<$set name=\"tv-config-toolbar-class\" filter=\"[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]\">\n\n<$transclude tiddler=<<listItem>> mode=\"inline\"/>\n\n</$set>\n\n</$reveal>\n\n</$list>\n\n</$set>\n\n</$set>\n\n</$set>\n\n</div>\n\n</$reveal>"
},
"$:/core/ui/Buttons/new-here": {
"title": "$:/core/ui/Buttons/new-here",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/new-here-button}} {{$:/language/Buttons/NewHere/Caption}}",
"description": "{{$:/language/Buttons/NewHere/Hint}}",
"text": "\\whitespace trim\n\\define newHereActions()\n<$set name=\"tags\" filter=\"[<currentTiddler>] [{$:/config/NewTiddler/Tags}]\">\n<$action-sendmessage $message=\"tm-new-tiddler\" tags=<<tags>>/>\n</$set>\n\\end\n\\define newHereButton()\n\\whitespace trim\n<$button actions=<<newHereActions>> tooltip={{$:/language/Buttons/NewHere/Hint}} aria-label={{$:/language/Buttons/NewHere/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/new-here-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/NewHere/Caption}}/>\n</span>\n</$list>\n</$button>\n\\end\n<<newHereButton>>\n"
},
"$:/core/ui/Buttons/new-journal-here": {
"title": "$:/core/ui/Buttons/new-journal-here",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/new-journal-button}} {{$:/language/Buttons/NewJournalHere/Caption}}",
"description": "{{$:/language/Buttons/NewJournalHere/Hint}}",
"text": "\\whitespace trim\n\\define journalButtonTags()\n[[$(currentTiddlerTag)$]] $(journalTags)$\n\\end\n\\define journalButton()\n\\whitespace trim\n<$button tooltip={{$:/language/Buttons/NewJournalHere/Hint}} aria-label={{$:/language/Buttons/NewJournalHere/Caption}} class=<<tv-config-toolbar-class>>>\n<$wikify name=\"journalTitle\" text=\"\"\"<$macrocall $name=\"now\" format=<<journalTitleTemplate>>/>\"\"\">\n<$action-sendmessage $message=\"tm-new-tiddler\" title=<<journalTitle>> tags=<<journalButtonTags>>/>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/new-journal-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/NewJournalHere/Caption}}/>\n</span>\n</$list>\n</$wikify>\n</$button>\n\\end\n<$set name=\"journalTitleTemplate\" value={{$:/config/NewJournal/Title}}>\n<$set name=\"journalTags\" value={{$:/config/NewJournal/Tags}}>\n<$set name=\"currentTiddlerTag\" value=<<currentTiddler>>>\n<<journalButton>>\n</$set>\n</$set>\n</$set>\n"
},
"$:/core/ui/Buttons/open-window": {
"title": "$:/core/ui/Buttons/open-window",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/open-window}} {{$:/language/Buttons/OpenWindow/Caption}}",
"description": "{{$:/language/Buttons/OpenWindow/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-open-window\" tooltip={{$:/language/Buttons/OpenWindow/Hint}} aria-label={{$:/language/Buttons/OpenWindow/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/open-window}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/OpenWindow/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/permalink": {
"title": "$:/core/ui/Buttons/permalink",
"tags": "$:/tags/ViewToolbar",
"caption": "{{$:/core/images/permalink-button}} {{$:/language/Buttons/Permalink/Caption}}",
"description": "{{$:/language/Buttons/Permalink/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-permalink\" tooltip={{$:/language/Buttons/Permalink/Hint}} aria-label={{$:/language/Buttons/Permalink/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/permalink-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Permalink/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/core/ui/Buttons/permaview": {
"title": "$:/core/ui/Buttons/permaview",
"tags": "$:/tags/ViewToolbar $:/tags/PageControls",
"caption": "{{$:/core/images/permaview-button}} {{$:/language/Buttons/Permaview/Caption}}",
"description": "{{$:/language/Buttons/Permaview/Hint}}",
"text": "\\whitespace trim\n<$button message=\"tm-permaview\" tooltip={{$:/language/Buttons/Permaview/Hint}} aria-label={{$:/language/Buttons/Permaview/Caption}} class=<<tv-config-toolbar-class>>>\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/permaview-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\">\n<$text text={{$:/language/Buttons/Permaview/Caption}}/>\n</span>\n</$list>\n</$button>"
},
"$:/DefaultTiddlers": {
"title": "$:/DefaultTiddlers",
"text": "GettingStarted\n"
},
"$:/temp/advancedsearch": {
"title": "$:/temp/advancedsearch",
"text": ""
},
"$:/snippets/allfields": {
"title": "$:/snippets/allfields",
"text": "\\define renderfield(title)\n<tr class=\"tc-view-field\"><td class=\"tc-view-field-name\">''$title$'':</td><td class=\"tc-view-field-value\">//{{$:/language/Docs/Fields/$title$}}//</td></tr>\n\\end\n<table class=\"tc-view-field-table\"><tbody><$list filter=\"[fields[]sort[title]]\" variable=\"listItem\"><$macrocall $name=\"renderfield\" title=<<listItem>>/></$list>\n</tbody></table>\n"
},
"$:/config/AnimationDuration": {
"title": "$:/config/AnimationDuration",
"text": "400"
},
"$:/config/AutoFocus": {
"title": "$:/config/AutoFocus",
"text": "title"
},
"$:/config/AutoSave": {
"title": "$:/config/AutoSave",
"text": "yes"
},
"$:/config/BitmapEditor/Colour": {
"title": "$:/config/BitmapEditor/Colour",
"text": "#444"
},
"$:/config/BitmapEditor/ImageSizes": {
"title": "$:/config/BitmapEditor/ImageSizes",
"text": "[[62px 100px]] [[100px 62px]] [[124px 200px]] [[200px 124px]] [[248px 400px]] [[371px 600px]] [[400px 248px]] [[556px 900px]] [[600px 371px]] [[742px 1200px]] [[900px 556px]] [[1200px 742px]]"
},
"$:/config/BitmapEditor/LineWidth": {
"title": "$:/config/BitmapEditor/LineWidth",
"text": "3px"
},
"$:/config/BitmapEditor/LineWidths": {
"title": "$:/config/BitmapEditor/LineWidths",
"text": "0.25px 0.5px 1px 2px 3px 4px 6px 8px 10px 16px 20px 28px 40px 56px 80px"
},
"$:/config/BitmapEditor/Opacities": {
"title": "$:/config/BitmapEditor/Opacities",
"text": "0.01 0.025 0.05 0.075 0.1 0.15 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0"
},
"$:/config/BitmapEditor/Opacity": {
"title": "$:/config/BitmapEditor/Opacity",
"text": "1.0"
},
"$:/config/DefaultMoreSidebarTab": {
"title": "$:/config/DefaultMoreSidebarTab",
"text": "$:/core/ui/MoreSideBar/Tags"
},
"$:/config/DefaultSidebarTab": {
"title": "$:/config/DefaultSidebarTab",
"text": "$:/core/ui/SideBar/Open"
},
"$:/config/DownloadSaver/AutoSave": {
"title": "$:/config/DownloadSaver/AutoSave",
"text": "no"
},
"$:/config/Drafts/TypingTimeout": {
"title": "$:/config/Drafts/TypingTimeout",
"text": "400"
},
"$:/config/EditMode/fieldname-filter": {
"title": "$:/config/EditMode/fieldname-filter",
"first-search-filter": "[!is[shadow]!is[system]fields[]search:title<userInput>sort[]] -created -creator -draft.of -draft.title -modified -modifier -tags -text -title -type",
"second-search-filter": "[fields[]search:title<userInput>sort[]] -[!is[shadow]!is[system]fields[]]"
},
"$:/config/EditTabIndex": {
"title": "$:/config/EditTabIndex",
"text": "1\n"
},
"$:/config/EditTemplateFields/Visibility/title": {
"title": "$:/config/EditTemplateFields/Visibility/title",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/tags": {
"title": "$:/config/EditTemplateFields/Visibility/tags",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/text": {
"title": "$:/config/EditTemplateFields/Visibility/text",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/creator": {
"title": "$:/config/EditTemplateFields/Visibility/creator",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/created": {
"title": "$:/config/EditTemplateFields/Visibility/created",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/modified": {
"title": "$:/config/EditTemplateFields/Visibility/modified",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/modifier": {
"title": "$:/config/EditTemplateFields/Visibility/modifier",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/type": {
"title": "$:/config/EditTemplateFields/Visibility/type",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/draft.title": {
"title": "$:/config/EditTemplateFields/Visibility/draft.title",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/draft.of": {
"title": "$:/config/EditTemplateFields/Visibility/draft.of",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/revision": {
"title": "$:/config/EditTemplateFields/Visibility/revision",
"text": "hide"
},
"$:/config/EditTemplateFields/Visibility/bag": {
"title": "$:/config/EditTemplateFields/Visibility/bag",
"text": "hide"
},
"$:/config/Editor/EnableImportFilter": {
"title": "$:/config/Editor/EnableImportFilter",
"type": "text/vnd.tiddlywiki",
"text": "[all[current]type[text/vnd.tiddlywiki]] [all[current]!has[type]]"
},
"$:/config/Editor/ImportContentTypesFilter": {
"title": "$:/config/Editor/ImportContentTypesFilter",
"type": "text/vnd.tiddlywiki",
"text": "[prefix[image/]]"
},
"$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-4": {
"title": "$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-4",
"text": "hide"
},
"$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-5": {
"title": "$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-5",
"text": "hide"
},
"$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-6": {
"title": "$:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/heading-6",
"text": "hide"
},
"$:/config/EditorTypeMappings/image/gif": {
"title": "$:/config/EditorTypeMappings/image/gif",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/image/webp": {
"title": "$:/config/EditorTypeMappings/image/webp",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/image/heic": {
"title": "$:/config/EditorTypeMappings/image/heic",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/image/heif": {
"title": "$:/config/EditorTypeMappings/image/heif",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/image/jpeg": {
"title": "$:/config/EditorTypeMappings/image/jpeg",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/image/jpg": {
"title": "$:/config/EditorTypeMappings/image/jpg",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/image/png": {
"title": "$:/config/EditorTypeMappings/image/png",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/image/x-icon": {
"title": "$:/config/EditorTypeMappings/image/x-icon",
"text": "bitmap"
},
"$:/config/EditorTypeMappings/text/vnd.tiddlywiki": {
"title": "$:/config/EditorTypeMappings/text/vnd.tiddlywiki",
"text": "text"
},
"$:/config/Manager/Show": {
"title": "$:/config/Manager/Show",
"text": "tiddlers"
},
"$:/config/Manager/Filter": {
"title": "$:/config/Manager/Filter",
"text": ""
},
"$:/config/Manager/Order": {
"title": "$:/config/Manager/Order",
"text": "forward"
},
"$:/config/Manager/Sort": {
"title": "$:/config/Manager/Sort",
"text": "title"
},
"$:/config/Manager/System": {
"title": "$:/config/Manager/System",
"text": "system"
},
"$:/config/Manager/Tag": {
"title": "$:/config/Manager/Tag",
"text": ""
},
"$:/state/popup/manager/item/$:/Manager/ItemMain/RawText": {
"title": "$:/state/popup/manager/item/$:/Manager/ItemMain/RawText",
"text": "hide"
},
"$:/config/MissingLinks": {
"title": "$:/config/MissingLinks",
"text": "yes"
},
"$:/config/Navigation/UpdateAddressBar": {
"title": "$:/config/Navigation/UpdateAddressBar",
"text": "no"
},
"$:/config/Navigation/UpdateHistory": {
"title": "$:/config/Navigation/UpdateHistory",
"text": "no"
},
"$:/config/NewImageType": {
"title": "$:/config/NewImageType",
"text": "jpeg"
},
"$:/config/OfficialPluginLibrary": {
"title": "$:/config/OfficialPluginLibrary",
"tags": "$:/tags/PluginLibrary",
"url": "https://tiddlywiki.com/library/v5.1.24/index.html",
"caption": "{{$:/language/OfficialPluginLibrary}}",
"text": "{{$:/language/OfficialPluginLibrary/Hint}}\n"
},
"$:/config/Navigation/openLinkFromInsideRiver": {
"title": "$:/config/Navigation/openLinkFromInsideRiver",
"text": "below"
},
"$:/config/Navigation/openLinkFromOutsideRiver": {
"title": "$:/config/Navigation/openLinkFromOutsideRiver",
"text": "top"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/advanced-search": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/advanced-search",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/close-all": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/close-all",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/encryption": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/encryption",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/export-page": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/export-page",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/fold-all": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/fold-all",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/full-screen": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/full-screen",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/home": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/home",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/refresh": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/refresh",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/import": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/import",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/language": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/language",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/tag-manager": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/tag-manager",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/manager": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/manager",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/more-page-actions": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/more-page-actions",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-journal": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-journal",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-image": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/new-image",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/palette": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/palette",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/permaview": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/permaview",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/print": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/print",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/storyview": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/storyview",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/timestamp": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/timestamp",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/theme": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/theme",
"text": "hide"
},
"$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/unfold-all": {
"title": "$:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/unfold-all",
"text": "hide"
},
"$:/config/Performance/Instrumentation": {
"title": "$:/config/Performance/Instrumentation",
"text": "no"
},
"$:/config/RegisterPluginType/plugin": {
"title": "$:/config/RegisterPluginType/plugin",
"text": "yes"
},
"$:/config/RegisterPluginType/theme": {
"title": "$:/config/RegisterPluginType/theme",
"text": "no"
},
"$:/config/RegisterPluginType/language": {
"title": "$:/config/RegisterPluginType/language",
"text": "no"
},
"$:/config/RegisterPluginType/info": {
"title": "$:/config/RegisterPluginType/info",
"text": "yes"
},
"$:/config/RegisterPluginType/import": {
"title": "$:/config/RegisterPluginType/import",
"text": "no"
},
"$:/config/SaveWikiButton/Template": {
"title": "$:/config/SaveWikiButton/Template",
"text": "$:/core/save/all"
},
"$:/config/SaverFilter": {
"title": "$:/config/SaverFilter",
"text": "[all[]] -[prefix[$:/HistoryList]] -[prefix[$:/StoryList]] -[status[pending]plugin-type[import]] -[[$:/isEncrypted]] -[[$:/UploadName]] -[prefix[$:/state/]] -[prefix[$:/temp/]]\n"
},
"$:/config/Search/AutoFocus": {
"title": "$:/config/Search/AutoFocus",
"text": "true"
},
"$:/config/Search/MinLength": {
"title": "$:/config/Search/MinLength",
"text": "3"
},
"$:/config/SearchResults/Default": {
"title": "$:/config/SearchResults/Default",
"text": "$:/core/ui/DefaultSearchResultList"
},
"$:/config/Server/ExternalFilters/[all[tiddlers]!is[system]sort[title]]": {
"title": "$:/config/Server/ExternalFilters/[all[tiddlers]!is[system]sort[title]]",
"text": "yes"
},
"$:/config/ShortcutInfo/add-field": {
"title": "$:/config/ShortcutInfo/add-field",
"text": "{{$:/language/EditTemplate/Fields/Add/Button/Hint}}"
},
"$:/config/ShortcutInfo/advanced-search": {
"title": "$:/config/ShortcutInfo/advanced-search",
"text": "{{$:/language/Buttons/AdvancedSearch/Hint}}"
},
"$:/config/ShortcutInfo/advanced-search-sidebar": {
"title": "$:/config/ShortcutInfo/advanced-search-sidebar",
"text": "{{$:/language/Shortcuts/Input/AdvancedSearch/Hint}}"
},
"$:/config/ShortcutInfo/bold": {
"title": "$:/config/ShortcutInfo/bold",
"text": "{{$:/language/Buttons/Bold/Hint}}"
},
"$:/config/ShortcutInfo/cancel-edit-tiddler": {
"title": "$:/config/ShortcutInfo/cancel-edit-tiddler",
"text": "{{$:/language/Buttons/Cancel/Hint}}"
},
"$:/config/ShortcutInfo/change-sidebar-layout": {
"title": "$:/config/ShortcutInfo/change-sidebar-layout",
"text": "{{$:/language/Shortcuts/SidebarLayout/Hint}}"
},
"$:/config/ShortcutInfo/delete-field": {
"title": "$:/config/ShortcutInfo/delete-field",
"text": "{{$:/language/EditTemplate/Field/Remove/Hint}}"
},
"$:/config/ShortcutInfo/excise": {
"title": "$:/config/ShortcutInfo/excise",
"text": "{{$:/language/Buttons/Excise/Hint}}"
},
"$:/config/ShortcutInfo/heading-1": {
"title": "$:/config/ShortcutInfo/heading-1",
"text": "{{$:/language/Buttons/Heading1/Hint}}"
},
"$:/config/ShortcutInfo/heading-2": {
"title": "$:/config/ShortcutInfo/heading-2",
"text": "{{$:/language/Buttons/Heading2/Hint}}"
},
"$:/config/ShortcutInfo/heading-3": {
"title": "$:/config/ShortcutInfo/heading-3",
"text": "{{$:/language/Buttons/Heading3/Hint}}"
},
"$:/config/ShortcutInfo/heading-4": {
"title": "$:/config/ShortcutInfo/heading-4",
"text": "{{$:/language/Buttons/Heading4/Hint}}"
},
"$:/config/ShortcutInfo/heading-5": {
"title": "$:/config/ShortcutInfo/heading-5",
"text": "{{$:/language/Buttons/Heading5/Hint}}"
},
"$:/config/ShortcutInfo/heading-6": {
"title": "$:/config/ShortcutInfo/heading-6",
"text": "{{$:/language/Buttons/Heading6/Hint}}"
},
"$:/config/ShortcutInfo/input-accept": {
"title": "$:/config/ShortcutInfo/input-accept",
"text": "{{$:/language/Shortcuts/Input/Accept/Hint}}"
},
"$:/config/ShortcutInfo/input-accept-variant": {
"title": "$:/config/ShortcutInfo/input-accept-variant",
"text": "{{$:/language/Shortcuts/Input/AcceptVariant/Hint}}"
},
"$:/config/ShortcutInfo/input-cancel": {
"title": "$:/config/ShortcutInfo/input-cancel",
"text": "{{$:/language/Shortcuts/Input/Cancel/Hint}}"
},
"$:/config/ShortcutInfo/input-down": {
"title": "$:/config/ShortcutInfo/input-down",
"text": "{{$:/language/Shortcuts/Input/Down/Hint}}"
},
"$:/config/ShortcutInfo/input-tab-left": {
"title": "$:/config/ShortcutInfo/input-tab-left",
"text": "{{$:/language/Shortcuts/Input/Tab-Left/Hint}}"
},
"$:/config/ShortcutInfo/input-tab-right": {
"title": "$:/config/ShortcutInfo/input-tab-right",
"text": "{{$:/language/Shortcuts/Input/Tab-Right/Hint}}"
},
"$:/config/ShortcutInfo/input-up": {
"title": "$:/config/ShortcutInfo/input-up",
"text": "{{$:/language/Shortcuts/Input/Up/Hint}}"
},
"$:/config/ShortcutInfo/italic": {
"title": "$:/config/ShortcutInfo/italic",
"text": "{{$:/language/Buttons/Italic/Hint}}"
},
"$:/config/ShortcutInfo/layout-switcher": {
"title": "$:/config/ShortcutInfo/layout-switcher",
"text": "{{$:/language/LayoutSwitcher/Description}}"
},
"$:/config/ShortcutInfo/link": {
"title": "$:/config/ShortcutInfo/link",
"text": "{{$:/language/Buttons/Link/Hint}}"
},
"$:/config/ShortcutInfo/linkify": {
"title": "$:/config/ShortcutInfo/linkify",
"text": "{{$:/language/Buttons/Linkify/Hint}}"
},
"$:/config/ShortcutInfo/list-bullet": {
"title": "$:/config/ShortcutInfo/list-bullet",
"text": "{{$:/language/Buttons/ListBullet/Hint}}"
},
"$:/config/ShortcutInfo/list-number": {
"title": "$:/config/ShortcutInfo/list-number",
"text": "{{$:/language/Buttons/ListNumber/Hint}}"
},
"$:/config/ShortcutInfo/mono-block": {
"title": "$:/config/ShortcutInfo/mono-block",
"text": "{{$:/language/Buttons/MonoBlock/Hint}}"
},
"$:/config/ShortcutInfo/mono-line": {
"title": "$:/config/ShortcutInfo/mono-line",
"text": "{{$:/language/Buttons/MonoLine/Hint}}"
},
"$:/config/ShortcutInfo/new-image": {
"title": "$:/config/ShortcutInfo/new-image",
"text": "{{$:/language/Buttons/NewImage/Hint}}"
},
"$:/config/ShortcutInfo/new-journal": {
"title": "$:/config/ShortcutInfo/new-journal",
"text": "{{$:/language/Buttons/NewJournal/Hint}}"
},
"$:/config/ShortcutInfo/new-tiddler": {
"title": "$:/config/ShortcutInfo/new-tiddler",
"text": "{{$:/language/Buttons/NewTiddler/Hint}}"
},
"$:/config/ShortcutInfo/picture": {
"title": "$:/config/ShortcutInfo/picture",
"text": "{{$:/language/Buttons/Picture/Hint}}"
},
"$:/config/ShortcutInfo/preview": {
"title": "$:/config/ShortcutInfo/preview",
"text": "{{$:/language/Buttons/Preview/Hint}}"
},
"$:/config/ShortcutInfo/quote": {
"title": "$:/config/ShortcutInfo/quote",
"text": "{{$:/language/Buttons/Quote/Hint}}"
},
"$:/config/ShortcutInfo/save-tiddler": {
"title": "$:/config/ShortcutInfo/save-tiddler",
"text": "{{$:/language/Buttons/Save/Hint}}"
},
"$:/config/ShortcutInfo/save-wiki": {
"title": "$:/config/ShortcutInfo/save-wiki",
"text": "{{$:/language/Buttons/SaveWiki/Hint}}"
},
"$:/config/ShortcutInfo/sidebar-search": {
"title": "$:/config/ShortcutInfo/sidebar-search",
"text": "{{$:/language/Buttons/SidebarSearch/Hint}}"
},
"$:/config/ShortcutInfo/stamp": {
"title": "$:/config/ShortcutInfo/stamp",
"text": "{{$:/language/Buttons/Stamp/Hint}}"
},
"$:/config/ShortcutInfo/strikethrough": {
"title": "$:/config/ShortcutInfo/strikethrough",
"text": "{{$:/language/Buttons/Strikethrough/Hint}}"
},
"$:/config/ShortcutInfo/subscript": {
"title": "$:/config/ShortcutInfo/subscript",
"text": "{{$:/language/Buttons/Subscript/Hint}}"
},
"$:/config/ShortcutInfo/superscript": {
"title": "$:/config/ShortcutInfo/superscript",
"text": "{{$:/language/Buttons/Superscript/Hint}}"
},
"$:/config/ShortcutInfo/toggle-sidebar": {
"title": "$:/config/ShortcutInfo/toggle-sidebar",
"text": "{{$:/language/Buttons/ToggleSidebar/Hint}}"
},
"$:/config/ShortcutInfo/transcludify": {
"title": "$:/config/ShortcutInfo/transcludify",
"text": "{{$:/language/Buttons/Transcludify/Hint}}"
},
"$:/config/ShortcutInfo/underline": {
"title": "$:/config/ShortcutInfo/underline",
"text": "{{$:/language/Buttons/Underline/Hint}}"
},
"$:/config/SwitcherTargets/layout": {
"title": "$:/config/SwitcherTargets/layout",
"text": "$:/snippets/LayoutSwitcher"
},
"$:/config/SwitcherTargets/language": {
"title": "$:/config/SwitcherTargets/language",
"text": "$:/snippets/languageswitcher"
},
"$:/config/SwitcherTargets/palette": {
"title": "$:/config/SwitcherTargets/palette",
"text": "$:/core/ui/ControlPanel/Palette"
},
"$:/config/SwitcherTargets/theme": {
"title": "$:/config/SwitcherTargets/theme",
"text": "$:/core/ui/ControlPanel/Theme"
},
"$:/config/SyncFilter": {
"title": "$:/config/SyncFilter",
"text": "[is[tiddler]] -[[$:/core]] -[[$:/library/sjcl.js]] -[prefix[$:/boot/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/isEncrypted]] -[prefix[$:/status/]] -[prefix[$:/state/]] -[prefix[$:/temp/]]\n"
},
"$:/config/SyncSystemTiddlersFromServer": {
"title": "$:/config/SyncSystemTiddlersFromServer",
"text": "no"
},
"$:/config/Tags/MinLength": {
"title": "$:/config/Tags/MinLength",
"text": "0"
},
"$:/config/TextEditor/EditorHeight/Height": {
"title": "$:/config/TextEditor/EditorHeight/Height",
"text": "400px"
},
"$:/config/TextEditor/EditorHeight/Mode": {
"title": "$:/config/TextEditor/EditorHeight/Mode",
"text": "auto"
},
"$:/config/TiddlerInfo/Default": {
"title": "$:/config/TiddlerInfo/Default",
"text": "$:/core/ui/TiddlerInfo/Fields"
},
"$:/config/TiddlerInfo/Mode": {
"title": "$:/config/TiddlerInfo/Mode",
"text": "popup"
},
"$:/config/Tiddlers/TitleLinks": {
"title": "$:/config/Tiddlers/TitleLinks",
"text": "no"
},
"$:/config/Toolbar/ButtonClass": {
"title": "$:/config/Toolbar/ButtonClass",
"text": "tc-btn-invisible"
},
"$:/config/Toolbar/Icons": {
"title": "$:/config/Toolbar/Icons",
"text": "yes"
},
"$:/config/Toolbar/Text": {
"title": "$:/config/Toolbar/Text",
"text": "no"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/clone": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/clone",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/close-others": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/close-others",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/export-tiddler": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/export-tiddler",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/info": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/info",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/more-tiddler-actions": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/more-tiddler-actions",
"text": "show"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/new-here": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/new-here",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/new-journal-here": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/new-journal-here",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/open-window": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/open-window",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/permalink": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/permalink",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/permaview": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/permaview",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/delete": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/delete",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold-bar": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold-bar",
"text": "hide"
},
"$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold-others": {
"title": "$:/config/ViewToolbarButtons/Visibility/$:/core/ui/Buttons/fold-others",
"text": "hide"
},
"$:/config/shortcuts-mac/bold": {
"title": "$:/config/shortcuts-mac/bold",
"text": "meta-B"
},
"$:/config/shortcuts-mac/input-tab-left": {
"title": "$:/config/shortcuts-mac/input-tab-left",
"text": "ctrl-Left"
},
"$:/config/shortcuts-mac/input-tab-right": {
"title": "$:/config/shortcuts-mac/input-tab-right",
"text": "ctrl-Right"
},
"$:/config/shortcuts-mac/italic": {
"title": "$:/config/shortcuts-mac/italic",
"text": "meta-I"
},
"$:/config/shortcuts-mac/underline": {
"title": "$:/config/shortcuts-mac/underline",
"text": "meta-U"
},
"$:/config/shortcuts-mac/new-image": {
"title": "$:/config/shortcuts-mac/new-image",
"text": "ctrl-I"
},
"$:/config/shortcuts-mac/new-journal": {
"title": "$:/config/shortcuts-mac/new-journal",
"text": "ctrl-J"
},
"$:/config/shortcuts-mac/new-tiddler": {
"title": "$:/config/shortcuts-mac/new-tiddler",
"text": "ctrl-N"
},
"$:/config/shortcuts-mac/save-wiki": {
"title": "$:/config/shortcuts-mac/save-wiki",
"text": "meta-S"
},
"$:/config/shortcuts-not-mac/bold": {
"title": "$:/config/shortcuts-not-mac/bold",
"text": "ctrl-B"
},
"$:/config/shortcuts-not-mac/italic": {
"title": "$:/config/shortcuts-not-mac/italic",
"text": "ctrl-I"
},
"$:/config/shortcuts-not-mac/underline": {
"title": "$:/config/shortcuts-not-mac/underline",
"text": "ctrl-U"
},
"$:/config/shortcuts-not-mac/new-image": {
"title": "$:/config/shortcuts-not-mac/new-image",
"text": "alt-I"
},
"$:/config/shortcuts-not-mac/new-journal": {
"title": "$:/config/shortcuts-not-mac/new-journal",
"text": "alt-J"
},
"$:/config/shortcuts-not-mac/new-tiddler": {
"title": "$:/config/shortcuts-not-mac/new-tiddler",
"text": "alt-N"
},
"$:/config/shortcuts/add-field": {
"title": "$:/config/shortcuts/add-field",
"text": "enter"
},
"$:/config/shortcuts/advanced-search": {
"title": "$:/config/shortcuts/advanced-search",
"text": "ctrl-shift-A"
},
"$:/config/shortcuts/advanced-search-sidebar": {
"title": "$:/config/shortcuts/advanced-search-sidebar",
"text": "alt-Enter"
},
"$:/config/shortcuts/cancel-edit-tiddler": {
"title": "$:/config/shortcuts/cancel-edit-tiddler",
"text": "escape"
},
"$:/config/shortcuts/change-sidebar-layout": {
"title": "$:/config/shortcuts/change-sidebar-layout",
"text": "shift-alt-Down"
},
"$:/config/shortcuts/delete-field": {
"title": "$:/config/shortcuts/delete-field",
"text": "shift-alt-D"
},
"$:/config/shortcuts/excise": {
"title": "$:/config/shortcuts/excise",
"text": "ctrl-E"
},
"$:/config/shortcuts/sidebar-search": {
"title": "$:/config/shortcuts/sidebar-search",
"text": "ctrl-shift-F"
},
"$:/config/shortcuts/heading-1": {
"title": "$:/config/shortcuts/heading-1",
"text": "ctrl-1"
},
"$:/config/shortcuts/heading-2": {
"title": "$:/config/shortcuts/heading-2",
"text": "ctrl-2"
},
"$:/config/shortcuts/heading-3": {
"title": "$:/config/shortcuts/heading-3",
"text": "ctrl-3"
},
"$:/config/shortcuts/heading-4": {
"title": "$:/config/shortcuts/heading-4",
"text": "ctrl-4"
},
"$:/config/shortcuts/heading-5": {
"title": "$:/config/shortcuts/heading-5",
"text": "ctrl-5"
},
"$:/config/shortcuts/heading-6": {
"title": "$:/config/shortcuts/heading-6",
"text": "ctrl-6"
},
"$:/config/shortcuts/input-accept": {
"title": "$:/config/shortcuts/input-accept",
"text": "Enter"
},
"$:/config/shortcuts/input-accept-variant": {
"title": "$:/config/shortcuts/input-accept-variant",
"text": "ctrl-Enter"
},
"$:/config/shortcuts/input-cancel": {
"title": "$:/config/shortcuts/input-cancel",
"text": "Escape"
},
"$:/config/shortcuts/input-down": {
"title": "$:/config/shortcuts/input-down",
"text": "Down"
},
"$:/config/shortcuts/input-tab-left": {
"title": "$:/config/shortcuts/input-tab-left",
"text": "alt-Left"
},
"$:/config/shortcuts/input-tab-right": {
"title": "$:/config/shortcuts/input-tab-right",
"text": "alt-Right"
},
"$:/config/shortcuts/input-up": {
"title": "$:/config/shortcuts/input-up",
"text": "Up"
},
"$:/config/shortcuts/layout-switcher": {
"title": "$:/config/shortcuts/layout-switcher",
"text": "ctrl-shift-L"
},
"$:/config/shortcuts/link": {
"title": "$:/config/shortcuts/link",
"text": "ctrl-L"
},
"$:/config/shortcuts/linkify": {
"title": "$:/config/shortcuts/linkify",
"text": "alt-shift-L"
},
"$:/config/shortcuts/list-bullet": {
"title": "$:/config/shortcuts/list-bullet",
"text": "ctrl-shift-L"
},
"$:/config/shortcuts/list-number": {
"title": "$:/config/shortcuts/list-number",
"text": "ctrl-shift-N"
},
"$:/config/shortcuts/mono-block": {
"title": "$:/config/shortcuts/mono-block",
"text": "ctrl-shift-M"
},
"$:/config/shortcuts/mono-line": {
"title": "$:/config/shortcuts/mono-line",
"text": "ctrl-M"
},
"$:/config/shortcuts/picture": {
"title": "$:/config/shortcuts/picture",
"text": "ctrl-shift-I"
},
"$:/config/shortcuts/preview": {
"title": "$:/config/shortcuts/preview",
"text": "alt-P"
},
"$:/config/shortcuts/quote": {
"title": "$:/config/shortcuts/quote",
"text": "ctrl-Q"
},
"$:/config/shortcuts/save-tiddler": {
"title": "$:/config/shortcuts/save-tiddler",
"text": "ctrl+enter"
},
"$:/config/shortcuts/save-wiki": {
"title": "$:/config/shortcuts/save-wiki",
"text": "ctrl-S"
},
"$:/config/shortcuts/stamp": {
"title": "$:/config/shortcuts/stamp",
"text": "ctrl-S"
},
"$:/config/shortcuts/strikethrough": {
"title": "$:/config/shortcuts/strikethrough",
"text": "ctrl-T"
},
"$:/config/shortcuts/subscript": {
"title": "$:/config/shortcuts/subscript",
"text": "ctrl-shift-B"
},
"$:/config/shortcuts/superscript": {
"title": "$:/config/shortcuts/superscript",
"text": "ctrl-shift-P"
},
"$:/config/shortcuts/toggle-sidebar": {
"title": "$:/config/shortcuts/toggle-sidebar",
"text": "alt-shift-S"
},
"$:/config/shortcuts/transcludify": {
"title": "$:/config/shortcuts/transcludify",
"text": "alt-shift-T"
},
"$:/config/ui/EditTemplate": {
"title": "$:/config/ui/EditTemplate",
"text": "$:/core/ui/EditTemplate"
},
"$:/config/ui/ViewTemplate": {
"title": "$:/config/ui/ViewTemplate",
"text": "$:/core/ui/ViewTemplate"
},
"$:/config/WikiParserRules/Inline/wikilink": {
"title": "$:/config/WikiParserRules/Inline/wikilink",
"text": "enable"
},
"$:/snippets/currpalettepreview": {
"title": "$:/snippets/currpalettepreview",
"text": "\\define resolve-colour(macrocall)\n\\import $:/core/macros/utils\n\\whitespace trim\n<$wikify name=\"name\" text=\"\"\"$macrocall$\"\"\">\n<<name>>\n</$wikify>\n\\end\n\\define swatchStyle()\nbackground-color: $(swatchColour)$;\n\\end\n\\define swatch-inner()\n<$set name=\"swatchColour\" value={{##$(colourResolved)$}}>\n<$list filter=\"[<swatchColour>!prefix[<<colour ]!suffix[>>]]\" variable=\"ignore\">\n<div class=\"tc-swatch\" style=<<swatchStyle>> title=<<swatchTitle>>/>\n</$list>\n<$list filter=\"[<swatchColour>prefix[<<colour ]suffix[>>]]\" variable=\"ignore\">\n<$wikify name=\"colourResolved\" text=\"\"\"<$macrocall $name=\"resolve-colour\" macrocall=<<swatchColour>>/>\"\"\">\n<<swatch-inner>>\n</$wikify>\n</$list>\n</$set>\n\\end\n\\define swatch()\n<$set name=\"swatchColour\" value={{##$(colour)$}}>\n<$set name=\"swatchTitle\" value=<<colour>>>\n<$list filter=\"[<swatchColour>!prefix[<<colour ]!suffix[>>]]\" variable=\"ignore\">\n<div class=\"tc-swatch\" style=<<swatchStyle>> title=<<swatchTitle>>/>\n</$list>\n<$list filter=\"[<swatchColour>prefix[<<colour ]suffix[>>]]\" variable=\"ignore\">\n<$wikify name=\"colourResolved\" text=\"\"\"<$macrocall $name=\"resolve-colour\" macrocall=<<swatchColour>>/>\"\"\">\n<<swatch-inner>>\n</$wikify>\n</$list>\n</$set>\n</$set>\n\\end\n<div class=\"tc-swatches-horiz\"><$list filter=\"\nforeground\nbackground\nmuted-foreground\nprimary\npage-background\ntab-background\ntiddler-info-background\n\" variable=\"colour\"><<swatch>></$list></div>\n"
},
"$:/snippets/download-wiki-button": {
"title": "$:/snippets/download-wiki-button",
"text": "\\define lingo-base() $:/language/ControlPanel/Tools/Download/\n<$button class=\"tc-btn-big-green\">\n<$action-sendmessage $message=\"tm-download-file\" $param=\"$:/core/save/all\" filename=\"index.html\"/>\n<<lingo Full/Caption>> {{$:/core/images/save-button}}\n</$button>"
},
"$:/language": {
"title": "$:/language",
"text": "$:/languages/en-GB"
},
"$:/snippets/languageswitcher": {
"title": "$:/snippets/languageswitcher",
"text": "\\define flag-title()\n$(languagePluginTitle)$/icon\n\\end\n\n<$linkcatcher to=\"$:/language\">\n<div class=\"tc-chooser tc-language-chooser\">\n<$list filter=\"[[$:/languages/en-GB]] [plugin-type[language]sort[description]]\">\n<$set name=\"cls\" filter=\"[all[current]field:title{$:/language}]\" value=\"tc-chooser-item tc-chosen\" emptyValue=\"tc-chooser-item\"><div class=<<cls>>>\n<$link>\n<span class=\"tc-image-button\">\n<$set name=\"languagePluginTitle\" value=<<currentTiddler>>>\n<$transclude subtiddler=<<flag-title>>>\n<$list filter=\"[all[current]field:title[$:/languages/en-GB]]\">\n<$transclude tiddler=\"$:/languages/en-GB/icon\"/>\n</$list>\n</$transclude>\n</$set>\n</span>\n<$view field=\"description\">\n<$view field=\"name\">\n<$view field=\"title\"/>\n</$view>\n</$view>\n</$link>\n</div>\n</$set>\n</$list>\n</div>\n</$linkcatcher>"
},
"$:/core/macros/CSS": {
"title": "$:/core/macros/CSS",
"tags": "$:/tags/Macro",
"text": "\\define colour(name)\n<$transclude tiddler={{$:/palette}} index=\"$name$\"><$transclude tiddler=\"$:/palettes/Vanilla\" index=\"$name$\"><$transclude tiddler=\"$:/config/DefaultColourMappings/$name$\"/></$transclude></$transclude>\n\\end\n\n\\define color(name)\n<<colour $name$>>\n\\end\n\n\\define box-shadow(shadow)\n``\n -webkit-box-shadow: $shadow$;\n -moz-box-shadow: $shadow$;\n box-shadow: $shadow$;\n``\n\\end\n\n\\define filter(filter)\n``\n -webkit-filter: $filter$;\n -moz-filter: $filter$;\n filter: $filter$;\n``\n\\end\n\n\\define transition(transition)\n``\n -webkit-transition: $transition$;\n -moz-transition: $transition$;\n transition: $transition$;\n``\n\\end\n\n\\define transform-origin(origin)\n``\n -webkit-transform-origin: $origin$;\n -moz-transform-origin: $origin$;\n transform-origin: $origin$;\n``\n\\end\n\n\\define background-linear-gradient(gradient)\n``\nbackground-image: linear-gradient($gradient$);\nbackground-image: -o-linear-gradient($gradient$);\nbackground-image: -moz-linear-gradient($gradient$);\nbackground-image: -webkit-linear-gradient($gradient$);\nbackground-image: -ms-linear-gradient($gradient$);\n``\n\\end\n\n\\define column-count(columns)\n``\n-moz-column-count: $columns$;\n-webkit-column-count: $columns$;\ncolumn-count: $columns$;\n``\n\\end\n\n\\define datauri(title)\n<$macrocall $name=\"makedatauri\" type={{$title$!!type}} text={{$title$}} _canonical_uri={{$title$!!_canonical_uri}}/>\n\\end\n\n\\define if-sidebar(text)\n<$reveal state=\"$:/state/sidebar\" type=\"match\" text=\"yes\" default=\"yes\">$text$</$reveal>\n\\end\n\n\\define if-no-sidebar(text)\n<$reveal state=\"$:/state/sidebar\" type=\"nomatch\" text=\"yes\" default=\"yes\">$text$</$reveal>\n\\end\n\n\\define if-background-attachment(text)\n<$reveal state=\"$:/themes/tiddlywiki/vanilla/settings/backgroundimage\" type=\"nomatch\" text=\"\">$text$</$reveal>\n\\end\n"
},
"$:/core/macros/colour-picker": {
"title": "$:/core/macros/colour-picker",
"tags": "$:/tags/Macro",
"text": "\\define colour-picker-update-recent()\n<$action-listops\n\t$tiddler=\"$:/config/ColourPicker/Recent\"\n\t$subfilter=\"$(colour-picker-value)$ [list[$:/config/ColourPicker/Recent]remove[$(colour-picker-value)$]] +[limit[8]]\"\n/>\n\\end\n\n\\define colour-picker-inner(actions)\n<$button tag=\"a\" tooltip=\"\"\"$(colour-picker-value)$\"\"\">\n\n$(colour-picker-update-recent)$\n\n$actions$\n\n<span style=\"display:inline-block; background-color: $(colour-picker-value)$; width: 100%; height: 100%; border-radius: 50%;\"/>\n\n</$button>\n\\end\n\n\\define colour-picker-recent-inner(actions)\n<$set name=\"colour-picker-value\" value=\"$(recentColour)$\">\n<$macrocall $name=\"colour-picker-inner\" actions=\"\"\"$actions$\"\"\"/>\n</$set>\n\\end\n\n\\define colour-picker-recent(actions)\n{{$:/language/ColourPicker/Recent}} <$list filter=\"[list[$:/config/ColourPicker/Recent]]\" variable=\"recentColour\">\n<$macrocall $name=\"colour-picker-recent-inner\" actions=\"\"\"$actions$\"\"\"/></$list>\n\\end\n\n\\define colour-picker(actions)\n<div class=\"tc-colour-chooser\">\n\n<$macrocall $name=\"colour-picker-recent\" actions=\"\"\"$actions$\"\"\"/>\n\n---\n\n<$list filter=\"LightPink Pink Crimson LavenderBlush PaleVioletRed HotPink DeepPink MediumVioletRed Orchid Thistle Plum Violet Magenta Fuchsia DarkMagenta Purple MediumOrchid DarkViolet DarkOrchid Indigo BlueViolet MediumPurple MediumSlateBlue SlateBlue DarkSlateBlue Lavender GhostWhite Blue MediumBlue MidnightBlue DarkBlue Navy RoyalBlue CornflowerBlue LightSteelBlue LightSlateGrey SlateGrey DodgerBlue AliceBlue SteelBlue LightSkyBlue SkyBlue DeepSkyBlue LightBlue PowderBlue CadetBlue Azure LightCyan PaleTurquoise Cyan Aqua DarkTurquoise DarkSlateGrey DarkCyan Teal MediumTurquoise LightSeaGreen Turquoise Aquamarine MediumAquamarine MediumSpringGreen MintCream SpringGreen MediumSeaGreen SeaGreen Honeydew LightGreen PaleGreen DarkSeaGreen LimeGreen Lime ForestGreen Green DarkGreen Chartreuse LawnGreen GreenYellow DarkOliveGreen YellowGreen OliveDrab Beige LightGoldenrodYellow Ivory LightYellow Yellow Olive DarkKhaki LemonChiffon PaleGoldenrod Khaki Gold Cornsilk Goldenrod DarkGoldenrod FloralWhite OldLace Wheat Moccasin Orange PapayaWhip BlanchedAlmond NavajoWhite AntiqueWhite Tan BurlyWood Bisque DarkOrange Linen Peru PeachPuff SandyBrown Chocolate SaddleBrown Seashell Sienna LightSalmon Coral OrangeRed DarkSalmon Tomato MistyRose Salmon Snow LightCoral RosyBrown IndianRed Red Brown FireBrick DarkRed Maroon White WhiteSmoke Gainsboro LightGrey Silver DarkGrey Grey DimGrey Black\" variable=\"colour-picker-value\">\n<$macrocall $name=\"colour-picker-inner\" actions=\"\"\"$actions$\"\"\"/>\n</$list>\n\n---\n\n<$edit-text tiddler=\"$:/config/ColourPicker/New\" tag=\"input\" default=\"\" placeholder=\"\"/>\n<$edit-text tiddler=\"$:/config/ColourPicker/New\" type=\"color\" tag=\"input\"/>\n<$set name=\"colour-picker-value\" value={{$:/config/ColourPicker/New}}>\n<$macrocall $name=\"colour-picker-inner\" actions=\"\"\"$actions$\"\"\"/>\n</$set>\n\n</div>\n\n\\end\n"
},
"$:/core/macros/copy-to-clipboard": {
"title": "$:/core/macros/copy-to-clipboard",
"tags": "$:/tags/Macro",
"text": "\\define copy-to-clipboard(src,class:\"tc-btn-invisible\",style)\n<$button class=<<__class__>> style=<<__style__>> message=\"tm-copy-to-clipboard\" param=<<__src__>> tooltip={{$:/language/Buttons/CopyToClipboard/Hint}}>\n{{$:/core/images/copy-clipboard}} <$text text={{$:/language/Buttons/CopyToClipboard/Caption}}/>\n</$button>\n\\end\n\n\\define copy-to-clipboard-above-right(src,class:\"tc-btn-invisible\",style)\n<div style=\"position: relative;\">\n<div style=\"position: absolute; bottom: 0; right: 0;\">\n<$macrocall $name=\"copy-to-clipboard\" src=<<__src__>> class=<<__class__>> style=<<__style__>>/>\n</div>\n</div>\n\\end\n\n"
},
"$:/core/macros/diff": {
"title": "$:/core/macros/diff",
"tags": "$:/tags/Macro",
"text": "\\define compareTiddlerText(sourceTiddlerTitle,sourceSubTiddlerTitle,destTiddlerTitle,destSubTiddlerTitle)\n<$set name=\"source\" tiddler=<<__sourceTiddlerTitle__>> subtiddler=<<__sourceSubTiddlerTitle__>>>\n<$set name=\"dest\" tiddler=<<__destTiddlerTitle__>> subtiddler=<<__destSubTiddlerTitle__>>>\n<$diff-text source=<<source>> dest=<<dest>>/>\n</$set>\n</$set>\n\\end\n\n\\define compareTiddlers(sourceTiddlerTitle,sourceSubTiddlerTitle,destTiddlerTitle,destSubTiddlerTitle,exclude)\n<table class=\"tc-diff-tiddlers\">\n<tbody>\n<$set name=\"sourceFields\" filter=\"[<__sourceTiddlerTitle__>fields[]sort[]]\">\n<$set name=\"destFields\" filter=\"[<__destSubTiddlerTitle__>subtiddlerfields<__destTiddlerTitle__>sort[]]\">\n<$list filter=\"[enlist<sourceFields>] [enlist<destFields>] -[enlist<__exclude__>] +[sort[]]\" variable=\"fieldName\">\n<tr>\n<th>\n<$text text=<<fieldName>>/> \n</th>\n<td>\n<$set name=\"source\" tiddler=<<__sourceTiddlerTitle__>> subtiddler=<<__sourceSubTiddlerTitle__>> field=<<fieldName>>>\n<$set name=\"dest\" tiddler=<<__destTiddlerTitle__>> subtiddler=<<__destSubTiddlerTitle__>> field=<<fieldName>>>\n<$diff-text source=<<source>> dest=<<dest>>>\n</$diff-text>\n</$set>\n</$set>\n</td>\n</tr>\n</$list>\n</$set>\n</$set>\n</tbody>\n</table>\n\\end\n"
},
"$:/core/macros/dumpvariables": {
"title": "$:/core/macros/dumpvariables",
"tags": "$:/tags/Macro",
"text": "\\define dumpvariables()\n<ul>\n<$list filter=\"[variables[]]\" variable=\"varname\">\n<li>\n<strong><code><$text text=<<varname>>/></code></strong>:<br/>\n<$codeblock code={{{ [<varname>getvariable[]] }}}/>\n</li>\n</$list>\n</ul>\n\\end\n"
},
"$:/core/macros/export": {
"title": "$:/core/macros/export",
"tags": "$:/tags/Macro",
"text": "\\define exportButtonFilename(baseFilename)\n$baseFilename$$(extension)$\n\\end\n\n\\define exportButton(exportFilter:\"[!is[system]sort[title]]\",lingoBase,baseFilename:\"tiddlers\")\n\\whitespace trim\n<$vars hint={{{ [<__lingoBase__>addsuffix[Hint]get[text]] }}} caption={{{ [<__lingoBase__>addsuffix[Caption]get[text]] }}}>\n<span class=\"tc-popup-keep\"><$button popup=<<qualify \"$:/state/popup/export\">> tooltip=<<hint>> aria-label=<<caption>> class=<<tv-config-toolbar-class>> selectedClass=\"tc-selected\">\n<$list filter=\"[<tv-config-toolbar-icons>match[yes]]\">\n{{$:/core/images/export-button}}\n</$list>\n<$list filter=\"[<tv-config-toolbar-text>match[yes]]\">\n<span class=\"tc-btn-text\"><$text text=<<caption>>/></span>\n</$list>\n</$button></span></$vars><$reveal state=<<qualify \"$:/state/popup/export\">> type=\"popup\" position=\"below\" animate=\"yes\">\n<div class=\"tc-drop-down\">\n<$set name=\"count\" value={{{ [subfilter<__exportFilter__>count[]] }}}>\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Exporter]]\">\n<$list filter=\"[<currentTiddler>has[condition]subfilter{!!condition}limit[1]] ~[<currentTiddler>!has[condition]then[true]]\" variable=\"ignore\">\n<$button class=\"tc-btn-invisible\">\n<$action-sendmessage $message=\"tm-download-file\" $param=<<currentTiddler>> exportFilter=<<__exportFilter__>> filename={{{ [<__baseFilename__>addsuffix{!!extension}] }}}/>\n<$action-deletetiddler $tiddler=<<qualify \"$:/state/popup/export\">>/>\n<$transclude field=\"description\"/>\n</$button>\n</$list>\n</$list>\n</$set>\n</div>\n</$reveal>\n\\end\n"
},
"$:/core/macros/image-picker": {
"title": "$:/core/macros/image-picker",
"created": "20170715180840889",
"modified": "20170715180914005",
"tags": "$:/tags/Macro",
"type": "text/vnd.tiddlywiki",
"text": "\\define image-picker-thumbnail(actions)\n<$button tag=\"a\" tooltip=\"\"\"$(imageTitle)$\"\"\">\n$actions$\n<$transclude tiddler=<<imageTitle>>/>\n</$button>\n\\end\n\n\\define image-picker-list(filter,actions)\n<$list filter=\"\"\"$filter$\"\"\" variable=\"imageTitle\">\n<$macrocall $name=\"image-picker-thumbnail\" actions=\"\"\"$actions$\"\"\"/>\n</$list>\n\\end\n\n\\define image-picker(actions,filter:\"[all[shadows+tiddlers]is[image]] -[type[application/pdf]] +[!has[draft.of]$subfilter$sort[title]]\",subfilter:\"\")\n<div class=\"tc-image-chooser\">\n<$vars state-system=<<qualify \"$:/state/image-picker/system\">>>\n<$checkbox tiddler=<<state-system>> field=\"text\" checked=\"show\" unchecked=\"hide\" default=\"hide\">\n{{$:/language/SystemTiddlers/Include/Prompt}}\n</$checkbox>\n<$reveal state=<<state-system>> type=\"match\" text=\"hide\" default=\"hide\" tag=\"div\">\n<$macrocall $name=\"image-picker-list\" filter=\"\"\"$filter$ +[!is[system]]\"\"\" actions=\"\"\"$actions$\"\"\"/>\n</$reveal>\n<$reveal state=<<state-system>> type=\"nomatch\" text=\"hide\" default=\"hide\" tag=\"div\">\n<$macrocall $name=\"image-picker-list\" filter=\"\"\"$filter$\"\"\" actions=\"\"\"$actions$\"\"\"/>\n</$reveal>\n</$vars>\n</div>\n\\end\n\n\\define image-picker-include-tagged-images(actions)\n<$macrocall $name=\"image-picker\" filter=\"[all[shadows+tiddlers]is[image]] [all[shadows+tiddlers]tag[$:/tags/Image]] -[type[application/pdf]] +[!has[draft.of]sort[title]]\" actions=\"\"\"$actions$\"\"\"/>\n\\end\n"
},
"$:/core/macros/keyboard-driven-input": {
"title": "$:/core/macros/keyboard-driven-input",
"tags": "$:/tags/Macro",
"text": "\\define change-input-tab(stateTitle,tag,beforeafter,defaultState,actions)\n<$set name=\"tabsList\" filter=\"[all[shadows+tiddlers]tag<__tag__>!has[draft.of]]\">\n<$vars currentState={{{ [<__stateTitle__>!is[missing]get[text]] ~[<__defaultState__>] }}} firstTab={{{ [enlist<tabsList>nth[1]] }}} lastTab={{{ [enlist<tabsList>last[]] }}}>\n<$set name=\"nextTab\" value={{{ [all[shadows+tiddlers]tag<__tag__>!has[draft.of]$beforeafter$<currentState>] ~[[$beforeafter$]removeprefix[after]suffix[]addprefix<firstTab>] ~[[$beforeafter$]removeprefix[before]suffix[]addprefix<lastTab>] }}}>\n<$action-setfield $tiddler=<<__stateTitle__>> text=<<nextTab>>/>\n$actions$\n</$set>\n</$vars>\n</$set>\n\\end\n\n\\define keyboard-input-actions()\n<$list filter=\"[<__index__>match[]]\">\n<$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>get<__field__>] }}}/>\n</$list>\n<$list filter=\"[<__index__>!match[]]\">\n<$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>getindex<__index__>] }}}/>\n</$list>\n\\end\n\n\\define input-next-actions-inner()\n<$list filter=\"[<nextItem>minlength[1]]\" variable=\"ignore\">\n<$action-setfield $tiddler=<<__selectionStateTitle__>> text=<<nextItem>>/>\n<$list filter=\"[<__index__>match[]]\">\n<$action-setfield $tiddler=<<__tiddler__>> $field=<<__field__>> $value={{{ [<nextItem>] +[splitregexp[(?:.(?!-))+$]] }}}/>\n</$list>\n<$list filter=\"[<__index__>!match[]]\">\n<$action-setfield $tiddler=<<__tiddler__>> $index=<<__index__>> $value={{{ [<nextItem>] +[splitregexp[(?:.(?!-))+$]] }}}/>\n</$list>\n<$action-setfield $tiddler=<<__refreshTitle__>> text=\"yes\"/>\n</$list>\n\\end\n\n\\define input-next-actions(afterOrBefore:\"after\",reverse:\"\")\n<$list filter=\"[<__storeTitle__>get[text]minlength<__filterMinLength__>] [<__filterMinLength__>match[0]] +[limit[1]]\" variable=\"ignore\">\n<$vars userInput={{{ [<__storeTitle__>get[text]] }}} selectedItem={{{ [<__selectionStateTitle__>get[text]] }}}>\n<$set name=\"configTiddler\" value={{{ [subfilter<__configTiddlerFilter__>] }}}>\n<$vars primaryListFilter={{{ [<configTiddler>get<__firstSearchFilterField__>] }}} secondaryListFilter={{{ [<configTiddler>get<__secondSearchFilterField__>] }}}>\n<$set name=\"filteredList\" filter=\"[subfilter<primaryListFilter>addsuffix[-primaryList]] =[subfilter<secondaryListFilter>addsuffix[-secondaryList]]\">\n<$vars nextItem={{{ [enlist<filteredList>$afterOrBefore$<selectedItem>] ~[enlist<filteredList>$reverse$nth[1]] }}} firstItem={{{ [enlist<filteredList>nth[1]] }}} lastItem={{{ [enlist<filteredList>last[]] }}}>\n<$list filter=\"[<selectedItem>match<firstItem>!match<lastItem>]\" variable=\"ignore\">\n<$set name=\"nextItem\" value={{{ [[$afterOrBefore$]match[before]then<userInput>addsuffix[-userInput]] ~[<nextItem>] }}}>\n<<input-next-actions-inner>>\n</$set>\n</$list>\n<$list filter=\"[<selectedItem>match<lastItem>!match<firstItem>]\" variable=\"ignore\">\n<$set name=\"nextItem\" value={{{ [[$afterOrBefore$]match[after]then<userInput>addsuffix[-userInput]] ~[<nextItem>] }}}>\n<<input-next-actions-inner>>\n</$set>\n</$list>\n<$list filter=\"[<selectedItem>match<firstItem>match<lastItem>]\" variable=\"ignore\">\n<$set name=\"nextItem\" value={{{ [<userInput>addsuffix[-userInput]] }}}>\n<<input-next-actions-inner>>\n</$set>\n</$list>\n<$list filter=\"[<selectedItem>!match<firstItem>!match<lastItem>]\" variable=\"ignore\">\n<<input-next-actions-inner>>\n</$list>\n</$vars>\n</$set>\n</$vars>\n</$set>\n</$vars>\n</$list>\n\\end\n\n\\define keyboard-driven-input(tiddler,storeTitle,field:\"text\",index:\"\",tag:\"input\",type,focus:\"\",inputAcceptActions,inputAcceptVariantActions,inputCancelActions,placeholder:\"\",default:\"\",class,focusPopup,rows,minHeight,tabindex,size,autoHeight,filterMinLength:\"0\",refreshTitle,selectionStateTitle,cancelPopups:\"\",configTiddlerFilter,firstSearchFilterField:\"first-search-filter\",secondSearchFilterField:\"second-search-filter\")\n\\whitespace trim\n<$keyboard key=\"((input-accept))\" actions=<<__inputAcceptActions__>>>\n<$keyboard key=\"((input-accept-variant))\" actions=<<__inputAcceptVariantActions__>>>\n<$keyboard key=\"((input-up))\" actions=<<input-next-actions \"before\" \"reverse[]\">>>\n<$keyboard key=\"((input-down))\" actions=<<input-next-actions>>>\n<$keyboard key=\"((input-cancel))\" actions=<<__inputCancelActions__>>>\n<$edit-text tiddler=<<__tiddler__>> field=<<__field__>> index=<<__index__>> \n\t\tinputActions=<<keyboard-input-actions>> tag=<<__tag__>> class=<<__class__>> \n\t\tplaceholder=<<__placeholder__>> default=<<__default__>> focusPopup=<<__focusPopup__>> \n\t\tfocus=<<__focus__>> type=<<__type__>> rows=<<__rows__>> minHeight=<<__minHeight__>> \n\t\ttabindex=<<__tabindex__>> size=<<__size__>> autoHeight=<<__autoHeight__>> \n\t\trefreshTitle=<<__refreshTitle__>> cancelPopups=<<__cancelPopups__>>/>\n</$keyboard>\n</$keyboard>\n</$keyboard>\n</$keyboard>\n</$keyboard>\n\\end\n"
},
"$:/core/macros/lingo": {
"title": "$:/core/macros/lingo",
"tags": "$:/tags/Macro",
"text": "\\define lingo-base()\n$:/language/\n\\end\n\n\\define lingo(title)\n{{$(lingo-base)$$title$}}\n\\end\n"
},
"$:/core/macros/list": {
"title": "$:/core/macros/list",
"tags": "$:/tags/Macro",
"text": "\\define list-links(filter,type:\"ul\",subtype:\"li\",class:\"\",emptyMessage)\n\\whitespace trim\n<$type$ class=\"$class$\">\n<$list filter=\"$filter$\" emptyMessage=<<__emptyMessage__>>>\n<$subtype$>\n<$link to={{!!title}}>\n<$transclude field=\"caption\">\n<$view field=\"title\"/>\n</$transclude>\n</$link>\n</$subtype$>\n</$list>\n</$type$>\n\\end\n\n\\define list-links-draggable-drop-actions()\n<$action-listops $tiddler=<<targetTiddler>> $field=<<targetField>> $subfilter=\"+[insertbefore:currentTiddler<actionTiddler>]\"/>\n\\end\n\n\\define list-links-draggable(tiddler,field:\"list\",type:\"ul\",subtype:\"li\",class:\"\",itemTemplate)\n\\whitespace trim\n<span class=\"tc-links-draggable-list\">\n<$vars targetTiddler=\"\"\"$tiddler$\"\"\" targetField=\"\"\"$field$\"\"\">\n<$type$ class=\"$class$\">\n<$list filter=\"[list[$tiddler$!!$field$]]\">\n<$droppable actions=<<list-links-draggable-drop-actions>> tag=\"\"\"$subtype$\"\"\" enable=<<tv-enable-drag-and-drop>>>\n<div class=\"tc-droppable-placeholder\"/>\n<div>\n<$transclude tiddler=\"\"\"$itemTemplate$\"\"\">\n<$link to={{!!title}}>\n<$transclude field=\"caption\">\n<$view field=\"title\"/>\n</$transclude>\n</$link>\n</$transclude>\n</div>\n</$droppable>\n</$list>\n<$tiddler tiddler=\"\">\n<$droppable actions=<<list-links-draggable-drop-actions>> tag=\"div\" enable=<<tv-enable-drag-and-drop>>>\n<div class=\"tc-droppable-placeholder\">\n{{$:/core/images/blank}}\n</div>\n<div style=\"height:0.5em;\"/>\n</$droppable>\n</$tiddler>\n</$type$>\n</$vars>\n</span>\n\\end\n\n\\define list-tagged-draggable-drop-actions(tag)\n<!-- Save the current ordering of the tiddlers with this tag -->\n<$set name=\"order\" filter=\"[<__tag__>tagging[]]\">\n<!-- Remove any list-after or list-before fields from the tiddlers with this tag -->\n<$list filter=\"[<__tag__>tagging[]]\">\n<$action-deletefield $field=\"list-before\"/>\n<$action-deletefield $field=\"list-after\"/>\n</$list>\n<!-- Save the new order to the Tag Tiddler -->\n<$action-listops $tiddler=<<__tag__>> $field=\"list\" $filter=\"+[enlist<order>] +[insertbefore:currentTiddler<actionTiddler>]\"/>\n<!-- Make sure the newly added item has the right tag -->\n<!-- Removing this line makes dragging tags within the dropdown work as intended -->\n<!--<$action-listops $tiddler=<<actionTiddler>> $tags=<<__tag__>>/>-->\n<!-- Using the following 5 lines as replacement makes dragging titles from outside into the dropdown apply the tag -->\n<$list filter=\"[<actionTiddler>!contains:tags<__tag__>]\">\n<$fieldmangler tiddler=<<actionTiddler>>>\n<$action-sendmessage $message=\"tm-add-tag\" $param=<<__tag__>>/>\n</$fieldmangler>\n</$list>\n</$set>\n\\end\n\n\\define list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:\"div\",storyview:\"\")\n\\whitespace trim\n<span class=\"tc-tagged-draggable-list\">\n<$set name=\"tag\" value=<<__tag__>>>\n<$list filter=\"[<__tag__>tagging[]$subFilter$]\" emptyMessage=<<__emptyMessage__>> storyview=<<__storyview__>>>\n<$elementTag$ class=\"tc-menu-list-item\">\n<$droppable actions=\"\"\"<$macrocall $name=\"list-tagged-draggable-drop-actions\" tag=<<__tag__>>/>\"\"\" enable=<<tv-enable-drag-and-drop>>>\n<$elementTag$ class=\"tc-droppable-placeholder\"/>\n<$elementTag$>\n<$transclude tiddler=\"\"\"$itemTemplate$\"\"\">\n<$link to={{!!title}}>\n<$view field=\"title\"/>\n</$link>\n</$transclude>\n</$elementTag$>\n</$droppable>\n</$elementTag$>\n</$list>\n<$tiddler tiddler=\"\">\n<$droppable actions=\"\"\"<$macrocall $name=\"list-tagged-draggable-drop-actions\" tag=<<__tag__>>/>\"\"\" enable=<<tv-enable-drag-and-drop>>>\n<$elementTag$ class=\"tc-droppable-placeholder\"/>\n<$elementTag$ style=\"height:0.5em;\">\n</$elementTag$>\n</$droppable>\n</$tiddler>\n</$set>\n</span>\n\\end\n"
},
"$:/core/macros/tabs": {
"title": "$:/core/macros/tabs",
"tags": "$:/tags/Macro",
"text": "\\define tabs(tabsList,default,state:\"$:/state/tab\",class,template,buttonTemplate,retain,actions,explicitState)\n<$set name=\"qualifiedState\" value=<<qualify \"$state$\">>>\n<$vars tabsState={{{ [<__explicitState__>minlength[1]] ~[<qualifiedState>] }}}>\n<div class=\"tc-tab-set $class$\">\n<div class=\"tc-tab-buttons $class$\">\n<$list filter=\"$tabsList$\" variable=\"currentTab\" storyview=\"pop\"><$set name=\"save-currentTiddler\" value=<<currentTiddler>>><$tiddler tiddler=<<currentTab>>><$button set=<<tabsState>> setTo=<<currentTab>> default=\"$default$\" selectedClass=\"tc-tab-selected\" tooltip={{!!tooltip}}>\n<$tiddler tiddler=<<save-currentTiddler>>>\n<$set name=\"tv-wikilinks\" value=\"no\">\n<$transclude tiddler=\"$buttonTemplate$\" mode=\"inline\">\n<$transclude tiddler=<<currentTab>> field=\"caption\">\n<$macrocall $name=\"currentTab\" $type=\"text/plain\" $output=\"text/plain\"/>\n</$transclude>\n</$transclude>\n</$set></$tiddler>$actions$</$button></$tiddler></$set></$list>\n</div>\n<div class=\"tc-tab-divider $class$\"/>\n<div class=\"tc-tab-content $class$\">\n<$list filter=\"$tabsList$\" variable=\"currentTab\">\n\n<$reveal type=\"match\" state=<<tabsState>> text=<<currentTab>> default=\"$default$\" retain=\"\"\"$retain$\"\"\">\n\n<$transclude tiddler=\"$template$\" mode=\"block\">\n\n<$transclude tiddler=<<currentTab>> mode=\"block\"/>\n\n</$transclude>\n\n</$reveal>\n\n</$list>\n</div>\n</div>\n</$vars>\n</$set>\n\\end\n"
},
"$:/core/macros/tag-picker": {
"title": "$:/core/macros/tag-picker",
"tags": "$:/tags/Macro",
"first-search-filter": "[tags[]!is[system]search:title<userInput>sort[]]",
"second-search-filter": "[tags[]is[system]search:title<userInput>sort[]]",
"text": "\\define get-tagpicker-focus-selector() [data-tiddler-title=\"$(currentTiddlerCSSEscaped)$\"] .tc-add-tag-name input\n\n\\define delete-tag-state-tiddlers() <$action-deletetiddler $filter=\"[<newTagNameTiddler>] [<storeTitle>] [<tagSelectionState>]\"/>\n\n\\define add-tag-actions(actions,tagField:\"tags\")\n<$set name=\"tag\" value={{{ [<__tiddler__>get[text]] }}}>\n<$list filter=\"[<saveTiddler>!contains:$tagField$<tag>!match[]]\" variable=\"ignore\" emptyMessage=\"\"\"\n<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter=\"-[<tag>]\"/>\n\"\"\">\n<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter=\"[<tag>]\"/>\n$actions$\n</$list>\n</$set>\n<<delete-tag-state-tiddlers>>\n<$action-setfield $tiddler=<<refreshTitle>> text=\"yes\"/>\n\\end\n\n\\define clear-tags-actions-inner()\n<$list filter=\"[<storeTitle>has[text]] [<newTagNameTiddler>has[text]]\" variable=\"ignore\" emptyMessage=\"\"\"<<cancel-delete-tiddler-actions \"cancel\">>\"\"\">\n<<delete-tag-state-tiddlers>>\n</$list>\n\\end\n\n\\define clear-tags-actions()\n<$set name=\"userInput\" value={{{ [<storeTitle>get[text]] }}}>\n<$list filter=\"[<newTagNameTiddler>get[text]!match<userInput>]\" emptyMessage=\"\"\"<<clear-tags-actions-inner>>\"\"\">\n<$action-setfield $tiddler=<<newTagNameTiddler>> text=<<userInput>>/><$action-setfield $tiddler=<<refreshTitle>> text=\"yes\"/>\n</$list>\n</$set>\n\\end\n\n\\define tag-picker-inner(actions,tagField:\"tags\")\n\\whitespace trim\n<$vars newTagNameInputTiddlerQualified=<<qualify \"$:/temp/NewTagName/input\">> newTagNameSelectionTiddlerQualified=<<qualify \"$:/temp/NewTagName/selected-item\">> fallbackTarget={{$(palette)$##tag-background}} colourA={{$(palette)$##foreground}} colourB={{$(palette)$##background}}>\n<$vars storeTitle={{{ [<newTagNameInputTiddler>!match[]] ~[<newTagNameInputTiddlerQualified>] }}} tagSelectionState={{{ [<newTagNameSelectionTiddler>!match[]] ~[<newTagNameSelectionTiddlerQualified>] }}}>\n<$vars refreshTitle=<<qualify \"$:/temp/NewTagName/refresh\">> nonSystemTagsFilter=\"[tags[]!is[system]search:title<userInput>sort[]]\" systemTagsFilter=\"[tags[]is[system]search:title<userInput>sort[]]\">\n<div class=\"tc-edit-add-tag\">\n<div>\n<span class=\"tc-add-tag-name tc-small-gap-right\">\n<$macrocall $name=\"keyboard-driven-input\" tiddler=<<newTagNameTiddler>> storeTitle=<<storeTitle>> refreshTitle=<<refreshTitle>>\n\t\tselectionStateTitle=<<tagSelectionState>> inputAcceptActions=\"\"\"<$macrocall $name=\"add-tag-actions\" actions=<<__actions__>> tagField=<<__tagField__>>/>\"\"\"\n\t\tinputCancelActions=<<clear-tags-actions>> tag=\"input\" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}}\n\t\tfocusPopup=<<qualify \"$:/state/popup/tags-auto-complete\">> class=\"tc-edit-texteditor tc-popup-handle\" tabindex=<<tabIndex>> \n\t\tfocus={{{ [{$:/config/AutoFocus}match[tags]then[true]] ~[[false]] }}} filterMinLength={{$:/config/Tags/MinLength}} \n\t\tcancelPopups=<<cancelPopups>> configTiddlerFilter=\"[[$:/core/macros/tag-picker]]\"/>\n</span><$button popup=<<qualify \"$:/state/popup/tags-auto-complete\">> class=\"tc-btn-invisible tc-btn-dropdown\" tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button><$reveal state=<<storeTitle>> type=\"nomatch\" text=\"\"><$button class=\"tc-btn-invisible tc-small-gap tc-btn-dropdown\" tooltip={{$:/language/EditTemplate/Tags/ClearInput/Hint}} aria-label={{$:/language/EditTemplate/Tags/ClearInput/Caption}}>{{$:/core/images/close-button}}<<delete-tag-state-tiddlers>></$button></$reveal><span class=\"tc-add-tag-button tc-small-gap-left\">\n<$set name=\"tag\" value={{{ [<newTagNameTiddler>get[text]] }}}>\n<$button set=<<newTagNameTiddler>> setTo=\"\" class=\"\">\n<$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter=\"[<tag>]\"/>\n$actions$\n<$set name=\"currentTiddlerCSSEscaped\" value={{{ [<saveTiddler>escapecss[]] }}}>\n<<delete-tag-state-tiddlers>><$action-sendmessage $message=\"tm-focus-selector\" $param=<<get-tagpicker-focus-selector>>/>\n</$set>\n{{$:/language/EditTemplate/Tags/Add/Button}}\n</$button>\n</$set>\n</span>\n</div>\n<div class=\"tc-block-dropdown-wrapper\">\n<$reveal state=<<qualify \"$:/state/popup/tags-auto-complete\">> type=\"nomatch\" text=\"\" default=\"\">\n<div class=\"tc-block-dropdown tc-block-tags-dropdown\">\n<$set name=\"userInput\" value={{{ [<storeTitle>get[text]] }}}>\n<$list filter=\"[<userInput>minlength{$:/config/Tags/MinLength}limit[1]]\" emptyMessage=\"\"\"<div class=\"tc-search-results\">{{$:/language/Search/Search/TooShort}}</div>\"\"\" variable=\"listItem\">\n<$list filter=<<nonSystemTagsFilter>> variable=\"tag\">\n<$list filter=\"[<tag>addsuffix[-primaryList]] -[<tagSelectionState>get[text]]\" emptyMessage=\"\"\"<$vars button-classes=\"tc-btn-invisible tc-tag-button-selected\" actions=<<__actions__>> tagField=<<__tagField__>> currentTiddler=<<tag>>>{{||$:/core/ui/TagPickerTagTemplate}}</$vars>\"\"\">\n<$vars button-classes=\"tc-btn-invisible\" actions=<<__actions__>> tagField=<<__tagField__>> currentTiddler=<<tag>>>{{||$:/core/ui/TagPickerTagTemplate}}</$vars>\n</$list>\n</$list></$list>\n<hr>\n<$list filter=\"[<userInput>minlength{$:/config/Tags/MinLength}limit[1]]\" emptyMessage=\"\"\"<div class=\"tc-search-results\">{{$:/language/Search/Search/TooShort}}</div>\"\"\" variable=\"listItem\">\n<$list filter=<<systemTagsFilter>> variable=\"tag\">\n<$list filter=\"[<tag>addsuffix[-secondaryList]] -[<tagSelectionState>get[text]]\" emptyMessage=\"\"\"<$vars button-classes=\"tc-btn-invisible tc-tag-button-selected\" actions=<<__actions__>> tagField=<<__tagField__>> currentTiddler=<<tag>>>{{||$:/core/ui/TagPickerTagTemplate}}</$vars>\"\"\">\n<$vars button-classes=\"tc-btn-invisible\" actions=<<__actions__>> tagField=<<__tagField__>> currentTiddler=<<tag>>>{{||$:/core/ui/TagPickerTagTemplate}}</$vars>\n</$list>\n</$list></$list>\n</$set>\n</div>\n</$reveal>\n</div>\n</div>\n</$vars>\n</$vars>\n</$vars>\n\\end\n\\define tag-picker(actions,tagField:\"tags\")\n\\whitespace trim\n<$vars saveTiddler=<<currentTiddler>> palette={{$:/palette}}>\n<$list filter=\"[<newTagNameTiddler>match[]]\" emptyMessage=\"\"\"<$macrocall $name=\"tag-picker-inner\" actions=<<__actions__>> tagField=<<__tagField__>>/>\"\"\">\n<$set name=\"newTagNameTiddler\" value=<<qualify \"$:/temp/NewTagName\">>>\n<$macrocall $name=\"tag-picker-inner\" actions=<<__actions__>> tagField=<<__tagField__>>/>\n</$set>\n</$list>\n</$vars>\n\\end\n"
},
"$:/core/macros/tag": {
"title": "$:/core/macros/tag",
"tags": "$:/tags/Macro",
"text": "\\define tag-pill-styles()\nbackground-color:$(backgroundColor)$;\nfill:$(foregroundColor)$;\ncolor:$(foregroundColor)$;\n\\end\n\n\\define tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions)\n<$vars foregroundColor=<<contrastcolour target:\"\"\"$colour$\"\"\" fallbackTarget:\"\"\"$fallbackTarget$\"\"\" colourA:\"\"\"$colourA$\"\"\" colourB:\"\"\"$colourB$\"\"\">> backgroundColor=\"\"\"$colour$\"\"\">\n<$element-tag$ $element-attributes$ class=\"tc-tag-label tc-btn-invisible\" style=<<tag-pill-styles>>>\n$actions$<$transclude tiddler=\"\"\"$icon$\"\"\"/><$view tiddler=<<__tag__>> field=\"title\" format=\"text\" />\n</$element-tag$>\n</$vars>\n\\end\n\n\\define tag-pill-body(tag,icon,colour,palette,element-tag,element-attributes,actions)\n<$macrocall $name=\"tag-pill-inner\" tag=<<__tag__>> icon=\"\"\"$icon$\"\"\" colour=\"\"\"$colour$\"\"\" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}} element-tag=\"\"\"$element-tag$\"\"\" element-attributes=\"\"\"$element-attributes$\"\"\" actions=\"\"\"$actions$\"\"\"/>\n\\end\n\n\\define tag-pill(tag,element-tag:\"span\",element-attributes:\"\",actions:\"\")\n<span class=\"tc-tag-list-item\" data-tag-title=<<__tag__>>>\n<$macrocall $name=\"tag-pill-body\" tag=<<__tag__>> icon={{{ [<__tag__>get[icon]] }}} colour={{{ [<__tag__>get[color]] }}} palette={{$:/palette}} element-tag=\"\"\"$element-tag$\"\"\" element-attributes=\"\"\"$element-attributes$\"\"\" actions=\"\"\"$actions$\"\"\"/>\n</span>\n\\end\n\n\\define tag(tag)\n{{$tag$||$:/core/ui/TagTemplate}}\n\\end\n"
},
"$:/core/macros/thumbnails": {
"title": "$:/core/macros/thumbnails",
"tags": "$:/tags/Macro",
"text": "\\define thumbnail(link,icon,color,background-color,image,caption,width:\"280\",height:\"157\")\n<$link to=\"\"\"$link$\"\"\"><div class=\"tc-thumbnail-wrapper\">\n<div class=\"tc-thumbnail-image\" style=\"width:$width$px;height:$height$px;\"><$reveal type=\"nomatch\" text=\"\" default=\"\"\"$image$\"\"\" tag=\"div\" style=\"width:$width$px;height:$height$px;\">\n[img[$image$]]\n</$reveal><$reveal type=\"match\" text=\"\" default=\"\"\"$image$\"\"\" tag=\"div\" class=\"tc-thumbnail-background\" style=\"width:$width$px;height:$height$px;background-color:$background-color$;\"></$reveal></div><div class=\"tc-thumbnail-icon\" style=\"fill:$color$;color:$color$;\">\n$icon$\n</div><div class=\"tc-thumbnail-caption\">\n$caption$\n</div>\n</div></$link>\n\\end\n\n\\define thumbnail-right(link,icon,color,background-color,image,caption,width:\"280\",height:\"157\")\n<div class=\"tc-thumbnail-right-wrapper\"><<thumbnail \"\"\"$link$\"\"\" \"\"\"$icon$\"\"\" \"\"\"$color$\"\"\" \"\"\"$background-color$\"\"\" \"\"\"$image$\"\"\" \"\"\"$caption$\"\"\" \"\"\"$width$\"\"\" \"\"\"$height$\"\"\">></div>\n\\end\n\n\\define list-thumbnails(filter,width:\"280\",height:\"157\")\n<$list filter=\"\"\"$filter$\"\"\"><$macrocall $name=\"thumbnail\" link={{!!link}} icon={{!!icon}} color={{!!color}} background-color={{!!background-color}} image={{!!image}} caption={{!!caption}} width=\"\"\"$width$\"\"\" height=\"\"\"$height$\"\"\"/></$list>\n\\end\n"
},
"$:/core/macros/timeline": {
"title": "$:/core/macros/timeline",
"created": "20141212105914482",
"modified": "20141212110330815",
"tags": "$:/tags/Macro",
"text": "\\define timeline-title()\n\\whitespace trim\n<!-- Override this macro with a global macro \n of the same name if you need to change \n how titles are displayed on the timeline \n -->\n<$view field=\"title\"/>\n\\end\n\\define timeline(limit:\"100\",format:\"DDth MMM YYYY\",subfilter:\"\",dateField:\"modified\")\n<div class=\"tc-timeline\">\n<$list filter=\"[!is[system]$subfilter$has[$dateField$]!sort[$dateField$]limit[$limit$]eachday[$dateField$]]\">\n<div class=\"tc-menu-list-item\">\n<$view field=\"$dateField$\" format=\"date\" template=\"$format$\"/>\n<$list filter=\"[sameday:$dateField${!!$dateField$}!is[system]$subfilter$!sort[$dateField$]]\">\n<div class=\"tc-menu-list-subitem\">\n<$link to={{!!title}}><<timeline-title>></$link>\n</div>\n</$list>\n</div>\n</$list>\n</div>\n\\end\n"
},
"$:/core/macros/toc": {
"title": "$:/core/macros/toc",
"tags": "$:/tags/Macro",
"text": "\\define toc-caption()\n<$set name=\"tv-wikilinks\" value=\"no\">\n <$transclude field=\"caption\">\n <$view field=\"title\"/>\n </$transclude>\n</$set>\n\\end\n\n\\define toc-body(tag,sort:\"\",itemClassFilter,exclude,path)\n<ol class=\"tc-toc\">\n <$list filter=\"\"\"[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]\"\"\">\n <$vars item=<<currentTiddler>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>\n <$set name=\"excluded\" filter=\"\"\"[enlist<__exclude__>] [<__tag__>]\"\"\">\n <$set name=\"toc-item-class\" filter=<<__itemClassFilter__>> emptyValue=\"toc-item-selected\" value=\"toc-item\">\n <li class=<<toc-item-class>>>\n <$list filter=\"[all[current]toc-link[no]]\" emptyMessage=\"<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}><$view field='caption'><$view field='title'/></$view></$link>\">\n <<toc-caption>>\n </$list>\n <$macrocall $name=\"toc-body\" tag=<<item>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>\n </li>\n </$set>\n </$set>\n </$vars>\n </$list>\n</ol>\n\\end\n\n\\define toc(tag,sort:\"\",itemClassFilter:\"\")\n<$macrocall $name=\"toc-body\" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> />\n\\end\n\n\\define toc-linked-expandable-body(tag,sort:\"\",itemClassFilter,exclude,path)\n<!-- helper function -->\n<$qualify name=\"toc-state\" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>\n <$set name=\"toc-item-class\" filter=<<__itemClassFilter__>> emptyValue=\"toc-item-selected\" value=\"toc-item\">\n <li class=<<toc-item-class>>>\n <$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}>\n <$reveal type=\"nomatch\" stateTitle=<<toc-state>> text=\"open\">\n <$button setTitle=<<toc-state>> setTo=\"open\" class=\"tc-btn-invisible tc-popup-keep\">\n {{$:/core/images/right-arrow}}\n </$button>\n </$reveal>\n <$reveal type=\"match\" stateTitle=<<toc-state>> text=\"open\">\n <$button setTitle=<<toc-state>> setTo=\"close\" class=\"tc-btn-invisible tc-popup-keep\">\n {{$:/core/images/down-arrow}}\n </$button>\n </$reveal>\n <<toc-caption>>\n </$link>\n <$reveal type=\"match\" stateTitle=<<toc-state>> text=\"open\">\n <$macrocall $name=\"toc-expandable\" tag=<<currentTiddler>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>> path=<<__path__>>/>\n </$reveal>\n </li>\n </$set>\n</$qualify>\n\\end\n\n\\define toc-unlinked-expandable-body(tag,sort:\"\",itemClassFilter,exclude,path)\n<!-- helper function -->\n<$qualify name=\"toc-state\" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>\n <$set name=\"toc-item-class\" filter=<<__itemClassFilter__>> emptyValue=\"toc-item-selected\" value=\"toc-item\">\n <li class=<<toc-item-class>>>\n <$reveal type=\"nomatch\" stateTitle=<<toc-state>> text=\"open\">\n <$button setTitle=<<toc-state>> setTo=\"open\" class=\"tc-btn-invisible tc-popup-keep\">\n {{$:/core/images/right-arrow}}\n <<toc-caption>>\n </$button>\n </$reveal>\n <$reveal type=\"match\" stateTitle=<<toc-state>> text=\"open\">\n <$button setTitle=<<toc-state>> setTo=\"close\" class=\"tc-btn-invisible tc-popup-keep\">\n {{$:/core/images/down-arrow}}\n <<toc-caption>>\n </$button>\n </$reveal>\n <$reveal type=\"match\" stateTitle=<<toc-state>> text=\"open\">\n <$macrocall $name=\"toc-expandable\" tag=<<currentTiddler>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>> path=<<__path__>>/>\n </$reveal>\n </li>\n </$set>\n</$qualify>\n\\end\n\n\\define toc-expandable-empty-message()\n<$macrocall $name=\"toc-linked-expandable-body\" tag=<<tag>> sort=<<sort>> itemClassFilter=<<itemClassFilter>> exclude=<<excluded>> path=<<path>>/>\n\\end\n\n\\define toc-expandable(tag,sort:\"\",itemClassFilter:\"\",exclude,path)\n<$vars tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>\n <$set name=\"excluded\" filter=\"\"\"[enlist<__exclude__>] [<__tag__>]\"\"\">\n <ol class=\"tc-toc toc-expandable\">\n <$list filter=\"\"\"[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]\"\"\">\n <$list filter=\"[all[current]toc-link[no]]\" emptyMessage=<<toc-expandable-empty-message>> >\n <$macrocall $name=\"toc-unlinked-expandable-body\" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=\"\"\"itemClassFilter\"\"\" exclude=<<excluded>> path=<<path>> />\n </$list>\n </$list>\n </ol>\n </$set>\n</$vars>\n\\end\n\n\\define toc-linked-selective-expandable-body(tag,sort:\"\",itemClassFilter,exclude,path)\n<$qualify name=\"toc-state\" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>\n <$set name=\"toc-item-class\" filter=<<__itemClassFilter__>> emptyValue=\"toc-item-selected\" value=\"toc-item\" >\n <li class=<<toc-item-class>>>\n <$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}>\n <$list filter=\"[all[current]tagging[]$sort$limit[1]]\" variable=\"ignore\" emptyMessage=\"<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>\">\n <$reveal type=\"nomatch\" stateTitle=<<toc-state>> text=\"open\">\n <$button setTitle=<<toc-state>> setTo=\"open\" class=\"tc-btn-invisible tc-popup-keep\">\n {{$:/core/images/right-arrow}}\n </$button>\n </$reveal>\n <$reveal type=\"match\" stateTitle=<<toc-state>> text=\"open\">\n <$button setTitle=<<toc-state>> setTo=\"close\" class=\"tc-btn-invisible tc-popup-keep\">\n {{$:/core/images/down-arrow}}\n </$button>\n </$reveal>\n </$list>\n <<toc-caption>>\n </$link>\n <$reveal type=\"match\" stateTitle=<<toc-state>> text=\"open\">\n <$macrocall $name=\"toc-selective-expandable\" tag=<<currentTiddler>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>> path=<<__path__>>/>\n </$reveal>\n </li>\n </$set>\n</$qualify>\n\\end\n\n\\define toc-unlinked-selective-expandable-body(tag,sort:\"\",itemClassFilter,exclude,path)\n<$qualify name=\"toc-state\" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>\n <$set name=\"toc-item-class\" filter=<<__itemClassFilter__>> emptyValue=\"toc-item-selected\" value=\"toc-item\">\n <li class=<<toc-item-class>>>\n <$list filter=\"[all[current]tagging[]$sort$limit[1]]\" variable=\"ignore\" emptyMessage=\"<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button> <$view field='caption'><$view field='title'/></$view>\">\n <$reveal type=\"nomatch\" stateTitle=<<toc-state>> text=\"open\">\n <$button setTitle=<<toc-state>> setTo=\"open\" class=\"tc-btn-invisible tc-popup-keep\">\n {{$:/core/images/right-arrow}}\n <<toc-caption>>\n </$button>\n </$reveal>\n <$reveal type=\"match\" stateTitle=<<toc-state>> text=\"open\">\n <$button setTitle=<<toc-state>> setTo=\"close\" class=\"tc-btn-invisible tc-popup-keep\">\n {{$:/core/images/down-arrow}}\n <<toc-caption>>\n </$button>\n </$reveal>\n </$list>\n <$reveal type=\"match\" stateTitle=<<toc-state>> text=\"open\">\n <$macrocall $name=\"toc-selective-expandable\" tag=<<currentTiddler>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>> path=<<__path__>>/>\n </$reveal>\n </li>\n </$set>\n</$qualify>\n\\end\n\n\\define toc-selective-expandable-empty-message()\n<$macrocall $name=\"toc-linked-selective-expandable-body\" tag=<<tag>> sort=<<sort>> itemClassFilter=<<itemClassFilter>> exclude=<<excluded>> path=<<path>>/>\n\\end\n\n\\define toc-selective-expandable(tag,sort:\"\",itemClassFilter,exclude,path)\n<$vars tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>\n <$set name=\"excluded\" filter=\"\"\"[enlist<__exclude__>] [<__tag__>]\"\"\">\n <ol class=\"tc-toc toc-selective-expandable\">\n <$list filter=\"\"\"[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]\"\"\">\n <$list filter=\"[all[current]toc-link[no]]\" variable=\"ignore\" emptyMessage=<<toc-selective-expandable-empty-message>> >\n <$macrocall $name=\"toc-unlinked-selective-expandable-body\" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>\n </$list>\n </$list>\n </ol>\n </$set>\n</$vars>\n\\end\n\n\\define toc-tabbed-external-nav(tag,sort:\"\",selectedTiddler:\"$:/temp/toc/selectedTiddler\",unselectedText,missingText,template:\"\")\n<$tiddler tiddler={{{ [<__selectedTiddler__>get[text]] }}}>\n <div class=\"tc-tabbed-table-of-contents\">\n <$linkcatcher to=<<__selectedTiddler__>>>\n <div class=\"tc-table-of-contents\">\n <$macrocall $name=\"toc-selective-expandable\" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=\"[all[current]] -[<__selectedTiddler__>get[text]]\"/>\n </div>\n </$linkcatcher>\n <div class=\"tc-tabbed-table-of-contents-content\">\n <$reveal stateTitle=<<__selectedTiddler__>> type=\"nomatch\" text=\"\">\n <$transclude mode=\"block\" tiddler=<<__template__>>>\n <h1><<toc-caption>></h1>\n <$transclude mode=\"block\">$missingText$</$transclude>\n </$transclude>\n </$reveal>\n <$reveal stateTitle=<<__selectedTiddler__>> type=\"match\" text=\"\">\n $unselectedText$\n </$reveal>\n </div>\n </div>\n</$tiddler>\n\\end\n\n\\define toc-tabbed-internal-nav(tag,sort:\"\",selectedTiddler:\"$:/temp/toc/selectedTiddler\",unselectedText,missingText,template:\"\")\n<$linkcatcher to=<<__selectedTiddler__>>>\n <$macrocall $name=\"toc-tabbed-external-nav\" tag=<<__tag__>> sort=<<__sort__>> selectedTiddler=<<__selectedTiddler__>> unselectedText=<<__unselectedText__>> missingText=<<__missingText__>> template=<<__template__>>/>\n</$linkcatcher>\n\\end\n\n"
},
"$:/core/macros/translink": {
"title": "$:/core/macros/translink",
"tags": "$:/tags/Macro",
"text": "\\define translink(title,mode:\"block\")\n<div style=\"border:1px solid #ccc; padding: 0.5em; background: black; foreground; white;\">\n<$link to=\"\"\"$title$\"\"\">\n<$text text=\"\"\"$title$\"\"\"/>\n</$link>\n<div style=\"border:1px solid #ccc; padding: 0.5em; background: white; foreground; black;\">\n<$transclude tiddler=\"\"\"$title$\"\"\" mode=\"$mode$\">\n\"<$text text=\"\"\"$title$\"\"\"/>\" is missing\n</$transclude>\n</div>\n</div>\n\\end\n"
},
"$:/core/macros/tree": {
"title": "$:/core/macros/tree",
"tags": "$:/tags/Macro",
"text": "\\define leaf-link(full-title,chunk,separator: \"/\")\n<$link to=<<__full-title__>>><$text text=<<__chunk__>>/></$link>\n\\end\n\n\\define leaf-node(prefix,chunk)\n<li>\n<$list filter=\"[<__prefix__>addsuffix<__chunk__>is[shadow]] [<__prefix__>addsuffix<__chunk__>is[tiddler]]\" variable=\"full-title\">\n<$list filter=\"[<full-title>removeprefix<__prefix__>]\" variable=\"chunk\">\n<span>{{$:/core/images/file}}</span> <$macrocall $name=\"leaf-link\" full-title=<<full-title>> chunk=<<chunk>>/>\n</$list>\n</$list>\n</li>\n\\end\n\n\\define branch-node(prefix,chunk,separator: \"/\")\n<li>\n<$set name=\"reveal-state\" value={{{ [[$:/state/tree/]addsuffix<__prefix__>addsuffix<__chunk__>] }}}>\n<$reveal type=\"nomatch\" stateTitle=<<reveal-state>> text=\"show\">\n<$button setTitle=<<reveal-state>> setTo=\"show\" class=\"tc-btn-invisible\">\n{{$:/core/images/folder}} <$text text=<<__chunk__>>/>\n</$button>\n</$reveal>\n<$reveal type=\"match\" stateTitle=<<reveal-state>> text=\"show\">\n<$button setTitle=<<reveal-state>> setTo=\"hide\" class=\"tc-btn-invisible\">\n{{$:/core/images/folder}} <$text text=<<__chunk__>>/>\n</$button>\n</$reveal>\n<span>(<$count filter=\"[all[shadows+tiddlers]removeprefix<__prefix__>removeprefix<__chunk__>] -[<__prefix__>addsuffix<__chunk__>]\"/>)</span>\n<$reveal type=\"match\" stateTitle=<<reveal-state>> text=\"show\">\n<$macrocall $name=\"tree-node\" prefix={{{ [<__prefix__>addsuffix<__chunk__>] }}} separator=<<__separator__>>/>\n</$reveal>\n</$set>\n</li>\n\\end\n\n\\define tree-node(prefix,separator: \"/\")\n<ol>\n<$list filter=\"[all[shadows+tiddlers]removeprefix<__prefix__>splitbefore<__separator__>sort[]!suffix<__separator__>]\" variable=\"chunk\">\n<$macrocall $name=\"leaf-node\" prefix=<<__prefix__>> chunk=<<chunk>> separator=<<__separator__>>/>\n</$list>\n<$list filter=\"[all[shadows+tiddlers]removeprefix<__prefix__>splitbefore<__separator__>sort[]suffix<__separator__>]\" variable=\"chunk\">\n<$macrocall $name=\"branch-node\" prefix=<<__prefix__>> chunk=<<chunk>> separator=<<__separator__>>/>\n</$list>\n</ol>\n\\end\n\n\\define tree(prefix: \"$:/\",separator: \"/\")\n<div class=\"tc-tree\">\n<span><$text text=<<__prefix__>>/></span>\n<div>\n<$macrocall $name=\"tree-node\" prefix=<<__prefix__>> separator=<<__separator__>>/>\n</div>\n</div>\n\\end\n"
},
"$:/core/macros/utils": {
"title": "$:/core/macros/utils",
"text": "\\define colour(colour)\n$colour$\n\\end\n"
},
"$:/snippets/minifocusswitcher": {
"title": "$:/snippets/minifocusswitcher",
"text": "<$select tiddler=\"$:/config/AutoFocus\">\n<$list filter=\"title tags text type fields\">\n<option value=<<currentTiddler>>><<currentTiddler>></option>\n</$list>\n</$select>\n"
},
"$:/snippets/minilanguageswitcher": {
"title": "$:/snippets/minilanguageswitcher",
"text": "<$select tiddler=\"$:/language\">\n<$list filter=\"[[$:/languages/en-GB]] [plugin-type[language]sort[title]]\">\n<option value=<<currentTiddler>>><$view field=\"description\"><$view field=\"name\"><$view field=\"title\"/></$view></$view></option>\n</$list>\n</$select>"
},
"$:/snippets/minithemeswitcher": {
"title": "$:/snippets/minithemeswitcher",
"text": "\\define lingo-base() $:/language/ControlPanel/Theme/\n<<lingo Prompt>> <$select tiddler=\"$:/theme\">\n<$list filter=\"[plugin-type[theme]sort[title]]\">\n<option value=<<currentTiddler>>><$view field=\"name\"><$view field=\"title\"/></$view></option>\n</$list>\n</$select>"
},
"$:/snippets/modules": {
"title": "$:/snippets/modules",
"text": "\\define describeModuleType(type)\n{{$:/language/Docs/ModuleTypes/$type$}}\n\\end\n<$list filter=\"[moduletypes[]]\">\n\n!! <$macrocall $name=\"currentTiddler\" $type=\"text/plain\" $output=\"text/plain\"/>\n\n<$macrocall $name=\"describeModuleType\" type=<<currentTiddler>>/>\n\n<ul><$list filter=\"[all[current]modules[]]\"><li><$link><<currentTiddler>></$link>\n</li>\n</$list>\n</ul>\n</$list>\n"
},
"$:/palette": {
"title": "$:/palette",
"text": "$:/palettes/Vanilla"
},
"$:/snippets/paletteeditor": {
"title": "$:/snippets/paletteeditor",
"text": "<$transclude tiddler=\"$:/PaletteManager\"/>\n"
},
"$:/snippets/palettepreview": {
"title": "$:/snippets/palettepreview",
"text": "<$set name=\"currentTiddler\" value={{$:/palette}}>\n{{||$:/snippets/currpalettepreview}}\n</$set>\n"
},
"$:/snippets/paletteswitcher": {
"title": "$:/snippets/paletteswitcher",
"text": "<$linkcatcher to=\"$:/palette\">\n<div class=\"tc-chooser\"><$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Palette]sort[name]]\"><$set name=\"cls\" filter=\"[all[current]prefix{$:/palette}]\" value=\"tc-chooser-item tc-chosen\" emptyValue=\"tc-chooser-item\"><div class=<<cls>>><$link to={{!!title}}>''<$view field=\"name\" format=\"text\"/>'' - <$view field=\"description\" format=\"text\"/>{{||$:/snippets/currpalettepreview}}</$link>\n</div></$set>\n</$list>\n</div>\n</$linkcatcher>\n"
},
"$:/snippets/peek-stylesheets": {
"title": "$:/snippets/peek-stylesheets",
"text": "\\define expandable-stylesheets-list()\n<ol>\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Stylesheet]!has[draft.of]]\">\n<$vars state=<<qualify \"$:/state/peek-stylesheets/open/\">>>\n<$set name=\"state\" value={{{ [<state>addsuffix<currentTiddler>] }}}>\n<li>\n<$reveal type=\"match\" state=<<state>> text=\"yes\" tag=\"span\">\n<$button set=<<state>> setTo=\"no\" class=\"tc-btn-invisible\">\n{{$:/core/images/down-arrow}}\n</$button>\n</$reveal>\n<$reveal type=\"nomatch\" state=<<state>> text=\"yes\" tag=\"span\">\n<$button set=<<state>> setTo=\"yes\" class=\"tc-btn-invisible\">\n{{$:/core/images/right-arrow}}\n</$button>\n</$reveal>\n<$link>\n<$view field=\"title\"/>\n</$link>\n<$reveal type=\"match\" state=<<state>> text=\"yes\" tag=\"div\">\n<$set name=\"source\" tiddler=<<currentTiddler>>>\n<$wikify name=\"styles\" text=<<source>>>\n<pre>\n<code>\n<$text text=<<styles>>/>\n</code>\n</pre>\n</$wikify>\n</$set>\n</$reveal>\n</li>\n</$set>\n</$vars>\n</$list>\n</ol>\n\\end\n\n\\define stylesheets-list()\n<ol>\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/Stylesheet]!has[draft.of]]\">\n<li>\n<$link>\n<$view field=\"title\"/>\n</$link>\n<$set name=\"source\" tiddler=<<currentTiddler>>>\n<$wikify name=\"styles\" text=<<source>>>\n<pre>\n<code>\n<$text text=<<styles>>/>\n</code>\n</pre>\n</$wikify>\n</$set>\n</li>\n</$list>\n</ol>\n\\end\n\n<$vars modeState=<<qualify \"$:/state/peek-stylesheets/mode/\">>>\n\n<$reveal type=\"nomatch\" state=<<modeState>> text=\"expanded\" tag=\"div\">\n<$button set=<<modeState>> setTo=\"expanded\" class=\"tc-btn-invisible\">{{$:/core/images/chevron-right}} {{$:/language/ControlPanel/Stylesheets/Expand/Caption}}</$button>\n</$reveal>\n<$reveal type=\"match\" state=<<modeState>> text=\"expanded\" tag=\"div\">\n<$button set=<<modeState>> setTo=\"restored\" class=\"tc-btn-invisible\">{{$:/core/images/chevron-down}} {{$:/language/ControlPanel/Stylesheets/Restore/Caption}}</$button>\n</$reveal>\n\n<$reveal type=\"nomatch\" state=<<modeState>> text=\"expanded\" tag=\"div\">\n<<expandable-stylesheets-list>>\n</$reveal>\n<$reveal type=\"match\" state=<<modeState>> text=\"expanded\" tag=\"div\">\n<<stylesheets-list>>\n</$reveal>\n\n</$vars>\n"
},
"$:/config/PublishingJobs/Default": {
"title": "$:/config/PublishingJobs/Default",
"tags": "$:/tags/PublishingJob",
"caption": "Demo static site",
"publisher": "filesystem",
"sitemap": "$:/core/sitemaps/StaticSite",
"jszip-output-filename": "myzipfile.zip",
"baseurl": "https://example.com",
"enabled": "yes",
"export-filter": "[!is[image]!is[system]] [is[image]!is[system]]"
},
"$:/core/routes/StaticSite/HTML": {
"title": "$:/core/routes/StaticSite/HTML",
"caption": "Static HTML",
"tags": "$:/tags/Route",
"route-type": "render",
"route-path": "static/$title_slugify$.html",
"route-tiddler-filter": "[!is[system]!is[image]]",
"route-template": "$:/core/templates/static.tiddler.html"
},
"$:/core/routes/StaticSite/Images": {
"title": "$:/core/routes/StaticSite/Images",
"caption": "Images",
"tags": "$:/tags/Route",
"route-type": "raw",
"route-path": "images/$title_slugify$.$type_extension$",
"route-tiddler-filter": "[is[image]]"
},
"$:/core/routes/StaticSite/Index": {
"title": "$:/core/routes/StaticSite/Index",
"caption": "Index",
"tags": "$:/tags/Route",
"route-type": "render",
"route-path": "index.html",
"route-template": "$:/core/save/all"
},
"$:/core/routes/StaticSite/Styles": {
"title": "$:/core/routes/StaticSite/Styles",
"caption": "Styles",
"tags": "$:/tags/Route",
"route-type": "render",
"route-path": "static/static.css",
"route-template": "$:/core/templates/static.template.css",
"route-output-type": "text/css"
},
"$:/temp/search": {
"title": "$:/temp/search",
"text": ""
},
"$:/core/sitemaps/StaticSite": {
"title": "$:/core/sitemaps/StaticSite",
"caption": "Static site map",
"description": "The original TiddlyWiki 5 static file layout",
"tags": "$:/tags/SiteMap",
"list": "$:/core/routes/StaticSite/Index $:/core/routes/StaticSite/HTML $:/core/routes/StaticSite/Images $:/core/routes/StaticSite/Styles",
"text": "\\define tv-wikilink-template()\n$title_slugify$.html\n\\end"
},
"$:/tags/AdvancedSearch": {
"title": "$:/tags/AdvancedSearch",
"list": "[[$:/core/ui/AdvancedSearch/Standard]] [[$:/core/ui/AdvancedSearch/System]] [[$:/core/ui/AdvancedSearch/Shadows]] [[$:/core/ui/AdvancedSearch/Filter]]"
},
"$:/tags/AdvancedSearch/FilterButton": {
"title": "$:/tags/AdvancedSearch/FilterButton",
"list": "$:/core/ui/AdvancedSearch/Filter/FilterButtons/dropdown $:/core/ui/AdvancedSearch/Filter/FilterButtons/clear $:/core/ui/AdvancedSearch/Filter/FilterButtons/export $:/core/ui/AdvancedSearch/Filter/FilterButtons/delete"
},
"$:/tags/ControlPanel": {
"title": "$:/tags/ControlPanel",
"list": "$:/core/ui/ControlPanel/Info $:/core/ui/ControlPanel/Appearance $:/core/ui/ControlPanel/Settings $:/core/ui/ControlPanel/Saving $:/core/ui/ControlPanel/Plugins $:/core/ui/ControlPanel/Tools $:/core/ui/ControlPanel/Internals"
},
"$:/tags/ControlPanel/Info": {
"title": "$:/tags/ControlPanel/Info",
"list": "$:/core/ui/ControlPanel/Basics $:/core/ui/ControlPanel/Advanced"
},
"$:/tags/ControlPanel/Plugins": {
"title": "$:/tags/ControlPanel/Plugins",
"list": "[[$:/core/ui/ControlPanel/Plugins/Installed]] [[$:/core/ui/ControlPanel/Plugins/Add]]"
},
"$:/tags/EditTemplate": {
"title": "$:/tags/EditTemplate",
"list": "[[$:/core/ui/EditTemplate/controls]] [[$:/core/ui/EditTemplate/title]] [[$:/core/ui/EditTemplate/tags]] [[$:/core/ui/EditTemplate/shadow]] [[$:/core/ui/ViewTemplate/classic]] [[$:/core/ui/EditTemplate/body]] [[$:/core/ui/EditTemplate/type]] [[$:/core/ui/EditTemplate/fields]]"
},
"$:/tags/EditToolbar": {
"title": "$:/tags/EditToolbar",
"list": "[[$:/core/ui/Buttons/delete]] [[$:/core/ui/Buttons/cancel]] [[$:/core/ui/Buttons/save]]"
},
"$:/tags/EditorToolbar": {
"title": "$:/tags/EditorToolbar",
"list": "$:/core/ui/EditorToolbar/paint $:/core/ui/EditorToolbar/opacity $:/core/ui/EditorToolbar/line-width $:/core/ui/EditorToolbar/rotate-left $:/core/ui/EditorToolbar/clear $:/core/ui/EditorToolbar/bold $:/core/ui/EditorToolbar/italic $:/core/ui/EditorToolbar/strikethrough $:/core/ui/EditorToolbar/underline $:/core/ui/EditorToolbar/superscript $:/core/ui/EditorToolbar/subscript $:/core/ui/EditorToolbar/mono-line $:/core/ui/EditorToolbar/mono-block $:/core/ui/EditorToolbar/quote $:/core/ui/EditorToolbar/list-bullet $:/core/ui/EditorToolbar/list-number $:/core/ui/EditorToolbar/heading-1 $:/core/ui/EditorToolbar/heading-2 $:/core/ui/EditorToolbar/heading-3 $:/core/ui/EditorToolbar/heading-4 $:/core/ui/EditorToolbar/heading-5 $:/core/ui/EditorToolbar/heading-6 $:/core/ui/EditorToolbar/link $:/core/ui/EditorToolbar/excise $:/core/ui/EditorToolbar/picture $:/core/ui/EditorToolbar/stamp $:/core/ui/EditorToolbar/size $:/core/ui/EditorToolbar/editor-height $:/core/ui/EditorToolbar/more $:/core/ui/EditorToolbar/preview $:/core/ui/EditorToolbar/preview-type"
},
"$:/tags/Manager/ItemMain": {
"title": "$:/tags/Manager/ItemMain",
"list": "$:/Manager/ItemMain/WikifiedText $:/Manager/ItemMain/RawText $:/Manager/ItemMain/Fields"
},
"$:/tags/Manager/ItemSidebar": {
"title": "$:/tags/Manager/ItemSidebar",
"list": "$:/Manager/ItemSidebar/Tags $:/Manager/ItemSidebar/Colour $:/Manager/ItemSidebar/Icon $:/Manager/ItemSidebar/Tools"
},
"$:/tags/MoreSideBar": {
"title": "$:/tags/MoreSideBar",
"list": "[[$:/core/ui/MoreSideBar/All]] [[$:/core/ui/MoreSideBar/Recent]] [[$:/core/ui/MoreSideBar/Tags]] [[$:/core/ui/MoreSideBar/Missing]] [[$:/core/ui/MoreSideBar/Drafts]] [[$:/core/ui/MoreSideBar/Orphans]] [[$:/core/ui/MoreSideBar/Types]] [[$:/core/ui/MoreSideBar/System]] [[$:/core/ui/MoreSideBar/Shadows]] [[$:/core/ui/MoreSideBar/Explorer]] [[$:/core/ui/MoreSideBar/Plugins]]",
"text": ""
},
"$:/tags/PageControls": {
"title": "$:/tags/PageControls",
"list": "[[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/new-image]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/manager]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/timestamp]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/print]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/more-page-actions]]"
},
"$:/tags/PageTemplate": {
"title": "$:/tags/PageTemplate",
"list": "[[$:/core/ui/PageTemplate/topleftbar]] [[$:/core/ui/PageTemplate/toprightbar]] [[$:/core/ui/PageTemplate/sidebar]] [[$:/core/ui/PageTemplate/story]] [[$:/core/ui/PageTemplate/alerts]]",
"text": ""
},
"$:/tags/PluginLibrary": {
"title": "$:/tags/PluginLibrary",
"list": "$:/config/OfficialPluginLibrary"
},
"$:/tags/SideBar": {
"title": "$:/tags/SideBar",
"list": "[[$:/core/ui/SideBar/Open]] [[$:/core/ui/SideBar/Recent]] [[$:/core/ui/SideBar/Tools]] [[$:/core/ui/SideBar/More]]",
"text": ""
},
"$:/tags/SideBarSegment": {
"title": "$:/tags/SideBarSegment",
"list": "[[$:/core/ui/SideBarSegments/site-title]] [[$:/core/ui/SideBarSegments/site-subtitle]] [[$:/core/ui/SideBarSegments/page-controls]] [[$:/core/ui/SideBarSegments/search]] [[$:/core/ui/SideBarSegments/tabs]]"
},
"$:/tags/TiddlerInfo": {
"title": "$:/tags/TiddlerInfo",
"list": "[[$:/core/ui/TiddlerInfo/Tools]] [[$:/core/ui/TiddlerInfo/References]] [[$:/core/ui/TiddlerInfo/Tagging]] [[$:/core/ui/TiddlerInfo/List]] [[$:/core/ui/TiddlerInfo/Listed]] [[$:/core/ui/TiddlerInfo/Fields]]",
"text": ""
},
"$:/tags/TiddlerInfo/Advanced": {
"title": "$:/tags/TiddlerInfo/Advanced",
"list": "[[$:/core/ui/TiddlerInfo/Advanced/ShadowInfo]] [[$:/core/ui/TiddlerInfo/Advanced/PluginInfo]]"
},
"$:/tags/ViewTemplate": {
"title": "$:/tags/ViewTemplate",
"list": "[[$:/core/ui/ViewTemplate/title]] [[$:/core/ui/ViewTemplate/unfold]] [[$:/core/ui/ViewTemplate/subtitle]] [[$:/core/ui/ViewTemplate/tags]] [[$:/core/ui/ViewTemplate/classic]] [[$:/core/ui/ViewTemplate/body]]"
},
"$:/tags/ViewToolbar": {
"title": "$:/tags/ViewToolbar",
"list": "[[$:/core/ui/Buttons/more-tiddler-actions]] [[$:/core/ui/Buttons/info]] [[$:/core/ui/Buttons/new-here]] [[$:/core/ui/Buttons/new-journal-here]] [[$:/core/ui/Buttons/clone]] [[$:/core/ui/Buttons/export-tiddler]] [[$:/core/ui/Buttons/edit]] [[$:/core/ui/Buttons/delete]] [[$:/core/ui/Buttons/permalink]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/open-window]] [[$:/core/ui/Buttons/close-others]] [[$:/core/ui/Buttons/close]] [[$:/core/ui/Buttons/fold-others]] [[$:/core/ui/Buttons/fold]]"
},
"$:/snippets/themeswitcher": {
"title": "$:/snippets/themeswitcher",
"text": "<$linkcatcher to=\"$:/theme\">\n<div class=\"tc-chooser\"><$list filter=\"[plugin-type[theme]sort[title]]\"><$set name=\"cls\" filter=\"[all[current]field:title{$:/theme}] [[$:/theme]!has[text]addsuffix[s/tiddlywiki/vanilla]field:title<currentTiddler>] +[limit[1]]\" value=\"tc-chooser-item tc-chosen\" emptyValue=\"tc-chooser-item\"><div class=<<cls>>><$link to={{!!title}}>''<$view field=\"name\" format=\"text\"/>'' <$view field=\"description\" format=\"text\"/></$link></div>\n</$set>\n</$list>\n</div>\n</$linkcatcher>"
},
"$:/core/wiki/title": {
"title": "$:/core/wiki/title",
"text": "{{$:/SiteTitle}}\n<$list filter=\"[{$:/SiteSubtitle}trim[]minlength[1]]\" variable=\"ignore\">\n--- {{$:/SiteSubtitle}}\n</$list>"
},
"$:/view": {
"title": "$:/view",
"text": "classic"
},
"$:/snippets/viewswitcher": {
"title": "$:/snippets/viewswitcher",
"text": "\\define icon()\n$:/core/images/storyview-$(storyview)$\n\\end\n<$linkcatcher to=\"$:/view\">\n<div class=\"tc-chooser tc-viewswitcher\">\n<$list filter=\"[storyviews[]]\" variable=\"storyview\">\n<$set name=\"cls\" filter=\"[<storyview>prefix{$:/view}]\" value=\"tc-chooser-item tc-chosen\" emptyValue=\"tc-chooser-item\"><div class=<<cls>>>\n<$button tag=\"a\" class=\"tc-tiddlylink tc-btn-invisible\" to=<<storyview>>><$transclude tiddler=<<icon>>/><$text text=<<storyview>>/></$button>\n</div>\n</$set>\n</$list>\n</div>\n</$linkcatcher>\n"
}
}
}
{
"tiddlers": {
"$:/DefaultTiddlers": {
"title": "$:/DefaultTiddlers",
"text": "HelloThere\n$:/plugins/tiddlywiki/tiddlywiki-on-fission"
},
"HelloThere": {
"title": "HelloThere",
"text": "<div class=\"tc-fission-panel\">\n\n!! Welcome\n\nThis tool lets you directly edit [[TiddlyWiki|https://tiddlywiki.com/]] files stored in [[Fission|https://fission.codes]]'s Webnative file system. You can choose to make them publicly accessible or to keep them entirely private. End-to-end encryption is used which means that even Fission cannot read private data stored on their servers.\n\n<div class=\"tc-fission-warning\">\n\n~TiddlyWiki on Fission is under active development, and is not yet in a state where you should trust it with important data. Please see the warnings below.\n\n</div>\n\n<$reveal stateTitle=\"$:/state/fission/status\" type=\"match\" text=\"INITIALISING\" tag=\"div\" class=\"tc-fission-authorising\">\n\n<$image width=\"80px\" source=\"$:/plugins/tiddlywiki/tiddlywiki-on-fission/spacecat\"/>\n\n''(Authorising with Fission)''\n\n</$reveal>\n\n<$reveal stateTitle=\"$:/state/fission/status\" type=\"match\" text=\"NOTAUTHORISED\">\n\nBefore starting, you'll need to authorise with Fission by clicking this button. Then you'll be able to create a new account or log into an existing account:\n\n<$button message=\"tm-fission-authorise\">\nAuthorise with Fission\n</$button>\n\n</$reveal>\n\n<$reveal stateTitle=\"$:/state/fission/status\" type=\"match\" text=\"AUTHORISED\">\n\nYou are logged into Fission as: ''<$text text={{$:/state/UserName}}/>''\n\nBrowse the Fission filing system:\n\n<div class=\"tc-fission-file-picker-wrapper\">\n\n@@.tc-fission-file-picker\n#.tc-fission-file-picker-private {{private||$:/plugins/tiddlywiki/tiddlywiki-on-fission/list-directory}}\n#.tc-fission-file-picker-public {{public||$:/plugins/tiddlywiki/tiddlywiki-on-fission/list-directory}}\n@@\n\n</div>\n\n* Click on a folder to open it and see the contents\n* Click on the \"+\" next to a folder to create a new empty ~TiddlyWiki in that folder\n* Click on a green `.html` file to open it for editing\n\n<$button message=\"tm-fission-leave\">\nLog out of Fission\n</$button>\n\n\n</$reveal>\n\n</div>\n\n<div class=\"tc-fission-panel\">\n\n!! Warnings and notes\n\n* [[TiddlyWiki v5.1.x|https://tiddlywiki.com/]] is supported, with [[TiddlyWiki Classic|https://classic.tiddlywiki.com/]] support coming soon\n* The Webnative file system is divided into two areas: \"public\" and \"private\". Files in the public area can be viewed by anyone on the internet who knows the unguessable direct link to the file. Files in the private area remain completely inaccessible to anyone not logged into Fission with the same credentials\n* The file picker will let you choose any HTML file, whether or not it is a ~TiddlyWiki file\n* Files viewed via the editor have access to the editor environment via `window.parent.document`, and thus have the same access to Fission as the ~TiddlyWiki on Fission app itself\n* This application is itself a ~TiddlyWiki that includes a plugin for talking to Fission -- see the bottom of the page for a button to switch back to the usual ~TiddlyWiki user interface\n\n</div>\n\n<div class=\"tc-fission-panel\">\n\n!! Get involved\n\n~TiddlyWiki on Fission is an open source project by [[Jeremy Ruston|https://federatial.com/]] with the support of [[Fission|https://fission.codes/]].\n\nhttps://github.com/Jermolene/TiddlyWiki-on-Fission\n\nDiscussions about ~TiddlyWiki on Fission are also happening in other forums:\n\n* [[Fission's TiddlyWiki Forum|https://talk.fission.codes]]\n* [[TiddlyWiki Forum|https://groups.google.com/group/TiddlyWiki]]\n\n</div>\n"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/PageLayout": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/PageLayout",
"tags": "$:/tags/Layout",
"name": "~TiddlyWiki-on-Fission",
"description": "~TiddlyWiki on Fission Custom Page Layout",
"text": "<div class=\"tc-fission-ui-wrapper\">\n<div class=\"tc-fission-ui\">\n<div class=\"tc-fission-branding\">\n[img width=250 [$:/plugins/tiddlywiki/tiddlywiki-on-fission/spacecat]]\n<br>\n<h1>~TiddlyWiki on Fission</h1>\n</div>\n<$transclude tiddler=\"HelloThere\" mode=\"block\"/>\n<$button set=\"$:/layout\" setTo=\"$:/core/ui/PageTemplate\">\nSwitch to ~TiddlyWiki user interface\n</$button> (or type <kbd>ctrl-shift-L</kbd>)\n</div>"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/SidebarSegment": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/SidebarSegment",
"tags": "$:/tags/SideBarSegment",
"list-after": "$:/core/ui/SideBarSegments/site-subtitle",
"text": "<$button set=\"$:/layout\" setTo=\"$:/plugins/tiddlywiki/tiddlywiki-on-fission/PageLayout\">\nSwitch to ~TiddlyWiki on Fission user interface\n</$button>\n"
},
"$:/SiteSubtitle": {
"title": "$:/SiteSubtitle",
"text": "a non-linear personal web notebook"
},
"$:/SiteTitle": {
"title": "$:/SiteTitle",
"text": "[img width=250 [$:/plugins/tiddlywiki/tiddlywiki-on-fission/spacecat]]\n<br>\n~TiddlyWiki on Fission\n"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/SplashScreen": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/SplashScreen",
"tags": "$:/tags/RawMarkupWikified/TopBody",
"type": "text/vnd.tiddlywiki",
"text": "\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n\\rules only filteredtranscludeinline transcludeinline macrocallinline\n<div class=\"tc-remove-when-wiki-loaded\">\n<style scoped>\n\n.tc-splash-text {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n font-size: 16px;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n\tmargin: 20px auto 0;\n\twidth: 200px;\n\ttext-align: center;\n\tcolor: <<colour foreground>>;\n\tfill: <<colour foreground>>;\n}\n\n.tc-splash-text img {\n\twidth: 150px;\n}\n\nhtml body.tc-body {\n\tbackground: <<colour page-background>>;\n}\n\n/*\nSpinner from https://github.com/tobiasahlin/SpinKit/ by Tobias Ahlin\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Tobias Ahlin\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n.tc-splash-spinner {\n\tmargin: 20px auto 0;\n\twidth: 100px;\n\ttext-align: center;\n}\n\n.tc-splash-spinner > div {\n\twidth: 28px;\n\theight: 28px;\n\tborder-radius: 100%;\n\tdisplay: inline-block;\n\t-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;\n\tanimation: sk-bouncedelay 1.4s infinite ease-in-out both;\n\tbackground-color: #fff;\n}\n\n.tc-splash-spinner .tc-splash-bounce-1 {\n\t-webkit-animation-delay: -0.32s;\n\tanimation-delay: -0.32s;\n\tbackground-color: #f00;\n}\n\n.tc-splash-spinner .tc-splash-bounce-2 {\n\t-webkit-animation-delay: -0.16s;\n\tanimation-delay: -0.16s;\n\tbackground-color: #000;\n}\n\n@-webkit-keyframes sk-bouncedelay {\n\t0%, 80%, 100% { -webkit-transform: scale(0) }\n\t40% { -webkit-transform: scale(1.0) }\n}\n\n@keyframes sk-bouncedelay {\n\t0%, 80%, 100% { \n\t-webkit-transform: scale(0);\n\ttransform: scale(0);\n\t} 40% { \n\t-webkit-transform: scale(1.0);\n\ttransform: scale(1.0);\n\t}\n}\n</style>\n\n<div class=\"tc-splash-spinner\">\n <div class=\"tc-splash-bounce-1\"></div>\n <div class=\"tc-splash-bounce-2\"></div>\n <div class=\"tc-splash-bounce-3\"></div>\n</div>\n\n<div class=\"tc-splash-text\">\nPlease wait while {{$:/SiteTitle}} is loading\n</div>\n\n<div class=\"tc-splash-text\">\n<img src=\"data:image/jpeg;base64,{{$:/plugins/tiddlywiki/tiddlywiki-on-fission/spacecat||$:/core/templates/plain-text-tiddler}}\" width=\"300\"/>\n</div>\n\n</div>\n"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/Styles": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/Styles",
"tags": "$:/tags/Stylesheet",
"text": "\\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline macrocallblock\n\n/* Main UI */\n\n.tc-fission-ui {\n\tmargin: 1em 0.5em;\n}\n\n@media (min-width: 760px) {\n\t.tc-fission-ui {\n\t\twidth: 660px;\n\t\tmargin: 1em auto;\n\t}\n}\n\n/* Branding */\n\n.tc-fission-branding {\n\ttext-align: center;\n\tmargin-bottom: 4em;\n}\n\n.tc-fission-branding h1 {\n\tfont-weight: bold;\n}\n\n/* Panels */\n\n.tc-fission-panel {\n\tmargin-bottom: 2em;\n\tpadding: 1em 2em;\n\tbackground-color: #ffffff;\n\tborder-radius: 12px;\n\t<<box-shadow \"1px 1px 5px rgba(0, 0, 0, 0.3)\">>\n}\n\n.tc-fission-panel h2 {\n\tfont-weight: bold;\n}\n\n/* Warning Animation */\n\n.tc-fission-warning {\n\tfont-weight: bold;\n\tpadding: 0 1em;\n\tmargin-left: -1em;\n\tmargin-right: -1em;\n\tcolor: #f22;\n\tborder-radius: 4px;\n\tborder: 3px solid transparent;\n\tbackground: #ffd;\n\tbackground: linear-gradient(#ffd, #ffd) padding-box, repeating-linear-gradient(-45deg, red 0, red 25%, transparent 0, transparent 50%) 0 / .6em .6em;\n\tanimation: marching-ants 20s linear infinite;\n}\n \n@keyframes marching-ants { to { background-position: 100% 100% } }\n\n/* Authentication Animation */\n\n.tc-fission-authorising {\n\tpadding-top: 3em;\n\ttext-align: center;\n}\n\n.tc-fission-authorising img {\n\ttransform-origin: 50% 50%;\n\tanimation: spin 1.5s linear infinite;\n}\n\n@keyframes spin { 100% { transform:rotate(360deg); } }\n\n/* File Picker */\n\n.tc-fission-file-picker-wrapper {\n\tborder: 1px solid <<colour muted-foreground>>;\n\tborder-radius: 4px;\n\tbackground-color: #f8f8fe;\n\t<<box-shadow \"inset 1px 2px 3px rgba(0,0,0,0.1)\">>\n}\n\nol.tc-fission-file-picker {\n\tlist-style: none;\n\tpadding-left: 1em;\n margin-bottom: 0.25em;\n}\n\n.tc-fission-file-picker > ol {\n\tpadding-left: 0;\n}\n\n.tc-fission-file-picker-heading {\n}\n\n.tc-fission-file-picker-folder-button,\n.tc-fission-file-picker-file-button,\n.tc-fission-file-picker-unknown-file {\n\tbackground: none;\n\tborder: none;\n\tcursor: pointer;\n\tcolor: <<colour foreground>>;\n\tfill: <<colour foreground>>;\n padding: 4px 8px;\n border-radius: 6px;\n margin-bottom: 0.5em;\n}\n\n.tc-fission-file-picker-folder-button svg,\n.tc-fission-file-picker-file-button svg,\n.tc-fission-file-picker-unknown-file svg {\n vertical-align: text-bottom;\n}\n\nol.tc-fission-file-picker > li.tc-fission-file-picker-private .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #c2d5ff}\nol.tc-fission-file-picker > li.tc-fission-file-picker-private > ol > li .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #afe0f9}\nol.tc-fission-file-picker > li.tc-fission-file-picker-private > ol > li > ol > li .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #99ebf8}\nol.tc-fission-file-picker > li.tc-fission-file-picker-private > ol > li > ol > li > ol > li .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #8feaf0}\nol.tc-fission-file-picker > li.tc-fission-file-picker-private > ol > li > ol > li > ol > li > ol > li .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #8fddd9}\nol.tc-fission-file-picker > li.tc-fission-file-picker-private > ol > li > ol > li > ol > li > ol > li > ol > li .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #96c3ba}\n\nol.tc-fission-file-picker > li.tc-fission-file-picker-public .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #ff8a8f}\nol.tc-fission-file-picker > li.tc-fission-file-picker-public > ol > li .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #ff9082}\nol.tc-fission-file-picker > li.tc-fission-file-picker-public > ol > li > ol > li .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #ffa56d}\nol.tc-fission-file-picker > li.tc-fission-file-picker-public > ol > li > ol > li > ol > li .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #ffcd57}\nol.tc-fission-file-picker > li.tc-fission-file-picker-public > ol > li > ol > li > ol > li > ol > li .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #ffe948}\nol.tc-fission-file-picker > li.tc-fission-file-picker-public > ol > li > ol > li > ol > li > ol > li > ol > li .tc-fission-file-picker-heading .tc-fission-file-picker-folder-button {background: #fff143}\n\n.tc-fission-file-picker-file-button {\n\tbackground: #8aec6b;\t\n}\n\n.tc-fission-file-picker-unknown-file {\n\tdisplay: inline-block;\n\tbackground: #d9d9d9;\n}\n\n/* Create New Wiki Modal */\n\n.tc-fission-new-wiki-name-input {\n\tfont-size: 1.5em;\n\tline-height: 1.1;\n\twidth: 100%;\n}\n\n.tc-fission-edition {\n\tpadding: 1em;\n}\n\n.tc-fission-edition > label > span {\n\tdisplay: block;\n}\n\n.tc-fission-edition-selected {\n\tbackground: #c6bbff;\n}\n\n.tc-fission-edition-info {\n\tpadding-left: 3em;\n}\n\n.tc-fission-edition-name {\n\tfont-size: 2em;\n\tline-height: 1.1;\n\tfont-weight: bold;\n}\n\n.tc-fission-edition-version {\n\tfont-style: italic;\n}\n\n.tc-fission-edition-description {\n\tmargin-top: 1em;\n\tmargin-bottom: 1em;\n}\n\n.tc-fission-edition-image img {\n\t<<box-shadow \"2px 2px 10px rgba(0, 0, 0, 0.5)\">>\n}\n"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/create-wiki-modal": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/create-wiki-modal",
"footer": "<$button message=\"tm-close-tiddler\">Cancel</$button>",
"subtitle": "Create a new ~TiddlyWiki file",
"text": "\\define create-new-wiki()\n<$action-sendmessage $message=\"tm-fission-open-tiddlywiki\" path={{{ [<wikiNameTiddler>get[text]!suffix[.html]addsuffix[.html]] [<wikiNameTiddler>get[text]suffix[.html]] ~[[index.html]] +[addprefix[/]addprefix<path>] }}} edition={{{ [<editionTitleTiddler>get[text]else<defaultEditionTitle>get[file-path]] }}}/>\n<$action-log/>\n<$action-deletetiddler $tiddler=<<popupState>>/>\n<$action-sendmessage $message=\"tm-close-tiddler\"/>\n\\end\n\n<$set name=\"wikiNameTiddler\" value={{{ [[$:/temp/fission/new-wiki-filename/]addsuffix<path>] }}}>\n\n<$set name=\"editionTitleTiddler\" value={{{ [[$:/temp/fission/edition-name/]addsuffix<path>] }}}>\n\n<$set name=\"defaultEditionTitle\" value={{{ [all[shadows+tiddlers]tag[$:/tags/FissionEditionInfo]sort[name]] }}}>\n\nCreate new empty ~TiddlyWiki file in ''<$text text=<<path>>/>'' called:\n\n<$edit-text tiddler=<<wikiNameTiddler>> placeholder=\"index.html\" tag=\"input\" default=\"\" class=\"tc-fission-new-wiki-name-input\"/>\n\n<$button class=\"tc-btn-big-green\" actions=<<create-new-wiki>>>\nCreate and open new wiki\n</$button>\n\nUse the template ''<$text text={{{ [<editionTitleTiddler>get[text]get[name]else[tiddlywiki.com]] }}}/>'':\n\n<div class=\"tc-fission-edition-chooser\">\n<$list filter=\"[all[shadows+tiddlers]tag[$:/tags/FissionEditionInfo]sort[name]]\">\n<div class={{{ [<editionTitleTiddler>get[text]else<defaultEditionTitle>match<currentTiddler>then[tc-fission-edition-selected]] tc-fission-edition +[join[ ]] }}}>\n<$radio tiddler=<<editionTitleTiddler>> field=\"text\" value=<<currentTiddler>> default=<<defaultEditionTitle>>>\n<div class=\"tc-fission-edition-info\">\n<div class=\"tc-fission-edition-name\">\n<$text text={{!!name}}/>\n</div>\n<div class=\"tc-fission-edition-version\">\nSize <$text text={{{ [<currentTiddler>get[size]divide[1048576]fixed[2]] }}}/>MB, based on ~TiddlyWiki version <$text text={{!!version}}/>\n</div>\n<div class=\"tc-fission-edition-description\">\n<$transclude field=\"text\" mode=\"block\"/>\n</div>\n<div class=\"tc-fission-edition-image\">\n<img src={{{ [{!!thumbnail-path}addprefix[editions/]] }}} width=\"240px\"/>\n</div>\n</div>\n</$radio>\n</div>\n</$list>\n</div>\n\n</$set>\n\n</$set>\n\n</$set>\n"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/fission-logo": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/fission-logo",
"text": "<svg width=\"453\" height=\"94\" xmlns=\"http://www.w3.org/2000/svg\"><defs><linearGradient x1=\"25.501%\" y1=\"13.681%\" x2=\"73.12%\" y2=\"84.309%\" id=\"a\"><stop stop-color=\"#FF5274\" offset=\"0%\"/><stop stop-color=\"#6446FA\" offset=\"100%\"/></linearGradient></defs><g fill=\"none\"><path d=\"M125.625 32.41h12.174V17.43c0-6.29 3.149-10.634 10.51-10.634h18.454v12.51H153.72c-1.873 0-2.81 1.043-2.81 3.128v9.974h41.625V84.12h-13.112v-39.2h-28.512v39.2h-13.112v-39.2h-12.174V32.408zm53.922-25.613h13.007v13.032h-13.007V6.797zm37.964 40.209c0 1.668.868 2.867 2.602 3.596 1.734.73 4.89 1.338 9.47 1.825 5.272.556 9.573 2.137 12.903 4.744 3.33 2.606 4.994 6.238 4.994 10.895v.625c0 5.144-1.873 9.244-5.619 12.303-3.746 3.058-9.018 4.587-15.817 4.587-4.023 0-7.457-.521-10.302-1.564-2.844-1.042-5.203-2.346-7.076-3.91-1.873-1.563-3.312-3.301-4.318-5.212-1.006-1.912-1.682-3.771-2.03-5.578l12.072-3.962c.555 2.224 1.717 4.17 3.486 5.838 1.769 1.669 4.491 2.503 8.168 2.503 3.26 0 5.498-.504 6.712-1.512 1.214-1.008 1.821-2.103 1.821-3.284 0-.695-.156-1.338-.468-1.93-.312-.59-.885-1.146-1.717-1.667-.833-.521-1.96-.956-3.382-1.303-1.422-.348-3.209-.626-5.36-.834-5.826-.487-10.457-1.999-13.891-4.536-3.434-2.537-5.15-6.273-5.15-11.207v-.626c0-2.572.554-4.83 1.664-6.777a16.132 16.132 0 014.37-4.952c1.804-1.355 3.885-2.38 6.244-3.076a25.635 25.635 0 017.284-1.042c3.26 0 6.088.4 8.481 1.199 2.393.8 4.422 1.842 6.087 3.128 1.665 1.285 3.018 2.71 4.059 4.274 1.04 1.564 1.838 3.076 2.393 4.535l-11.863 4.796c-.624-1.876-1.7-3.353-3.225-4.43-1.527-1.078-3.504-1.617-5.932-1.617-2.22 0-3.885.4-4.995 1.2-1.11.798-1.665 1.789-1.665 2.97zm50.677 0c0 1.668.867 2.867 2.602 3.596 1.734.73 4.89 1.338 9.469 1.825 5.272.556 9.573 2.137 12.903 4.744 3.33 2.606 4.995 6.238 4.995 10.895v.625c0 5.144-1.873 9.244-5.619 12.303-3.746 3.058-9.018 4.587-15.817 4.587-4.024 0-7.458-.521-10.302-1.564-2.844-1.042-5.203-2.346-7.076-3.91-1.873-1.563-3.312-3.301-4.318-5.212-1.006-1.912-1.683-3.771-2.03-5.578l12.071-3.962c.555 2.224 1.717 4.17 3.486 5.838 1.77 1.669 4.492 2.503 8.169 2.503 3.26 0 5.498-.504 6.712-1.512 1.214-1.008 1.82-2.103 1.82-3.284 0-.695-.155-1.338-.467-1.93-.313-.59-.885-1.146-1.717-1.667-.833-.521-1.96-.956-3.382-1.303-1.422-.348-3.209-.626-5.36-.834-5.827-.487-10.457-1.999-13.891-4.536-3.434-2.537-5.151-6.273-5.151-11.207v-.626c0-2.572.555-4.83 1.665-6.777a16.132 16.132 0 014.37-4.952c1.804-1.355 3.885-2.38 6.244-3.076a25.635 25.635 0 017.284-1.042c3.26 0 6.087.4 8.48 1.199 2.394.8 4.423 1.842 6.088 3.128 1.665 1.285 3.018 2.71 4.059 4.274 1.04 1.564 1.838 3.076 2.393 4.535l-11.863 4.796c-.624-1.876-1.7-3.353-3.226-4.43-1.526-1.078-3.503-1.617-5.931-1.617-2.22 0-3.885.4-4.995 1.2-1.11.798-1.665 1.789-1.665 2.97zm49.145-2.086h-12.136V32.41h25.247v51.732l-13.111-.02V44.92zm.116-38.123h13.008v13.032h-13.008V6.797zm77.729 52.094c0 4.31-.729 8.115-2.185 11.416-1.457 3.302-3.434 6.082-5.932 8.34-2.497 2.26-5.359 3.98-8.585 5.162-3.226 1.181-6.607 1.772-10.145 1.772-3.539 0-6.92-.59-10.146-1.772-3.226-1.182-6.088-2.902-8.585-5.161-2.498-2.26-4.475-5.04-5.932-8.34-1.456-3.302-2.185-7.108-2.185-11.417V57.64c0-4.24.729-8.01 2.185-11.312 1.457-3.302 3.434-6.1 5.932-8.393a25.557 25.557 0 018.585-5.213c3.226-1.181 6.607-1.772 10.146-1.772 3.538 0 6.92.59 10.145 1.772a25.557 25.557 0 018.585 5.213c2.498 2.294 4.475 5.091 5.932 8.393 1.456 3.301 2.185 7.072 2.185 11.312v1.25zM368.33 73.07c1.873 0 3.642-.313 5.307-.938a12.87 12.87 0 004.37-2.711c1.249-1.182 2.237-2.624 2.966-4.327.728-1.703 1.092-3.631 1.092-5.786v-2.085c0-2.155-.364-4.084-1.092-5.787-.729-1.702-1.717-3.145-2.966-4.326a12.87 12.87 0 00-4.37-2.71c-1.665-.626-3.434-.94-5.307-.94-1.874 0-3.643.314-5.308.94a12.87 12.87 0 00-4.37 2.71c-1.249 1.181-2.237 2.624-2.966 4.326-.728 1.703-1.092 3.632-1.092 5.787v2.085c0 2.155.364 4.083 1.092 5.786.729 1.703 1.717 3.145 2.966 4.327a12.87 12.87 0 004.37 2.71c1.665.626 3.434.939 5.308.939zm49.303 11.051h-13.112V32.41h13.112v7.716h1.873c1.18-2.92 3.087-5.179 5.723-6.777 2.636-1.599 5.723-2.398 9.261-2.398 2.498 0 4.84.4 7.024 1.199a15.71 15.71 0 015.776 3.7c1.665 1.67 2.965 3.789 3.902 6.36.936 2.572 1.405 5.63 1.405 9.175v32.737h-13.112v-29.4c0-3.684-.884-6.586-2.653-8.706-1.77-2.12-4.319-3.18-7.649-3.18-3.885 0-6.78 1.303-8.689 3.91-1.907 2.606-2.861 6.099-2.861 10.478V84.12z\" fill=\"#1E2347\"/><path d=\"M29.5 76.398c1.974-3.868 5.99-6.516 10.624-6.516 6.585 0 11.923 5.348 11.923 11.946S46.71 93.774 40.124 93.774c-4.634 0-8.65-2.648-10.624-6.516H18.445C8.268 87.258.018 78.992.018 68.796c0-10.197 8.25-18.463 18.427-18.463H44.42l-4.387-6.516h-21.59C8.269 43.817.019 35.551.019 25.355c0-10.197 8.25-18.463 18.427-18.463 5.9 0 10.84 2.283 14.42 6.97.234.306 1.131 1.61 3.245 4.706l9.687 14.389h33.349c4.19 0 7.587-3.404 7.587-7.602 0-4.199-3.397-7.602-7.587-7.602H68.09c-1.973 3.868-5.99 6.516-10.623 6.516-6.585 0-11.924-5.349-11.924-11.946 0-6.598 5.339-11.947 11.924-11.947 4.633 0 8.65 2.648 10.623 6.516h11.056c10.177 0 18.427 8.266 18.427 18.463 0 10.196-8.25 18.462-18.427 18.462H53.108l4.387 6.516h21.65c10.178 0 18.428 8.266 18.428 18.463 0 10.196-8.25 18.462-18.427 18.462-5.634 0-10.86-2.556-14.54-7.133l-2.682-3.793-10.192-15.138H18.445c-4.19 0-7.588 3.403-7.588 7.602 0 4.198 3.397 7.602 7.588 7.602H29.5zm41.34-6.242l2.401 3.414a7.556 7.556 0 005.905 2.828c4.19 0 7.587-3.404 7.587-7.602 0-4.199-3.397-7.602-7.587-7.602h-14.34l6.033 8.962zM27.144 24.67a725.11 725.11 0 00-2.887-4.208c-1.462-1.913-3.187-2.71-5.813-2.71-4.19 0-7.588 3.403-7.588 7.602 0 4.198 3.397 7.602 7.588 7.602h14.278l-5.578-8.286z\" fill=\"url(#a)\"/></g></svg>",
"type": "image/svg+xml"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/fission-publisher.js": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/fission-publisher.js",
"text": "/*\\\ntitle: $:/plugins/tiddlywiki/tiddlywiki-on-fission/fission-publisher.js\ntype: application/javascript\nmodule-type: library\n\nHandles publishing to Fission Webnative filing system\n\n\\*/\n(function(){\n\nif(module.setStringHandler) {\n\tmodule.setStringHandler(function(name,language) {\n\t\tswitch(name) {\n\t\t\tcase \"ui\":\n\t\t\t\treturn \"User interface of the Fission publisher\\n\\nOutput base path: <$edit-text field=fission-output-path default='public/'/>\";\n\t\t}\n\t\treturn null;\n\t});\n}\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = \"fission\";\n\nexports.create = function(params) {\n\tvar webnativeDetails = window.webnativeDetails || window.parent && window.parent.webnativeDetails;\n\tif(webnativeDetails) {\n\t\treturn new FissionPublisher(params,webnativeDetails);\t\t\n\t} else {\n\t\treturn null;\n\t}\n};\n\nfunction FissionPublisher(params,webnativeDetails) {\n\tthis.webnativeDetails = webnativeDetails;\n\tthis.params = params;\n\tthis.outputBasePath = params[\"fission-output-path\"] || \"public/\";\n\tconsole.log(\"FissionPublisher\",params);\n};\n\nFissionPublisher.prototype.publishStart = function(callback) {\n\tconsole.log(\"publishStart\");\n\tcallback([]);\n};\n\nFissionPublisher.prototype.publishFile = function(item,callback) {\n\tvar path = this.outputBasePath + item.path\n\tthis.webnativeDetails.fs.add(path,item.text).then(function() {\n\t\tconsole.log(`Saved to ${path}`);\n\t\tcallback();\n\t}).catch(function(err) {\n\t\talert(`Error saving file ${path} to fission: ${err}`);\n\t\tcallback();\n\t});\n};\n\nFissionPublisher.prototype.publishEnd = function(callback) {\n\tthis.webnativeDetails.fs.publish().then(function() {\n\t\talert(`Published`);\n\t\tcallback();\n\t}).catch(function(err) {\n\t\talert(`Error publishing to fission: ${err}`);\n\t\tcallback();\n\t});\n};\n\n})();\n",
"type": "application/javascript",
"module-type": "library"
},
"$:/layout": {
"title": "$:/layout",
"text": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/PageLayout"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/list-directory": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/list-directory",
"text": "<$set name=\"path\" value=<<currentTiddler>>>\n<$set name=\"currentTiddler\" value={{{ [tag[$:/tags/FissionFileListing]!is[draft]field:path<path>] }}}>\n<div class=\"tc-fission-file-picker-heading\">\n<$button class=\"tc-fission-file-picker-folder-button\" tooltip=\"Open this folder\">\n<$action-sendmessage $message=\"tm-fission-list-directory\" path=<<path>>/>\n{{$:/core/images/folder}} ''<$text text=<<path>>/>''\n</$button>\n<$button class=\"tc-btn-invisible\">\n<$action-sendmessage $message=\"tm-modal\" $param=\"$:/plugins/tiddlywiki/tiddlywiki-on-fission/create-wiki-modal\" path=<<path>>/>\n{{$:/core/images/new-button}}\n</$button>\n</div>\n<ol class=\"tc-fission-file-picker\">\n<$list filter=\"[tag[$:/tags/FissionFileListing]!is[draft]field:parent<path>sort[name]]\" variable=\"currentTiddler\">\n<li>\n<$list filter=\"[<currentTiddler>field:is-file[no]]\" variable=\"ignore\" emptyMessage={{$:/plugins/tiddlywiki/tiddlywiki-on-fission/list-file}}>\n<$set name=\"currentTiddler\" value={{!!path}}>\n<$transclude tiddler=\"$:/plugins/tiddlywiki/tiddlywiki-on-fission/list-directory\"/>\n</$set>\n</$list>\n</li>\n</$list>\n</ol>\n</$set>\n</$set>\n"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/list-file": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/list-file",
"text": "<div class=\"tc-fission-file-picker-heading\">\n<$list filter=\"[{!!name}suffix[.html]]\" emptyMessage=\"\"\"<span class=\"tc-fission-file-picker-unknown-file\"><$text text={{!!name}}/></span>\"\"\" variable=\"ignore\">\n<$button class=\"tc-fission-file-picker-file-button\" tooltip=\"Open this HTML file\">\n<$action-sendmessage $message=\"tm-fission-open-tiddlywiki\" path={{!!path}}/>\n{{$:/core/images/open-window}}\n''<$text text={{!!name}}/>''\n</$button>\n</$list>\n<$list filter=\"[<currentTiddler>has[public-path]]\" variable=\"none\">\n<a href={{!!public-path}} target=\"_blank\" rel=\"noopener noreferrer\">(read-only public link)</a>\n</$list>\n</div>\n"
},
"$:/palette": {
"title": "$:/palette",
"text": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/palette"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/readme": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/readme",
"text": "! Fission Status\n\nThe tiddler `$:/state/fission/status` provides a code indicating the current status of the connection to Fission. It may contain the following values:\n\n* ''INITIALISING'': Fission is initialising\n* ''AUTHORISED'': Fission is authorised\n* ''NOTAUTHORISED'': Fission is not authorised\n\n! Authorising with Fission\n\nThe authorisation process is initialised with the `tm-fission-authorise` message:\n\n```\n<$button message=\"tm-fission-authorise\">\nAuthorise with Fission\n</$button>\n```\n\n! Logging out of Fission\n\nThe user is logged out of Fission with the `tm-fission-leave` message:\n\n```\n<$button message=\"tm-fission-leave\">\nLog out of Fission\n</$button>\n```\n\n! Obtaining Directory Listings\n\nInitiate reading information about the entries in a Fission file directory with the `tm-fission-list-directory` message. A tiddler is created to describe each directory entry (see below)\n\nThe `tm-fission-list-directory` message takes the following parameters:\n\n* ''path'': path of folder. The special root directory ''private'' refers to the ~TiddlyWiki on Fission application folder\n* ''statusTitle'': optional title of tiddler to contain status information while the directory is being read\n* ''resultPrefix'': prefix to be used for titles of directory entry tiddlers. Defaults to `$:/temp/fission/filesystem/` plus the path and an extra slash\n\nThe status information is as follows:\n\n* ''PENDING'': The request is pending\n* ''FINISHED'': The request is finished\n\nNote that any existing tiddlers with the specified result prefix will be overwritten or deleted by this operation.\n\nThe directory entry tiddlers have the following fields:\n\n* ''title'': The result prefix plus the name of the directory entry\n* ''tags'': `$:/tags/FissionFileListing`\n* ''parent'': Parent path of this directory entry\n* ''name'': Name of this directory entry\n* ''path'': Full path of this directory entry\n* ''public-path'': If available, the full public URL corresponding to this \n* ''modified'': Last modification date and time of this directory entry\n* ''size'': Size of this directory entry\n* ''is-file'': `yes` if this directory entry is a file, or `no` if not\n\n```\n<$button>\n<$action-sendmessage $message=\"tm-list-directory\" path=\"public\"/>\nList directory \"public\"\n</$button>\n\n<ul>\n<$list filter=\"[prefix[$:/temp/fission/filesystem/]sort[name]]\">\n<li>\n<$link><$view field=\"path\"/></$link>\n</li>\n</$list>\n<ul>\n```\n\n! Opening ~TiddlyWiki documents\n\nA ~TiddlyWiki document can be opened for editing with the `tm-fission-open-tiddlywiki` message.\n\nThe `tm-fission-open-tiddlywiki` message takes the following parameters:\n\n* ''path'': Full path to the file\n* ''edition'': Optional application path to edition to be used to initialise missing files (see below)\n\n```\n<$button message=\"tm-fission-open-tiddlywiki\" path=\"public/mypath/myfile.html\" edition=\"tiddlywiki.com-prerelease/index.html\">\nLog out of Fission\n</$button>\n```\n\n! Edition information\n\nThe available editions are described by configuration tiddlers with the following fields:\n\n* ''title'': The prefix `$:/config/Fission/EditionInfo/` plus the name of the edition\n* ''tags'': `$:/tags/FissionEditionInfo`\n* ''thumbnail-path'': Application path to the thumbnail image for the edition (typicall 1280x1024 pixels)\n* ''file-path'': Application path to the HTML file for the edition\n* ''size'': Size of the HTML file for the edition in bytes\n* ''version'': ~TiddlyWiki version number of the edition\n* ''details'': A wikitext table listing the plugins used by the edition\n* ''name'': Short name\n* ''text'': Brief description\n"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/spacecat": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/spacecat",
"text": "iVBORw0KGgoAAAANSUhEUgAAAgAAAAGZCAMAAADIJ3neAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAFZaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJYTVAgQ29yZSA1LjQuMCI+CiAgIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIj4KICAgICAgICAgPHRpZmY6T3JpZW50YXRpb24+MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CkzCJ1kAAAAJcEhZcwAACxMAAAsTAQCanBgAAALKUExURUdwTHu511T7/1Z42VT0/0pNTjVCQ1Py/lLy/V+SslL2/0L5/0lNTlOjwfjw4purnVTp9NTW8yah0zE0OTNISTiI0CaWwyiOymT6/DEmLja21TA+QEjW5Arz/j3F3zhFSNLe8YeqnqmSeis6PUPi8B+WxXTd4jY1OiCVwDGqzU542UNNTjzx/Nnl8n/Ozdbj7CGYwiKYwT1MTUNNTo3Au0942iKVwU142XqfljNESJS1q0542dXj8dHe8Jne7MX09Izv+Or086js9KH0+hbv87309kBARHS0qlrr8tHW8l6SjygmLFfIyWm8t8vd7y4pMO/y7qWSeqOSeqWLbZaUfY6Te6eTezr+/4mRf0ybmYmDXDydoy2AiHx4Z7q/14pkUAAOANDFt22wvautmdWlo+7z81d42ZupmlZ32O3y8u/19dfx6c7y9Vh525yqm+309DInLQEBAZqomdXv55iqm6mSetGindPW8/T29p+un////ktQUqGqmtP4+1p94drc9s/Y2OTp8DQrMtn07iio1ff9/V2C6yuiziwiLsrp7NSiYWJ1bNrj4lBTVZOikwUHFR47ROHk/7vg5uz7/Mvi4ZyhkgkQJ9OaSQYiOLeegp6LgeLz82uCeZiViUzM2UFr1uDY21Z10e7p6ExINYaYi6CGVoeJgjEAAfJ7BXWPhAM5RcWaYLS9tLvA2XF5btG8sL3X1cTN5wOUwdTMx+vi4IN/c86Xk76lm1BdoJ6CfJy5s8HLxVVntbKPWqaJbZDJ3FdnyKqzpq6FgUNHbayVkqvMxk9Sg/OLOuO1jxM+bVmmwxwDAm3D4kR8fsKLh4iuzJ9tcO7RxPKeaTMQIylNU7Tv9D1svD4sTyRamH5ZVzSQo/3e8Nao3kek3mxs14lmYGlXUezB5TtpaWQ/PLeO2BFm1HGV1wZjao1j0FsIG5GL2UUuAAAKl0dwTIQExWYAAADudFJOUwAHh/iO/geOkAOLh/cV/vya+SZuJFn+PoT51j2ticCLSP33T6F0r/7U65/fj8HDKpi4rcrdxuuD/mLx4198//ai3tC3PeP/6Gbk/rG/1KDflbCHQOVlzoCx3XzI2tja3NPkq/K8/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wAn743sAABcc0lEQVR42uxcW29T2RW2ne14+9gWliF25bGNEHYuEJDNJEaEB8JECQ8zIx75B/YR6jFSFCGwPXmgzpyHKhISQqoG8UDnrS99qdRSjVSJVn2pOp2H/oCq/SNda1/OzceXMEZKnPUFnPgKyvetb1323icSIRAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBALhY5H0gH4b54v5KMBHungkSkI4D+xHo4H7gWdJBHMd+uJ7Ller11clmk28bdQBSzklAnKC+cz4+C2aW6qv5vM2YE2gWIQbWyLfbNQKGV0f0O9sjtiX34D8JnJfrJSq2YQRMwwjFosZPME5z2arlSIqAUWgrIA0MD/IFDDyIeyLpWoihrQzxgTxHJFQWkAVoBU0aiofEOYh9KNLDQz8tUqJI/eCeJZIuPyDAsS9hFBBtSREsForkBGc8bQv2a83HfINzb0A49zl33mAaREM7IbUAEngzNIfLdQE+1mR65Foh31BuJSA9zEmrQBen0AN5BtLGU8VQThT9Gdqq5p9EeZ+8hMjIUUA6cBADTTrhSS5wFmb9sBNod4c2MWqZB+CPTEezKcJWSGCBnhlDVIB2gBJ4CzRnyw08oO1CuR9NmT8w8yHPyg0gPUA2MBqLRqcGhJOKZClXMN2gn8o9id5gQOu64FsBSSwRBI4E/QnZfQj/SyY98fTP/QMxxERExLgFeUCpIBTH/6FOtBfEvSHCUCn+OlSQYKzBPYKKIGBjRKg1aLTHf6ZGuT+qqLf7fCn9QEWohX5OZgIBoPVApnA6Q7/1cFayRA9v6/DZ2EEs5Fu4H3eGRaBBIqDfC1CJnBqi/9kPW9D5W+IzB0c8bhksylin/kNgDPGUAIl227kqBY8lfxj+NtrJaRfx+2UNT/zuEBIDtBSYjgY4MoE6Bd++uy/lreLiViCO7SxaRo+vyewMAUkPKMEQ5hAhhRw6uI/2hjkMfzdHg5N25fsTzoNCs6F5I9oAs0CDQZPGf85sP9sjHuMO9TOEx8B1Uro90IeqNj5pY9ZICLRfLr0L+yfByq+nx35oa+AYhDSQJ2WCE8R/zU7X4kx7l/NKa97rTu8+JuS9UA1wWPVtUEjehIFwEsXLwEWSTefgn9M/76hD9K/vV1O+TlW5T6bMhOMfhnHkcBqZnouk5HFy+m9eC99/SIp4BPEf7Ma8/f8xvrOm273XjWFZDM2ahQUvMsmykBlFW6wkyhgMbL4ee8/v47v9XrHt5KkgNnyXx8M8c/KO13EbvkXfBzPJykTA1nAMCpTKwBedKv3v9+/+de/4+n08S0SwIz595b/ovJj6+xZ9wi+vqnGRgc1C90KMu0SgVDAlO1gMnLn+Hc//bZ7758rvXi6dxUcgTCj8U+mIfjXY33GDINxBgaA/IMDGHzaoW9o1z9GE5zFKoP8NArABHD88qc/vPrLf/d68XjvcyoDZsZ/tOGJf8bKAkxngG+gBph+0jNNLvD2GdAOVmxQQHSyAVy6fpz+/v2B4D8ef0kWMCv+0f+5in+kn+3cuL+7XYYUcL/bPfrlcpmdbArETtILCAVgFohOFMBncXD+3/xD8h9fuUgCmBX/tuP/wP/2jScY9692UqCAnRs7gS6QjVwR/shJoVJAbpICkpGr6PzHx8dxKYDLJIBZ1H9J6P8d/2fr5Z3HwD6m/ntlA+6W4dbDKBvfAbCTzAiZTwGrk5aGwAHSvTRIQPK/t3KHBDAb/u18VfIP4Y+mj3WfrP1x/Z4xFkInO0GhN1kSYh7QiI5XwGLk0sN4Oq7Qe/kwQ0XgLBJAIW+XdPyXt59I+rUApuruZgBuJIqD+viyHp67vJeW8d8DA6ASYCYDgFwT+Jer/8D/M8G/6P0wBUwZzOwjckAgh/AYX5ukALSAvbRIAemVlS+pC5wF/5lVW6//AP9HKvyFA3xRZmookJh6T7A+CDBi/W+cB8SyuDqcnFAGrqys7O3twe2Xi8T/LAaAjUHRMDT/zyT/qgTA6g+3BI0UwKiEzid6AQubCcZKOA6YqIAXKy9evHhIi0Gz4b/mDACh5XvcdenvHu2kgg3f0F5QuSzIhgTAJpQNTJ4wDnaSsYnLApgEVkAC0AES/7MQQCGvGwAwgPtdfwIY2u/NRhDpnP1wdhFO7Pzla1hgWQBbgbHMLkY+W1ECSJIEZlAANKEA0Pzf6HoNYFckgAntvnfTuN4+HLqPfDhLhLgEJIHsmr00vhO8GhcVwJ0Q9pMjfY4wugDQBeD6tmJe3t4rx9jkk7/qqAdzj33geXBVNrBRe4eYEsBwJcBjVbuZG0MZCKDXS8fTvTs/l1e6sin8BpfcFUCRANwM4Fn+mRDIXBz99GDyohBnjPNEKsVCugIsA8YE7aKYBoulYDXGyGQyuVxhSeI24Nq1a7fxj/i6LR8vFHK5HLwy5CzS+b3GbTKSy+MOMKYWALq6A8D4rz5ifPJKrjw3mvBpAC1gzDv0ErCRyi5nvWvMTJUBvDiojftPXxQLAb3bBUH15ubduwuWdXj47TgcfntotVoLC3fvbm6CKEAVBZBD8twbQsMpAJQB6Pz/qz9/nU2po0FjKznmOfPnhj+fsB0Io58vbx3g/NE3ZGCMcUgC9uheMBm5LFeC3mluDw8tQe54mC3L8urkEMUAPiGUcD7dQCwBcTUBEFt/dPo/2t163b+CEvDHMvPnbCbPDIiD/3z8GeLAuwygf+N5/+ArTALOu7Q5xCp2Y9wwWAjg+J1LbqvVMuFvC3SALFt4z2rhN0t9maa465FJS4tBKgGF4CxDJM/F5a6xA3ASgN77d4QO8GbnZr9zod8/QAm4V34bbgGd4HUUwEYvHDB36J9iy1v9/oUL/QfrMR68vhhIwsAkkBwngB4IoGVaknRBvCkkIHWAjmDKB1AE8icLVSFfbYln/Eo4tBY2N70ymHsRRCN1u+hsAcQe8EjQ/2q3XN54vt85AAlcuZlNGcFrQ3iUwP3nvmU9IFP8qAKQ81QKo799odPuXylpAfh7wdGdQDKSvHycFgKwFPuWprfV0hqwvD9b7s/+n9QHODoQfiDdIONawVxXgFlDM6X3fr3azZYfLW+1L7TbbQjR/oOv1mOhxi4eZPrUkEcBqpYbcZYIwj+7cdDHzwcBQA5IDKcOUACuC0ZHCOAWCuD7v76zTIfclg53U1m/n/GWh3uwB1M8ZbpqwYdaHhlAVgAVKC+IzqkIkrICdFbzjPLOk8f3v8AjIMZNMAAkqAMSONgopTy1OvMeGXRmAYmhKpCHF388xW9uQX6Bj4d/wpsDAuMgOx9uAWJbqBCAN+RVLAteHS2YTuibDtOm1yxM031bS+cGIQNUgYVeoC55PocaiEaWbDAAL0Xl7PY6bv4x+EYfDaCNJIk8EGoC3kzgQ8iRIeaE//JGH8N/v41/Djw5wHsJAqwDR1iAI4C/OzauQ1vFtKkeNy030BXppviylEicqsHSijF1/YAqsJQVLBWiygjm2QBEPkf2GeOp7BYKoNPZ39/HRNBvPyg9MviYeeBwHxjeND5iN59j+IsPhtuOzAHyA3yDIiOLy4KLEwQgHN8JZgx5Tbrl9gXaHizXMWTom5bHPLRq5HfUiLaCwwVwglxyzowAdwFBCxiYzcuzIKnl54IdRBuoOugMmwDjw5f+mNAGQu8PxR8UFm0UF8pL5gCDM5YYTgKVQSPMAlwBWP4UEMgAPs4lySK+TccjvNWi7By1ZEBJWgroBNAkYGkoL3U8LxqQBuCt5h0XNqAEkDl6/+1brAUA/c6D6iPfhULZsAAS4/lPpTD8D+AT9Sd3IMFcUUuRw4UgVgHRsNXg60IAf7Ikk07/Z0oKTevQEYHjDS2d7N3G0WyZHoGY6iOkSJwOUohGdoqHJmSD3LxoAA3AVwHgdEbt/hMlALDU3v/w4bv3r5+DCexfgI7tq1TwbBDzt3eh+z+crA7Ff0fmlXbn9Xv4aNSWKAKYFoCvcBhRBaAAeloAgn3TreIE/z/8YDlGrvShy0I5H7C8HYDl6xFMJRXlE5ap/WWhhf0BZIPbhTkxgDpuAwus6ciSXpQAGKavf3z69G/vRaiiCRx8vR7j0+8OZP7Dg6nlrT6ICgTQ6bz98OPTP373ugMaE8NAd1+B91Ry1g47J+B1AKcAQGcXMW39n7rre23jysKxIsey0yBTCIVQCmYTb7sEQ9hs19u870Jo/oCledbclztUw6xhqBiglNhgYvllhBAWYSAo2IDf7MggwERGYEzMQo3tvIUsEPa/2PPj/pqRsiR5m0nrONJIDjnfPec73/nulZDPWqNYsUGZbwWlooFuARCKEHDPYJ6TwtUMVLLARACMoPifgTKFNgCbAMozaqZD4QIKQDEPuwAACFQnwWwAcWv84+vS57mDqawwjiD9d0734Y073TBAhvno7tzkxrF0a/XOJADQzgAGgGDxlzFA34j48sVApgobqueXLvXLaEG2IcwoClozFLaXlCovcCL4suAWg6krd1ZvlXKf92Go2lJEdT/qIABWXh4dJEwEuAx88HQ4dnhN3BJ2HapK4DOOkgN625WjLmQAn5SA8sRzJuduTxoLAwCmCQADnQFUX8cBk2n7IpXCiEK6URC6Vgiq9KoNNHRQ1FJZE4YSSFnTL1MtgeUI+Ibyq2IDAH0gq2Y1546CnZu7H1VpqTIAqAxg5oYCDgn77lzFtYOW8UOiruNVKpXod/hzvgCovpIqQPfVPr9rp4MACJEFlt3WQsMAssZ3E/aLKjsAA0CldZPnpYjP60MpBXMDHXlpRR+hpQFhWj6K7uXJKJXO2s/SA+HkDMoQBQcA9YAzhtJVLAHQHBDXu99RoVp5edDFvhADCBm7RJ8HhZ8CQpGfmZ9fXFxcWnoE19LS4uL8fAUfn5tRd5XmoKY0MPao/Zn4rxx18C2JBWaby7JDA++NbRm/duVvDgAUzcMMzjJffFkfSVPnObWP9YtSymz6h1c166PYvso2AZKZgxQ1+0ZSFD4DuBQw276XYbl6VSzXFgCAAODsKAph4z5/+95Pjx8//unH+fL84tL9Hx7uJlGjsbG1u77XaHjR9tbz+0uLgAJz21LEHILKv35LAgD8mKpmgePqwlxlAg2cZQBMTx9KuyJtiCGUQ8vchFUHjNgnau6YkFv/9Ljerr8YxFLqVKEgYu5QP4LThiw4B5jCrSC3S24CcP7ZWQbCYONiVRgAKhiQKBRU/YfvT1p4Nd8tVyHy1e31bjWoLmytr/cAOeH2eqcBQPjhn2dw2xrc9kW3QYDKxh8AQJwAWKDDK1BM+P80kAHwCwJAmMhYagcAAA6QuuIPMzcIbkxeASlEBjVYIs7r9WarftE/TOkOvDFNDb6cCiI5FxQeADdXv6OtIJMaMN0E+IHK1vsGAQGs4/B1e3PzjH61f3+TVKvV5fUeLG4CQBAG4dYuPBgtvGvTPXjb2l6D31DHf19lAJVS7rqHkrrJqPT1OA1kRxhNg6n7q9Xc1S7lZf1FP1bsXWqSKEV63sdrACGOmdUJnQ4EvqgFEKjXTy76aU2k6eFghN/UjMbgJhOgDw8KvSeVrMCOCphtwLBhw2pvAWByADbuFH91ne203ya+v7C+5ykAeKG3sLUH2X75vb1tc2dtL0IBwF3/BABfDwTLrppkW4kJNcAxBFnlRrDZA/8DEli/gFxuQyxknPaP23W+WhcjAEHMyYB+Q/HgGAEASQAwcDEcHm9CNki1MODojAoQRQfAFG4GnS9NPvEHuDfqgDisyQIAaXvgRQ93Np3rrPUGiDys+RC+ru/2YJljPvAW3rfOnNt2fj2I8vHHEmDagIweZVngHNWA2TEAsB1AUzaplBxF2o7rzbV+ipJNzF9q58cUXSpbCIK1YX8wOOQrFXDLs1adnsCbGCc/H8bCmQ9YWZgQET+YKjYAbq7iZsDJOp5qAiDZ5wEAOaCx/J4i2saLQ9vxw+3dLqT+7fXdLgIAvvoAk53Mbf9JQif+qgQwr4Q2YC4rSFpJsXT7t2+z/9Z4TBzPgoRa9Yqra0oYn7dhOcM6h4WeHh4O+v1hC9e2inBTgaDVgr/aWnvtAsBQO1fx5yfggk5Ci4FKT9ZYoP/jB0VmAHgcnDsHKtsKUCYAQM8euBxgxXSDne5Djuf0+tbWGX571t6LoAZ0fQ2AcHvP86PXbUgAO+2nu1vrdNvm2kH3NBN+AgB6TrxMH5glAZXS2ETIAYApyVlJjxEAsV4DBPKCbtn4qlzg/vlkeFzP3AAP9eO05mhBrqyEgvBfCi4Df6srQHlcgmUAWA6w74TtZfcdxf9tEkHYX8Pqbv+XYt+LPA2ALUoDO62d9hq0h1HEOWPnzWkGS1wC8Aob4Y+lCZ8poWhg3h167co1mwEyDaBp02JM+Wqh2yWfvZpcEXRVyN7RxI5QWQqEUYa4JOCPuQoAKDQHzFSA/DY+kgECatpyJQCi9/Jdi9I+0sQofHh2Nr2HgsFyr6EA0FjoAVX08amnvQZKysAacCn+Oxt9BQAEWkYIyPuHoQ+4lzkPdjbrBxHSTnmNsBcLqvofeTWbeYQgALR3jE0m0hknAQCe/KnAAKADQW0FqLibdPUoiJXgMQCsvDztvW+3/7jXQIYAXH9jI6EJb7id+OEyAiBa7vlY2f2N50kUBuj8iV7vtNpvX7mZZN+QQHi+6j26/qE9iFgDsn3AtSs3/myGgRwaR+03yp4474+OIfMMh+16s/6Jl84AWi+UNeEKg5ABig2AqZwKlF19BADWfDhoVg581ekmG9vbQPI8MnR5kR/RjCCEaAP93wUYPE/w2cBrRBEqxzj8D59v9ZKk8+p0P8cBSG70qv6j6+XJ2w3wENlbq5kjQwAAdhpsJSBh/YBCCz8pXTufDoA6A8BZ93o+zMpysTMANoHmREjUXnNHNKgM4AdelgRS+IHfYdBprkOeUVrjgRcG2P/tJej3wQxAjzPJ9/E1kR96CboA8joAvNYOhHObDbgP+Ab3Cc5O9oPQHIhbczO+VeMh3ggm5bPPygA/H0rHZyas2Zx+ztUnfy10BnApQCX/ySCkBNPazZaAo4NuoiyCmOF9hQC8E8sF3A4ACPA7n15Ntj9+1lMWcz8LARoG+UoKHPug4bLZLJ49LwIA8IWeBkszCnbtwDUdKqoNn5MBmvWhcZvJmh4I2xxz9cmdogOgVK5MPrOpokcBfkYJJFeIijnPCWi476nvEAMNlAARHvS4tpTS84QQ+jbJDoPoKScDlMc+gYwAMDUZADK740MYvU4aEw/8IpX3Ey/oAscqACeV4gOAzgT6xp4JPiYHXudNIRCt0E5u0RBgFr3HT9NkwDe1wF/Y6jV47fPgmJa9GgJznvACxw7A00C0G45lgNwOke9vOPZwPizYsQNkAqUbNakjJmjO86kJ4CLNDYaz19X4ZpEBMHvP4YDjh/4iB/CofIf/2rdTAAo0Wfo8zQA41J6Obbjda/B+D5UdEAc+3+Lxn8gPiklgnx1BHm87eDQOAH3IRGWudCtzbBgZgqZ/MQAQzvZA4/HTJYG6uMtPAEBTN4GpVEMk1xig2IaQcaEB8OX3q4oDVsY38DEJZCKvAHCEbhDf5H8/4O0iHGSftw8REdzuRhR73/f0TeQDMDgJmA+oJIAA8Pz8OLCc5SYVZoGzzt//D2wHGEid8R0Tt0nXWrzRZo+PDj98ORnFyg4snXGQVHtPSAksNACYA/JHuU/Y8Y0lgOMaHu0bP5hZyBw0z/edasBlPtxIzJ+oAVS3GNrALzJlAD2BPu09AwCUJ2cAJQU5LBA/MUTbAYyrqybttgC9yY9NYdgQnn8kC2iejFA/OhkZg3nNthScD7jnKLghCDngTKXs7O91h4G8LYjbty7ZwpNQpXNmfTasuhb4Ks8rCsiMwNCFIDBA0YnATxABnS7vEJvAAWiPiT081N0prgHwVDv4HD+/cXBp+w45hdO2AUCTrg/Ev1X/PRX94Wig31gqzqfYpZRm50mB/SBKB3TPfMiJMOwHoSACADocf17jHhlFdJgDFVJfVQPd8xmC4PkKSUQIfFYNVBnp7CtbeL4EZGZCaFdnLXA2Pw3G0wGks7nLSQYmebMF+NjG34VBDgnNFnB/SfNjYUbLetlLR2cmANwoMgDu/fa1+WCISV3AYqTiCQA4IhOIyd++TQBqzRMpDFTHH+iA+56TLFQSoOUehCHdBC3maadLcJoMgBk9oaigN3gcAH+n4yFsgZYyu09YO8bRI2jj/6vxheSzfwtTfyqFdYobM7iaAykSiHCIH9wosArg2AEnWkJ0BoBgJQcd3RGGgaHyLARrvu+xeShwW8SAN4DpFGHlA2gV+BHMAQcJycikA4wfJmHOnkRTyFcOAGa1H0QaZ7+SALLmMH40Pm8aCth60ReHg/4lOX5y2b9ev+iLmqMfmD0HNesL01/RD1JgACg30MSjfMrEAYIq0XcAAOV/VRCYyqkdw4EjB+tFrgq/sg9zw2jIge0aVXpJDhLtMwYA5PcV2oMmsA246WYA1w/ChF84kyCVp5VRBIVA7fZBm1dMLrD0cDAY9Ad9pRJDLTgZ9g9jyW9ptSTDBYTePqZkgALbAQgA/+PualviSs9wmkyJGkLCQptSwkKg3aUA+2lLLQU/trD0D4R+n3mCnkNzMrCe6Xg2qWvZYJ2ka0ZEHQ6nOxgcjBsLQ00iOEYSCFEiuDEJ6uyaHWdT6Y/o/fK8nXHG76fDmqzjzBi4r+d+ve7roSqwRaZZl1/sAchUxaJrHWFZG2SMSdWZd/lMm6oA30VlgOfFfYNJDTNukVxHxj3nEgCOrhvLfxBPA4wHiAHAivhpa3Yvv2eyn/QAExDj2cVzqA8CzQN5tQTQiCSUnLQBUExXSEkRJRwA76mVkE5bXACArDKSp8M5h3BlUssNqKGQbPvp5gA9qV7n6irApIUu/+EiL7zNKJiXlVOprtg4yNABhLXQZzHATcmOw6LXqrbHr62aozfCRCQi+Cn9BIJ/4Ag1UlCGbm0zGjmZRA8DFQBSbWV8EBRECCG7uSbIe7KPR+He97GU832feUMZ3ei1+j/0A59GwvKFqhXgeRkDB5oFZP54pqOsLE4D3rduEdHyEEvE1nActe2naQEWd8MJaRK0haRA8ARr0sUzXpwo2GbvAJGByMNC1v6quBB27FddQBoF/CbhAOA+UDsxBwaAMpFrin3d0M342fLM6OjY6EK1BJaVp95lH+Bqu8K3fnaOXziL1BBrgszTQYUJTzGCWkKATgVOXmwPAMPTTcvjK5cBTDtIkJNfIz+AEcDeGAIPEOGPb11dc4SlFiXim2HqS06b8fP/PwDQSc0l1ZPiRU5X5fMqblM8yPu9o99UkOxbqfy+WvTtxIAnwMr9+71vKxV65e0x+UKdKLoqWCByEADtROhSUnqsBQBnJR3AaIMosqZjyztQEUdd4LvL21cnCQCB1dfV+GAA2IaPLYLIVwpH7R6IpA8DL9AwuKOaD++GWjkeZ3ky7OezG2D+iUmk/E5WJsew+88R3pNtHzUbzH5SgRdM3uaXj81SZml6ya5CghffDj3aEW4FgOGDxNQfYrNb+Tw4eWztL1EqOIEt/tjptj2AWQEScgMsbYkQWsKCIuHDwBPdP/lcAqCDykdPigRilDVdNcfBMjB/6S2c6LFquVCem3lbuV35ChBgpYpmQIgLJJUPR6uz+MoK8QizjBFVHKi6QgOgg74MMQK6LQBoPoiSiLXtbreEMUVA099dxqMOVWDNsdP6CPnjCIBXRzQgWlDF2hMaDUkGgGIDtN7nkbJXwz7O2+dfVvyY36H9yfEjLczNzv1wu/J9yad+oJoAqTMO9p/8ruTi63y3sFHB7TCuHzSNRDYLPVsgoJ3+3Mnz1nJIN8lD0DRY7wVZLRtdqsm+XUBsgK3liBDw1KFaT8ElkFQBrA4ce6aI+gL2QrmjpSXkr7qQaA+A+sCdrwEDBLBGmOL1UDaA+xu+n92YRIvL+a7rX3p7e/JNXjIEVD6I3/m4Gvht3lUFIsSDyodTSA2UBBE1UuRp8C96OsvKd3XFtoOID2LoAMIWbxD2OEA9qBO89ewZ9nsgCwBbRnLnKwpkGYjLpK0ik2mtK6DqQ7kjIng5PMEP6QG6OtZdkhRoDXsRAZD7L2yQGVkqAuGR7/2BdgQ8MwPihw9IeZPP6v6fm4W3/nhmplp09cRIV4E8Ckh1+NecJg9w1gCA6QBf1ZzYNoDVBFA7w0wIgrOvVj9uUbs/cJQqoOwS3MI9MMdIhyqxmdjnWh5BJHsU0K0A0NEDUCfIk71cYvYR3WNjAlI6XPOVjV6q9CDTe5Mxppc+HneDwVPwqMhlUegNTAm3prhw9E25QGsBPV3HXiYZA4BFB0ir0kwcEXKRhDCw3PakWv9Cc3+xthTpd6pO4KvIadGT5vlv2uhDGEkRSAF+96Pke4BUhyKQFUJwOZCM7xUwicPBPZz2L76Z/DYvG3hMEUK7/qeUjTf8cRlo8q9VX5LDpa+/hG9HrwC5w9xsueARu7z9YpB1Hw12As/HFkQ1HYB7vdYOv0oHjDAkdX1rzyYnJv68jPRgmgA/DbhpILsEvAYSycV/OQlwFAmYBWVtETHnVLI3AyUfRMtCtskBeD0YrV/GVk61TEbE0/59SU35yKiQC/ZWvivqjoFuGeCz6pRzDJBvRwfgUYNoAUCAfsQoRbYTo6Yy0PYAJ7p/q4eBwlbzU3oQ6s4QkyI4QVSrRelgu8ISAHdrquf3TEICC0FZ67dshOqOglAxRTin/pZkADApvN1GkG4F9pz5COvAAjb8sI2Xl7yO7MxfZg0zGLMCsKFmfqmpIWOh4GUL5dmSNTeCNGCMVKEwe8yW5/CzEVrnjikC2AnYANB8kKeRNbGVjSDhSOK2EELYl0KwDEQQ8cIgJv30TkwCr1IhuFUDF+A4rfMfW2ZUM8NoLyjJALjAAoEcA9rd30sycYU5aX6XjYbTYF8KPMt4Ty1hSut4CSBjZQJuL9q35GkqEErMuZwVkDvJFhAC8AsKxwPgdDwEGAAIpyU9UwLA6VA+xEHI+xxhxJgIxPbTtbU12UHABPE1MgMAAc/XHEccPfyW/JwWoBA0Ckh6CKDxe+poDGCJkNTH0jpVOP2efLiuZvxlZKoHVV1hZtbVrA9N+csgRbzI24FMF1LLApIWRpMCwM8C/JJSoXMjkDlhUAZ2HwEAd+eEsGe15KfrjU8X8bFyuLhOjK76YZOhEYYBwCIIlKOH4OBEKCYwMfEcPi8ScT0Q1RqQpDChbiJK+lqIzAE63v3e1dP1h1E2DY/ufKrf5Rg4I296kAaHn7iGIaYbgjgzYJaQZ7GE5Efgx9FmqYIAygOkOjUCUrE+gOGDGIF4excIYFHfp2vPci8bg32hI8IQ/64HjjhcXIkOV5SMMEABfEOImkLPnz+fuLomeSVpq+a3l4IU7xA3AxPdCcYQ0JPq6mR+1GY7/8koCj7RDA8zwXKhkDEoMIbmNJ8ne5otYNChtwYykhFII2QqLAoUF1y/AAiYGf1TuxCQ0qshditY80GWWB5aTQRJEphN6zSbjcGh5mETTj54//RBI9cXpg/Cg8bgy2h/fL0W4Ovr9+418QMiEWz/d4Jnwkc2gBxTTdp1ZrIbgagRSquhqU4YOHlxZgGOf57jPZUCMwszmLST/WIBwZU0AJrvZbOZrKs7PFZvmFQC4AGJ4Rx82NxcST6dR1WJhcuoLdv5kjF7MUDzQZYcfQVcq9XI1AdhuDu9HjY+u/Llbq7voH5vcR2ere2M78GpTzsHtf3cSljfvbESisMXze3XT2thGFlGl53A2GIYhwD4Be8lOgk0hJAODwAA2N/nyO1ivV7gehBTNqZ3eHLjx5Xb4pgCFuHhFal3zO5CEQj45GfpIyDxx+Ov44ab7Z0ZvXz6KAAMYTU2DWwFgDC3fehkIAgbuZdOIPZz6+92Rm5+OjiygmFh+kaur74z9GJxRYh600FYvNvJvRThLkSLf/SFh03ZQHSEaDE8dQ3U559KciNQsoLPnzwGAF0/Aw9At0ToLSAyaFaBoEhEHxoGAEgKhULR94qlKfkoFaEChIehjeHJV5W/l6fPYkIYZQl+7+jlrp5298vELo7QAJDT4OXAUvY394XQcwiAMF3bH9+jw78/st7IDTQPdwgATXQCkBagl2gM5ob2wBf0HV7pC3fH10OMJOGBcCw9ccsncDw4Ffw64RJhvBuaOsYDVKmN62f1WqeM3+jDEQTVUp6CAZjZX52ffwjWf6AejwEE80/mH7oEApwglaXxXQaOYgxhBMAP8cuXTx/XCj5tk0INABx7IUgyQeWfeKZDpw4AgJAfhbsj67u59YMDQMO7naF/wf/XyDkMid2Rf47vvQNE1JsBxYQgEPX9L/fkpRKOdi/WgDjhfSDeDLp4stMF77wfXjxHzZrZIi+DyOyfUQBJHB3ncn51df7R9TvX+vtvrj7YfAAY4P82H3x9rf/atTv3nzz0mRVWLRddlT6ohRHSlZktZVCOhjfDUp1umjr5c0ML77boAPJEOsK+HQxDNwAA0j4CwMj6QQgoAAwI0WAAyL/A7i92hu7l0DuAK1ip0WvDsL4/vRc56sqAtCU27hiFqKQD4P1jb34585F/zoejvlDyNNGHL/shl57nZG707Zv5/uHh4f7+/uFr91enNtELTE1tPp6/DpjAZ4dvXsKjXyLYKEppxjPMYcgAqyUtD9AJAD1dvzL74QQAHAYuO9boNm2aQui+CQCivjP+Obr+xiCHAnnswfJDHBnGFwdfHub68Bt8AwCgBkmhw7mAsPZBzLohoi3hADgR04dozwf4YBUPbrWoevky1Zfjfq7ls8X5J4/wpOOjf7j/zjya/8Hjr/8OtpfP3nzy6GHBVT0ET1EGXTU4QGExDCftNsPijcCzLXQAIxVu3QRornxp3FjHEDCwR8nfFXTzuZufDQIABgd+WtvNDU7vIUpGRgARAzsQ+wEA4AFW9nMD8NKBPbvFZK0J4u/ATvAvTyTbBdgKMe2mL2c+6FU9Xjej94K50HddyuJ8f/X69HA/AoCtDQf+fnFz89/Xh/vlc/Q1PfyEkj7fdxUL1Psfe1f3GtWZxpN41PlISIiNgdalhNpgXQndbqxtAvZSCHoty97PHDieWThzCHvMGLKcahCTAULmZpOQBkJACM6UoHZnFjTi3Cz92JsAi1vNLlWKf8U+H+/nydiyH7XMsAckyZgx6vt7n+/n95PbglRkgp905y4pB7aQC9AkQWkDAMQVP/NQy3+p/b0EGtCGb7x88OLlN7PrL/+xsgRp4fe/38PC0NW950+ff/eEI8CrV+YfEgCuwusb6xgSGDTUVq1RkAMMtzkAhnUe6CRkOmhQBNPAW3cDvflPQiF4kFjD4WerVKstiJsunrjY2PFivv/CCngQCIxs0RswJORsQhcVMQJEjnEMAlOv6k/ZM6E8D0K7wa4+EzfRFJCt/JxoDGAVeGMdXsTaECR/cOdn1zEH/BbuPlj/DQ4Mf4cvgIf41vXtQpBvDp1hHai9AcBU4c6BKWwpBI8A2AoKopJXwMPPUyUAEwDw6qurEB7U69sMAGEByBHEEhISAEv1ev02vmGVir6rtzkTNLCFLPMyC0jRKHiLJOD9LnMcQC6Hu4YWpKZy1BKQvCPIreENJv10Icj7/A9X944/9d2n333+YAMyxutfCgBgsoC1AQSA6gxxj1EoiBBNbJsPhKWJJzLBFe8I3VjeFsgMTN3l4h5nbFgAWKWzwxJOhBng7mcr+rQTD/kAj4EBmLhWw4tfopLBJhcCAQSyPog6A7d+m3EIfimLIlDGgBmDLRhcwTFDOt6ghXOtES5X9nElyb+qFbnfP7l+7ct1Kuitr2On6Bvf3YAs4eGT6+D/r30qLYAY//NzcsJM1B3bvA5k5oH2Ip7Wf84MfFTpD+QOl2j707mL0k5Q3qYoH49Zo4C/kFGBhxECeYSb9YoMAbmgJAcFxIR4tHkxQ1xFTqvUlJIAxRWblhaAFL5U6cc11vqMdR5ZIVKy4S5Jw73Iree0TDg1hfwXs0//vkTBoHYB1nS4nD3GOlB3uwtGtYgC6f5L9bjUeCkshLfXxOZGKYpU+E91wUJpJ14G994AJ7CsvYBXm5PxP/xahgig2agtL8RNuTkiesFRJJuG4eYaDoScyDopY1PNScaA5kzwgXEAxRAm0gLFDeCaEsG6Wky0UTwt6JMoCC1/Q4AASAC3cP6lyAI0xYTVG+IyQJtLxjFNWDL+p2UsAgDOhZPwi2ABCPRiII6BBeW17XoY1htzxSsjVbL2FAJ88tH9WPp/uPfV+GatWQ+jZn0T+wmitSAjQB4yGYFgMxo5mSHdct2aMmmLrBBAAeCLBH+3ofNlzQj7VoDoWzrhYsAHTnuDB8ngtedgD17wFKDSI5T0Uyw31e7jIIIsWkaB9m1z2AxkR6NNJH5moV/eCyB3DcdIbaG17cZCvAJhwN7dHT5zBIEAALuB+MGfwElAqrjchDDw9hblAEFgU8wEEfILYxaoCMsdm7OK+EFa00PkTDGvZE9IjHX6sk6oKX9YMFKneL7kgSWbMDuL1kBvHRoJpgg4270MkCgGH6gDoCmGIIDO3yj+4FgwFQBXV7c27y/A2VPmxwDgtD/e++oRB4ZoAhAAnBqsrCyN0PvKAbeBxJxIgcgl4SdhCMAmoFUd8KipHqoA8EXOKM9oIr+cbyjCuraUhB4STcqNGt/la26wFkShrmAJbXcA0GpAq6q7ZOVJ/ebOmtz7FU6gRP1cOMUo2tUFgCtTjxkKcNJXLizuV1fEb8V7U2AORDYY1yL57lIkJgQkrUh4+9aJHioAmHJxTmIpQANAdYN9fZg51yaHcl3XiAFz1uKvdbNNVgnf3CxwVRfI1eOAotfgtr18fHfX0PE3M5lX3H9qv1xEAUBZByTC93CTzy8KK3TpRaJ//p/3sSIIF/3KX/Yfre5XCQ/xyidTf13QEaHXpHcCBrbWSpHkFqTCYFSeGsikeEy9VYfKpom0xgGMG8vrm652BnbtRig+uy1GflypMe/atNNaU9LX2qM+GoDJdhcOV6pxjhKAVneOaQMhCOjPq6EuInfbXL27lsfby+cv7Dwc9flbaw048Hhpav/rx1/fXtxdiOP4ZnPqj5/FRZ0S3GyWabmwDBAoG6xx+ZDUIlIttGucVkSxackO8OdDP/7kDiXCRF3cFRpAKioUSqK+EfxrHJjA8akMkG57H/ArMwhIcLRDIJhNEUeEKtfA3V3j3n250pCFHv4QL0EcF9ZHvnp2b/rx19Nbi3fgi9U7jxfiogEADxAg4ghsMot5QiQiK4UXLwu5WIOzQFYFUgkBcd0Nnp29MXvj1Q/pBeKF1XCwM3shBOTKDwYLgOaZNsdBZQiA0wDpto8C3p1/syfDBcAWnAzZgXEWjxYrP/mQfDcOce7ueIkCYOzVRu7sP3s0PX0fADB9/+7+357tzsVe0fg+/KIZVvjPELsCgdw9pzKAI5oBWjCCIxKsAvQdAMBhsACTk2fhOc3PuXOnz4lPT+PLZycn4cgBBAoOKPQikOBbDsBq/KqxP6PR6LtmhbH9ywDkA4grUNf+0Pc7UqEhdXl0oqRmv0XIxqrBle05GeYbFcA4rjKt/GOhBFBtVSb2avUyU40VAotquBRewjwwxWUIHZHi50nlUDkOcPjjvsG+vu7ubqEtb0jMd+PT1zc4ODg8PDQ0dA6wAXhANAgs+NIsyAayQoEr4ko3MRlsZBBu+2eBXUo50knJ0g8/lIilMtmx/lIgebzEvC9FA2GlUaQScGyVgMEIVIWsiNCarnpWj6go5kZu1gO9VaA45oL+QnDpTA/deAoCHEUNQrMAlmYYjwMcPjzzlvyHvKrh0WVozaUBD8MAB8TC5KQvkZBTvsGXzQMzaNRho14Yw9Xz4bY3AGgCho+/l8qkrIctbzYzFjEtcCHQLKB0WCU8/+Lycq0xp6JAOmqves9UA0MAeIb1vwlvWMbRseVmYCyRGGzjpQsnRSQoNlZFXdpJdALhwXEAMALvdB1Jp+H+t3yM1xOogH86YAHsAiDhkACC75o44BFgpRFqBoGkF9bmTPE6DDw1f6LnqGMDAM9/APlhCooZRlAD00xQaRefqAxAMOI7tAA7lr7gvZ3Y88xvWEb/T+8NA0kPmdfCUzhlMnJRIsA5arSlIAQcsoVjEQCHZ3rf+uFTMNKGBBjwI/3SQPAZB2QQVBM4pxvLqiQAAUInZIFsAt5F1QgDAQ6tC2bB/XOXrqA3uhRpIDUCS40FT038CEM/Z8tLzlnxH37bcr1chvcGkl48HxhmAH9AKX9JzIVRICAQmQgB8XlnsRcsQO8bhorQv9EKTxgF+q8YHEQcnCUccISQM7YAErUjSAL6OgMAgx/Oo2i7jL0cFgwbi/JqDEwRf8jJEOzoV7YXYs+8/fypDQDbPnBveKlerigKIcVDK1nHsV944QxlptIVpEg4GEJA6/y7sRvcu/jL/wgAXZZdMDtMGCcMK8fAGWTOzVlypCIG7IAkgBHwPq4IcgNIjGJknfFIKQIUFE20kouA2w9ZgGePfvAnVUMXlmLABETwi1o9LAvTEqgSg5SXyocoIp6V6yCONAAfJgxA1zEGQN9/BQDTVaTtHKJvGGHgMwyMyUBRCaBeYGcAQJgAVQl00P0L5pdAEcSxB6DLH+yC8Y8PDP+wDzA0Zu/NxSo6NCNFagyiG6DkQq6P6l5zPwYCGaUZiwBIGgAhFtC7+Osj/xsAJB2EjBTJK0wSp7ivCQKIa2KoqzOeNJqAHkswlBliOTZj5j+2AcT+sNuY82R2b07+iEeZADAArYfEqGBQrDXreRlkBIoynMEA2Sfkg44qBfWcnE8YADEO8NMAwIgT+I6jU0CfwEVFMgQdkgQoE3BCrYhh9gfnrwiABPMzmX+I38qVndgy7J7qB/GXC1piesFLHr2oGlPCEDfLlXJZSk1JHRohM0X5YEbOBmQORADKAnxw5Kc9hjTWmAhwaAwwQmQYdEoSIBOB98RWJpn/oN9WhuBwvQCWv7m9vd0wU3sjwJefL1fv4TNdXfCS7l8lCzQpRH9YMwokyigYFNFGKNwAL4Sc+PRUwt+KcYDemQ9ehyNmFODPSaNLgHxx1r8x2dcpABBOIMW7QFT8zff3h1L5UY8C7O5wIe/AuVonHBd3qvDsFK0pUTsdZGuA06TN0LT/ePr9QX8/7YsWLg1kmKvMagOZ3eDembdfWyQmbAF6BEDBubPn0h0DAOoInCTxmMzo+ER/oYSPon4OpEwspH5zB4/eMOtiIozHAhKDwi3AAoFAvRwU8nrzhHno8SmEE+PjxBnFMhHdXS0BsPj26w3FNQo66iEnwD4gm02Njo6NTxAM8gWrWlsIMf0rekaDxztwyF6x+IPHrgsCePwVk1OMasHggCYmxsfGRgfOXM7oCDB9AAA4DvA6LYB2PgCCI93pDsPBqXneE00BBC5ns87A6NjYeGQoPvNqMEIAc8BYLXwUf+TxbGPB9gKyAMoEmVNEkkjiePgFPPoU/R0EbTCtg3R3tQTA4ZljP1cTrbPOHwmjjov5YJ4HhyO4jOrxhvan6AaXK8gGUGQTb+aARmygC0PFA24AywC1xnaEfFOFgtERJqhd+AUevSNkDEgoav5Uq78wjQP0AgA60CL/vHGgqL5kUuNRHomCQyELGnDZhliDK9Hu9o41C1BslRkk0CCeJvaRykowStKLhrx6OoKToY6aTe8ZmD/eMt96g5bDZz7+PwD+xd7VuLZxnnE7OItsx9jNUg28eHHJFhaI56YLYYA/4rhmA0oJMPAAVoBxmLsTOhYbfFEsfIckvBPyaM7Xeka0CI2AmSysD2+GGE2YYio8d16yOguGAgzo37Hned/3TneSTq4TmQG5Jyb+1Om43+/5ft73bREBeu74yTmyrBvQ7bu9wE4Of0D3BLCOfJzBfSE+21XEps7eZgNY3mD+j66fniI2YzMAhAGsCkh3r+xgm4I03Izxe5fJNMD5ax4BWsWAt7EY4KNr83xYDSSnhs6QoWD7/jDEC5jpgOioA9uxdxYLHJUCK/ozDx2lB8bQUKN3YY4wwGcrATQSNg7ww7MqBL6BDLhFN4yhs2C9C6wHPDc3x4b32YGQpBM0GxFP0PwGjYLqYiGN9AKCQav8ax0uDW+Fk2HnfGx78CV/44prdRzAI0DrnMASdQLYDF6w94DNTUGDYPshBFQsqz5bDQNFN/zFBoEBlgAgDPwk+NB+IKG5Y2Aw+Euye5mvq6M/6jZ49zrjAJ64OgHIBND9Q/hXPSF4hh3tho1AkgSKjtXgzrFAa4Wo0wmI1TXjVgHByOFwSLDmPGGMM8nG8T6yFOCWS8LV2ZJxAE+cue270f4OckwI2xPAOvqTfd7dMWYdO7/M2kcCLXMgNsgARLFRJdDYe2gdP2ztGkTmgt650o0BwB3Xgvv3PQK0ngHtP43+aJrMggWtA0OtM2BxBiRSN+btrAJY/T7RNg4s1lUHLFJgW/jpjG3ncdpxDj7AvQKm+24subdcr3oEOAMGXPIXPgD8F6jQEI0MBKCO4lagdD/IJtm+2GACyFY1Fu25oZHb29jdfWiijsDjWCiTuQ/6bWeFuxDg7MYB3tQwwL9/+2cot29jP6A3aHFhpvcB2Q14YRdIIEbcYv4TSsOseBgh24fiTsJ0GMwCPtiLnQB6CzdcAwCU9zwCnEkY8JPoje7p7mmQ7gu+PuwIABdYgzAYnKN1QBIKOnT+ZPBFWzxoEPDJfuJw4SDlFwH+el8fJCHT+O9K3RxwAwK81+YVglrMgFvRfjoj3tFBOwIABraG0CA8xIMAQFn/+NlGouFIaH33v1FKKOpPcddYuBgQaq6XaDwgfxPfrKuri50Uv1Q3BOCoBP7cI8BZSHtbOzDgXBc9R8RaKYLdua6+67/LrH3yYG7uQXVBiGsDWKxJD5080PYe4mW21965jr0/tDfdbGlCB64IwR5wzUKQWgKQbvDyVY8ALWdAD3aGq0cJdbAFAxe6BwZ+vZqJAwd2lYZbA1bnvUTRkR42SAAj+u7aWjxT+uvAuS7bmhRyNhTZDeQGTgF2NiPAMnaDPQKcAQMu3VmyNhGnsHQD+Dc77k7m1p6UMqvxymZRSdB1nnboRceAkLMxUI3+SSapFDcrAP/fS6UfD5Dm7wXbknDA34f4Nx25YOMAVz38Wx4G4HpRrAn7yEpx303A3nf37uS9qUA4PFspIQVWKQkMbTYiimLN2K9YnRSiZKiGCBEcBFF2NrbjcAmAf3V1Z2qy7+aAOQBAVgR3IP61K0Hr7vL/NRD0ZtiAH/hJa7gDFH/Ah9iPA/jhcABkM14C5JADq5m17Z2dnKFpWqB+RtDp/7VZ+CtNz+3sbK9l4MWZ0pMnAH9FgauOT03e9TEO0JXgvn7Ev/mxzJcvknawNw5wNgx4e+mbK9N14BNRKkR5S5k4I8H2BtBA12wyqxnwDz+Y6HouB3oP4JPXZNCMgCspanhZwoF7130DA11kj+JzF/qxANAc/87LdHeAa14Z4Ax8QDvYgDv+6yb4AYeEtWKFqXAmHqcsIDTY2Mnmcvmcntep5PV8LpfLAvIEeoJ9PJ5hr1yNbxrVa8KbTN2b7AMO+Lp83wF/Og4A4hGg1crfTp58z+BQdN+oA9+iQByhBCRRk+OMBsCDzBqRbSrk6wxFnmGP4CNvCPyOi+N7jSMHfP3f3Dp5D2YyDnBx2ZsHabHq43NvHxwdmuDlcWRAwEWIFWAcICwgNKA8cAqhSoZiz/iyWg+/SQLgwI3CuxYPT7AAF5e9eZBWoo+fhkfuT/CxUCwmyIHoi7wrA0wKUJNOaYA8oESwxEL+CVN9hL9SNNyuGg4fFLJDI5fIDTWzAu3Xli8+8pqBrUOfPOzh0SFVDsVkgUeRA58Xsk7QHVgFjM044QCx7SbMDaVUskxEfFPRAq68Oor6i3Ispg4NNuVAZ2ebNw/SQvjxMfcQ1TfBJ8IlDwqH7mBhMKAgB1ad6l6yA1+qGgVSPShqzS54FN1PyTwvqCqvDo30tNGNfOoLFW1tHgFaBz9Bf0gFu28DnzJAGit8azRjQDgAHKjEV6ssaCirrHSkBcJNrhYYKxxuycA7ZYsXwA4kKQfa6nf46hke/g11AT0eAV5fRu6roVCMI5Bb2NNP8lHhRdY9DtA0UiPQSGU3Xo36TNzjLP7HsqFGM0pNcyPTEXicNHAwqeD/HMcRXzA6bLLUpOvg/SGVF8a+Pv/o4iNvHOC1tR/8fkJNKIlEmnNSgLcCgUPNTW2PdB0BpcgaShF4UKlUFR++2SQV4wDVfE2Hv3dX/xeKLAH+RrpqiYRQKDk0OtjO7hbv9z4HUQonj/1l+RHpBrd7ML4G/j0fKmoCRQHZ4ikHUPuYHeB4GdzAfpNsgNR8iFqHzYKhZqBg8Zf9kCg++Tv3AOCAmH+A3Eg5PREXCq1MjA7S87na78shcm9y+Q/L58//+bfDbV4z4HXUfyjGc4Ig40cyQSjgsAH0WY9HmRFopL1hqtiILvLAYkKYYq1p7Le6q+3Ha4xF/VkSf3KRFLxrjRnCvHTiQ+DA4ESIV4EkHLdS/sfy+a9//8+J0R6PAa/u/PkQZz1rQZZmlVRaqiJv/kpOlgv7WS3sar7DdqDrRaMGwh1+8P6HKZm8s2BsSTxv3RXn5AAfUoGwPK8mjNzGxsZe73Y6NjXiMeAVDcBITHYquywZCmOAwwZwsnZQ2C/nm0Xw4QCz9JoDevqbQLMXHsG1s7xM3ouLKGkL9lo7EArxaV6Qkgb1VypIQknJsclLbZ0eBU6P/zAf4wX6mDk0q0QBZ5V0bTJIsBB00FK9OZQsMQyb0jznwxgSYwIIMbJpmdFO0FJ8LQFtPEhDjgjwJ9LgskikIuHrQuPvewx4BQaAPxWqxp5ZXWSAZAaADj8QKPsLh0b4RAo0qhq655FjUQz+LM5JxhZXn4zayJDMAUNlp5VKIwM8OXUAEFI5vt7cog5KpuLZfqnOZxNjBT+1AuPNcR3XvhM/wkflKDp/2XonLqmk7SGggwBSeotPKimuzkJJfCzwvpcOnlYgAag+eNsDl4wUZ2pYNR9MLubBUAfKS4XDnEa8fTN49ZMZAKEfwP9tlpPtOo4E4LhafBk1nz3De2toGmLjHgNOKcOW/belXRwFIcU5uAEf0uJ8vgh+QI6M7UM4qJ/g3k8iALx67POCP5vPL6p2NGkSyPP1cSgSoPJctLKUGgfFhya9VOB0IeBgrEGox1BQtmqVcHF+PosFGk6Wk3q5ABzQmlHAhQC0TIDKfwDOJJuQV3L5edX2XoLoqAI47kLY+nK9qNp8E2cPVfiVX3km4FQEGA3ZgOcc0basKbYny5MAAAiwJbF6gSDqBzQaCLtViBuWjFh56AgCv/1sAswJL+jZ+UW1qszCLCEAVwM++YH0bH29wkv1fGV1gqkezwacngCOLMsK+ZJOE8Al5+cxBABoJFoWEHgNogHqChqRQK9vIYbD+t7TvZw+dlAoHCqqTCJ/OZIFavG2HCRls+2OiqDAV4AAUoPyALtJzwSctgrkBN2edWM5RqAIwLcq6v98tujghCxEwAyAHSjrWj0JdKO+2PuLr16+PPYvFY6zKi8L7GIS+ADLBlACsMS01g9I6efrXz5jEYAg2U0A/RS751UET1UGesyCKVvZlX0pcYJWJA9WVRcX30KZX8ymOIdFBgsuRfTyvp+SwDE6Pm4jACkMBY72j4/9IMcv//vFv4rVPF7Q8/NwdZMBMnEBVPXN5iRn5gDr68/TK5xAKMmzyhVXvSXZSwROxYCet2rKKWbJb4WEVFqKYT+/+BhkMf/RluTAn4YDsqQCCQpgCvbLZdLrJZ6eWAVCCe1IHysfHCzBnxx/9cXH//n40z99+u+/yRKDTp76aPHx/9i7vte2jiwsAzEIGkBuWAIBYig0QBGC9GUL9q6TNCYKYAJ9K7BPe4AZBy4iS3yRCdLEiI1bBedaRitQASEgeE1NnEoEmgAmdqkdbxvZdhZvvUB2n4z/i87M/aG5c+fK99qKn+a2dZNUroXON+d855zvnKE/p+D8D2dYEQJJfWlwAbBJ7rEq8Ar70ig3wUdUoHJRAyBWHcAUP2P7OBkVtLO5S5/NHeqbuelT2fTE6Mjw4IgJUm0WuiCYnV/tMBtTHGx1Vtkzz778ssX/cGvrh/8c/vxrbX/vbXv+9tNfa3svmobbaRzKTGQti8UBdtrdXqAvDPA/MTYXN56tFMtlQpqE+QAiFwNKOhOM9YxaTfAigM2zcXNnd9F5vnk2lWWWzzi359wp+dHiy9BMxunIvQWKg87W1t//4GBhq9NZfr5A6qu1o7dtY/Xw6P8lk5B6p3Z03y3/UOqWGBhJp6wC5wJ1fq59fQCnEAEMAN2QBU7zQngzLA/QLiBGIaBAQDjQgDDe2Vhc3KD/UAfQbjfRZHqYv5TdwMkKhyBwBQUVB5M9jJ/NrBQJi9P2n5izh3Pbjc42Ws3db87+8dsXkwe57XbFsdoYN9r50TQNBRQClH0aUgmAv0WbA1aU/N8DwJAGQKwYYIk1GGQgesao+Tc2d1ClgrEBZj5/85a7Gv1ayeeUUWg+xrSkC20TY5de4j+9qa4tHOTekoPcz29yuaPGVm7fdQH5G/SdcPX38ESWYmC5QQLSRF4haG4s7ralNoDfFWkWGPMZtlKiG2dHjJ7+zTaudD/XfGXiPBdin79mqupzYtLepeR1u2TvOGu8Wlv6rTH/8nX77suXr79/+axwsPdkzanpmjdt4S+zHA0FU1PPHTog/SzmASQAyPgzdUcoXgxIUheAuyeM239jB2P/Z5u/+SUTXmaQ6f/Ew44/e+pc1+eW9Cpb1fVHa40yKTcrhJTJwlZtvebGAPPBlw51Y5NJyczEX+xQ4C8EADLa1AO4UgW1YEQD4CQuwPGxhm3/XW4W8HXi8pVR+rmOmDgYewGCrsBpKOJu0b5OAfCuWl1fX39BOvTrUm7/HQcA/57SRY+7O26AZQUBDGABAIL9RShoAMR1AZQFFFxJ0Ca3P8JIzgwRMktjycRoCcupuVq5AZwDCMpeMH6pru9vt1jubt6lX5dvP1oXAHBDfE98QDEzSrMCq5Cy9X9uhLI5APiKP763oznACRKBKTsIVHa4/ZtYcagNYtJc7U7ecQggH0FQkUARAIwDvG/Mv1qmf/33wfKr9uzhfm1bqAT40nc+oTwwPJqdsqwpQpCT7WHOASo94o5OA+MDYGDCShHOsGj0X9ywD5hE9gEMygOG0nmkFusF9bscAGIbZ/5w7u3CYS73r/XqGvmBZQFzXhbAKwH++o3tBs7zUGBxvQC4JLASwkJsX3I9qStBcRsCqQLLBCo8AEhZtlAhQJUb3SRAkoupBDo+D4Bghub9jc76j61yZ+7+g9tr5YPqb90fVhoLms1eVEBDAaMDBeYGDLS7+E2rCSYGhcvhb6Ayph1AbBZAXUDBcQCbRji5hxlBJQoqtaZfPyIAgJ3e1aWj+zQHMPP/PjxqkfLqm70X4ElRWRdP8d64GxigGKChIEUImKwSWCyWiV13xCCXA6Cu+8FxH5rdZSkCOAPY8DMsqdZLmmJp1l+lgTAP4EoLzZmDuekf//ZTi3SeLO0/vf2uui1oz2USIGCADwJTOsDdAJMDzPCRgGLZm2QUZct/1oXA2C6AsnsrNUVoCsgCAIRX+AStHqiLsaKM0KsDuLaZP6wuVef+9+2b/fWlaq36viHmcz2UHNwNJCkdoFlBi7WDMSF8kLHcDJQEdS/oRC7gPHUBjV362SL/fIAU8G29fkglsNugUXAADgM8f1CdXn9S22dlgL21NhYjSalX7O7uLmlt8GYA2DXm4LvUiqCTIWCkUGgxBojl6rsgxwU2s9v1uQBSKU4eLHdDQBdM5kznTbX2pFarVt8/8/w/fwEw9n6Mn2JfM1//g/IUI0BQXS6pBUEnA0AybT1jzlXh1gVn4Kg1Vc4BUEDB4XqA7kkF01h4+c/vvnv6umWPgQnfEUoCBAjYGPjqryQQhNx38UBXgU6IgOEUja6bbkVQUe/nx5SRAAiR7INcoBVCQBcevFGMbDGov6kYyXknuRdIWSSoCOdqkE/1+T8pD5zYWbQjQOhIBpeJKlowINVkwccBwvL1YCM/YgLPOesUUbUiKte1KPzkPPDF4oY7FA6KCMD7ATPFJvjHCKQBDcGt80qgxwt8dSMIq+Emo73XRNqaKiDDT0CAaPufCgFf0RzAQMFQbn+8xBbrFZvISe1B0RP0m1gcLwxRnou/it7FoWhlCCBIVCfViXV9SNv/NAj4egfLbrlL39ACG9icLHp1H1DGCDEc2L2AUMGQ/L04egZHXzY6ZUPA+ZGEWFNj+vyfMghcKwXOswcC6tApc2dD43C8GATcEOAs/FAxRxSINqUbkRk8fd1wmquIC6RASMEqWNlbelXYaRMBT+4DCs0H4IUWzDbEww/K/R1yNxCUYUUa/oSYjdwkzVyZdKxQoH9bhVR2YsjZHaqfkxeDTBzmnsHJ6wWTKlyANKLRbQcHxTtIoeuMp+Whr7zw9Kfvl5efZyf4CkFt/tMlgtQDAFZ2ed0zDvWVV20jqNUOc+0CBwBFtijXGwHHG+oZSFzK5XJ74+P8vpgBbf9Te4AMMZWm94xmTrYkQabnzYVikTvWJ6mCezMA5OrCotO4wcSl8fHxK4+qlxLntfn74AISA4wEBuZxhUOOJ73VUSrm3zU2CN3AwBRZOATizXQMJj55+PDKlfFxfVtEv1zAnZLI/oOP4fSCRIcenhRIiiB/yPeWUYiMMh4JoACgDuDKwyt6V3zfWGCpl8yf727CPQu7/lpQ3S8JU5cNfJQgFgkYTHz8+Ny5c+P6soA+FgJMRQzwqr54tujfzQKhckB7EuBYAMj5RCwSYANA3xbR1xiQl1ZDAsKGZyV3b5i8vANBoMXDfbvLAQChCMNEXM4TR9M/mLjMPMC0vi2ifzRQGP1z4zhBbk+/uz0USVtC1MyBXfmBlQk/BPrMLgmIo+gcTFzlANC3RfSTBeSlc8yIvyO9pQ4AB4o+CgGhl9d3PQCo2sCqFSBxSEDSBYDWAPXxSefl4H5vpcGdAJ5tNQ0UrASDurDPSWAbI8XwGAj6EPCtA+NTHZGrwYnP2bWh01f1iuh+1gKyJfmM1ldabcDgOQAIloLl2iCEhwBRPRisDcarBGgAfAAEZFKlwIjXvZViGy0UkaHYKRzO70QPoFaZBOmgGUvU6wFAG66fCMiagZVh9XLRbgMoBkJ8K2N8x5x7gAjNY9EJlMaiRvRkYvAzDoDLmgP2GwEWQeLiQE7PV4vKfXIopHvASSAPAdAjAQxmD6XrUVvCycSFjzQAPkwymC5YxNF9Ad8TaVmfTpg4bBQIVEmdzAHg+AYiB0DkSgADALs5fvpjDYB+J4OJkSwbw3OegmU9v9VdKnxcW8ejCdgfAnwDAir/b+8JiFwJGExc4Paf/kIDoP8IyPBdXWxpn2VZ2dEhnh/C8QdYzPSUHgACXSHpFZFJQDJx6RxHgAZA/6PAgD2VzwRXqfToEK8R5lWnXTAgyCw/JASE/h6c/Q4D0VzAYOISpwDnPtEA+ABOgO/qGh4ZGckM8N9lSAkwxgbqLQT1BXu5DiAOkYFUEequI4tKAgYTXzzmLkDLAT4YBFiFJcl2NCQTw+xi2SZCGJsY4zB5j3/Lv9s9Fhr/IepgYOBij0HQ3VuxADD9kW4GfjAI2A//zWjJvliY4YBvaadAMLnNwhXfM8W2z2MQX4zg38y3fNir34lzdXE5IgmgAOAhQHeDzyIzZI1iAzEjFbmVbCjwTcAMDNyWLiTc02wyD+DY2Ta28woTcxkRs7lr9aIHrnbUSsBg4rIGwJkBYIAlAdyYBjinVbAcMx43H7NgmdmVNAkhk87FrtzSxPnvRd+3uWa3ocThE5UEaDnAWeaFmWslr9ADGAN2bnuxsUAcy8q2fSWZ2jG3a/KmU2i2H3AXvz+4FTEE2N3gz7Qc4Aw8ANsRHFgbgLlPMLntQLzJk3BkoMliExFEUL2JiD/6m9jBkYpAlC5GIgHJxFUeAj7XawHP4BnJK6u90s2eAGAAO8nAbGvyO6fs2yjAWRoMEfoJ+ajtAN4MfHxV60HOhAOSXk0dZYkYz8iX0KuXisg1QjYmnozyprQc4OwAkGYAkCKAogboL+3aAOg5aQCKTrIZiQR43WAtBzgDAEiFYHTcnQH2yZ4UPYBKSgLqPkGkdgB9U1oOcMYcsHcJOLhXdFKYIwEEoR0BkDqG+esDxwNg0O0GawD0dt6JRB9ipHvFNEgOHVAPNiDIyEO2BDjkUJgujU4CNAAi278PEHCvmDac2h8oHhsb9i/4v35n7+pe28ayuAzEIIiyuAl0TIHJB2CghELnJbO0u/1Ysm0DTR3HIWTpzgcIsHfBMkGVcWZRrUFsSjO0aTJD3cyUkELNlrhpSEKYFLykNC9T0klIXtwXh/ip7D+x594rWbIs2bId9+leN3EaF8n1+d1zfufjnkMqyo3X9eHUJp6Ar5Yi0SI5pf8ekQAXYQCaDXYRwLtw6xbO5zUDAeIEaDs3hZpyyEa1CI7hmX+KGI97KA5gflkTNDxwYw+pbMn1RQK8TN8UBUCtCF5/ElZH/8VzTBMNNLRz45phX5DRRC9XazUruV2rxuRolyRABwAtB6giuFvJjvWOjo5kcv3mOW0sX8Mc0DjAlVpddQUB2Q0AkBqA682UVRqh0wEuATBFywGqSO5yh76SMzdPNa4Eus1HBfjowvxqFmHA0OE+n4QnTJuXz7eaJSPHfZWrJP7V1Wz27kykvNIE9QmozQFINridAsB543aYlnq5u2EEXExahsNGZu6C4LAikHHloNauq2xvIw2Afkv+opl9/ND/IVwjm11EA2AsDabmrrkAQCc2AbQexCUAOjoiNxsdp3WrYlRUIrowM4/ll8UGgUjXpAJ8ssYB5BIITEpfwjsfST8VSVhayiNXIVm7T4BeDkAB4BoAHckrpxiPt/7rMOY4oG6rUVkHqg/BgrzQjR+jz4013q2vC+i18nXu7wg5UkrrHW7TLIhzAQA9G0xDwbU5gIaAnT4G75f6+KAeB7RmfHCZTwy285/w4F/v0P+M9TXchvWy5f4nS4oM4c/FWaQLjJEBZWcGeTxJlqEAOAkvwIqACQ+DxFKX2kQcsGJMhE4JFyRp9gqqHAzdPnr2rA0/2otnOVRSyOKaQtZTsdCsSlh6wxnzGXEjElDrf3eeAqAOG7CuPS/fPs0wXNhbDxu4kKwyICIF5v4KwGmkV3yyUSgU8nn4dr+6YUan0BEClhzbxycv1TZMJBtM20NU+ZA8hgq4u0IgsLScC4O0RkN1xAZvJS0NgPhIaRocDwCYvcRwwbTYK6ZFtHrTo7XceA+aVChJKceEkkrGyVcDgJcCwIX1NlTAskggMLOdG+9iRtIT7s2AMS+WN53tJyKLIQ/wWqiXyJ7I/3nNMI6HuYAAIEdiDhPIakYCaDmA282rA2Dyx1z6zj7SAdu50TAgYNxdgsDoHGWb9V1ALt8fRbP8R0/XlAlYJxL+j0Xs+9LVjAR4aTkA41J4OgJei2IOMLC2v7gtpse5MBKUq91zzul8lw6A1bdE9hs5LP8uVyWdmASk7FqN4++1SICXdgdwaQTWF/e1ONA2yAcwkEtvimK6dyQoiiMc42KzlnFA3lIQsIBi/trm3zgqgPw5dyW9GgngHdqG1SIBGgCmKABqfdDdM8t3SkaACAptVDE9OgpfYa9Gqas6k7Ylf1pGH/ZxVruu+PJZ/rY7rwzeFyEBTp3EUSSArQoAWg7g1ou/++N7ogReiRULINCFBcJW5YA8bztRHhZS5DsaAHrFjfNui/RZzieVAGDTehaRgFoAmKIAcPFBA9/6Rsxh+tfxOmcFQG863TseImqAtUeBx+geypsPARAKgACwndOuJU7U4ZP1YxvA2/Scx09AAlwBgJYD1AwGMNxYOochsLRciQDkvY+FuRJeLDBgEQfkLQNfSjwAUQBJ+i4nEqMSdi9/MrBcki3zRAwYoCHAVQHwJS0HcLk8jDeYFhEE1me+q7QCgIF0enR84kwXa6DAAw+8PBYOaMkGlJwAkP/4qTpyDCYSYO4WasCgxihhPRtMAeBKBzAjwPuB/69si6IDBF4WvwqOhEOcl7WLAzpNkEAccBWr/ycT9ZUbsNx12SfJzgeOqpMADQA0G+xSBzBhsNAAgZwoOkDgfnEvDYRgdAzBIMRxpY+1X7Xp6qTJCscBszlN/dcnCdYgAbYnxNRL1QFAywHqo4KhMRBvr+i47hdz6GUAQRrwMDY2FtTWYtR55BPmgMu5tDgO3n9dggDZEhLgOE+uOgkotYegyUD3ZgApAUcAvMxjKocWgYG+9qP2DR55nQMui2j7119ySkhAyqlpWOLP1UJK+uHws/RwuHszEAqKViVgmISNgtkgGOu9pdljRRhI+sME10i1ISEB2AbwdseLq4eCtHKA9rM0GViHGUB2QDRDYGPPgMKevWZ4v2R7mpNMh0YU4NHpRo+d3CSOIO9QFVBteARLp0U0pARYD7YDvSW1b6sMylTEHaPPW8VcKKAAvtkrjRUbg+q+aESDeZsRtNVIgKkehMq/PiXAGRB4WdwTa63cStSmIwhfygShapBGRdCNCgOlpcqZM9qc0iqRAC8tB2gQAgyBAOICG235XG0A7Ecdu0ITAFxr+K0YJMC2zwj/L+d2YaXuAOepF1i/EmC4MPiEz4+KhZryF9+vRy11gKYRUMABfS4O8TjagH4jGmw3kLgKCfBSADSnBbyh4NHRUVUF8EthD3PAmM2QwFI5mE961DgASCRAcpo8w6tXq5gAWg/SHARYpqvzK1Mll01goJjTOKDtgDf0TUYVwVzj76MbHyZKRZwKA52Ph3iZMxQATasBNjQyJqbtQZDeeFbAHJC3n/uKmj0QJ4Bt/C1w1zU/gLcfPehMAkoAoOUAzbEBhIFeOxA8OSriCrJ91ZqmM2y05gQ0DgBPv31ZkN4pRP2sCgDa6LyY5iGAdy8XDhIQpPXCHvjaeIZdhNzmeiLqYKNRKtA3+1kzSoiQgJTt9ROJhVd/czYBfVNTtD3ESYCAxPC50EhwbEzPAojpX5CLgH7Y2lhZT0RtB4RiAPzzWhP3ZrrxSeGUTdfIRHRy5zje7tQIGtWDTNFygJPCgKZnPaFQODwyEgQo3D77xVdjweD4N+q9gfzKEoJAtFz/R3jkBMgNOwFlJMBaEaouvOp5kdlbu+dEAmg9yAkvdIbTzA28sNDzZTUx9+hGYWVJjRq1AFrDrxjmgFzjoTiPRgKkpbLToUj8N+IfNxcTScc5oqZyABoJPDlK4PF64A9hh1hA3BowgMTczs+FlYhqMQSEA7rp6eiKBGg5Ibjb5M5uPL+yrqrRhflvHa5eAgBHAdAC95BlkQJggWp//HUtEoUtuXUfflBjZSd4UpoT0EwDOiABmg3A14yqsfmeh5k90DhqNPVq4PBrh2EAtDvAp1hgaB/HAQJLiYR6r+eHvbWEGkuV1QNiJ6BxCXjQmFpcFYLFj3W/UtxcjKhqbHLr58fxTMDexrO0O8CnAcBQYBCksAcQUOfmAQIrCc0Q8KQYoPFUUFkkANuAhDq5tQubfz2hAhC2duPxg8GA0FkdAF9QKbXUGgwJAobAr8gkEwgsIUPAk0AwrL80eQdCAiTY8/d6XiBtoyLxDxzG4wqIX1CGbHc4KgegAGi9AugaVgQNAoVNDIGt4/wKD1oghc8Fgxd4qikV7NHSAXLs1cALovuBA/7nRfydMohu7VeGbat+vXp7CFoO0FIA9IEIBASBwE/xd3nwywgENrFTSJwArkkAnLsu+2al/+q6PzaPdH8mEEDiR3f325IArT9IO80Gt5gDEjGAJg4EpuPvim8RBCa3jotIHXyPAHCVbRIAbP+c7/fjg721SCIxR3T/gS5+uK9gTwJKBUE0GdhSDjCkCwJjAEHgDXgCc//Y2f34ZjElN+sEEBLw+2HxbRZIwNz3O8eP4++EgOmmguK3JQFgnSgAPgUHNGShCIoSEB7EP75BPA3ctYPCsiyjTADbnJbpy2/6ZFmene85jr87UBSz+DEJsIsE4HqQdpoMbLEF4IaF8gXiATWQx2GaRwMPj+5I15q8CYkEyFJ24CFsfqv4FQCALQkoFQTRcoBWAuCMn3BACwgeYD44J6/2DP5wukkWzuI+AdkbP8UzuvAVQ/yOJIB2B/gkAPiyfDcaagBZgtfS7Kz012ZzMSzLXNy58SAuKILtUvzKkM2pU7AcFACtB8Dnio38MR1AhDD/Nhu76mnWDwdRxuN+ZXp6WhCs+l97HuqqOHmkA4Bmg1vMAe0sgIItdSAAauDtt0zzAOgaDvinpzECBO3iFhowfMZ6G60/SFsbzQa3UAF4hysBoAgZWCCk6Wkl8Dg+dAIAYIcEvy7/A7h4hTXwC9OdFjNgmhZBAdAi+cPWDJQBgHCyzOHu7iESEojMP9h5IpYGroUuJygZZXf3+CBjsTzoXXxejgA9G0zLAVq3/5muoUofQMnsPoW1m0EAgH17pvnPH8w5vhQAIDP1G1z8Q+BAsTJBIAKsGQFaPUgbzQa3SPzwqfYNW80xGH4if4SAAJKa/wT6syASQABwMPgbvviHg0orAM4Ax3hNVWtaOQAVf+u2v83+Fw6IiJ7+OwO83S8Mc80DACedMQnMfCAXf3qcCVhvTPKCujNgKgegCDh5+g8y7RxWbGJAgcyUJqKnh4AAvzB0Ev1ZQJ1PlwPg/+3dsU7DMBCA4SxUqlSmdLEydPDQgY3NL8CSgVfJzuYpS54j74LUqUx5GnznJFS0KSq6ioH/AxUkUBPVZ/t8ttqhPxt7ZAxwfv4w5GIMAHaD79T9Y3Tn7Z8C4OErAPata3eFSQCUOQk8DYDz6oNUhafFwBQAHQFwj/a/3P11ld6/z00kjVZavP4pCXC6EJwSDImuS5d3cVoMyHmQLh8HIADMF38L3X+cAzQC3lOi3rqmNSnE5pNnMgYchzEFWKgLp7uqNevQANikAGA32Lz7h6XuL9rYvxyG4RBzDuhsCrG5EiDLgGN68uHjQgYwR0A+Ija/Pwi7wdbFv2dJt5plUQqB/VFq96553RoFgB8rQW0/1hm/z/+n5wO8pKnbJz0OEJgCTLt/pd0/NtciQHMBrQM29cooALZ5M6C9sCV0PgakRGCdAkCnAE8A2K3+imLnppc/XosA+WMOAJv36EvP8dpM7Z+7/9UxQAJvHAEIAMPm1+6v/d/pLODmQqyTgyHz4RCn2zONrgLXRmPPTueAJm8JyS3EuBiGLsZ6pQGwIQcwnP3reItWQsDqPJaeP9e2b8ftZjmBqMcQYzP+iCe70c2+rjbdW9cxAtgNANsy+FKFUP4sBO+91U7MuliVpfdeH9Llvaryl3zr1Sr9VR5DqB7TP4ddoOUMpwDbP937Xpc+4Qi/rwHd7A+vvja/AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPwnn8RRvQy3xoCwAAAAAElFTkSuQmCC",
"type": "image/png"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/startup.js": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/startup.js",
"text": "/*\\\ntitle: $:/plugins/tiddlywiki/tiddlywiki-on-fission/startup.js\ntype: application/javascript\nmodule-type: startup\n\nTiddlyWiki startup module to initialise Fission\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n// Export name and synchronous status\nexports.name = \"fission\";\nexports.after = [\"startup\"];\nexports.platforms = [\"browser\"];\nexports.synchronous = false;\n\nexports.startup = function(callback) {\n\t$tw.fission = new Fission();\n\t$tw.fission.initialise(callback);\n}\n\nfunction Fission() {\n\tthis.fs = null;\n\tthis.permissions = null;\n\tthis.username = null;\n\tthis.webnative = require(\"$:/plugins/tiddlywiki/tiddlywiki-on-fission/webnative.js\");\n\tthis.webnative.setup.debug({ enabled: true });\n\tthis.windows = [];\n\tthis.setStatus(\"INITIALISING\");\n}\n\nFission.prototype.setStatus = function(status) {\n\t$tw.wiki.addTiddler({title: \"$:/state/fission/status\",text: status});\n};\n\nFission.prototype.initialise = function(callback) {\n\tvar self = this;\n\t$tw.rootWidget.addEventListener(\"tm-fission-authorise\",function(event) {\n\t\tif(self.permissions) {\n\t\t self.webnative.redirectToLobby(self.permissions);\n\t\t}\n\t\treturn false;\n\t});\n\t$tw.rootWidget.addEventListener(\"tm-fission-leave\",function(event) {\n\t\tself.webnative.leave(function(err) {\n\t\t\tconsole.log(\"webnative.leave() returned\",err);\n\t\t\tself.setUserName();\n\t\t});\n\t\treturn false;\n\t});\n\t$tw.rootWidget.addEventListener(\"tm-fission-list-directory\",function(event) {\n\t\tif(self.fs && self.permissions && event.paramObject && event.paramObject.path) {\n\t\t\tconst userFilepath = self.cleanPath(event.paramObject.path),\n\t\t\t\tsystemFilepath = self.convertUserDirpathToSystemDirpath(userFilepath),\n\t\t\t\tresultPrefix = event.paramObject.resultPrefix || (\"$:/temp/fission/filesystem/\" + userFilepath + \"/\"),\n\t\t\t\tstatusTitle = event.paramObject.statusTitle;\n\t\t\tif(statusTitle) {\n\t\t\t\t$tw.wiki.addTiddler({title: statusTitle, text: \"PENDING\"});\n\t\t\t}\n\t\t\tself.fs.ls(systemFilepath).then(function(data) {\n\t\t\t\t\tif(statusTitle) {\n\t\t\t\t\t\t$tw.wiki.addTiddler({title: statusTitle, text: \"FINISHED\"});\n\t\t\t\t\t}\n\t\t\t\t\t$tw.utils.each(Object.keys(data),function(name) {\n\t\t\t\t\tvar info = data[name],\n\t\t\t\t\t\tuserFilepathString = userFilepath.join(\"/\");\n\t\t\t\t\t$tw.wiki.addTiddler({\n\t\t\t\t\t\ttitle: resultPrefix + name,\n\t\t\t\t\t\ttags: \"$:/tags/FissionFileListing\",\n\t\t\t\t\t\tparent: userFilepathString,\n\t\t\t\t\t\tname: name,\n\t\t\t\t\t\tpath: userFilepathString + \"/\" + name,\n\t\t\t\t\t\t\"public-path\": userFilepath[0] === \"public\" ? (\"https://\" + self.username + \".files.fission.name/p/\" + userFilepath.slice(1).concat(name).join(\"/\")) : undefined,\n\t\t\t\t\t\tcreated: info.mtime ? $tw.utils.stringifyDate(new Date(info.mtime)) : undefined,\n\t\t\t\t\t\tsize: info.size.toString(),\n\t\t\t\t\t\t\"is-file\": info.isFile ? \"yes\" : \"no\"\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\tconsole.log(\"List\",data);\n\t\t\t}).catch(function(err) {\n\t\t\t\talert(\"List directory error: \" + err)\n\t\t\t});\n\t\t}\n\t\treturn false;\n\t});\n\t$tw.rootWidget.addEventListener(\"tm-fission-open-tiddlywiki\",function(event) {\n\t\tif(self.fs && self.permissions && event.paramObject && event.paramObject.path) {\n\t\t\t// Open the wiki\n\t\t\tvar domLink = document.createElement(\"a\");\n\t\t\tconst filepath = self.cleanPath(event.paramObject.path).join(\"/\");\n\t\t\tvar params = [`path=${filepath}`];\n\t\t\tif(event.paramObject && event.paramObject.edition) {\n\t\t\t\tconst editionURL = event.paramObject.edition;\n\t\t\t\tparams.push(`edition=${editionURL}`);\n\t\t\t}\n\t\t\tdomLink.setAttribute(\"href\",\"/editor.html#\" + params.join(\"&\"));\n\t\t\tdomLink.setAttribute(\"target\",\"_blank\");\n\t\t\tdomLink.setAttribute(\"rel\",\"noopener noreferrer\");\n\t\t\tdocument.body.appendChild(domLink);\n\t\t\tdomLink.click();\n\t\t\tdocument.body.removeChild(domLink);\n\t\t}\n\t\treturn false;\n\t});\n\t// Close open windows when unloading main window\n\t$tw.addUnloadTask(function() {\n\t\t$tw.utils.each(self.windows,function(win) {\n\t\t\twin.close();\n\t\t});\n\t});\n\t// Initialise webnative\n\tconst fissionInit = {\n\t\tpermissions: {\n\t\t\tapp: {\n\t\t\t\tname: 'tiddlywiki-on-fission',\n\t\t\t\tcreator: 'tiddlywiki'\n\t\t\t},\n\t\t\tfs: {\n\t\t\t\tpublic: [ this.webnative.path.root() ]\n\t\t\t}\n\t\t}\n\t};\n\tthis.webnative.initialize(fissionInit).then(function(state) {\n\t\tconsole.log(\"state\",state)\n\t\tself.permissions = state.permissions;\n\t\tswitch (state.scenario) {\n\t\t\tcase self.webnative.Scenario.AuthSucceeded:\n\t\t\t\tconsole.log(\"webnative.Scenario.AuthSucceeded\");\n\t\t\tcase self.webnative.Scenario.Continuation:\n\t\t\t\tconsole.log(\"webnative.Scenario.Continuation\");\n\t\t\t\tself.setStatus(\"AUTHORISED\");\n\t\t\t\tself.fs = state.fs;\n\t\t\t\tself.username = state.username;\n\t\t\t\tself.setUserName(state.username);\n\t\t\t\t(async function() {\n\t\t\t\t\t// Check the app directory exists\n\t\t\t\t\tconst appPath = self.fs.appPath();\n\t\t\t\t\tconst appDirectoryExists = await self.fs.exists(appPath);\n\t\t\t\t\tif (!appDirectoryExists) {\n\t\t\t\t\t\tawait self.fs.mkdir(appPath);\n\t\t\t\t\t\tawait self.fs.publish();\n\t\t\t\t\t}\n\t\t\t\t})().then(callback);\n\t\t\t break;\n\t\tcase self.webnative.Scenario.NotAuthorised:\n\t\t\tconsole.log(\"webnative.Scenario.NotAuthorised\");\n\t\tcase self.webnative.Scenario.AuthCancelled:\n\t\t\tconsole.log(\"webnative.Scenario.AuthCancelled\");\n\t\t\tself.setStatus(\"NOTAUTHORISED\");\n\t\t\tself.setUserName(\"\");\n\t\t\tcallback();\n\t\t\tbreak;\n\t\t}\n\t});\n};\n\n// Helper to set the username if it has changed\nFission.prototype.setUserName = function(username) {\n\tusername = username || \"\";\n\tif($tw.wiki.getTiddlerText(\"$:/state/UserName\",\"\") !== username) {\n\t\t$tw.wiki.addTiddler({title: \"$:/state/UserName\", text: username});\n\t}\n};\n\n/*\nClean up a path by removing leading and trailing slashes and returning the parts as an array\n*/\nFission.prototype.cleanPath = function(filepath) {\n\treturn filepath.split(\"/\").filter(part => part !== \"\");\n}\n\n/*\nConvert a user-facing path to a real absolute path by replacing `private/` with the app folder\n*/\nFission.prototype.convertUserDirpathToSystemDirpath = function(userFilepathParts) {\n\tlet root;\n\tswitch(userFilepathParts[0]) {\n\t\tcase \"private\":\n\t\t\troot = this.fs.appPath().directory;\n\t\t\tbreak;\n\t\tcase \"public\":\n\t\t\troot = [this.webnative.path.Branch.Public];\n\t\t\tbreak;\n\t\tcase \"pretty\":\n\t\t\troot = [this.webnative.path.Branch.Pretty];\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tuserFilepathParts.unshift(\"private\");\n\t\t\troot = [this.webnative.path.Branch.Private];\n\t\t\tbreak;\n\t}\n\treturn this.webnative.path.directory.apply(null,root.concat(userFilepathParts.slice(1)));\n}\n\n})();\n",
"type": "application/javascript",
"module-type": "startup"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/templates/editor/script": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/templates/editor/script",
"text": "/*\nThis script is run as part of the editor loader, and doesn't run under TiddlyWiki\n*/\n\n(function() {\n\n\"use strict\";\n\nwindow.webnativeDetails = {\n\tfs: null,\n\tpermissions: null\n}\n\ndocument.addEventListener(\"DOMContentLoaded\",function(event) {\n\tinitialiseWebnative(function() {\n\t\tconst params = document.location.hash.slice(1).split(\"&\").map(part => part.split(\"=\")).reduce((accumulator,currentValue) => {\n\t\t\taccumulator[currentValue[0]] = currentValue[1];\n\t\t\treturn accumulator;\n\t\t},Object.create(null));\n\t\tif(!params.path) {\n\t\t\talert(\"Missing path\");\n\t\t\treturn;\n\t\t}\n\t\tif(webnativeDetails.fs) {\n\t\t\tloadWiki(params.path,params.edition,function(err) {\n\t\t\t\tif(err) {\n\t\t\t\t\tdocument.getElementById(\"banner\").hidden = false;\n\t\t\t\t\tconsole.log(\"Load wiki status: \" + status);\n\t\t\t\t}\n\t\t\t}).then(function() {\n\t\t\t}).catch(function(err) {\n\t\t\t\talert(\"Error opening wiki: \" + err);\n\t\t\t});\n\t\t} else {\n\t\t\talert(\"Webnative not initialised\");\n\t\t}\n\t});\n});\n\nfunction initialiseWebnative(callback) {\n\tconst fissionInit = {\n\t\tpermissions: {\n\t\t\tapp: {\n\t\t\t\tname: \"tiddlywiki-on-fission\",\n\t\t\t\tcreator: \"tiddlywiki\"\n\t\t\t},\n\t\t\tfs: {\n\t\t\t\tpublic: [ window.webnative.path.root() ]\n\t\t\t}\n\t\t}\n\t};\n\twindow.webnative.initialize(fissionInit).then(function(state) {\n\t\tconsole.log(\"state\",state)\n\t\tswitch (state.scenario) {\n\t\t\tcase window.webnative.Scenario.AuthSucceeded:\n\t\t\t\tconsole.log(\"webnative.Scenario.AuthSucceeded\");\n\t\t\tcase window.webnative.Scenario.Continuation:\n\t\t\t\tconsole.log(\"webnative.Scenario.Continuation\");\n\t\t\t\twebnativeDetails.fs = state.fs;\n\t\t\t\twebnativeDetails.permissions = state.permissions;\n\t\t\t\tconsole.log(\"Logged in as\",state.username);\n\t\t\t\tcallback();\n\t\t\t break;\n\t\tcase window.webnative.Scenario.NotAuthorised:\n\t\t\tconsole.log(\"webnative.Scenario.NotAuthorised\");\n\t\tcase window.webnative.Scenario.AuthCancelled:\n\t\t\tconsole.log(\"webnative.Scenario.AuthCancelled\");\n\t\t\tbreak;\n\t\t}\n\t});\n}\n\nasync function loadWiki(userFilepath,editionPath,initialisationHandler) {\n\teditionPath = editionPath || \"editions/tiddlywiki.com/index.html\";\n\tconst realFilepath = convertUserFilepathToSystemFilepath(cleanPath(userFilepath));\n\tconsole.log(`Loading wiki from userpath ${userFilepath} (absolute path ${realFilepath.file.join(\"/\")})`);\n\tconst iframe = document.getElementsByTagName(\"iframe\")[0];\n\t// Set up the message channel for talking to the iframe\n\tiframe.addEventListener(\"load\",function() {\n\t\t// Subscribe to saving messages\n\t\tenableSaving(iframe.contentDocument,function(text,callback) {\n\t\t\tconsole.log(\"Saving to: \" + realFilepath.file.join(\"/\"))\n\t\t\twebnativeDetails.fs.write(realFilepath,text).then(function() {\n\t\t\t\twebnativeDetails.fs.publish().then(function() {\n\t\t\t\t\tcallback(null);\n\t\t\t\t});\n\t\t\t}).catch(function(err) {\n\t\t\t\tcallback(\"Saving error: \" + err);\n\t\t\t});\n\t\t});\n\t\t// Observe mutations of the title element of the iframe\n\t\tvar extractTitle = function() {\n\t\t\t\twindow.document.title = iframe.contentDocument.title;\n\t\t\t},\n\t\t\ttitleObserver = new MutationObserver(extractTitle),\n\t\t\tiframeTitleNode = iframe.contentDocument.getElementsByTagName(\"title\")[0];\n\t\textractTitle();\n\t\ttitleObserver.observe(iframeTitleNode,{attributes: true, childList: true, characterData: true});\n\t\t// Observe mutations of the favicon element of the iframe\n\t\tvar faviconLink = iframe.contentDocument.getElementById(\"faviconLink\"),\n\t\t\thostFaviconLink = document.getElementById(\"faviconLink\"),\n\t\t\textractFavicon = function() {\n\t\t\t\thostFaviconLink.setAttribute(\"href\",faviconLink.getAttribute(\"href\"));\n\t\t\t},\n\t\t\tfaviconObserver = new MutationObserver(extractFavicon);\n\t\tif(faviconLink) {\n\t\t\textractFavicon();\n\t\t\tfaviconObserver.observe(faviconLink,{attributes: true, childList: true, characterData: true});\t\t\n\t\t}\n\t\t// Inject the Fission publisher module if the wiki has the publisher \n\t\tif(iframe.contentWindow.$tw.publisherHandler) {\n\t\t\tiframe.contentWindow.$tw.modules.define(\"$:/plugins/tiddlywiki/tiddlywiki-on-fission/fission-publisher.js\",\"publisher\",document.getElementById(\"publisher-script\").textContent);\n\t\t}\n\t});\n\t// Try to load the file content\n\tif(await webnativeDetails.fs.exists(realFilepath)) {\n\t\tiframe.srcdoc = await webnativeDetails.fs.read(realFilepath);\n\t} else {\n\t\t// Grab an empty wiki\n\t\tconst response = await fetch(\"editions/\" + editionPath);\n\t\tif(response.ok && response.status === 200) {\n\t\t\tiframe.srcdoc = await response.text();\n\t\t} else {\n\t\t\tiframe.srcdoc = `Cannot load ${editionPath}`;\n\t\t}\n\t}\n}\n\n/*\nClean up a path by removing leading and trailing slashes and returning the parts as an array\n*/\nfunction cleanPath(filepath) {\n\treturn filepath.split(\"/\").filter(part => part !== \"\");\n}\n\n/*\nConvert a user-facing path to a real absolute path by replacing `private/` with the app folder\n*/\nfunction convertUserFilepathToSystemFilepath(userFilepathParts) {\n\tlet root;\n\tswitch(userFilepathParts[0]) {\n\t\tcase \"private\":\n\t\t\troot = webnativeDetails.fs.appPath().directory;\n\t\t\tbreak;\n\t\tcase \"public\":\n\t\t\troot = [webnative.path.Branch.Public];\n\t\t\tbreak;\n\t\tcase \"pretty\":\n\t\t\troot = [webnative.path.Branch.Pretty];\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tuserFilepathParts.unshift(\"private\");\n\t\t\troot = [webnative.path.Branch.Private];\n\t\t\tbreak;\n\t}\n\treturn webnative.path.file.apply(null,root.concat(userFilepathParts.slice(1)));\n}\n\n\n// Helper to enable TiddlyFox-style saving for a window\nfunction enableSaving(doc,fnSaveFile) {\n\t// Create the message box\n\tlet messageBox = doc.createElement(\"div\");\n\tmessageBox.id = \"tiddlyfox-message-box\";\n\tdoc.body.appendChild(messageBox);\n\t// Listen for save events\n\tmessageBox.addEventListener(\"tiddlyfox-save-file\",function(event) {\n\t\t// Get the details from the message\n\t\tlet message = event.target,\n\t\t\tfilepath = message.getAttribute(\"data-tiddlyfox-path\"),\n\t\t\tcontent = message.getAttribute(\"data-tiddlyfox-content\");\n\t\t// Save the file\n\t\tfnSaveFile(content,function(err) {\n\t\t\tif(err) {\n\t\t\t\talert(\"Error saving file: \" + err);\n\t\t\t}\n\t\t\t// Remove the message element from the message box\n\t\t\tmessage.parentNode.removeChild(message);\n\t\t\t// Send a confirmation message\n\t\t\tlet event = doc.createEvent(\"Events\");\n\t\t\tevent.initEvent(\"tiddlyfox-have-saved-file\",true,false);\n\t\t\tevent.savedFilePath = filepath;\n\t\t\tmessage.dispatchEvent(event);\n\t\t});\n\t\treturn false;\n\t},false);\n}\n\n/*\nPad a string to a given length with \"0\"s. Length defaults to 2\n*/\nfunction pad(value,length) {\n\tlength = length || 2;\n\tlet 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/*\n * Returns an escape sequence for given character. Uses \\x for characters <=\n * 0xFF to save space, \\u for the rest.\n *\n * The code needs to be in sync with th code template in the compilation\n * function for \"action\" nodes.\n */\n// Copied from peg.js, thanks to David Majda\nfunction escapeChar(ch) {\n\tlet charCode = ch.charCodeAt(0);\n\tif(charCode <= 0xFF) {\n\t\treturn '\\\\x' + pad(charCode.toString(16).toUpperCase());\n\t} else {\n\t\treturn '\\\\u' + pad(charCode.toString(16).toUpperCase(),4);\n\t}\n};\n\n// Turns a string into a legal JavaScript string\n// Copied from peg.js, thanks to David Majda\nfunction stringify(s) {\n\t/*\n\t* ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a string\n\t* literal except for the closing quote character, backslash, carriage return,\n\t* line separator, paragraph separator, and line feed. Any character may\n\t* appear in the form of an escape sequence.\n\t*\n\t* For portability, we also escape all non-ASCII characters.\n\t*/\n\treturn (s || \"\")\n\t\t.replace(/\\\\/g, '\\\\\\\\') // backslash\n\t\t.replace(/\"/g, '\\\\\"') // double quote character\n\t\t.replace(/'/g, \"\\\\'\") // single quote character\n\t\t.replace(/\\r/g, '\\\\r') // carriage return\n\t\t.replace(/\\n/g, '\\\\n') // line feed\n\t\t.replace(/[\\x00-\\x1f\\x80-\\uFFFF]/g, escapeChar); // non-ASCII characters\n};\n\n})();\n",
"type": "application/javascript"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/templates/editor/styles": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/templates/editor/styles",
"text": "body {\n\tmargin: 0;\n}\n\n#container {\n\tdisplay: flex;\n\tflex-direction: column;\n\theight: 100vh;\n}\n\n#banner {\n\tflex: 0 0 auto;\n\ttext-align: center;\n\tpadding: 1em;\n\tbackground: repeating-linear-gradient(135deg,#ffc,#ffc 10px,#fff 10px,#fff 20px);\n\tfont-style: italic;\n\tborder-bottom: 3px solid #eea;\n}\n\n#iframe {\n\tflex: 1 0 auto;\n\tborder: 0;\n}\n"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/templates/editor": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/templates/editor",
"text": "`<!doctype html>\n<head>\n<title>TiddlyWiki on Fission Editor</title>\n<link id=\"faviconLink\" rel=\"shortcut icon\" href=\"favicon.ico\">\n<style>`\n{{$:/plugins/tiddlywiki/tiddlywiki-on-fission/templates/editor/styles||$:/core/templates/plain-text-tiddler}}\n`</style>\n</head>\n<body>\n<div id=\"container\">\n<div id=\"banner\" hidden>\nThis file is not recognised as a TiddlyWiki containing the TiddlyWiki on Fission saver, and so saving changes is not supported.\n</div>\n<iframe id=\"iframe\" sandbox='allow-same-origin allow-downloads allow-popups allow-presentation allow-scripts allow-modals'>\n</iframe>\n</div>\n</body>\n<script>`\n{{$:/plugins/tiddlywiki/tiddlywiki-on-fission/webnative.js||$:/core/templates/plain-text-tiddler}}\n{{$:/plugins/tiddlywiki/tiddlywiki-on-fission/templates/editor/script||$:/core/templates/plain-text-tiddler}}\n`</script>\n<script type=\"text/plain\" id=\"publisher-script\">`\n{{$:/plugins/tiddlywiki/tiddlywiki-on-fission/fission-publisher.js||$:/core/templates/plain-text-tiddler}}\n`</script>\n</html>`\n"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/palette": {
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/palette",
"description": "A fusion of TiddlyWiki and Fission colours",
"name": "TiddlyWiki on Fission",
"tags": "$:/tags/Palette",
"type": "application/x-tiddler-dictionary",
"text": "alert-background: #ffe476\nalert-border: #b99e2f\nalert-highlight: #881122\nalert-muted-foreground: #b99e2f\nbackground: #ffffff\nblockquote-bar: <<colour muted-foreground>>\nbutton-background: \nbutton-foreground: \nbutton-border: \ncode-background: #f7f7f9\ncode-border: #e1e1e8\ncode-foreground: #dd1144\ndiff-delete-background: #ffc9c9\ndiff-delete-foreground: <<colour foreground>>\ndiff-equal-background: \ndiff-equal-foreground: <<colour foreground>>\ndiff-insert-background: #aaefad\ndiff-insert-foreground: <<colour foreground>>\ndiff-invisible-background: \ndiff-invisible-foreground: <<colour muted-foreground>>\ndirty-indicator: #ff0000\ndownload-background: #34c734\ndownload-foreground: <<colour background>>\ndragger-background: <<colour foreground>>\ndragger-foreground: <<colour background>>\ndropdown-background: <<colour background>>\ndropdown-border: <<colour muted-foreground>>\ndropdown-tab-background-selected: #fff\ndropdown-tab-background: #ececec\ndropzone-background: rgba(0,200,0,0.7)\nexternal-link-background-hover: inherit\nexternal-link-background-visited: inherit\nexternal-link-background: inherit\nexternal-link-foreground-hover: inherit\nexternal-link-foreground-visited: #0000aa\nexternal-link-foreground: #0000ee\nforeground: #333333\nmessage-background: #ecf2ff\nmessage-border: #cfd6e6\nmessage-foreground: #547599\nmodal-backdrop: <<colour foreground>>\nmodal-background: <<colour background>>\nmodal-border: #999999\nmodal-footer-background: #f5f5f5\nmodal-footer-border: #dddddd\nmodal-header-border: #eeeeee\nmuted-foreground: #888888\nnotification-background: #ffffdd\nnotification-border: #999999\npage-background: #babbc5\npre-background: #f5f5f5\npre-border: #cccccc\nprimary: #6447fa\nselection-background: \nselection-foreground: \nselect-tag-background: \nselect-tag-foreground: \nsidebar-button-foreground: <<colour foreground>>\nsidebar-controls-foreground-hover: #000000\nsidebar-controls-foreground: #fd5374\nsidebar-foreground-shadow: rgba(255,255,255, 0.8)\nsidebar-foreground: #46485d\nsidebar-muted-foreground-hover: #444444\nsidebar-muted-foreground: #ffffff\nsidebar-tab-background-selected: #cccedb\nsidebar-tab-background: transparent\nsidebar-tab-border-selected: #9798a1\nsidebar-tab-border: #99999f\nsidebar-tab-divider: #c3c4cb\nsidebar-tab-foreground-selected: \nsidebar-tab-foreground: <<colour tab-foreground>>\nsidebar-tiddler-link-foreground-hover: #444444\nsidebar-tiddler-link-foreground: #bc4fb0\nsite-title-foreground: <<colour tiddler-title-foreground>>\nstatic-alert-foreground: #aaaaaa\ntab-background-selected: #ffffff\ntab-background: #d8d8d8\ntab-border-selected: #d8d8d8\ntab-border: #cccccc\ntab-divider: #d8d8d8\ntab-foreground-selected: <<colour tab-foreground>>\ntab-foreground: #666666\ntable-border: #dddddd\ntable-footer-background: #a8a8a8\ntable-header-background: #f0f0f0\ntag-background: #ec6\ntag-foreground: #ffffff\ntiddler-background: <<colour background>>\ntiddler-border: <<colour background>>\ntiddler-controls-foreground-hover: #888888\ntiddler-controls-foreground-selected: #444444\ntiddler-controls-foreground: #c885d5\ntiddler-editor-background: #f8f8f8\ntiddler-editor-border-image: #ffffff\ntiddler-editor-border: #cccccc\ntiddler-editor-fields-even: #e0e8e0\ntiddler-editor-fields-odd: #f0f4f0\ntiddler-info-background: #f8f8f8\ntiddler-info-border: #dddddd\ntiddler-info-tab-background: #f8f8f8\ntiddler-link-background: <<colour background>>\ntiddler-link-foreground: <<colour primary>>\ntiddler-subtitle-foreground: #c0c0c0\ntiddler-title-foreground: #182955\ntoolbar-new-button: \ntoolbar-options-button: \ntoolbar-save-button: \ntoolbar-info-button: \ntoolbar-edit-button: \ntoolbar-close-button: \ntoolbar-delete-button: \ntoolbar-cancel-button: \ntoolbar-done-button: \nuntagged-background: #999999\nvery-muted-foreground: #888888\nwikilist-background: #e5e5e5\nwikilist-item: #fff\nwikilist-info: #000\nwikilist-title: #666\nwikilist-title-svg: <<colour wikilist-title>>\nwikilist-url: #aaa\nwikilist-button-open: #4fb82b\nwikilist-button-open-hover: green\nwikilist-button-reveal: #5778d8\nwikilist-button-reveal-hover: blue\nwikilist-button-remove: #d85778\nwikilist-button-remove-hover: red\nwikilist-toolbar-background: #d3d3d3\nwikilist-toolbar-foreground: #888\nwikilist-droplink-dragover: rgba(255,192,192,0.5)\nwikilist-button-background: #acacac\nwikilist-button-foreground: #000\n"
},
"$:/plugins/tiddlywiki/tiddlywiki-on-fission/webnative.js": {
"text": "// Saved from: https://unpkg.com/webnative@0.24.1/dist/index.umd.js\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.webnative = {}));\n}(this, (function (exports) { 'use strict';\n\n /*! *****************************************************************************\n Copyright (c) Microsoft Corporation.\n\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n PERFORMANCE OF THIS SOFTWARE.\n ***************************************************************************** */\n /* global Reflect, Promise */\n\n var extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n\n function __extends(d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n }\n\n var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n\n function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n }\n\n function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n }\n\n function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n }\n\n function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n }\n\n function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n }\n function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n }\n\n var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\n function getDefaultExportFromCjs (x) {\n \treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n }\n\n function getAugmentedNamespace(n) {\n \tif (n.__esModule) return n;\n \tvar a = Object.defineProperty({}, '__esModule', {value: true});\n \tObject.keys(n).forEach(function (k) {\n \t\tvar d = Object.getOwnPropertyDescriptor(n, k);\n \t\tObject.defineProperty(a, k, d.get ? d : {\n \t\t\tenumerable: true,\n \t\t\tget: function () {\n \t\t\t\treturn n[k];\n \t\t\t}\n \t\t});\n \t});\n \treturn a;\n }\n\n function createCommonjsModule(fn) {\n var module = { exports: {} };\n \treturn fn(module, module.exports), module.exports;\n }\n\n function commonjsRequire (target) {\n \tthrow new Error('Could not dynamically require \"' + target + '\". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.');\n }\n\n /*!\n localForage -- Offline Storage, Improved\n Version 1.9.0\n https://localforage.github.io/localForage\n (c) 2013-2017 Mozilla, Apache License 2.0\n */\n\n var localforage = createCommonjsModule(function (module, exports) {\n (function(f){{module.exports=f();}})(function(){return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof commonjsRequire==\"function\"&&commonjsRequire;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw (f.code=\"MODULE_NOT_FOUND\", f)}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r);}return n[o].exports}var i=typeof commonjsRequire==\"function\"&&commonjsRequire;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){\n (function (global){\n var Mutation = global.MutationObserver || global.WebKitMutationObserver;\n\n var scheduleDrain;\n\n {\n if (Mutation) {\n var called = 0;\n var observer = new Mutation(nextTick);\n var element = global.document.createTextNode('');\n observer.observe(element, {\n characterData: true\n });\n scheduleDrain = function () {\n element.data = (called = ++called % 2);\n };\n } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {\n var channel = new global.MessageChannel();\n channel.port1.onmessage = nextTick;\n scheduleDrain = function () {\n channel.port2.postMessage(0);\n };\n } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {\n scheduleDrain = function () {\n\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n var scriptEl = global.document.createElement('script');\n scriptEl.onreadystatechange = function () {\n nextTick();\n\n scriptEl.onreadystatechange = null;\n scriptEl.parentNode.removeChild(scriptEl);\n scriptEl = null;\n };\n global.document.documentElement.appendChild(scriptEl);\n };\n } else {\n scheduleDrain = function () {\n setTimeout(nextTick, 0);\n };\n }\n }\n\n var draining;\n var queue = [];\n //named nextTick for less confusing stack traces\n function nextTick() {\n draining = true;\n var i, oldQueue;\n var len = queue.length;\n while (len) {\n oldQueue = queue;\n queue = [];\n i = -1;\n while (++i < len) {\n oldQueue[i]();\n }\n len = queue.length;\n }\n draining = false;\n }\n\n module.exports = immediate;\n function immediate(task) {\n if (queue.push(task) === 1 && !draining) {\n scheduleDrain();\n }\n }\n\n }).call(this,typeof commonjsGlobal !== \"undefined\" ? commonjsGlobal : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n },{}],2:[function(_dereq_,module,exports){\n var immediate = _dereq_(1);\n\n /* istanbul ignore next */\n function INTERNAL() {}\n\n var handlers = {};\n\n var REJECTED = ['REJECTED'];\n var FULFILLED = ['FULFILLED'];\n var PENDING = ['PENDING'];\n\n module.exports = Promise;\n\n function Promise(resolver) {\n if (typeof resolver !== 'function') {\n throw new TypeError('resolver must be a function');\n }\n this.state = PENDING;\n this.queue = [];\n this.outcome = void 0;\n if (resolver !== INTERNAL) {\n safelyResolveThenable(this, resolver);\n }\n }\n\n Promise.prototype[\"catch\"] = function (onRejected) {\n return this.then(null, onRejected);\n };\n Promise.prototype.then = function (onFulfilled, onRejected) {\n if (typeof onFulfilled !== 'function' && this.state === FULFILLED ||\n typeof onRejected !== 'function' && this.state === REJECTED) {\n return this;\n }\n var promise = new this.constructor(INTERNAL);\n if (this.state !== PENDING) {\n var resolver = this.state === FULFILLED ? onFulfilled : onRejected;\n unwrap(promise, resolver, this.outcome);\n } else {\n this.queue.push(new QueueItem(promise, onFulfilled, onRejected));\n }\n\n return promise;\n };\n function QueueItem(promise, onFulfilled, onRejected) {\n this.promise = promise;\n if (typeof onFulfilled === 'function') {\n this.onFulfilled = onFulfilled;\n this.callFulfilled = this.otherCallFulfilled;\n }\n if (typeof onRejected === 'function') {\n this.onRejected = onRejected;\n this.callRejected = this.otherCallRejected;\n }\n }\n QueueItem.prototype.callFulfilled = function (value) {\n handlers.resolve(this.promise, value);\n };\n QueueItem.prototype.otherCallFulfilled = function (value) {\n unwrap(this.promise, this.onFulfilled, value);\n };\n QueueItem.prototype.callRejected = function (value) {\n handlers.reject(this.promise, value);\n };\n QueueItem.prototype.otherCallRejected = function (value) {\n unwrap(this.promise, this.onRejected, value);\n };\n\n function unwrap(promise, func, value) {\n immediate(function () {\n var returnValue;\n try {\n returnValue = func(value);\n } catch (e) {\n return handlers.reject(promise, e);\n }\n if (returnValue === promise) {\n handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));\n } else {\n handlers.resolve(promise, returnValue);\n }\n });\n }\n\n handlers.resolve = function (self, value) {\n var result = tryCatch(getThen, value);\n if (result.status === 'error') {\n return handlers.reject(self, result.value);\n }\n var thenable = result.value;\n\n if (thenable) {\n safelyResolveThenable(self, thenable);\n } else {\n self.state = FULFILLED;\n self.outcome = value;\n var i = -1;\n var len = self.queue.length;\n while (++i < len) {\n self.queue[i].callFulfilled(value);\n }\n }\n return self;\n };\n handlers.reject = function (self, error) {\n self.state = REJECTED;\n self.outcome = error;\n var i = -1;\n var len = self.queue.length;\n while (++i < len) {\n self.queue[i].callRejected(error);\n }\n return self;\n };\n\n function getThen(obj) {\n // Make sure we only access the accessor once as required by the spec\n var then = obj && obj.then;\n if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') {\n return function appyThen() {\n then.apply(obj, arguments);\n };\n }\n }\n\n function safelyResolveThenable(self, thenable) {\n // Either fulfill, reject or reject with error\n var called = false;\n function onError(value) {\n if (called) {\n return;\n }\n called = true;\n handlers.reject(self, value);\n }\n\n function onSuccess(value) {\n if (called) {\n return;\n }\n called = true;\n handlers.resolve(self, value);\n }\n\n function tryToUnwrap() {\n thenable(onSuccess, onError);\n }\n\n var result = tryCatch(tryToUnwrap);\n if (result.status === 'error') {\n onError(result.value);\n }\n }\n\n function tryCatch(func, value) {\n var out = {};\n try {\n out.value = func(value);\n out.status = 'success';\n } catch (e) {\n out.status = 'error';\n out.value = e;\n }\n return out;\n }\n\n Promise.resolve = resolve;\n function resolve(value) {\n if (value instanceof this) {\n return value;\n }\n return handlers.resolve(new this(INTERNAL), value);\n }\n\n Promise.reject = reject;\n function reject(reason) {\n var promise = new this(INTERNAL);\n return handlers.reject(promise, reason);\n }\n\n Promise.all = all;\n function all(iterable) {\n var self = this;\n if (Object.prototype.toString.call(iterable) !== '[object Array]') {\n return this.reject(new TypeError('must be an array'));\n }\n\n var len = iterable.length;\n var called = false;\n if (!len) {\n return this.resolve([]);\n }\n\n var values = new Array(len);\n var resolved = 0;\n var i = -1;\n var promise = new this(INTERNAL);\n\n while (++i < len) {\n allResolver(iterable[i], i);\n }\n return promise;\n function allResolver(value, i) {\n self.resolve(value).then(resolveFromAll, function (error) {\n if (!called) {\n called = true;\n handlers.reject(promise, error);\n }\n });\n function resolveFromAll(outValue) {\n values[i] = outValue;\n if (++resolved === len && !called) {\n called = true;\n handlers.resolve(promise, values);\n }\n }\n }\n }\n\n Promise.race = race;\n function race(iterable) {\n var self = this;\n if (Object.prototype.toString.call(iterable) !== '[object Array]') {\n return this.reject(new TypeError('must be an array'));\n }\n\n var len = iterable.length;\n var called = false;\n if (!len) {\n return this.resolve([]);\n }\n\n var i = -1;\n var promise = new this(INTERNAL);\n\n while (++i < len) {\n resolver(iterable[i]);\n }\n return promise;\n function resolver(value) {\n self.resolve(value).then(function (response) {\n if (!called) {\n called = true;\n handlers.resolve(promise, response);\n }\n }, function (error) {\n if (!called) {\n called = true;\n handlers.reject(promise, error);\n }\n });\n }\n }\n\n },{\"1\":1}],3:[function(_dereq_,module,exports){\n (function (global){\n if (typeof global.Promise !== 'function') {\n global.Promise = _dereq_(2);\n }\n\n }).call(this,typeof commonjsGlobal !== \"undefined\" ? commonjsGlobal : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n },{\"2\":2}],4:[function(_dereq_,module,exports){\n\n var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n function getIDB() {\n /* global indexedDB,webkitIndexedDB,mozIndexedDB,OIndexedDB,msIndexedDB */\n try {\n if (typeof indexedDB !== 'undefined') {\n return indexedDB;\n }\n if (typeof webkitIndexedDB !== 'undefined') {\n return webkitIndexedDB;\n }\n if (typeof mozIndexedDB !== 'undefined') {\n return mozIndexedDB;\n }\n if (typeof OIndexedDB !== 'undefined') {\n return OIndexedDB;\n }\n if (typeof msIndexedDB !== 'undefined') {\n return msIndexedDB;\n }\n } catch (e) {\n return;\n }\n }\n\n var idb = getIDB();\n\n function isIndexedDBValid() {\n try {\n // Initialize IndexedDB; fall back to vendor-prefixed versions\n // if needed.\n if (!idb || !idb.open) {\n return false;\n }\n // We mimic PouchDB here;\n //\n // We test for openDatabase because IE Mobile identifies itself\n // as Safari. Oh the lulz...\n var isSafari = typeof openDatabase !== 'undefined' && /(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) && !/BlackBerry/.test(navigator.platform);\n\n var hasFetch = typeof fetch === 'function' && fetch.toString().indexOf('[native code') !== -1;\n\n // Safari <10.1 does not meet our requirements for IDB support\n // (see: https://github.com/pouchdb/pouchdb/issues/5572).\n // Safari 10.1 shipped with fetch, we can use that to detect it.\n // Note: this creates issues with `window.fetch` polyfills and\n // overrides; see:\n // https://github.com/localForage/localForage/issues/856\n return (!isSafari || hasFetch) && typeof indexedDB !== 'undefined' &&\n // some outdated implementations of IDB that appear on Samsung\n // and HTC Android devices <4.4 are missing IDBKeyRange\n // See: https://github.com/mozilla/localForage/issues/128\n // See: https://github.com/mozilla/localForage/issues/272\n typeof IDBKeyRange !== 'undefined';\n } catch (e) {\n return false;\n }\n }\n\n // Abstracts constructing a Blob object, so it also works in older\n // browsers that don't support the native Blob constructor. (i.e.\n // old QtWebKit versions, at least).\n // Abstracts constructing a Blob object, so it also works in older\n // browsers that don't support the native Blob constructor. (i.e.\n // old QtWebKit versions, at least).\n function createBlob(parts, properties) {\n /* global BlobBuilder,MSBlobBuilder,MozBlobBuilder,WebKitBlobBuilder */\n parts = parts || [];\n properties = properties || {};\n try {\n return new Blob(parts, properties);\n } catch (e) {\n if (e.name !== 'TypeError') {\n throw e;\n }\n var Builder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : WebKitBlobBuilder;\n var builder = new Builder();\n for (var i = 0; i < parts.length; i += 1) {\n builder.append(parts[i]);\n }\n return builder.getBlob(properties.type);\n }\n }\n\n // This is CommonJS because lie is an external dependency, so Rollup\n // can just ignore it.\n if (typeof Promise === 'undefined') {\n // In the \"nopromises\" build this will just throw if you don't have\n // a global promise object, but it would throw anyway later.\n _dereq_(3);\n }\n var Promise$1 = Promise;\n\n function executeCallback(promise, callback) {\n if (callback) {\n promise.then(function (result) {\n callback(null, result);\n }, function (error) {\n callback(error);\n });\n }\n }\n\n function executeTwoCallbacks(promise, callback, errorCallback) {\n if (typeof callback === 'function') {\n promise.then(callback);\n }\n\n if (typeof errorCallback === 'function') {\n promise[\"catch\"](errorCallback);\n }\n }\n\n function normalizeKey(key) {\n // Cast the key to a string, as that's all we can set as a key.\n if (typeof key !== 'string') {\n console.warn(key + ' used as a key, but it is not a string.');\n key = String(key);\n }\n\n return key;\n }\n\n function getCallback() {\n if (arguments.length && typeof arguments[arguments.length - 1] === 'function') {\n return arguments[arguments.length - 1];\n }\n }\n\n // Some code originally from async_storage.js in\n // [Gaia](https://github.com/mozilla-b2g/gaia).\n\n var DETECT_BLOB_SUPPORT_STORE = 'local-forage-detect-blob-support';\n var supportsBlobs = void 0;\n var dbContexts = {};\n var toString = Object.prototype.toString;\n\n // Transaction Modes\n var READ_ONLY = 'readonly';\n var READ_WRITE = 'readwrite';\n\n // Transform a binary string to an array buffer, because otherwise\n // weird stuff happens when you try to work with the binary string directly.\n // It is known.\n // From http://stackoverflow.com/questions/14967647/ (continues on next line)\n // encode-decode-image-with-base64-breaks-image (2013-04-21)\n function _binStringToArrayBuffer(bin) {\n var length = bin.length;\n var buf = new ArrayBuffer(length);\n var arr = new Uint8Array(buf);\n for (var i = 0; i < length; i++) {\n arr[i] = bin.charCodeAt(i);\n }\n return buf;\n }\n\n //\n // Blobs are not supported in all versions of IndexedDB, notably\n // Chrome <37 and Android <5. In those versions, storing a blob will throw.\n //\n // Various other blob bugs exist in Chrome v37-42 (inclusive).\n // Detecting them is expensive and confusing to users, and Chrome 37-42\n // is at very low usage worldwide, so we do a hacky userAgent check instead.\n //\n // content-type bug: https://code.google.com/p/chromium/issues/detail?id=408120\n // 404 bug: https://code.google.com/p/chromium/issues/detail?id=447916\n // FileReader bug: https://code.google.com/p/chromium/issues/detail?id=447836\n //\n // Code borrowed from PouchDB. See:\n // https://github.com/pouchdb/pouchdb/blob/master/packages/node_modules/pouchdb-adapter-idb/src/blobSupport.js\n //\n function _checkBlobSupportWithoutCaching(idb) {\n return new Promise$1(function (resolve) {\n var txn = idb.transaction(DETECT_BLOB_SUPPORT_STORE, READ_WRITE);\n var blob = createBlob(['']);\n txn.objectStore(DETECT_BLOB_SUPPORT_STORE).put(blob, 'key');\n\n txn.onabort = function (e) {\n // If the transaction aborts now its due to not being able to\n // write to the database, likely due to the disk being full\n e.preventDefault();\n e.stopPropagation();\n resolve(false);\n };\n\n txn.oncomplete = function () {\n var matchedChrome = navigator.userAgent.match(/Chrome\\/(\\d+)/);\n var matchedEdge = navigator.userAgent.match(/Edge\\//);\n // MS Edge pretends to be Chrome 42:\n // https://msdn.microsoft.com/en-us/library/hh869301%28v=vs.85%29.aspx\n resolve(matchedEdge || !matchedChrome || parseInt(matchedChrome[1], 10) >= 43);\n };\n })[\"catch\"](function () {\n return false; // error, so assume unsupported\n });\n }\n\n function _checkBlobSupport(idb) {\n if (typeof supportsBlobs === 'boolean') {\n return Promise$1.resolve(supportsBlobs);\n }\n return _checkBlobSupportWithoutCaching(idb).then(function (value) {\n supportsBlobs = value;\n return supportsBlobs;\n });\n }\n\n function _deferReadiness(dbInfo) {\n var dbContext = dbContexts[dbInfo.name];\n\n // Create a deferred object representing the current database operation.\n var deferredOperation = {};\n\n deferredOperation.promise = new Promise$1(function (resolve, reject) {\n deferredOperation.resolve = resolve;\n deferredOperation.reject = reject;\n });\n\n // Enqueue the deferred operation.\n dbContext.deferredOperations.push(deferredOperation);\n\n // Chain its promise to the database readiness.\n if (!dbContext.dbReady) {\n dbContext.dbReady = deferredOperation.promise;\n } else {\n dbContext.dbReady = dbContext.dbReady.then(function () {\n return deferredOperation.promise;\n });\n }\n }\n\n function _advanceReadiness(dbInfo) {\n var dbContext = dbContexts[dbInfo.name];\n\n // Dequeue a deferred operation.\n var deferredOperation = dbContext.deferredOperations.pop();\n\n // Resolve its promise (which is part of the database readiness\n // chain of promises).\n if (deferredOperation) {\n deferredOperation.resolve();\n return deferredOperation.promise;\n }\n }\n\n function _rejectReadiness(dbInfo, err) {\n var dbContext = dbContexts[dbInfo.name];\n\n // Dequeue a deferred operation.\n var deferredOperation = dbContext.deferredOperations.pop();\n\n // Reject its promise (which is part of the database readiness\n // chain of promises).\n if (deferredOperation) {\n deferredOperation.reject(err);\n return deferredOperation.promise;\n }\n }\n\n function _getConnection(dbInfo, upgradeNeeded) {\n return new Promise$1(function (resolve, reject) {\n dbContexts[dbInfo.name] = dbContexts[dbInfo.name] || createDbContext();\n\n if (dbInfo.db) {\n if (upgradeNeeded) {\n _deferReadiness(dbInfo);\n dbInfo.db.close();\n } else {\n return resolve(dbInfo.db);\n }\n }\n\n var dbArgs = [dbInfo.name];\n\n if (upgradeNeeded) {\n dbArgs.push(dbInfo.version);\n }\n\n var openreq = idb.open.apply(idb, dbArgs);\n\n if (upgradeNeeded) {\n openreq.onupgradeneeded = function (e) {\n var db = openreq.result;\n try {\n db.createObjectStore(dbInfo.storeName);\n if (e.oldVersion <= 1) {\n // Added when support for blob shims was added\n db.createObjectStore(DETECT_BLOB_SUPPORT_STORE);\n }\n } catch (ex) {\n if (ex.name === 'ConstraintError') {\n console.warn('The database \"' + dbInfo.name + '\"' + ' has been upgraded from version ' + e.oldVersion + ' to version ' + e.newVersion + ', but the storage \"' + dbInfo.storeName + '\" already exists.');\n } else {\n throw ex;\n }\n }\n };\n }\n\n openreq.onerror = function (e) {\n e.preventDefault();\n reject(openreq.error);\n };\n\n openreq.onsuccess = function () {\n resolve(openreq.result);\n _advanceReadiness(dbInfo);\n };\n });\n }\n\n function _getOriginalConnection(dbInfo) {\n return _getConnection(dbInfo, false);\n }\n\n function _getUpgradedConnection(dbInfo) {\n return _getConnection(dbInfo, true);\n }\n\n function _isUpgradeNeeded(dbInfo, defaultVersion) {\n if (!dbInfo.db) {\n return true;\n }\n\n var isNewStore = !dbInfo.db.objectStoreNames.contains(dbInfo.storeName);\n var isDowngrade = dbInfo.version < dbInfo.db.version;\n var isUpgrade = dbInfo.version > dbInfo.db.version;\n\n if (isDowngrade) {\n // If the version is not the default one\n // then warn for impossible downgrade.\n if (dbInfo.version !== defaultVersion) {\n console.warn('The database \"' + dbInfo.name + '\"' + \" can't be downgraded from version \" + dbInfo.db.version + ' to version ' + dbInfo.version + '.');\n }\n // Align the versions to prevent errors.\n dbInfo.version = dbInfo.db.version;\n }\n\n if (isUpgrade || isNewStore) {\n // If the store is new then increment the version (if needed).\n // This will trigger an \"upgradeneeded\" event which is required\n // for creating a store.\n if (isNewStore) {\n var incVersion = dbInfo.db.version + 1;\n if (incVersion > dbInfo.version) {\n dbInfo.version = incVersion;\n }\n }\n\n return true;\n }\n\n return false;\n }\n\n // encode a blob for indexeddb engines that don't support blobs\n function _encodeBlob(blob) {\n return new Promise$1(function (resolve, reject) {\n var reader = new FileReader();\n reader.onerror = reject;\n reader.onloadend = function (e) {\n var base64 = btoa(e.target.result || '');\n resolve({\n __local_forage_encoded_blob: true,\n data: base64,\n type: blob.type\n });\n };\n reader.readAsBinaryString(blob);\n });\n }\n\n // decode an encoded blob\n function _decodeBlob(encodedBlob) {\n var arrayBuff = _binStringToArrayBuffer(atob(encodedBlob.data));\n return createBlob([arrayBuff], { type: encodedBlob.type });\n }\n\n // is this one of our fancy encoded blobs?\n function _isEncodedBlob(value) {\n return value && value.__local_forage_encoded_blob;\n }\n\n // Specialize the default `ready()` function by making it dependent\n // on the current database operations. Thus, the driver will be actually\n // ready when it's been initialized (default) *and* there are no pending\n // operations on the database (initiated by some other instances).\n function _fullyReady(callback) {\n var self = this;\n\n var promise = self._initReady().then(function () {\n var dbContext = dbContexts[self._dbInfo.name];\n\n if (dbContext && dbContext.dbReady) {\n return dbContext.dbReady;\n }\n });\n\n executeTwoCallbacks(promise, callback, callback);\n return promise;\n }\n\n // Try to establish a new db connection to replace the\n // current one which is broken (i.e. experiencing\n // InvalidStateError while creating a transaction).\n function _tryReconnect(dbInfo) {\n _deferReadiness(dbInfo);\n\n var dbContext = dbContexts[dbInfo.name];\n var forages = dbContext.forages;\n\n for (var i = 0; i < forages.length; i++) {\n var forage = forages[i];\n if (forage._dbInfo.db) {\n forage._dbInfo.db.close();\n forage._dbInfo.db = null;\n }\n }\n dbInfo.db = null;\n\n return _getOriginalConnection(dbInfo).then(function (db) {\n dbInfo.db = db;\n if (_isUpgradeNeeded(dbInfo)) {\n // Reopen the database for upgrading.\n return _getUpgradedConnection(dbInfo);\n }\n return db;\n }).then(function (db) {\n // store the latest db reference\n // in case the db was upgraded\n dbInfo.db = dbContext.db = db;\n for (var i = 0; i < forages.length; i++) {\n forages[i]._dbInfo.db = db;\n }\n })[\"catch\"](function (err) {\n _rejectReadiness(dbInfo, err);\n throw err;\n });\n }\n\n // FF doesn't like Promises (micro-tasks) and IDDB store operations,\n // so we have to do it with callbacks\n function createTransaction(dbInfo, mode, callback, retries) {\n if (retries === undefined) {\n retries = 1;\n }\n\n try {\n var tx = dbInfo.db.transaction(dbInfo.storeName, mode);\n callback(null, tx);\n } catch (err) {\n if (retries > 0 && (!dbInfo.db || err.name === 'InvalidStateError' || err.name === 'NotFoundError')) {\n return Promise$1.resolve().then(function () {\n if (!dbInfo.db || err.name === 'NotFoundError' && !dbInfo.db.objectStoreNames.contains(dbInfo.storeName) && dbInfo.version <= dbInfo.db.version) {\n // increase the db version, to create the new ObjectStore\n if (dbInfo.db) {\n dbInfo.version = dbInfo.db.version + 1;\n }\n // Reopen the database for upgrading.\n return _getUpgradedConnection(dbInfo);\n }\n }).then(function () {\n return _tryReconnect(dbInfo).then(function () {\n createTransaction(dbInfo, mode, callback, retries - 1);\n });\n })[\"catch\"](callback);\n }\n\n callback(err);\n }\n }\n\n function createDbContext() {\n return {\n // Running localForages sharing a database.\n forages: [],\n // Shared database.\n db: null,\n // Database readiness (promise).\n dbReady: null,\n // Deferred operations on the database.\n deferredOperations: []\n };\n }\n\n // Open the IndexedDB database (automatically creates one if one didn't\n // previously exist), using any options set in the config.\n function _initStorage(options) {\n var self = this;\n var dbInfo = {\n db: null\n };\n\n if (options) {\n for (var i in options) {\n dbInfo[i] = options[i];\n }\n }\n\n // Get the current context of the database;\n var dbContext = dbContexts[dbInfo.name];\n\n // ...or create a new context.\n if (!dbContext) {\n dbContext = createDbContext();\n // Register the new context in the global container.\n dbContexts[dbInfo.name] = dbContext;\n }\n\n // Register itself as a running localForage in the current context.\n dbContext.forages.push(self);\n\n // Replace the default `ready()` function with the specialized one.\n if (!self._initReady) {\n self._initReady = self.ready;\n self.ready = _fullyReady;\n }\n\n // Create an array of initialization states of the related localForages.\n var initPromises = [];\n\n function ignoreErrors() {\n // Don't handle errors here,\n // just makes sure related localForages aren't pending.\n return Promise$1.resolve();\n }\n\n for (var j = 0; j < dbContext.forages.length; j++) {\n var forage = dbContext.forages[j];\n if (forage !== self) {\n // Don't wait for itself...\n initPromises.push(forage._initReady()[\"catch\"](ignoreErrors));\n }\n }\n\n // Take a snapshot of the related localForages.\n var forages = dbContext.forages.slice(0);\n\n // Initialize the connection process only when\n // all the related localForages aren't pending.\n return Promise$1.all(initPromises).then(function () {\n dbInfo.db = dbContext.db;\n // Get the connection or open a new one without upgrade.\n return _getOriginalConnection(dbInfo);\n }).then(function (db) {\n dbInfo.db = db;\n if (_isUpgradeNeeded(dbInfo, self._defaultConfig.version)) {\n // Reopen the database for upgrading.\n return _getUpgradedConnection(dbInfo);\n }\n return db;\n }).then(function (db) {\n dbInfo.db = dbContext.db = db;\n self._dbInfo = dbInfo;\n // Share the final connection amongst related localForages.\n for (var k = 0; k < forages.length; k++) {\n var forage = forages[k];\n if (forage !== self) {\n // Self is already up-to-date.\n forage._dbInfo.db = dbInfo.db;\n forage._dbInfo.version = dbInfo.version;\n }\n }\n });\n }\n\n function getItem(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var req = store.get(key);\n\n req.onsuccess = function () {\n var value = req.result;\n if (value === undefined) {\n value = null;\n }\n if (_isEncodedBlob(value)) {\n value = _decodeBlob(value);\n }\n resolve(value);\n };\n\n req.onerror = function () {\n reject(req.error);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Iterate over all items stored in database.\n function iterate(iterator, callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var req = store.openCursor();\n var iterationNumber = 1;\n\n req.onsuccess = function () {\n var cursor = req.result;\n\n if (cursor) {\n var value = cursor.value;\n if (_isEncodedBlob(value)) {\n value = _decodeBlob(value);\n }\n var result = iterator(value, cursor.key, iterationNumber++);\n\n // when the iterator callback returns any\n // (non-`undefined`) value, then we stop\n // the iteration immediately\n if (result !== void 0) {\n resolve(result);\n } else {\n cursor[\"continue\"]();\n }\n } else {\n resolve();\n }\n };\n\n req.onerror = function () {\n reject(req.error);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n\n return promise;\n }\n\n function setItem(key, value, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n var dbInfo;\n self.ready().then(function () {\n dbInfo = self._dbInfo;\n if (toString.call(value) === '[object Blob]') {\n return _checkBlobSupport(dbInfo.db).then(function (blobSupport) {\n if (blobSupport) {\n return value;\n }\n return _encodeBlob(value);\n });\n }\n return value;\n }).then(function (value) {\n createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n\n // The reason we don't _save_ null is because IE 10 does\n // not support saving the `null` type in IndexedDB. How\n // ironic, given the bug below!\n // See: https://github.com/mozilla/localForage/issues/161\n if (value === null) {\n value = undefined;\n }\n\n var req = store.put(value, key);\n\n transaction.oncomplete = function () {\n // Cast to undefined so the value passed to\n // callback/promise is the same as what one would get out\n // of `getItem()` later. This leads to some weirdness\n // (setItem('foo', undefined) will return `null`), but\n // it's not my fault localStorage is our baseline and that\n // it's weird.\n if (value === undefined) {\n value = null;\n }\n\n resolve(value);\n };\n transaction.onabort = transaction.onerror = function () {\n var err = req.error ? req.error : req.transaction.error;\n reject(err);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function removeItem(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n // We use a Grunt task to make this safe for IE and some\n // versions of Android (including those used by Cordova).\n // Normally IE won't like `.delete()` and will insist on\n // using `['delete']()`, but we have a build step that\n // fixes this for us now.\n var req = store[\"delete\"](key);\n transaction.oncomplete = function () {\n resolve();\n };\n\n transaction.onerror = function () {\n reject(req.error);\n };\n\n // The request will be also be aborted if we've exceeded our storage\n // space.\n transaction.onabort = function () {\n var err = req.error ? req.error : req.transaction.error;\n reject(err);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function clear(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var req = store.clear();\n\n transaction.oncomplete = function () {\n resolve();\n };\n\n transaction.onabort = transaction.onerror = function () {\n var err = req.error ? req.error : req.transaction.error;\n reject(err);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function length(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var req = store.count();\n\n req.onsuccess = function () {\n resolve(req.result);\n };\n\n req.onerror = function () {\n reject(req.error);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function key(n, callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n if (n < 0) {\n resolve(null);\n\n return;\n }\n\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var advanced = false;\n var req = store.openKeyCursor();\n\n req.onsuccess = function () {\n var cursor = req.result;\n if (!cursor) {\n // this means there weren't enough keys\n resolve(null);\n\n return;\n }\n\n if (n === 0) {\n // We have the first key, return it if that's what they\n // wanted.\n resolve(cursor.key);\n } else {\n if (!advanced) {\n // Otherwise, ask the cursor to skip ahead n\n // records.\n advanced = true;\n cursor.advance(n);\n } else {\n // When we get here, we've got the nth key.\n resolve(cursor.key);\n }\n }\n };\n\n req.onerror = function () {\n reject(req.error);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function keys(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var req = store.openKeyCursor();\n var keys = [];\n\n req.onsuccess = function () {\n var cursor = req.result;\n\n if (!cursor) {\n resolve(keys);\n return;\n }\n\n keys.push(cursor.key);\n cursor[\"continue\"]();\n };\n\n req.onerror = function () {\n reject(req.error);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function dropInstance(options, callback) {\n callback = getCallback.apply(this, arguments);\n\n var currentConfig = this.config();\n options = typeof options !== 'function' && options || {};\n if (!options.name) {\n options.name = options.name || currentConfig.name;\n options.storeName = options.storeName || currentConfig.storeName;\n }\n\n var self = this;\n var promise;\n if (!options.name) {\n promise = Promise$1.reject('Invalid arguments');\n } else {\n var isCurrentDb = options.name === currentConfig.name && self._dbInfo.db;\n\n var dbPromise = isCurrentDb ? Promise$1.resolve(self._dbInfo.db) : _getOriginalConnection(options).then(function (db) {\n var dbContext = dbContexts[options.name];\n var forages = dbContext.forages;\n dbContext.db = db;\n for (var i = 0; i < forages.length; i++) {\n forages[i]._dbInfo.db = db;\n }\n return db;\n });\n\n if (!options.storeName) {\n promise = dbPromise.then(function (db) {\n _deferReadiness(options);\n\n var dbContext = dbContexts[options.name];\n var forages = dbContext.forages;\n\n db.close();\n for (var i = 0; i < forages.length; i++) {\n var forage = forages[i];\n forage._dbInfo.db = null;\n }\n\n var dropDBPromise = new Promise$1(function (resolve, reject) {\n var req = idb.deleteDatabase(options.name);\n\n req.onerror = req.onblocked = function (err) {\n var db = req.result;\n if (db) {\n db.close();\n }\n reject(err);\n };\n\n req.onsuccess = function () {\n var db = req.result;\n if (db) {\n db.close();\n }\n resolve(db);\n };\n });\n\n return dropDBPromise.then(function (db) {\n dbContext.db = db;\n for (var i = 0; i < forages.length; i++) {\n var _forage = forages[i];\n _advanceReadiness(_forage._dbInfo);\n }\n })[\"catch\"](function (err) {\n (_rejectReadiness(options, err) || Promise$1.resolve())[\"catch\"](function () {});\n throw err;\n });\n });\n } else {\n promise = dbPromise.then(function (db) {\n if (!db.objectStoreNames.contains(options.storeName)) {\n return;\n }\n\n var newVersion = db.version + 1;\n\n _deferReadiness(options);\n\n var dbContext = dbContexts[options.name];\n var forages = dbContext.forages;\n\n db.close();\n for (var i = 0; i < forages.length; i++) {\n var forage = forages[i];\n forage._dbInfo.db = null;\n forage._dbInfo.version = newVersion;\n }\n\n var dropObjectPromise = new Promise$1(function (resolve, reject) {\n var req = idb.open(options.name, newVersion);\n\n req.onerror = function (err) {\n var db = req.result;\n db.close();\n reject(err);\n };\n\n req.onupgradeneeded = function () {\n var db = req.result;\n db.deleteObjectStore(options.storeName);\n };\n\n req.onsuccess = function () {\n var db = req.result;\n db.close();\n resolve(db);\n };\n });\n\n return dropObjectPromise.then(function (db) {\n dbContext.db = db;\n for (var j = 0; j < forages.length; j++) {\n var _forage2 = forages[j];\n _forage2._dbInfo.db = db;\n _advanceReadiness(_forage2._dbInfo);\n }\n })[\"catch\"](function (err) {\n (_rejectReadiness(options, err) || Promise$1.resolve())[\"catch\"](function () {});\n throw err;\n });\n });\n }\n }\n\n executeCallback(promise, callback);\n return promise;\n }\n\n var asyncStorage = {\n _driver: 'asyncStorage',\n _initStorage: _initStorage,\n _support: isIndexedDBValid(),\n iterate: iterate,\n getItem: getItem,\n setItem: setItem,\n removeItem: removeItem,\n clear: clear,\n length: length,\n key: key,\n keys: keys,\n dropInstance: dropInstance\n };\n\n function isWebSQLValid() {\n return typeof openDatabase === 'function';\n }\n\n // Sadly, the best way to save binary data in WebSQL/localStorage is serializing\n // it to Base64, so this is how we store it to prevent very strange errors with less\n // verbose ways of binary <-> string data storage.\n var BASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n var BLOB_TYPE_PREFIX = '~~local_forage_type~';\n var BLOB_TYPE_PREFIX_REGEX = /^~~local_forage_type~([^~]+)~/;\n\n var SERIALIZED_MARKER = '__lfsc__:';\n var SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER.length;\n\n // OMG the serializations!\n var TYPE_ARRAYBUFFER = 'arbf';\n var TYPE_BLOB = 'blob';\n var TYPE_INT8ARRAY = 'si08';\n var TYPE_UINT8ARRAY = 'ui08';\n var TYPE_UINT8CLAMPEDARRAY = 'uic8';\n var TYPE_INT16ARRAY = 'si16';\n var TYPE_INT32ARRAY = 'si32';\n var TYPE_UINT16ARRAY = 'ur16';\n var TYPE_UINT32ARRAY = 'ui32';\n var TYPE_FLOAT32ARRAY = 'fl32';\n var TYPE_FLOAT64ARRAY = 'fl64';\n var TYPE_SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER_LENGTH + TYPE_ARRAYBUFFER.length;\n\n var toString$1 = Object.prototype.toString;\n\n function stringToBuffer(serializedString) {\n // Fill the string into a ArrayBuffer.\n var bufferLength = serializedString.length * 0.75;\n var len = serializedString.length;\n var i;\n var p = 0;\n var encoded1, encoded2, encoded3, encoded4;\n\n if (serializedString[serializedString.length - 1] === '=') {\n bufferLength--;\n if (serializedString[serializedString.length - 2] === '=') {\n bufferLength--;\n }\n }\n\n var buffer = new ArrayBuffer(bufferLength);\n var bytes = new Uint8Array(buffer);\n\n for (i = 0; i < len; i += 4) {\n encoded1 = BASE_CHARS.indexOf(serializedString[i]);\n encoded2 = BASE_CHARS.indexOf(serializedString[i + 1]);\n encoded3 = BASE_CHARS.indexOf(serializedString[i + 2]);\n encoded4 = BASE_CHARS.indexOf(serializedString[i + 3]);\n\n /*jslint bitwise: true */\n bytes[p++] = encoded1 << 2 | encoded2 >> 4;\n bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;\n bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;\n }\n return buffer;\n }\n\n // Converts a buffer to a string to store, serialized, in the backend\n // storage library.\n function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n }\n\n // Serialize a value, afterwards executing a callback (which usually\n // instructs the `setItem()` callback/promise to be executed). This is how\n // we store binary data with localStorage.\n function serialize(value, callback) {\n var valueType = '';\n if (value) {\n valueType = toString$1.call(value);\n }\n\n // Cannot use `value instanceof ArrayBuffer` or such here, as these\n // checks fail when running the tests using casper.js...\n //\n // TODO: See why those tests fail and use a better solution.\n if (value && (valueType === '[object ArrayBuffer]' || value.buffer && toString$1.call(value.buffer) === '[object ArrayBuffer]')) {\n // Convert binary arrays to a string and prefix the string with\n // a special marker.\n var buffer;\n var marker = SERIALIZED_MARKER;\n\n if (value instanceof ArrayBuffer) {\n buffer = value;\n marker += TYPE_ARRAYBUFFER;\n } else {\n buffer = value.buffer;\n\n if (valueType === '[object Int8Array]') {\n marker += TYPE_INT8ARRAY;\n } else if (valueType === '[object Uint8Array]') {\n marker += TYPE_UINT8ARRAY;\n } else if (valueType === '[object Uint8ClampedArray]') {\n marker += TYPE_UINT8CLAMPEDARRAY;\n } else if (valueType === '[object Int16Array]') {\n marker += TYPE_INT16ARRAY;\n } else if (valueType === '[object Uint16Array]') {\n marker += TYPE_UINT16ARRAY;\n } else if (valueType === '[object Int32Array]') {\n marker += TYPE_INT32ARRAY;\n } else if (valueType === '[object Uint32Array]') {\n marker += TYPE_UINT32ARRAY;\n } else if (valueType === '[object Float32Array]') {\n marker += TYPE_FLOAT32ARRAY;\n } else if (valueType === '[object Float64Array]') {\n marker += TYPE_FLOAT64ARRAY;\n } else {\n callback(new Error('Failed to get type for BinaryArray'));\n }\n }\n\n callback(marker + bufferToString(buffer));\n } else if (valueType === '[object Blob]') {\n // Conver the blob to a binaryArray and then to a string.\n var fileReader = new FileReader();\n\n fileReader.onload = function () {\n // Backwards-compatible prefix for the blob type.\n var str = BLOB_TYPE_PREFIX + value.type + '~' + bufferToString(this.result);\n\n callback(SERIALIZED_MARKER + TYPE_BLOB + str);\n };\n\n fileReader.readAsArrayBuffer(value);\n } else {\n try {\n callback(JSON.stringify(value));\n } catch (e) {\n console.error(\"Couldn't convert value into a JSON string: \", value);\n\n callback(null, e);\n }\n }\n }\n\n // Deserialize data we've inserted into a value column/field. We place\n // special markers into our strings to mark them as encoded; this isn't\n // as nice as a meta field, but it's the only sane thing we can do whilst\n // keeping localStorage support intact.\n //\n // Oftentimes this will just deserialize JSON content, but if we have a\n // special marker (SERIALIZED_MARKER, defined above), we will extract\n // some kind of arraybuffer/binary data/typed array out of the string.\n function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n }\n\n var localforageSerializer = {\n serialize: serialize,\n deserialize: deserialize,\n stringToBuffer: stringToBuffer,\n bufferToString: bufferToString\n };\n\n /*\n * Includes code from:\n *\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n */\n\n function createDbTable(t, dbInfo, callback, errorCallback) {\n t.executeSql('CREATE TABLE IF NOT EXISTS ' + dbInfo.storeName + ' ' + '(id INTEGER PRIMARY KEY, key unique, value)', [], callback, errorCallback);\n }\n\n // Open the WebSQL database (automatically creates one if one didn't\n // previously exist), using any options set in the config.\n function _initStorage$1(options) {\n var self = this;\n var dbInfo = {\n db: null\n };\n\n if (options) {\n for (var i in options) {\n dbInfo[i] = typeof options[i] !== 'string' ? options[i].toString() : options[i];\n }\n }\n\n var dbInfoPromise = new Promise$1(function (resolve, reject) {\n // Open the database; the openDatabase API will automatically\n // create it for us if it doesn't exist.\n try {\n dbInfo.db = openDatabase(dbInfo.name, String(dbInfo.version), dbInfo.description, dbInfo.size);\n } catch (e) {\n return reject(e);\n }\n\n // Create our key/value table if it doesn't exist.\n dbInfo.db.transaction(function (t) {\n createDbTable(t, dbInfo, function () {\n self._dbInfo = dbInfo;\n resolve();\n }, function (t, error) {\n reject(error);\n });\n }, reject);\n });\n\n dbInfo.serializer = localforageSerializer;\n return dbInfoPromise;\n }\n\n function tryExecuteSql(t, dbInfo, sqlStatement, args, callback, errorCallback) {\n t.executeSql(sqlStatement, args, callback, function (t, error) {\n if (error.code === error.SYNTAX_ERR) {\n t.executeSql('SELECT name FROM sqlite_master ' + \"WHERE type='table' AND name = ?\", [dbInfo.storeName], function (t, results) {\n if (!results.rows.length) {\n // if the table is missing (was deleted)\n // re-create it table and retry\n createDbTable(t, dbInfo, function () {\n t.executeSql(sqlStatement, args, callback, errorCallback);\n }, errorCallback);\n } else {\n errorCallback(t, error);\n }\n }, errorCallback);\n } else {\n errorCallback(t, error);\n }\n }, errorCallback);\n }\n\n function getItem$1(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'SELECT * FROM ' + dbInfo.storeName + ' WHERE key = ? LIMIT 1', [key], function (t, results) {\n var result = results.rows.length ? results.rows.item(0).value : null;\n\n // Check to see if this is serialized content we need to\n // unpack.\n if (result) {\n result = dbInfo.serializer.deserialize(result);\n }\n\n resolve(result);\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function iterate$1(iterator, callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'SELECT * FROM ' + dbInfo.storeName, [], function (t, results) {\n var rows = results.rows;\n var length = rows.length;\n\n for (var i = 0; i < length; i++) {\n var item = rows.item(i);\n var result = item.value;\n\n // Check to see if this is serialized content\n // we need to unpack.\n if (result) {\n result = dbInfo.serializer.deserialize(result);\n }\n\n result = iterator(result, item.key, i + 1);\n\n // void(0) prevents problems with redefinition\n // of `undefined`.\n if (result !== void 0) {\n resolve(result);\n return;\n }\n }\n\n resolve();\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function _setItem(key, value, callback, retriesLeft) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n // The localStorage API doesn't return undefined values in an\n // \"expected\" way, so undefined is always cast to null in all\n // drivers. See: https://github.com/mozilla/localForage/pull/42\n if (value === undefined) {\n value = null;\n }\n\n // Save the original value to pass to the callback.\n var originalValue = value;\n\n var dbInfo = self._dbInfo;\n dbInfo.serializer.serialize(value, function (value, error) {\n if (error) {\n reject(error);\n } else {\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'INSERT OR REPLACE INTO ' + dbInfo.storeName + ' ' + '(key, value) VALUES (?, ?)', [key, value], function () {\n resolve(originalValue);\n }, function (t, error) {\n reject(error);\n });\n }, function (sqlError) {\n // The transaction failed; check\n // to see if it's a quota error.\n if (sqlError.code === sqlError.QUOTA_ERR) {\n // We reject the callback outright for now, but\n // it's worth trying to re-run the transaction.\n // Even if the user accepts the prompt to use\n // more storage on Safari, this error will\n // be called.\n //\n // Try to re-run the transaction.\n if (retriesLeft > 0) {\n resolve(_setItem.apply(self, [key, originalValue, callback, retriesLeft - 1]));\n return;\n }\n reject(sqlError);\n }\n });\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function setItem$1(key, value, callback) {\n return _setItem.apply(this, [key, value, callback, 1]);\n }\n\n function removeItem$1(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'DELETE FROM ' + dbInfo.storeName + ' WHERE key = ?', [key], function () {\n resolve();\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Deletes every item in the table.\n // TODO: Find out if this resets the AUTO_INCREMENT number.\n function clear$1(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'DELETE FROM ' + dbInfo.storeName, [], function () {\n resolve();\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Does a simple `COUNT(key)` to get the number of items stored in\n // localForage.\n function length$1(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n // Ahhh, SQL makes this one soooooo easy.\n tryExecuteSql(t, dbInfo, 'SELECT COUNT(key) as c FROM ' + dbInfo.storeName, [], function (t, results) {\n var result = results.rows.item(0).c;\n resolve(result);\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Return the key located at key index X; essentially gets the key from a\n // `WHERE id = ?`. This is the most efficient way I can think to implement\n // this rarely-used (in my experience) part of the API, but it can seem\n // inconsistent, because we do `INSERT OR REPLACE INTO` on `setItem()`, so\n // the ID of each key will change every time it's updated. Perhaps a stored\n // procedure for the `setItem()` SQL would solve this problem?\n // TODO: Don't change ID on `setItem()`.\n function key$1(n, callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'SELECT key FROM ' + dbInfo.storeName + ' WHERE id = ? LIMIT 1', [n + 1], function (t, results) {\n var result = results.rows.length ? results.rows.item(0).key : null;\n resolve(result);\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function keys$1(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'SELECT key FROM ' + dbInfo.storeName, [], function (t, results) {\n var keys = [];\n\n for (var i = 0; i < results.rows.length; i++) {\n keys.push(results.rows.item(i).key);\n }\n\n resolve(keys);\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // https://www.w3.org/TR/webdatabase/#databases\n // > There is no way to enumerate or delete the databases available for an origin from this API.\n function getAllStoreNames(db) {\n return new Promise$1(function (resolve, reject) {\n db.transaction(function (t) {\n t.executeSql('SELECT name FROM sqlite_master ' + \"WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'\", [], function (t, results) {\n var storeNames = [];\n\n for (var i = 0; i < results.rows.length; i++) {\n storeNames.push(results.rows.item(i).name);\n }\n\n resolve({\n db: db,\n storeNames: storeNames\n });\n }, function (t, error) {\n reject(error);\n });\n }, function (sqlError) {\n reject(sqlError);\n });\n });\n }\n\n function dropInstance$1(options, callback) {\n callback = getCallback.apply(this, arguments);\n\n var currentConfig = this.config();\n options = typeof options !== 'function' && options || {};\n if (!options.name) {\n options.name = options.name || currentConfig.name;\n options.storeName = options.storeName || currentConfig.storeName;\n }\n\n var self = this;\n var promise;\n if (!options.name) {\n promise = Promise$1.reject('Invalid arguments');\n } else {\n promise = new Promise$1(function (resolve) {\n var db;\n if (options.name === currentConfig.name) {\n // use the db reference of the current instance\n db = self._dbInfo.db;\n } else {\n db = openDatabase(options.name, '', '', 0);\n }\n\n if (!options.storeName) {\n // drop all database tables\n resolve(getAllStoreNames(db));\n } else {\n resolve({\n db: db,\n storeNames: [options.storeName]\n });\n }\n }).then(function (operationInfo) {\n return new Promise$1(function (resolve, reject) {\n operationInfo.db.transaction(function (t) {\n function dropTable(storeName) {\n return new Promise$1(function (resolve, reject) {\n t.executeSql('DROP TABLE IF EXISTS ' + storeName, [], function () {\n resolve();\n }, function (t, error) {\n reject(error);\n });\n });\n }\n\n var operations = [];\n for (var i = 0, len = operationInfo.storeNames.length; i < len; i++) {\n operations.push(dropTable(operationInfo.storeNames[i]));\n }\n\n Promise$1.all(operations).then(function () {\n resolve();\n })[\"catch\"](function (e) {\n reject(e);\n });\n }, function (sqlError) {\n reject(sqlError);\n });\n });\n });\n }\n\n executeCallback(promise, callback);\n return promise;\n }\n\n var webSQLStorage = {\n _driver: 'webSQLStorage',\n _initStorage: _initStorage$1,\n _support: isWebSQLValid(),\n iterate: iterate$1,\n getItem: getItem$1,\n setItem: setItem$1,\n removeItem: removeItem$1,\n clear: clear$1,\n length: length$1,\n key: key$1,\n keys: keys$1,\n dropInstance: dropInstance$1\n };\n\n function isLocalStorageValid() {\n try {\n return typeof localStorage !== 'undefined' && 'setItem' in localStorage &&\n // in IE8 typeof localStorage.setItem === 'object'\n !!localStorage.setItem;\n } catch (e) {\n return false;\n }\n }\n\n function _getKeyPrefix(options, defaultConfig) {\n var keyPrefix = options.name + '/';\n\n if (options.storeName !== defaultConfig.storeName) {\n keyPrefix += options.storeName + '/';\n }\n return keyPrefix;\n }\n\n // Check if localStorage throws when saving an item\n function checkIfLocalStorageThrows() {\n var localStorageTestKey = '_localforage_support_test';\n\n try {\n localStorage.setItem(localStorageTestKey, true);\n localStorage.removeItem(localStorageTestKey);\n\n return false;\n } catch (e) {\n return true;\n }\n }\n\n // Check if localStorage is usable and allows to save an item\n // This method checks if localStorage is usable in Safari Private Browsing\n // mode, or in any other case where the available quota for localStorage\n // is 0 and there wasn't any saved items yet.\n function _isLocalStorageUsable() {\n return !checkIfLocalStorageThrows() || localStorage.length > 0;\n }\n\n // Config the localStorage backend, using options set in the config.\n function _initStorage$2(options) {\n var self = this;\n var dbInfo = {};\n if (options) {\n for (var i in options) {\n dbInfo[i] = options[i];\n }\n }\n\n dbInfo.keyPrefix = _getKeyPrefix(options, self._defaultConfig);\n\n if (!_isLocalStorageUsable()) {\n return Promise$1.reject();\n }\n\n self._dbInfo = dbInfo;\n dbInfo.serializer = localforageSerializer;\n\n return Promise$1.resolve();\n }\n\n // Remove all keys from the datastore, effectively destroying all data in\n // the app's key/value store!\n function clear$2(callback) {\n var self = this;\n var promise = self.ready().then(function () {\n var keyPrefix = self._dbInfo.keyPrefix;\n\n for (var i = localStorage.length - 1; i >= 0; i--) {\n var key = localStorage.key(i);\n\n if (key.indexOf(keyPrefix) === 0) {\n localStorage.removeItem(key);\n }\n }\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Retrieve an item from the store. Unlike the original async_storage\n // library in Gaia, we don't modify return values at all. If a key's value\n // is `undefined`, we pass that value to the callback function.\n function getItem$2(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = self.ready().then(function () {\n var dbInfo = self._dbInfo;\n var result = localStorage.getItem(dbInfo.keyPrefix + key);\n\n // If a result was found, parse it from the serialized\n // string into a JS object. If result isn't truthy, the key\n // is likely undefined and we'll pass it straight to the\n // callback.\n if (result) {\n result = dbInfo.serializer.deserialize(result);\n }\n\n return result;\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Iterate over all items in the store.\n function iterate$2(iterator, callback) {\n var self = this;\n\n var promise = self.ready().then(function () {\n var dbInfo = self._dbInfo;\n var keyPrefix = dbInfo.keyPrefix;\n var keyPrefixLength = keyPrefix.length;\n var length = localStorage.length;\n\n // We use a dedicated iterator instead of the `i` variable below\n // so other keys we fetch in localStorage aren't counted in\n // the `iterationNumber` argument passed to the `iterate()`\n // callback.\n //\n // See: github.com/mozilla/localForage/pull/435#discussion_r38061530\n var iterationNumber = 1;\n\n for (var i = 0; i < length; i++) {\n var key = localStorage.key(i);\n if (key.indexOf(keyPrefix) !== 0) {\n continue;\n }\n var value = localStorage.getItem(key);\n\n // If a result was found, parse it from the serialized\n // string into a JS object. If result isn't truthy, the\n // key is likely undefined and we'll pass it straight\n // to the iterator.\n if (value) {\n value = dbInfo.serializer.deserialize(value);\n }\n\n value = iterator(value, key.substring(keyPrefixLength), iterationNumber++);\n\n if (value !== void 0) {\n return value;\n }\n }\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Same as localStorage's key() method, except takes a callback.\n function key$2(n, callback) {\n var self = this;\n var promise = self.ready().then(function () {\n var dbInfo = self._dbInfo;\n var result;\n try {\n result = localStorage.key(n);\n } catch (error) {\n result = null;\n }\n\n // Remove the prefix from the key, if a key is found.\n if (result) {\n result = result.substring(dbInfo.keyPrefix.length);\n }\n\n return result;\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function keys$2(callback) {\n var self = this;\n var promise = self.ready().then(function () {\n var dbInfo = self._dbInfo;\n var length = localStorage.length;\n var keys = [];\n\n for (var i = 0; i < length; i++) {\n var itemKey = localStorage.key(i);\n if (itemKey.indexOf(dbInfo.keyPrefix) === 0) {\n keys.push(itemKey.substring(dbInfo.keyPrefix.length));\n }\n }\n\n return keys;\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Supply the number of keys in the datastore to the callback function.\n function length$2(callback) {\n var self = this;\n var promise = self.keys().then(function (keys) {\n return keys.length;\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Remove an item from the store, nice and simple.\n function removeItem$2(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = self.ready().then(function () {\n var dbInfo = self._dbInfo;\n localStorage.removeItem(dbInfo.keyPrefix + key);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Set a key's value and run an optional callback once the value is set.\n // Unlike Gaia's implementation, the callback function is passed the value,\n // in case you want to operate on that value only after you're sure it\n // saved, or something like that.\n function setItem$2(key, value, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = self.ready().then(function () {\n // Convert undefined values to null.\n // https://github.com/mozilla/localForage/pull/42\n if (value === undefined) {\n value = null;\n }\n\n // Save the original value to pass to the callback.\n var originalValue = value;\n\n return new Promise$1(function (resolve, reject) {\n var dbInfo = self._dbInfo;\n dbInfo.serializer.serialize(value, function (value, error) {\n if (error) {\n reject(error);\n } else {\n try {\n localStorage.setItem(dbInfo.keyPrefix + key, value);\n resolve(originalValue);\n } catch (e) {\n // localStorage capacity exceeded.\n // TODO: Make this a specific error/event.\n if (e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') {\n reject(e);\n }\n reject(e);\n }\n }\n });\n });\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function dropInstance$2(options, callback) {\n callback = getCallback.apply(this, arguments);\n\n options = typeof options !== 'function' && options || {};\n if (!options.name) {\n var currentConfig = this.config();\n options.name = options.name || currentConfig.name;\n options.storeName = options.storeName || currentConfig.storeName;\n }\n\n var self = this;\n var promise;\n if (!options.name) {\n promise = Promise$1.reject('Invalid arguments');\n } else {\n promise = new Promise$1(function (resolve) {\n if (!options.storeName) {\n resolve(options.name + '/');\n } else {\n resolve(_getKeyPrefix(options, self._defaultConfig));\n }\n }).then(function (keyPrefix) {\n for (var i = localStorage.length - 1; i >= 0; i--) {\n var key = localStorage.key(i);\n\n if (key.indexOf(keyPrefix) === 0) {\n localStorage.removeItem(key);\n }\n }\n });\n }\n\n executeCallback(promise, callback);\n return promise;\n }\n\n var localStorageWrapper = {\n _driver: 'localStorageWrapper',\n _initStorage: _initStorage$2,\n _support: isLocalStorageValid(),\n iterate: iterate$2,\n getItem: getItem$2,\n setItem: setItem$2,\n removeItem: removeItem$2,\n clear: clear$2,\n length: length$2,\n key: key$2,\n keys: keys$2,\n dropInstance: dropInstance$2\n };\n\n var sameValue = function sameValue(x, y) {\n return x === y || typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y);\n };\n\n var includes = function includes(array, searchElement) {\n var len = array.length;\n var i = 0;\n while (i < len) {\n if (sameValue(array[i], searchElement)) {\n return true;\n }\n i++;\n }\n\n return false;\n };\n\n var isArray = Array.isArray || function (arg) {\n return Object.prototype.toString.call(arg) === '[object Array]';\n };\n\n // Drivers are stored here when `defineDriver()` is called.\n // They are shared across all instances of localForage.\n var DefinedDrivers = {};\n\n var DriverSupport = {};\n\n var DefaultDrivers = {\n INDEXEDDB: asyncStorage,\n WEBSQL: webSQLStorage,\n LOCALSTORAGE: localStorageWrapper\n };\n\n var DefaultDriverOrder = [DefaultDrivers.INDEXEDDB._driver, DefaultDrivers.WEBSQL._driver, DefaultDrivers.LOCALSTORAGE._driver];\n\n var OptionalDriverMethods = ['dropInstance'];\n\n var LibraryMethods = ['clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem'].concat(OptionalDriverMethods);\n\n var DefaultConfig = {\n description: '',\n driver: DefaultDriverOrder.slice(),\n name: 'localforage',\n // Default DB size is _JUST UNDER_ 5MB, as it's the highest size\n // we can use without a prompt.\n size: 4980736,\n storeName: 'keyvaluepairs',\n version: 1.0\n };\n\n function callWhenReady(localForageInstance, libraryMethod) {\n localForageInstance[libraryMethod] = function () {\n var _args = arguments;\n return localForageInstance.ready().then(function () {\n return localForageInstance[libraryMethod].apply(localForageInstance, _args);\n });\n };\n }\n\n function extend() {\n for (var i = 1; i < arguments.length; i++) {\n var arg = arguments[i];\n\n if (arg) {\n for (var _key in arg) {\n if (arg.hasOwnProperty(_key)) {\n if (isArray(arg[_key])) {\n arguments[0][_key] = arg[_key].slice();\n } else {\n arguments[0][_key] = arg[_key];\n }\n }\n }\n }\n }\n\n return arguments[0];\n }\n\n var LocalForage = function () {\n function LocalForage(options) {\n _classCallCheck(this, LocalForage);\n\n for (var driverTypeKey in DefaultDrivers) {\n if (DefaultDrivers.hasOwnProperty(driverTypeKey)) {\n var driver = DefaultDrivers[driverTypeKey];\n var driverName = driver._driver;\n this[driverTypeKey] = driverName;\n\n if (!DefinedDrivers[driverName]) {\n // we don't need to wait for the promise,\n // since the default drivers can be defined\n // in a blocking manner\n this.defineDriver(driver);\n }\n }\n }\n\n this._defaultConfig = extend({}, DefaultConfig);\n this._config = extend({}, this._defaultConfig, options);\n this._driverSet = null;\n this._initDriver = null;\n this._ready = false;\n this._dbInfo = null;\n\n this._wrapLibraryMethodsWithReady();\n this.setDriver(this._config.driver)[\"catch\"](function () {});\n }\n\n // Set any config values for localForage; can be called anytime before\n // the first API call (e.g. `getItem`, `setItem`).\n // We loop through options so we don't overwrite existing config\n // values.\n\n\n LocalForage.prototype.config = function config(options) {\n // If the options argument is an object, we use it to set values.\n // Otherwise, we return either a specified config value or all\n // config values.\n if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {\n // If localforage is ready and fully initialized, we can't set\n // any new configuration values. Instead, we return an error.\n if (this._ready) {\n return new Error(\"Can't call config() after localforage \" + 'has been used.');\n }\n\n for (var i in options) {\n if (i === 'storeName') {\n options[i] = options[i].replace(/\\W/g, '_');\n }\n\n if (i === 'version' && typeof options[i] !== 'number') {\n return new Error('Database version must be a number.');\n }\n\n this._config[i] = options[i];\n }\n\n // after all config options are set and\n // the driver option is used, try setting it\n if ('driver' in options && options.driver) {\n return this.setDriver(this._config.driver);\n }\n\n return true;\n } else if (typeof options === 'string') {\n return this._config[options];\n } else {\n return this._config;\n }\n };\n\n // Used to define a custom driver, shared across all instances of\n // localForage.\n\n\n LocalForage.prototype.defineDriver = function defineDriver(driverObject, callback, errorCallback) {\n var promise = new Promise$1(function (resolve, reject) {\n try {\n var driverName = driverObject._driver;\n var complianceError = new Error('Custom driver not compliant; see ' + 'https://mozilla.github.io/localForage/#definedriver');\n\n // A driver name should be defined and not overlap with the\n // library-defined, default drivers.\n if (!driverObject._driver) {\n reject(complianceError);\n return;\n }\n\n var driverMethods = LibraryMethods.concat('_initStorage');\n for (var i = 0, len = driverMethods.length; i < len; i++) {\n var driverMethodName = driverMethods[i];\n\n // when the property is there,\n // it should be a method even when optional\n var isRequired = !includes(OptionalDriverMethods, driverMethodName);\n if ((isRequired || driverObject[driverMethodName]) && typeof driverObject[driverMethodName] !== 'function') {\n reject(complianceError);\n return;\n }\n }\n\n var configureMissingMethods = function configureMissingMethods() {\n var methodNotImplementedFactory = function methodNotImplementedFactory(methodName) {\n return function () {\n var error = new Error('Method ' + methodName + ' is not implemented by the current driver');\n var promise = Promise$1.reject(error);\n executeCallback(promise, arguments[arguments.length - 1]);\n return promise;\n };\n };\n\n for (var _i = 0, _len = OptionalDriverMethods.length; _i < _len; _i++) {\n var optionalDriverMethod = OptionalDriverMethods[_i];\n if (!driverObject[optionalDriverMethod]) {\n driverObject[optionalDriverMethod] = methodNotImplementedFactory(optionalDriverMethod);\n }\n }\n };\n\n configureMissingMethods();\n\n var setDriverSupport = function setDriverSupport(support) {\n if (DefinedDrivers[driverName]) {\n console.info('Redefining LocalForage driver: ' + driverName);\n }\n DefinedDrivers[driverName] = driverObject;\n DriverSupport[driverName] = support;\n // don't use a then, so that we can define\n // drivers that have simple _support methods\n // in a blocking manner\n resolve();\n };\n\n if ('_support' in driverObject) {\n if (driverObject._support && typeof driverObject._support === 'function') {\n driverObject._support().then(setDriverSupport, reject);\n } else {\n setDriverSupport(!!driverObject._support);\n }\n } else {\n setDriverSupport(true);\n }\n } catch (e) {\n reject(e);\n }\n });\n\n executeTwoCallbacks(promise, callback, errorCallback);\n return promise;\n };\n\n LocalForage.prototype.driver = function driver() {\n return this._driver || null;\n };\n\n LocalForage.prototype.getDriver = function getDriver(driverName, callback, errorCallback) {\n var getDriverPromise = DefinedDrivers[driverName] ? Promise$1.resolve(DefinedDrivers[driverName]) : Promise$1.reject(new Error('Driver not found.'));\n\n executeTwoCallbacks(getDriverPromise, callback, errorCallback);\n return getDriverPromise;\n };\n\n LocalForage.prototype.getSerializer = function getSerializer(callback) {\n var serializerPromise = Promise$1.resolve(localforageSerializer);\n executeTwoCallbacks(serializerPromise, callback);\n return serializerPromise;\n };\n\n LocalForage.prototype.ready = function ready(callback) {\n var self = this;\n\n var promise = self._driverSet.then(function () {\n if (self._ready === null) {\n self._ready = self._initDriver();\n }\n\n return self._ready;\n });\n\n executeTwoCallbacks(promise, callback, callback);\n return promise;\n };\n\n LocalForage.prototype.setDriver = function setDriver(drivers, callback, errorCallback) {\n var self = this;\n\n if (!isArray(drivers)) {\n drivers = [drivers];\n }\n\n var supportedDrivers = this._getSupportedDrivers(drivers);\n\n function setDriverToConfig() {\n self._config.driver = self.driver();\n }\n\n function extendSelfWithDriver(driver) {\n self._extend(driver);\n setDriverToConfig();\n\n self._ready = self._initStorage(self._config);\n return self._ready;\n }\n\n function initDriver(supportedDrivers) {\n return function () {\n var currentDriverIndex = 0;\n\n function driverPromiseLoop() {\n while (currentDriverIndex < supportedDrivers.length) {\n var driverName = supportedDrivers[currentDriverIndex];\n currentDriverIndex++;\n\n self._dbInfo = null;\n self._ready = null;\n\n return self.getDriver(driverName).then(extendSelfWithDriver)[\"catch\"](driverPromiseLoop);\n }\n\n setDriverToConfig();\n var error = new Error('No available storage method found.');\n self._driverSet = Promise$1.reject(error);\n return self._driverSet;\n }\n\n return driverPromiseLoop();\n };\n }\n\n // There might be a driver initialization in progress\n // so wait for it to finish in order to avoid a possible\n // race condition to set _dbInfo\n var oldDriverSetDone = this._driverSet !== null ? this._driverSet[\"catch\"](function () {\n return Promise$1.resolve();\n }) : Promise$1.resolve();\n\n this._driverSet = oldDriverSetDone.then(function () {\n var driverName = supportedDrivers[0];\n self._dbInfo = null;\n self._ready = null;\n\n return self.getDriver(driverName).then(function (driver) {\n self._driver = driver._driver;\n setDriverToConfig();\n self._wrapLibraryMethodsWithReady();\n self._initDriver = initDriver(supportedDrivers);\n });\n })[\"catch\"](function () {\n setDriverToConfig();\n var error = new Error('No available storage method found.');\n self._driverSet = Promise$1.reject(error);\n return self._driverSet;\n });\n\n executeTwoCallbacks(this._driverSet, callback, errorCallback);\n return this._driverSet;\n };\n\n LocalForage.prototype.supports = function supports(driverName) {\n return !!DriverSupport[driverName];\n };\n\n LocalForage.prototype._extend = function _extend(libraryMethodsAndProperties) {\n extend(this, libraryMethodsAndProperties);\n };\n\n LocalForage.prototype._getSupportedDrivers = function _getSupportedDrivers(drivers) {\n var supportedDrivers = [];\n for (var i = 0, len = drivers.length; i < len; i++) {\n var driverName = drivers[i];\n if (this.supports(driverName)) {\n supportedDrivers.push(driverName);\n }\n }\n return supportedDrivers;\n };\n\n LocalForage.prototype._wrapLibraryMethodsWithReady = function _wrapLibraryMethodsWithReady() {\n // Add a stub for each driver API method that delays the call to the\n // corresponding driver method until localForage is ready. These stubs\n // will be replaced by the driver methods as soon as the driver is\n // loaded, so there is no performance impact.\n for (var i = 0, len = LibraryMethods.length; i < len; i++) {\n callWhenReady(this, LibraryMethods[i]);\n }\n };\n\n LocalForage.prototype.createInstance = function createInstance(options) {\n return new LocalForage(options);\n };\n\n return LocalForage;\n }();\n\n // The actual localForage object that we expose as a module or via a\n // global. It's extended by pulling in one of our other libraries.\n\n\n var localforage_js = new LocalForage();\n\n module.exports = localforage_js;\n\n },{\"3\":3}]},{},[4])(4)\n });\n });\n\n /**\n * Race an array of promises, returning whichever finishes first\n */\n function race(promises) {\n return new Promise(function (resolve, reject) {\n for (var _i = 0, promises_1 = promises; _i < promises_1.length; _i++) {\n var promise = promises_1[_i];\n promise.then(resolve, reject);\n }\n });\n }\n\n /**\n * Lookup a DNS TXT record.\n *\n * Race lookups to Google & Cloudflare, return the first to finish\n *\n * @param domain The domain to get the TXT record from.\n * @returns Contents of the TXT record.\n */\n function lookupTxtRecord(domain) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, race([\n googleLookup(domain),\n cloudflareLookup(domain)\n ])];\n });\n });\n }\n /**\n * Lookup DNS TXT record using Google DNS-over-HTTPS\n *\n * @param domain The domain to get the TXT record from.\n * @returns Contents of the TXT record.\n */\n function googleLookup(domain) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, dnsOverHttps(\"https://dns.google/resolve?name=\" + domain + \"&type=txt\")];\n });\n });\n }\n /**\n * Lookup DNS TXT record using Cloudflare DNS-over-HTTPS\n *\n * @param domain The domain to get the TXT record from.\n * @returns Contents of the TXT record.\n */\n function cloudflareLookup(domain) {\n return dnsOverHttps(\"https://cloudflare-dns.com/dns-query?name=\" + domain + \"&type=txt\");\n }\n /**\n * Lookup a DNS TXT record.\n *\n * If there are multiple records, they will be joined together.\n * Records are sorted by a decimal prefix before they are joined together.\n * Prefixes have a format of `001;` → `999;`\n *\n * @param url The DNS-over-HTTPS endpoint to hit.\n * @returns Contents of the TXT record.\n */\n function dnsOverHttps(url) {\n return fetch(url, {\n headers: {\n \"accept\": \"application/dns-json\"\n }\n })\n .then(function (r) { return r.json(); })\n .then(function (r) {\n if (r.Answer) {\n // Remove double-quotes from beginning and end of the resulting string (if present)\n var answers = r.Answer.map(function (a) {\n return (a.data || \"\").replace(/^\"+|\"+$/g, \"\");\n });\n // Sort by prefix, if prefix is present,\n // and then add the answers together as one string.\n if (answers[0][3] === \";\") {\n return answers\n .sort(function (a, b) { return a.slice(0, 4).localeCompare(b.slice(0, 4)); })\n .map(function (a) { return a.slice(4); })\n .join(\"\");\n }\n else {\n return answers.join(\"\");\n }\n }\n else {\n return null;\n }\n });\n }\n /**\n * Lookup a DNSLink.\n *\n * @param domain The domain to get the DNSLink from.\n * @returns Contents of the DNSLink with the \"ipfs/\" prefix removed.\n */\n function lookupDnsLink(domain) {\n return __awaiter(this, void 0, void 0, function () {\n var txt;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, lookupTxtRecord(domain.startsWith(\"_dnslink.\")\n ? domain\n : \"_dnslink.\" + domain)];\n case 1:\n txt = _a.sent();\n return [2 /*return*/, txt && !txt.includes(\"/ipns/\")\n ? txt.replace(/^dnslink=/, \"\").replace(/^\\/ipfs\\//, \"\")\n : null];\n }\n });\n });\n }\n\n var index = /*#__PURE__*/Object.freeze({\n __proto__: null,\n lookupTxtRecord: lookupTxtRecord,\n googleLookup: googleLookup,\n cloudflareLookup: cloudflareLookup,\n dnsOverHttps: dnsOverHttps,\n lookupDnsLink: lookupDnsLink\n });\n\n /**\n * @internal\n */\n var setup = {\n debug: false,\n endpoints: {\n api: \"https://runfission.com\",\n lobby: \"https://auth.fission.codes\",\n user: \"fission.name\"\n }\n };\n\n var didCache = {\n did: null,\n host: null,\n lastFetched: 0,\n };\n /**\n * Lookup the DID of a Fission API.\n * This function caches the DID for 3 hours.\n */\n function did() {\n return __awaiter(this, void 0, void 0, function () {\n var host, now, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n host = setup.endpoints.api.replace(/^https?:\\/\\//, '').replace(/\\/$/, '');\n now = Date.now() // in milliseconds\n ;\n if (!(didCache.host !== host ||\n didCache.lastFetched + 1000 * 60 * 60 * 3 <= now)) return [3 /*break*/, 2];\n _a = didCache;\n return [4 /*yield*/, lookupTxtRecord('_did.' + host)];\n case 1:\n _a.did = _b.sent();\n didCache.host = host;\n didCache.lastFetched = now;\n _b.label = 2;\n case 2:\n if (!didCache.did)\n throw new Error(\"Couldn't get the Fission API DID\");\n return [2 /*return*/, didCache.did];\n }\n });\n });\n }\n\n var api = /*#__PURE__*/Object.freeze({\n __proto__: null,\n did: did\n });\n\n var equal = function (aBuf, bBuf) {\n var a = new Uint8Array(aBuf);\n var b = new Uint8Array(bBuf);\n if (a.length !== b.length)\n return false;\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i])\n return false;\n }\n return true;\n };\n\n var arrbufs = /*#__PURE__*/Object.freeze({\n __proto__: null,\n equal: equal\n });\n\n var byteLength_1 = byteLength;\n var toByteArray_1 = toByteArray;\n var fromByteArray_1 = fromByteArray;\n\n var lookup = [];\n var revLookup = [];\n var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;\n\n var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n for (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n }\n\n // Support decoding URL-safe base64 strings, as Node.js does.\n // See: https://en.wikipedia.org/wiki/Base64#URL_applications\n revLookup['-'.charCodeAt(0)] = 62;\n revLookup['_'.charCodeAt(0)] = 63;\n\n function getLens (b64) {\n var len = b64.length;\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=');\n if (validLen === -1) validLen = len;\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4);\n\n return [validLen, placeHoldersLen]\n }\n\n // base64 is 4/3 + up to two characters of the original data\n function byteLength (b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n }\n\n function _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n }\n\n function toByteArray (b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n\n var curByte = 0;\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen;\n\n var i;\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)];\n arr[curByte++] = (tmp >> 16) & 0xFF;\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4);\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2);\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n return arr\n }\n\n function tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n }\n\n function encodeChunk (uint8, start, end) {\n var tmp;\n var output = [];\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF);\n output.push(tripletToBase64(tmp));\n }\n return output.join('')\n }\n\n function fromByteArray (uint8) {\n var tmp;\n var len = uint8.length;\n var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes\n var parts = [];\n var maxChunkLength = 16383; // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1];\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n );\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1];\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n );\n }\n\n return parts.join('')\n }\n\n var base64Js = {\n \tbyteLength: byteLength_1,\n \ttoByteArray: toByteArray_1,\n \tfromByteArray: fromByteArray_1\n };\n\n /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\n var read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m;\n var eLen = (nBytes * 8) - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var nBits = -7;\n var i = isLE ? (nBytes - 1) : 0;\n var d = isLE ? -1 : 1;\n var s = buffer[offset + i];\n\n i += d;\n\n e = s & ((1 << (-nBits)) - 1);\n s >>= (-nBits);\n nBits += eLen;\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1);\n e >>= (-nBits);\n nBits += mLen;\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n };\n\n var write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c;\n var eLen = (nBytes * 8) - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);\n var i = isLE ? 0 : (nBytes - 1);\n var d = isLE ? 1 : -1;\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n value = Math.abs(value);\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128;\n };\n\n var ieee754 = {\n \tread: read,\n \twrite: write\n };\n\n /*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n\n var buffer = createCommonjsModule(function (module, exports) {\n\n\n\n const customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null;\n\n exports.Buffer = Buffer;\n exports.SlowBuffer = SlowBuffer;\n exports.INSPECT_MAX_BYTES = 50;\n\n const K_MAX_LENGTH = 0x7fffffff;\n exports.kMaxLength = K_MAX_LENGTH;\n\n /**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\n Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();\n\n if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n );\n }\n\n function typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1);\n const proto = { foo: function () { return 42 } };\n Object.setPrototypeOf(proto, Uint8Array.prototype);\n Object.setPrototypeOf(arr, proto);\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n }\n\n Object.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n });\n\n Object.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n });\n\n function createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length);\n Object.setPrototypeOf(buf, Buffer.prototype);\n return buf\n }\n\n /**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\n function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n }\n\n Buffer.poolSize = 8192; // not used by this implementation\n\n function from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf();\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value);\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n /**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\n Buffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n };\n\n // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n // https://github.com/feross/buffer/pull/148\n Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);\n Object.setPrototypeOf(Buffer, Uint8Array);\n\n function assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n }\n\n function alloc (size, fill, encoding) {\n assertSize(size);\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n }\n\n /**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\n Buffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n };\n\n function allocUnsafe (size) {\n assertSize(size);\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n }\n\n /**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\n Buffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n };\n /**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\n Buffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n };\n\n function fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8';\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0;\n let buf = createBuffer(length);\n\n const actual = buf.write(string, encoding);\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual);\n }\n\n return buf\n }\n\n function fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0;\n const buf = createBuffer(length);\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255;\n }\n return buf\n }\n\n function fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView);\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n }\n\n function fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf;\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array);\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset);\n } else {\n buf = new Uint8Array(array, byteOffset, length);\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype);\n\n return buf\n }\n\n function fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0;\n const buf = createBuffer(len);\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len);\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n }\n\n function checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n }\n\n function SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0;\n }\n return Buffer.alloc(+length)\n }\n\n Buffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n };\n\n Buffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length;\n let y = b.length;\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n };\n\n Buffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n };\n\n Buffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i;\n if (length === undefined) {\n length = 0;\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n\n const buffer = Buffer.allocUnsafe(length);\n let pos = 0;\n for (i = 0; i < list.length; ++i) {\n let buf = list[i];\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);\n buf.copy(buffer, pos);\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n );\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos);\n }\n pos += buf.length;\n }\n return buffer\n };\n\n function byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length;\n const mustMatch = (arguments.length > 2 && arguments[2] === true);\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false;\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer.byteLength = byteLength;\n\n function slowToString (encoding, start, end) {\n let loweredCase = false;\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0;\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length;\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0;\n start >>>= 0;\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8';\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase();\n loweredCase = true;\n }\n }\n }\n\n // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n // to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n // reliably in a browserify context because there could be multiple different\n // copies of the 'buffer' package in use. This method works even for Buffer\n // instances that were created from another copy of the `buffer` package.\n // See: https://github.com/feross/buffer/issues/154\n Buffer.prototype._isBuffer = true;\n\n function swap (b, n, m) {\n const i = b[n];\n b[n] = b[m];\n b[m] = i;\n }\n\n Buffer.prototype.swap16 = function swap16 () {\n const len = this.length;\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n return this\n };\n\n Buffer.prototype.swap32 = function swap32 () {\n const len = this.length;\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this\n };\n\n Buffer.prototype.swap64 = function swap64 () {\n const len = this.length;\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this\n };\n\n Buffer.prototype.toString = function toString () {\n const length = this.length;\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n };\n\n Buffer.prototype.toLocaleString = Buffer.prototype.toString;\n\n Buffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n };\n\n Buffer.prototype.inspect = function inspect () {\n let str = '';\n const max = exports.INSPECT_MAX_BYTES;\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();\n if (this.length > max) str += ' ... ';\n return '<Buffer ' + str + '>'\n };\n if (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;\n }\n\n Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength);\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0;\n }\n if (end === undefined) {\n end = target ? target.length : 0;\n }\n if (thisStart === undefined) {\n thisStart = 0;\n }\n if (thisEnd === undefined) {\n thisEnd = this.length;\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart;\n let y = end - start;\n const len = Math.min(x, y);\n\n const thisCopy = this.slice(thisStart, thisEnd);\n const targetCopy = target.slice(start, end);\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n };\n\n // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n // OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n //\n // Arguments:\n // - buffer - a Buffer to search\n // - val - a string, Buffer, or number\n // - byteOffset - an index into `buffer`; will be clamped to an int32\n // - encoding - an optional encoding, relevant is val is a string\n // - dir - true for indexOf, false for lastIndexOf\n function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff;\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000;\n }\n byteOffset = +byteOffset; // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1);\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset;\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0;\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding);\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF; // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n }\n\n function arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1;\n let arrLength = arr.length;\n let valLength = val.length;\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase();\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i;\n if (dir) {\n let foundIndex = -1;\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i;\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n for (i = byteOffset; i >= 0; i--) {\n let found = true;\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false;\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n }\n\n Buffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n };\n\n Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n };\n\n Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n };\n\n function hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0;\n const remaining = buf.length - offset;\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n if (length > remaining) {\n length = remaining;\n }\n }\n\n const strLen = string.length;\n\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n let i;\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16);\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed;\n }\n return i\n }\n\n function utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n }\n\n function asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n }\n\n function base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n }\n\n function ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n }\n\n Buffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8';\n length = this.length;\n offset = 0;\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset;\n length = this.length;\n offset = 0;\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0;\n if (isFinite(length)) {\n length = length >>> 0;\n if (encoding === undefined) encoding = 'utf8';\n } else {\n encoding = length;\n length = undefined;\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset;\n if (length === undefined || length > remaining) length = remaining;\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8';\n\n let loweredCase = false;\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n };\n\n Buffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n };\n\n function base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64Js.fromByteArray(buf)\n } else {\n return base64Js.fromByteArray(buf.slice(start, end))\n }\n }\n\n function utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end);\n const res = [];\n\n let i = start;\n while (i < end) {\n const firstByte = buf[i];\n let codePoint = null;\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1;\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint;\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte;\n }\n break\n case 2:\n secondByte = buf[i + 1];\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint;\n }\n }\n break\n case 3:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint;\n }\n }\n break\n case 4:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n fourthByte = buf[i + 3];\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint;\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD;\n bytesPerSequence = 1;\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000;\n res.push(codePoint >>> 10 & 0x3FF | 0xD800);\n codePoint = 0xDC00 | codePoint & 0x3FF;\n }\n\n res.push(codePoint);\n i += bytesPerSequence;\n }\n\n return decodeCodePointsArray(res)\n }\n\n // Based on http://stackoverflow.com/a/22747272/680742, the browser with\n // the lowest limit is Chrome, with 0x10000 args.\n // We go 1 magnitude less, for safety\n const MAX_ARGUMENTS_LENGTH = 0x1000;\n\n function decodeCodePointsArray (codePoints) {\n const len = codePoints.length;\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = '';\n let i = 0;\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n );\n }\n return res\n }\n\n function asciiSlice (buf, start, end) {\n let ret = '';\n end = Math.min(buf.length, end);\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F);\n }\n return ret\n }\n\n function latin1Slice (buf, start, end) {\n let ret = '';\n end = Math.min(buf.length, end);\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i]);\n }\n return ret\n }\n\n function hexSlice (buf, start, end) {\n const len = buf.length;\n\n if (!start || start < 0) start = 0;\n if (!end || end < 0 || end > len) end = len;\n\n let out = '';\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]];\n }\n return out\n }\n\n function utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end);\n let res = '';\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256));\n }\n return res\n }\n\n Buffer.prototype.slice = function slice (start, end) {\n const len = this.length;\n start = ~~start;\n end = end === undefined ? len : ~~end;\n\n if (start < 0) {\n start += len;\n if (start < 0) start = 0;\n } else if (start > len) {\n start = len;\n }\n\n if (end < 0) {\n end += len;\n if (end < 0) end = 0;\n } else if (end > len) {\n end = len;\n }\n\n if (end < start) end = start;\n\n const newBuf = this.subarray(start, end);\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype);\n\n return newBuf\n };\n\n /*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\n function checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n }\n\n Buffer.prototype.readUintLE =\n Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n\n return val\n };\n\n Buffer.prototype.readUintBE =\n Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length);\n }\n\n let val = this[offset + --byteLength];\n let mul = 1;\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul;\n }\n\n return val\n };\n\n Buffer.prototype.readUint8 =\n Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n return this[offset]\n };\n\n Buffer.prototype.readUint16LE =\n Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] | (this[offset + 1] << 8)\n };\n\n Buffer.prototype.readUint16BE =\n Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return (this[offset] << 8) | this[offset + 1]\n };\n\n Buffer.prototype.readUint32LE =\n Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n };\n\n Buffer.prototype.readUint32BE =\n Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n };\n\n Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0;\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8);\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24;\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24;\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n });\n\n Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0;\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8);\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset];\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last;\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n });\n\n Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n mul *= 0x80;\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n return val\n };\n\n Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n let i = byteLength;\n let mul = 1;\n let val = this[offset + --i];\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul;\n }\n mul *= 0x80;\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n return val\n };\n\n Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n };\n\n Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n const val = this[offset] | (this[offset + 1] << 8);\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n };\n\n Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n const val = this[offset + 1] | (this[offset] << 8);\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n };\n\n Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n };\n\n Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n };\n\n Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0;\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8);\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24); // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n });\n\n Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0;\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8);\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset];\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n });\n\n Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, true, 23, 4)\n };\n\n Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, false, 23, 4)\n };\n\n Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, true, 52, 8)\n };\n\n Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, false, 52, 8)\n };\n\n function checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n }\n\n Buffer.prototype.writeUintLE =\n Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n let mul = 1;\n let i = 0;\n this[offset] = value & 0xFF;\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeUintBE =\n Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n let i = byteLength - 1;\n let mul = 1;\n this[offset + i] = value & 0xFF;\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeUint8 =\n Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);\n this[offset] = (value & 0xff);\n return offset + 1\n };\n\n Buffer.prototype.writeUint16LE =\n Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n return offset + 2\n };\n\n Buffer.prototype.writeUint16BE =\n Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n this[offset] = (value >>> 8);\n this[offset + 1] = (value & 0xff);\n return offset + 2\n };\n\n Buffer.prototype.writeUint32LE =\n Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n this[offset + 3] = (value >>> 24);\n this[offset + 2] = (value >>> 16);\n this[offset + 1] = (value >>> 8);\n this[offset] = (value & 0xff);\n return offset + 4\n };\n\n Buffer.prototype.writeUint32BE =\n Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n this[offset] = (value >>> 24);\n this[offset + 1] = (value >>> 16);\n this[offset + 2] = (value >>> 8);\n this[offset + 3] = (value & 0xff);\n return offset + 4\n };\n\n function wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7);\n\n let lo = Number(value & BigInt(0xffffffff));\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n return offset\n }\n\n function wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7);\n\n let lo = Number(value & BigInt(0xffffffff));\n buf[offset + 7] = lo;\n lo = lo >> 8;\n buf[offset + 6] = lo;\n lo = lo >> 8;\n buf[offset + 5] = lo;\n lo = lo >> 8;\n buf[offset + 4] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));\n buf[offset + 3] = hi;\n hi = hi >> 8;\n buf[offset + 2] = hi;\n hi = hi >> 8;\n buf[offset + 1] = hi;\n hi = hi >> 8;\n buf[offset] = hi;\n return offset + 8\n }\n\n Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n });\n\n Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n });\n\n Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1);\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n let i = 0;\n let mul = 1;\n let sub = 0;\n this[offset] = value & 0xFF;\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1);\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n let i = byteLength - 1;\n let mul = 1;\n let sub = 0;\n this[offset + i] = value & 0xFF;\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);\n if (value < 0) value = 0xff + value + 1;\n this[offset] = (value & 0xff);\n return offset + 1\n };\n\n Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n return offset + 2\n };\n\n Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n this[offset] = (value >>> 8);\n this[offset + 1] = (value & 0xff);\n return offset + 2\n };\n\n Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n this[offset + 2] = (value >>> 16);\n this[offset + 3] = (value >>> 24);\n return offset + 4\n };\n\n Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n if (value < 0) value = 0xffffffff + value + 1;\n this[offset] = (value >>> 24);\n this[offset + 1] = (value >>> 16);\n this[offset + 2] = (value >>> 8);\n this[offset + 3] = (value & 0xff);\n return offset + 4\n };\n\n Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n });\n\n Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n });\n\n function checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n }\n\n function writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4);\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4);\n return offset + 4\n }\n\n Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n };\n\n Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n };\n\n function writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8);\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8);\n return offset + 8\n }\n\n Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n };\n\n Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n };\n\n // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\n Buffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0;\n if (!end && end !== 0) end = this.length;\n if (targetStart >= target.length) targetStart = target.length;\n if (!targetStart) targetStart = 0;\n if (end > 0 && end < start) end = start;\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length;\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n\n const len = end - start;\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end);\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n );\n }\n\n return len\n };\n\n // Usage:\n // buffer.fill(number[, offset[, end]])\n // buffer.fill(buffer[, offset[, end]])\n // buffer.fill(string[, offset[, end]][, encoding])\n Buffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === 'string') {\n encoding = end;\n end = this.length;\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0);\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code;\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255;\n } else if (typeof val === 'boolean') {\n val = Number(val);\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0;\n end = end === undefined ? this.length : end >>> 0;\n\n if (!val) val = 0;\n\n let i;\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding);\n const len = bytes.length;\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n\n return this\n };\n\n // CUSTOM ERRORS\n // =============\n\n // Simplified versions from Node, changed for Buffer-only usage\n const errors = {};\n function E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super();\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n });\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`;\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack; // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name;\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n };\n }\n\n E('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError);\n E('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError);\n E('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`;\n let received = input;\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input));\n } else if (typeof input === 'bigint') {\n received = String(input);\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received);\n }\n received += 'n';\n }\n msg += ` It must be ${range}. Received ${received}`;\n return msg\n }, RangeError);\n\n function addNumericalSeparator (val) {\n let res = '';\n let i = val.length;\n const start = val[0] === '-' ? 1 : 0;\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`;\n }\n return `${val.slice(0, i)}${res}`\n }\n\n // CHECK FUNCTIONS\n // ===============\n\n function checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset');\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1));\n }\n }\n\n function checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : '';\n let range;\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`;\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`;\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`;\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength);\n }\n\n function validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n }\n\n function boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type);\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n }\n\n // HELPER FUNCTIONS\n // ================\n\n const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\n\n function base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0];\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '');\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '=';\n }\n return str\n }\n\n function utf8ToBytes (string, units) {\n units = units || Infinity;\n let codePoint;\n const length = string.length;\n let leadSurrogate = null;\n const bytes = [];\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i);\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint;\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n leadSurrogate = codePoint;\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n }\n\n leadSurrogate = null;\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint);\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n );\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n );\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n );\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n }\n\n function asciiToBytes (str) {\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF);\n }\n return byteArray\n }\n\n function utf16leToBytes (str, units) {\n let c, hi, lo;\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n\n return byteArray\n }\n\n function base64ToBytes (str) {\n return base64Js.toByteArray(base64clean(str))\n }\n\n function blitBuffer (src, dst, offset, length) {\n let i;\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i];\n }\n return i\n }\n\n // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n // the `instanceof` check but they should be treated as of that type.\n // See: https://github.com/feross/buffer/issues/166\n function isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n }\n function numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n }\n\n // Create lookup table for `toString('hex')`\n // See: https://github.com/feross/buffer/issues/219\n const hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef';\n const table = new Array(256);\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16;\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j];\n }\n }\n return table\n })();\n\n // Return not function with Error if BigInt not supported\n function defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n }\n\n function BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n }\n });\n\n function decode(base64) {\n return buffer.Buffer.from(base64, 'base64').toString('binary');\n }\n function encode(str) {\n return buffer.Buffer.from(str, 'binary').toString('base64');\n }\n function urlDecode(base64) {\n return decode(makeUrlUnsafe(base64));\n }\n function urlEncode(str) {\n return makeUrlSafe(encode(str));\n }\n function makeUrlSafe(a) {\n return a.replace(/\\//g, \"_\").replace(/\\+/g, \"-\").replace(/=+$/, \"\");\n }\n function makeUrlUnsafe(a) {\n return a.replace(/_/g, \"/\").replace(/-/g, \"+\");\n }\n\n var base64 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n decode: decode,\n encode: encode,\n urlDecode: urlDecode,\n urlEncode: urlEncode,\n makeUrlSafe: makeUrlSafe,\n makeUrlUnsafe: makeUrlUnsafe\n });\n\n var toBuffer = function (blob) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve, reject) {\n var fail = function () { return reject(new Error(\"Failed to read file\")); };\n var reader = new FileReader();\n reader.addEventListener('load', function (e) {\n var _a;\n var arrbuf = ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.result) || null;\n if (arrbuf === null) {\n fail();\n }\n resolve(buffer.Buffer.from(arrbuf));\n });\n reader.addEventListener('error', function () { return reader.abort(); });\n reader.addEventListener('abort', fail);\n reader.readAsArrayBuffer(blob);\n })];\n });\n }); };\n\n var blob = /*#__PURE__*/Object.freeze({\n __proto__: null,\n toBuffer: toBuffer\n });\n\n var global$1 = (typeof global !== \"undefined\" ? global :\n typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window : {});\n\n // shim for using process in browser\n // based off https://github.com/defunctzombie/node-process/blob/master/browser.js\n\n function defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n }\n function defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n }\n var cachedSetTimeout = defaultSetTimout;\n var cachedClearTimeout = defaultClearTimeout;\n if (typeof global$1.setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n }\n if (typeof global$1.clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n }\n\n function runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n }\n function runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n }\n var queue = [];\n var draining = false;\n var currentQueue;\n var queueIndex = -1;\n\n function cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n }\n\n function drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n }\n function nextTick(fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n }\n // v8 likes predictible objects\n function Item(fun, array) {\n this.fun = fun;\n this.array = array;\n }\n Item.prototype.run = function () {\n this.fun.apply(null, this.array);\n };\n var title = 'browser';\n var platform = 'browser';\n var browser = true;\n var env = {};\n var argv = [];\n var version = ''; // empty string to avoid regexp issues\n var versions = {};\n var release = {};\n var config = {};\n\n function noop() {}\n\n var on = noop;\n var addListener = noop;\n var once = noop;\n var off = noop;\n var removeListener = noop;\n var removeAllListeners = noop;\n var emit = noop;\n\n function binding(name) {\n throw new Error('process.binding is not supported');\n }\n\n function cwd () { return '/' }\n function chdir (dir) {\n throw new Error('process.chdir is not supported');\n }function umask() { return 0; }\n\n // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js\n var performance = global$1.performance || {};\n var performanceNow =\n performance.now ||\n performance.mozNow ||\n performance.msNow ||\n performance.oNow ||\n performance.webkitNow ||\n function(){ return (new Date()).getTime() };\n\n // generate timestamp or delta\n // see http://nodejs.org/api/process.html#process_process_hrtime\n function hrtime(previousTimestamp){\n var clocktime = performanceNow.call(performance)*1e-3;\n var seconds = Math.floor(clocktime);\n var nanoseconds = Math.floor((clocktime%1)*1e9);\n if (previousTimestamp) {\n seconds = seconds - previousTimestamp[0];\n nanoseconds = nanoseconds - previousTimestamp[1];\n if (nanoseconds<0) {\n seconds--;\n nanoseconds += 1e9;\n }\n }\n return [seconds,nanoseconds]\n }\n\n var startTime = new Date();\n function uptime() {\n var currentTime = new Date();\n var dif = currentTime - startTime;\n return dif / 1000;\n }\n\n var browser$1 = {\n nextTick: nextTick,\n title: title,\n browser: browser,\n env: env,\n argv: argv,\n version: version,\n versions: versions,\n on: on,\n addListener: addListener,\n once: once,\n off: off,\n removeListener: removeListener,\n removeAllListeners: removeAllListeners,\n emit: emit,\n binding: binding,\n cwd: cwd,\n chdir: chdir,\n umask: umask,\n hrtime: hrtime,\n platform: platform,\n release: release,\n config: config,\n uptime: uptime\n };\n\n var empty = {};\n\n var empty$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n 'default': empty\n });\n\n var require$$0 = /*@__PURE__*/getAugmentedNamespace(empty$1);\n\n var nobleEd25519 = createCommonjsModule(function (module, exports) {\n /*! noble-ed25519 - MIT License (c) Paul Miller (paulmillr.com) */\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.utils = exports.verify = exports.sign = exports.getPublicKey = exports.SignResult = exports.Signature = exports.Point = exports.ExtendedPoint = exports.CURVE = void 0;\n const CURVE = {\n a: -1n,\n d: 37095705934669439343138083508754565189542113879843219016388785533085940283555n,\n P: 2n ** 255n - 19n,\n n: 2n ** 252n + 27742317777372353535851937790883648493n,\n h: 8n,\n Gx: 15112221349535400772501151409588531511454012693041857206046113283949847762202n,\n Gy: 46316835694926478169428394003475163141307993866256225615783033603165251855960n,\n };\n exports.CURVE = CURVE;\n const ENCODING_LENGTH = 32;\n const DIV_8_MINUS_3 = (CURVE.P + 3n) / 8n;\n const I = powMod(2n, (CURVE.P + 1n) / 4n, CURVE.P);\n const SQRT_M1 = 19681161376707505956807079304988542015446066515923890162744021073123829784752n;\n const INVSQRT_A_MINUS_D = 54469307008909316920995813868745141605393597292927456921205312896311721017578n;\n const SQRT_AD_MINUS_ONE = 25063068953384623474111414158702152701244531502492656460079210482610430750235n;\n class ExtendedPoint {\n constructor(x, y, z, t) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.t = t;\n }\n static fromAffine(p) {\n if (!(p instanceof Point)) {\n throw new TypeError('ExtendedPoint#fromAffine: expected Point');\n }\n if (p.equals(Point.ZERO))\n return ExtendedPoint.ZERO;\n return new ExtendedPoint(p.x, p.y, 1n, mod(p.x * p.y));\n }\n static toAffineBatch(points) {\n const toInv = invertBatch(points.map((p) => p.z));\n return points.map((p, i) => p.toAffine(toInv[i]));\n }\n static normalizeZ(points) {\n return this.toAffineBatch(points).map(this.fromAffine);\n }\n static fromRistrettoHash(hash) {\n const r1 = bytesToNumberRst(hash.slice(0, ENCODING_LENGTH));\n const R1 = this.elligatorRistrettoFlavor(r1);\n const r2 = bytesToNumberRst(hash.slice(ENCODING_LENGTH, ENCODING_LENGTH * 2));\n const R2 = this.elligatorRistrettoFlavor(r2);\n return R1.add(R2);\n }\n static elligatorRistrettoFlavor(r0) {\n const { d } = CURVE;\n const oneMinusDSq = mod(1n - d ** 2n);\n const dMinusOneSq = (d - 1n) ** 2n;\n const r = SQRT_M1 * (r0 * r0);\n const NS = mod((r + 1n) * oneMinusDSq);\n let c = mod(-1n);\n const D = mod((c - d * r) * mod(r + d));\n let { isNotZeroSquare, value: S } = sqrtRatio(NS, D);\n let sPrime = mod(S * r0);\n sPrime = edIsNegative(sPrime) ? sPrime : mod(-sPrime);\n S = isNotZeroSquare ? S : sPrime;\n c = isNotZeroSquare ? c : r;\n const NT = c * (r - 1n) * dMinusOneSq - D;\n const sSquared = S * S;\n const W0 = (S + S) * D;\n const W1 = NT * SQRT_AD_MINUS_ONE;\n const W2 = 1n - sSquared;\n const W3 = 1n + sSquared;\n return new ExtendedPoint(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2));\n }\n static fromRistrettoBytes(bytes) {\n const s = bytesToNumberRst(bytes);\n const sEncodingIsCanonical = equalBytes(numberToBytesPadded(s, ENCODING_LENGTH), bytes);\n const sIsNegative = edIsNegative(s);\n if (!sEncodingIsCanonical || sIsNegative) {\n throw new Error('Cannot convert bytes to Ristretto Point');\n }\n const s2 = s * s;\n const u1 = 1n - s2;\n const u2 = 1n + s2;\n const squaredU2 = u2 * u2;\n const v = u1 * u1 * -CURVE.d - squaredU2;\n const { isNotZeroSquare, value: I } = invertSqrt(mod(v * squaredU2));\n const Dx = I * u2;\n const Dy = I * Dx * v;\n let x = mod((s + s) * Dx);\n if (edIsNegative(x))\n x = mod(-x);\n const y = mod(u1 * Dy);\n const t = mod(x * y);\n if (!isNotZeroSquare || edIsNegative(t) || y === 0n) {\n throw new Error('Cannot convert bytes to Ristretto Point');\n }\n return new ExtendedPoint(x, y, 1n, t);\n }\n toRistrettoBytes() {\n let { x, y, z, t } = this;\n const u1 = (z + y) * (z - y);\n const u2 = x * y;\n const { value: invsqrt } = invertSqrt(mod(u2 ** 2n * u1));\n const i1 = invsqrt * u1;\n const i2 = invsqrt * u2;\n const invz = i1 * i2 * t;\n let invDeno = i2;\n if (edIsNegative(t * invz)) {\n const iX = mod(x * SQRT_M1);\n const iY = mod(y * SQRT_M1);\n x = iY;\n y = iX;\n invDeno = mod(i1 * INVSQRT_A_MINUS_D);\n }\n if (edIsNegative(x * invz))\n y = mod(-y);\n let s = mod((z - y) * invDeno);\n if (edIsNegative(s))\n s = mod(-s);\n return numberToBytesPadded(s, ENCODING_LENGTH);\n }\n equals(other) {\n const a = this;\n const b = other;\n const [T1, T2, Z1, Z2] = [a.t, b.t, a.z, b.z];\n return mod(T1 * Z2) === mod(T2 * Z1);\n }\n negate() {\n return new ExtendedPoint(mod(-this.x), this.y, this.z, mod(-this.t));\n }\n double() {\n const X1 = this.x;\n const Y1 = this.y;\n const Z1 = this.z;\n const { a } = CURVE;\n const A = mod(X1 ** 2n);\n const B = mod(Y1 ** 2n);\n const C = mod(2n * Z1 ** 2n);\n const D = mod(a * A);\n const E = mod((X1 + Y1) ** 2n - A - B);\n const G = mod(D + B);\n const F = mod(G - C);\n const H = mod(D - B);\n const X3 = mod(E * F);\n const Y3 = mod(G * H);\n const T3 = mod(E * H);\n const Z3 = mod(F * G);\n return new ExtendedPoint(X3, Y3, Z3, T3);\n }\n add(other) {\n const X1 = this.x;\n const Y1 = this.y;\n const Z1 = this.z;\n const T1 = this.t;\n const X2 = other.x;\n const Y2 = other.y;\n const Z2 = other.z;\n const T2 = other.t;\n const A = mod((Y1 - X1) * (Y2 + X2));\n const B = mod((Y1 + X1) * (Y2 - X2));\n const F = mod(B - A);\n if (F === 0n) {\n return this.double();\n }\n const C = mod(Z1 * 2n * T2);\n const D = mod(T1 * 2n * Z2);\n const E = mod(D + C);\n const G = mod(B + A);\n const H = mod(D - C);\n const X3 = mod(E * F);\n const Y3 = mod(G * H);\n const T3 = mod(E * H);\n const Z3 = mod(F * G);\n return new ExtendedPoint(X3, Y3, Z3, T3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n multiplyUnsafe(scalar) {\n if (typeof scalar !== 'number' && typeof scalar !== 'bigint') {\n throw new TypeError('Point#multiply: expected number or bigint');\n }\n let n = mod(BigInt(scalar), CURVE.n);\n if (n <= 0) {\n throw new Error('Point#multiply: invalid scalar, expected positive integer');\n }\n let p = ExtendedPoint.ZERO;\n let d = this;\n while (n > 0n) {\n if (n & 1n)\n p = p.add(d);\n d = d.double();\n n >>= 1n;\n }\n return p;\n }\n precomputeWindow(W) {\n const windows = 256 / W + 1;\n let points = [];\n let p = this;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n for (let i = 1; i < 2 ** (W - 1); i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n }\n wNAF(n, affinePoint) {\n if (!affinePoint && this.equals(ExtendedPoint.BASE))\n affinePoint = Point.BASE;\n const W = (affinePoint && affinePoint._WINDOW_SIZE) || 1;\n if (256 % W) {\n throw new Error('Point#wNAF: Invalid precomputation window, must be power of 2');\n }\n let precomputes = affinePoint && pointPrecomputes.get(affinePoint);\n if (!precomputes) {\n precomputes = this.precomputeWindow(W);\n if (affinePoint && W !== 1) {\n precomputes = ExtendedPoint.normalizeZ(precomputes);\n pointPrecomputes.set(affinePoint, precomputes);\n }\n }\n let p = ExtendedPoint.ZERO;\n let f = ExtendedPoint.ZERO;\n const windows = 256 / W + 1;\n const windowSize = 2 ** (W - 1);\n const mask = BigInt(2 ** W - 1);\n const maxNumber = 2 ** W;\n const shiftBy = BigInt(W);\n for (let window = 0; window < windows; window++) {\n const offset = window * windowSize;\n let wbits = Number(n & mask);\n n >>= shiftBy;\n if (wbits > windowSize) {\n wbits -= maxNumber;\n n += 1n;\n }\n if (wbits === 0) {\n f = f.add(window % 2 ? precomputes[offset].negate() : precomputes[offset]);\n }\n else {\n const cached = precomputes[offset + Math.abs(wbits) - 1];\n p = p.add(wbits < 0 ? cached.negate() : cached);\n }\n }\n return [p, f];\n }\n multiply(scalar, affinePoint) {\n if (typeof scalar !== 'number' && typeof scalar !== 'bigint') {\n throw new TypeError('Point#multiply: expected number or bigint');\n }\n const n = mod(BigInt(scalar), CURVE.n);\n if (n <= 0) {\n throw new Error('Point#multiply: invalid scalar, expected positive integer');\n }\n return ExtendedPoint.normalizeZ(this.wNAF(n, affinePoint))[0];\n }\n toAffine(invZ = invert(this.z)) {\n const x = mod(this.x * invZ);\n const y = mod(this.y * invZ);\n return new Point(x, y);\n }\n }\n exports.ExtendedPoint = ExtendedPoint;\n ExtendedPoint.BASE = new ExtendedPoint(CURVE.Gx, CURVE.Gy, 1n, mod(CURVE.Gx * CURVE.Gy));\n ExtendedPoint.ZERO = new ExtendedPoint(0n, 1n, 1n, 0n);\n const pointPrecomputes = new WeakMap();\n class Point {\n constructor(x, y) {\n this.x = x;\n this.y = y;\n }\n _setWindowSize(windowSize) {\n this._WINDOW_SIZE = windowSize;\n pointPrecomputes.delete(this);\n }\n static fromHex(hash) {\n const { d, P } = CURVE;\n const bytes = hash instanceof Uint8Array ? hash : hexToBytes(hash);\n const len = bytes.length - 1;\n const normedLast = bytes[len] & ~0x80;\n const isLastByteOdd = (bytes[len] & 0x80) !== 0;\n const normed = Uint8Array.from(Array.from(bytes.slice(0, len)).concat(normedLast));\n const y = bytesToNumberLE(normed);\n if (y >= P) {\n throw new Error('Point#fromHex expects hex <= Fp');\n }\n const sqrY = y * y;\n const sqrX = mod((sqrY - 1n) * invert(d * sqrY + 1n));\n let x = powMod(sqrX, DIV_8_MINUS_3);\n if (mod(x * x - sqrX) !== 0n) {\n x = mod(x * I);\n }\n const isXOdd = (x & 1n) === 1n;\n if (isLastByteOdd !== isXOdd) {\n x = mod(-x);\n }\n return new Point(x, y);\n }\n toRawBytes() {\n const hex = numberToHex(this.y);\n const u8 = new Uint8Array(ENCODING_LENGTH);\n for (let i = hex.length - 2, j = 0; j < ENCODING_LENGTH && i >= 0; i -= 2, j++) {\n u8[j] = parseInt(hex[i] + hex[i + 1], 16);\n }\n const mask = this.x & 1n ? 0x80 : 0;\n u8[ENCODING_LENGTH - 1] |= mask;\n return u8;\n }\n toHex() {\n return bytesToHex(this.toRawBytes());\n }\n toX25519() {\n return mod((1n + this.y) * invert(1n - this.y));\n }\n equals(other) {\n return this.x === other.x && this.y === other.y;\n }\n negate() {\n return new Point(mod(-this.x), this.y);\n }\n add(other) {\n return ExtendedPoint.fromAffine(this).add(ExtendedPoint.fromAffine(other)).toAffine();\n }\n subtract(other) {\n return this.add(other.negate());\n }\n multiply(scalar) {\n return ExtendedPoint.fromAffine(this).multiply(scalar, this).toAffine();\n }\n }\n exports.Point = Point;\n Point.BASE = new Point(CURVE.Gx, CURVE.Gy);\n Point.ZERO = new Point(0n, 1n);\n class Signature {\n constructor(r, s) {\n this.r = r;\n this.s = s;\n }\n static fromHex(hex) {\n hex = ensureBytes(hex);\n const r = Point.fromHex(hex.slice(0, 32));\n const s = bytesToNumberLE(hex.slice(32));\n if (s >= CURVE.n) {\n throw new Error('Signature#fromHex expects s <= CURVE.n');\n }\n return new Signature(r, s);\n }\n toRawBytes() {\n const numberBytes = hexToBytes(numberToHex(this.s)).reverse();\n const sBytes = new Uint8Array(ENCODING_LENGTH);\n sBytes.set(numberBytes);\n const res = new Uint8Array(ENCODING_LENGTH * 2);\n res.set(this.r.toRawBytes());\n res.set(sBytes, 32);\n return res;\n }\n toHex() {\n return bytesToHex(this.toRawBytes());\n }\n }\n exports.Signature = Signature;\n exports.SignResult = Signature;\n function concatBytes(...arrays) {\n if (arrays.length === 1)\n return arrays[0];\n const length = arrays.reduce((a, arr) => a + arr.length, 0);\n const result = new Uint8Array(length);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const arr = arrays[i];\n result.set(arr, pad);\n pad += arr.length;\n }\n return result;\n }\n function bytesToHex(uint8a) {\n let hex = '';\n for (let i = 0; i < uint8a.length; i++) {\n hex += uint8a[i].toString(16).padStart(2, '0');\n }\n return hex;\n }\n function pad64(num) {\n return num.toString(16).padStart(ENCODING_LENGTH * 2, '0');\n }\n function hexToBytes(hex) {\n hex = hex.length & 1 ? `0${hex}` : hex;\n const array = new Uint8Array(hex.length / 2);\n for (let i = 0; i < array.length; i++) {\n let j = i * 2;\n array[i] = Number.parseInt(hex.slice(j, j + 2), 16);\n }\n return array;\n }\n function numberToHex(num) {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n }\n function numberToBytesPadded(num, length = ENCODING_LENGTH) {\n const hex = numberToHex(num).padStart(length * 2, '0');\n return hexToBytes(hex).reverse();\n }\n function edIsNegative(num) {\n const hex = numberToHex(mod(num));\n const byte = Number.parseInt(hex.slice(hex.length - 2, hex.length), 16);\n return Boolean(byte & 1);\n }\n function bytesToNumberLE(uint8a) {\n let value = 0n;\n for (let i = 0; i < uint8a.length; i++) {\n value += BigInt(uint8a[i]) << (8n * BigInt(i));\n }\n return value;\n }\n function load8(input, padding = 0) {\n return (BigInt(input[0 + padding]) |\n (BigInt(input[1 + padding]) << 8n) |\n (BigInt(input[2 + padding]) << 16n) |\n (BigInt(input[3 + padding]) << 24n) |\n (BigInt(input[4 + padding]) << 32n) |\n (BigInt(input[5 + padding]) << 40n) |\n (BigInt(input[6 + padding]) << 48n) |\n (BigInt(input[7 + padding]) << 56n));\n }\n const low51bitMask = (1n << 51n) - 1n;\n function bytesToNumberRst(bytes) {\n const octet1 = load8(bytes, 0) & low51bitMask;\n const octet2 = (load8(bytes, 6) >> 3n) & low51bitMask;\n const octet3 = (load8(bytes, 12) >> 6n) & low51bitMask;\n const octet4 = (load8(bytes, 19) >> 1n) & low51bitMask;\n const octet5 = (load8(bytes, 24) >> 12n) & low51bitMask;\n return mod(octet1 + (octet2 << 51n) + (octet3 << 102n) + (octet4 << 153n) + (octet5 << 204n));\n }\n function mod(a, b = CURVE.P) {\n const res = a % b;\n return res >= 0n ? res : b + res;\n }\n function powMod(a, power, m = CURVE.P) {\n let res = 1n;\n while (power > 0n) {\n if (power & 1n) {\n res = mod(res * a, m);\n }\n power >>= 1n;\n a = mod(a * a, m);\n }\n return res;\n }\n function egcd(a, b) {\n let [x, y, u, v] = [0n, 1n, 1n, 0n];\n while (a !== 0n) {\n let q = b / a;\n let r = b % a;\n let m = x - u * q;\n let n = y - v * q;\n [b, a] = [a, r];\n [x, y] = [u, v];\n [u, v] = [m, n];\n }\n let gcd = b;\n return [gcd, x, y];\n }\n function invert(number, modulo = CURVE.P) {\n if (number === 0n || modulo <= 0n) {\n throw new Error('invert: expected positive integers');\n }\n let [gcd, x] = egcd(mod(number, modulo), modulo);\n if (gcd !== 1n) {\n throw new Error('invert: does not exist');\n }\n return mod(x, modulo);\n }\n function invertBatch(nums, n = CURVE.P) {\n const len = nums.length;\n const scratch = new Array(len);\n let acc = 1n;\n for (let i = 0; i < len; i++) {\n if (nums[i] === 0n)\n continue;\n scratch[i] = acc;\n acc = mod(acc * nums[i], n);\n }\n acc = invert(acc, n);\n for (let i = len - 1; i >= 0; i--) {\n if (nums[i] === 0n)\n continue;\n let tmp = mod(acc * nums[i], n);\n nums[i] = mod(acc * scratch[i], n);\n acc = tmp;\n }\n return nums;\n }\n function invertSqrt(number) {\n return sqrtRatio(1n, number);\n }\n function powMod2(t, power) {\n const { P } = CURVE;\n let res = t;\n while (power-- > 0n) {\n res *= res;\n res %= P;\n }\n return res;\n }\n function pow_2_252_3(t) {\n t = mod(t);\n const { P } = CURVE;\n const t0 = (t * t) % P;\n const t1 = t0 ** 4n % P;\n const t2 = (t * t1) % P;\n const t3 = (t0 * t2) % P;\n const t4 = t3 ** 2n % P;\n const t5 = (t2 * t4) % P;\n const t6 = powMod2(t5, 5n);\n const t7 = (t6 * t5) % P;\n const t8 = powMod2(t7, 10n);\n const t9 = (t8 * t7) % P;\n const t10 = powMod2(t9, 20n);\n const t11 = (t10 * t9) % P;\n const t12 = powMod2(t11, 10n);\n const t13 = (t12 * t7) % P;\n const t14 = powMod2(t13, 50n);\n const t15 = (t14 * t13) % P;\n const t16 = powMod2(t15, 100n);\n const t17 = (t16 * t15) % P;\n const t18 = powMod2(t17, 50n);\n const t19 = (t18 * t13) % P;\n const t20 = (t19 * t19) % P;\n const t21 = (t20 * t20 * t) % P;\n return t21;\n }\n function sqrtRatio(t, v) {\n const v3 = mod(v * v * v);\n const v7 = mod(v3 * v3 * v);\n let r = mod(pow_2_252_3(t * v7) * t * v3);\n const check = mod(r * r * v);\n const i = SQRT_M1;\n const correctSignSqrt = check === t;\n const flippedSignSqrt = check === mod(-t);\n const flippedSignSqrtI = check === mod(mod(-t) * i);\n const rPrime = mod(SQRT_M1 * r);\n r = flippedSignSqrt || flippedSignSqrtI ? rPrime : r;\n if (edIsNegative(r))\n r = mod(-r);\n const isNotZeroSquare = correctSignSqrt || flippedSignSqrt;\n return { isNotZeroSquare, value: mod(r) };\n }\n async function sha512ToNumberLE(...args) {\n const messageArray = concatBytes(...args);\n const hash = await exports.utils.sha512(messageArray);\n const value = bytesToNumberLE(hash);\n return mod(value, CURVE.n);\n }\n function keyPrefix(privateBytes) {\n return privateBytes.slice(ENCODING_LENGTH);\n }\n function encodePrivate(privateBytes) {\n const last = ENCODING_LENGTH - 1;\n const head = privateBytes.slice(0, ENCODING_LENGTH);\n head[0] &= 248;\n head[last] &= 127;\n head[last] |= 64;\n return bytesToNumberLE(head);\n }\n function ensureBytes(hash) {\n return hash instanceof Uint8Array ? hash : hexToBytes(hash);\n }\n function equalBytes(b1, b2) {\n if (b1.length !== b2.length) {\n return false;\n }\n for (let i = 0; i < b1.length; i++) {\n if (b1[i] !== b2[i]) {\n return false;\n }\n }\n return true;\n }\n function ensurePrivInputBytes(privateKey) {\n if (privateKey instanceof Uint8Array)\n return privateKey;\n if (typeof privateKey === 'string')\n return hexToBytes(privateKey.padStart(ENCODING_LENGTH * 2, '0'));\n return hexToBytes(pad64(BigInt(privateKey)));\n }\n async function getPublicKey(privateKey) {\n const privBytes = await exports.utils.sha512(ensurePrivInputBytes(privateKey));\n const publicKey = Point.BASE.multiply(encodePrivate(privBytes));\n return typeof privateKey === 'string' ? publicKey.toHex() : publicKey.toRawBytes();\n }\n exports.getPublicKey = getPublicKey;\n async function sign(hash, privateKey) {\n const privBytes = await exports.utils.sha512(ensurePrivInputBytes(privateKey));\n const p = encodePrivate(privBytes);\n const P = Point.BASE.multiply(p);\n const msg = ensureBytes(hash);\n const r = await sha512ToNumberLE(keyPrefix(privBytes), msg);\n const R = Point.BASE.multiply(r);\n const h = await sha512ToNumberLE(R.toRawBytes(), P.toRawBytes(), msg);\n const S = mod(r + h * p, CURVE.n);\n const sig = new Signature(R, S);\n return typeof hash === 'string' ? sig.toHex() : sig.toRawBytes();\n }\n exports.sign = sign;\n async function verify(signature, hash, publicKey) {\n hash = ensureBytes(hash);\n if (!(publicKey instanceof Point))\n publicKey = Point.fromHex(publicKey);\n if (!(signature instanceof Signature))\n signature = Signature.fromHex(signature);\n const h = await sha512ToNumberLE(signature.r.toRawBytes(), publicKey.toRawBytes(), hash);\n const Ph = ExtendedPoint.fromAffine(publicKey).multiplyUnsafe(h);\n const Gs = ExtendedPoint.BASE.multiply(signature.s);\n const RPh = ExtendedPoint.fromAffine(signature.r).add(Ph);\n return Gs.equals(RPh);\n }\n exports.verify = verify;\n Point.BASE._setWindowSize(8);\n exports.utils = {\n TORSION_SUBGROUP: [\n '0100000000000000000000000000000000000000000000000000000000000000',\n 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a',\n '0000000000000000000000000000000000000000000000000000000000000080',\n '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05',\n 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f',\n '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85',\n '0000000000000000000000000000000000000000000000000000000000000000',\n 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa',\n ],\n randomPrivateKey: (bytesLength = 32) => {\n if (typeof window == 'object' && 'crypto' in window) {\n return window.crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n else if (typeof browser$1 === 'object' && 'node' in browser$1.versions) {\n const { randomBytes } = require$$0;\n return new Uint8Array(randomBytes(bytesLength).buffer);\n }\n else {\n throw new Error(\"The environment doesn't have randomBytes function\");\n }\n },\n sha512: async (message) => {\n if (typeof window == 'object' && 'crypto' in window) {\n const buffer = await window.crypto.subtle.digest('SHA-512', message.buffer);\n return new Uint8Array(buffer);\n }\n else if (typeof browser$1 === 'object' && 'node' in browser$1.versions) {\n const { createHash } = require$$0;\n const hash = createHash('sha512');\n hash.update(message);\n return Uint8Array.from(hash.digest());\n }\n else {\n throw new Error(\"The environment doesn't have sha512 function\");\n }\n },\n precompute(windowSize = 8, point = Point.BASE) {\n const cached = point.equals(Point.BASE) ? point : new Point(point.x, point.y);\n cached._setWindowSize(windowSize);\n cached.multiply(1n);\n return cached;\n },\n };\n });\n\n var types = createCommonjsModule(function (module, exports) {\n Object.defineProperty(exports, \"__esModule\", { value: true });\n (function (CryptoSystem) {\n CryptoSystem[\"ECC\"] = \"ecc\";\n CryptoSystem[\"RSA\"] = \"rsa\";\n })(exports.CryptoSystem || (exports.CryptoSystem = {}));\n (function (EccCurve) {\n EccCurve[\"P_256\"] = \"P-256\";\n EccCurve[\"P_384\"] = \"P-384\";\n EccCurve[\"P_521\"] = \"P-521\";\n })(exports.EccCurve || (exports.EccCurve = {}));\n (function (RsaSize) {\n RsaSize[RsaSize[\"B1024\"] = 1024] = \"B1024\";\n RsaSize[RsaSize[\"B2048\"] = 2048] = \"B2048\";\n RsaSize[RsaSize[\"B4096\"] = 4096] = \"B4096\";\n })(exports.RsaSize || (exports.RsaSize = {}));\n (function (SymmAlg) {\n SymmAlg[\"AES_CTR\"] = \"AES-CTR\";\n SymmAlg[\"AES_CBC\"] = \"AES-CBC\";\n })(exports.SymmAlg || (exports.SymmAlg = {}));\n (function (SymmKeyLength) {\n SymmKeyLength[SymmKeyLength[\"B128\"] = 128] = \"B128\";\n SymmKeyLength[SymmKeyLength[\"B192\"] = 192] = \"B192\";\n SymmKeyLength[SymmKeyLength[\"B256\"] = 256] = \"B256\";\n })(exports.SymmKeyLength || (exports.SymmKeyLength = {}));\n (function (HashAlg) {\n HashAlg[\"SHA_1\"] = \"SHA-1\";\n HashAlg[\"SHA_256\"] = \"SHA-256\";\n HashAlg[\"SHA_384\"] = \"SHA-384\";\n HashAlg[\"SHA_512\"] = \"SHA-512\";\n })(exports.HashAlg || (exports.HashAlg = {}));\n (function (CharSize) {\n CharSize[CharSize[\"B8\"] = 8] = \"B8\";\n CharSize[CharSize[\"B16\"] = 16] = \"B16\";\n })(exports.CharSize || (exports.CharSize = {}));\n (function (KeyUse) {\n KeyUse[\"Read\"] = \"read\";\n KeyUse[\"Write\"] = \"write\";\n })(exports.KeyUse || (exports.KeyUse = {}));\n\n });\n\n var constants = createCommonjsModule(function (module, exports) {\n Object.defineProperty(exports, \"__esModule\", { value: true });\n\n exports.ECC_READ_ALG = 'ECDH';\n exports.ECC_WRITE_ALG = 'ECDSA';\n exports.RSA_READ_ALG = 'RSA-OAEP';\n exports.RSA_WRITE_ALG = 'RSASSA-PKCS1-v1_5';\n exports.SALT_LENGTH = 128;\n exports.DEFAULT_CRYPTOSYSTEM = 'ecc';\n exports.DEFAULT_ECC_CURVE = types.EccCurve.P_256;\n exports.DEFAULT_RSA_SIZE = types.RsaSize.B2048;\n exports.DEFAULT_SYMM_ALG = types.SymmAlg.AES_CTR;\n exports.DEFAULT_SYMM_LEN = types.SymmKeyLength.B256;\n exports.DEFAULT_CTR_LEN = 64;\n exports.DEFAULT_HASH_ALG = types.HashAlg.SHA_256;\n exports.DEFAULT_CHAR_SIZE = types.CharSize.B16;\n exports.DEFAULT_STORE_NAME = 'keystore';\n exports.DEFAULT_READ_KEY_NAME = 'read-key';\n exports.DEFAULT_WRITE_KEY_NAME = 'write-key';\n exports.default = {\n ECC_READ_ALG: exports.ECC_READ_ALG,\n ECC_WRITE_ALG: exports.ECC_WRITE_ALG,\n RSA_READ_ALG: exports.RSA_READ_ALG,\n RSA_WRITE_ALG: exports.RSA_WRITE_ALG,\n SALT_LENGTH: exports.SALT_LENGTH,\n DEFAULT_CRYPTOSYSTEM: exports.DEFAULT_CRYPTOSYSTEM,\n DEFAULT_ECC_CURVE: exports.DEFAULT_ECC_CURVE,\n DEFAULT_RSA_SIZE: exports.DEFAULT_RSA_SIZE,\n DEFAULT_SYMM_ALG: exports.DEFAULT_SYMM_ALG,\n DEFAULT_CTR_LEN: exports.DEFAULT_CTR_LEN,\n DEFAULT_HASH_ALG: exports.DEFAULT_HASH_ALG,\n DEFAULT_CHAR_SIZE: exports.DEFAULT_CHAR_SIZE,\n DEFAULT_STORE_NAME: exports.DEFAULT_STORE_NAME,\n DEFAULT_READ_KEY_NAME: exports.DEFAULT_READ_KEY_NAME,\n DEFAULT_WRITE_KEY_NAME: exports.DEFAULT_WRITE_KEY_NAME,\n };\n\n });\n\n var utils = createCommonjsModule(function (module, exports) {\n var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n\n function arrBufToStr(buf, charSize) {\n var arr = charSize === 8 ? new Uint8Array(buf) : new Uint16Array(buf);\n return Array.from(arr)\n .map(function (b) { return String.fromCharCode(b); })\n .join('');\n }\n exports.arrBufToStr = arrBufToStr;\n function arrBufToBase64(buf) {\n var str = arrBufToStr(buf, 8);\n return buffer.Buffer.from(str, 'binary').toString('base64');\n }\n exports.arrBufToBase64 = arrBufToBase64;\n function strToArrBuf(str, charSize) {\n var view = charSize === 8 ? new Uint8Array(str.length) : new Uint16Array(str.length);\n for (var i = 0, strLen = str.length; i < strLen; i++) {\n view[i] = str.charCodeAt(i);\n }\n return view.buffer;\n }\n exports.strToArrBuf = strToArrBuf;\n function base64ToArrBuf(base64) {\n var str = buffer.Buffer.from(base64, 'base64').toString('binary');\n return strToArrBuf(str, 8);\n }\n exports.base64ToArrBuf = base64ToArrBuf;\n function publicExponent() {\n return new Uint8Array([0x01, 0x00, 0x01]);\n }\n exports.publicExponent = publicExponent;\n function randomBuf(length) {\n var arr = new Uint8Array(length);\n globalThis.crypto.getRandomValues(arr);\n return arr.buffer;\n }\n exports.randomBuf = randomBuf;\n function joinBufs(fst, snd) {\n var view1 = new Uint8Array(fst);\n var view2 = new Uint8Array(snd);\n var joined = new Uint8Array(view1.length + view2.length);\n joined.set(view1);\n joined.set(view2, view1.length);\n return joined.buffer;\n }\n exports.joinBufs = joinBufs;\n exports.normalizeUtf8ToBuf = function (msg) {\n return exports.normalizeToBuf(msg, function (str) { return strToArrBuf(str, types.CharSize.B8); });\n };\n exports.normalizeUtf16ToBuf = function (msg) {\n return exports.normalizeToBuf(msg, function (str) { return strToArrBuf(str, types.CharSize.B16); });\n };\n exports.normalizeBase64ToBuf = function (msg) {\n return exports.normalizeToBuf(msg, base64ToArrBuf);\n };\n exports.normalizeUnicodeToBuf = function (msg, charSize) {\n switch (charSize) {\n case 8: return exports.normalizeUtf8ToBuf(msg);\n default: return exports.normalizeUtf16ToBuf(msg);\n }\n };\n exports.normalizeToBuf = function (msg, strConv) {\n if (typeof msg === 'string') {\n return strConv(msg);\n }\n else if (typeof msg === 'object' && msg.byteLength !== undefined) {\n // this is the best runtime check I could find for ArrayBuffer/Uint8Array\n var temp = new Uint8Array(msg);\n return temp.buffer;\n }\n else {\n throw new Error(\"Improper value. Must be a string, ArrayBuffer, Uint8Array\");\n }\n };\n /* istanbul ignore next */\n function structuralClone(obj) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve) {\n var _a = new MessageChannel(), port1 = _a.port1, port2 = _a.port2;\n port2.onmessage = function (ev) { return resolve(ev.data); };\n port1.postMessage(obj);\n })];\n });\n });\n }\n exports.structuralClone = structuralClone;\n exports.default = {\n arrBufToStr: arrBufToStr,\n arrBufToBase64: arrBufToBase64,\n strToArrBuf: strToArrBuf,\n base64ToArrBuf: base64ToArrBuf,\n publicExponent: publicExponent,\n randomBuf: randomBuf,\n joinBufs: joinBufs,\n normalizeUtf8ToBuf: exports.normalizeUtf8ToBuf,\n normalizeUtf16ToBuf: exports.normalizeUtf16ToBuf,\n normalizeBase64ToBuf: exports.normalizeBase64ToBuf,\n normalizeToBuf: exports.normalizeToBuf,\n structuralClone: structuralClone\n };\n //# sourceMappingURL=utils.js.map\n });\n\n var utils$1 = /*@__PURE__*/getDefaultExportFromCjs(utils);\n\n var errors = createCommonjsModule(function (module, exports) {\n Object.defineProperty(exports, \"__esModule\", { value: true });\n\n exports.KeyDoesNotExist = new Error(\"Key does not exist. Make sure you properly instantiated the keystore.\");\n exports.NotKeyPair = new Error(\"Retrieved a symmetric key when an asymmetric keypair was expected. Please use a different key name.\");\n exports.NotKey = new Error(\"Retrieved an asymmetric keypair when an symmetric key was expected. Please use a different key name.\");\n exports.ECCNotEnabled = new Error(\"ECC is not enabled for this browser. Please use RSA instead.\");\n exports.UnsupportedCrypto = new Error(\"Cryptosystem not supported. Please use ECC or RSA\");\n exports.InvalidKeyUse = new Error(\"Invalid key use. Please use 'read' or 'write\");\n function checkIsKeyPair(keypair) {\n if (!keypair || keypair === null) {\n throw exports.KeyDoesNotExist;\n }\n else if (keypair.privateKey === undefined) {\n throw exports.NotKeyPair;\n }\n return keypair;\n }\n exports.checkIsKeyPair = checkIsKeyPair;\n function checkIsKey(key) {\n if (!key || key === null) {\n throw exports.KeyDoesNotExist;\n }\n else if (key.privateKey !== undefined || key.algorithm === undefined) {\n throw exports.NotKey;\n }\n return key;\n }\n exports.checkIsKey = checkIsKey;\n function checkValidCryptoSystem(type) {\n checkValid(type, [types.CryptoSystem.ECC, types.CryptoSystem.RSA], exports.UnsupportedCrypto);\n }\n exports.checkValidCryptoSystem = checkValidCryptoSystem;\n function checkValidKeyUse(use) {\n checkValid(use, [types.KeyUse.Read, types.KeyUse.Write], exports.InvalidKeyUse);\n }\n exports.checkValidKeyUse = checkValidKeyUse;\n function checkValid(toCheck, opts, error) {\n var match = opts.some(function (opt) { return opt === toCheck; });\n if (!match) {\n throw error;\n }\n }\n exports.default = {\n KeyDoesNotExist: exports.KeyDoesNotExist,\n NotKeyPair: exports.NotKeyPair,\n NotKey: exports.NotKey,\n ECCNotEnabled: exports.ECCNotEnabled,\n UnsupportedCrypto: exports.UnsupportedCrypto,\n InvalidKeyUse: exports.InvalidKeyUse,\n checkIsKeyPair: checkIsKeyPair,\n checkIsKey: checkIsKey,\n checkValidCryptoSystem: checkValidCryptoSystem,\n checkValidKeyUse: checkValidKeyUse,\n };\n\n });\n\n var __awaiter$1 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n var __generator$1 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n\n\n\n\n\n function makeKeypair(size, hashAlg, use) {\n return __awaiter$1(this, void 0, void 0, function () {\n var alg, uses;\n return __generator$1(this, function (_a) {\n errors.checkValidKeyUse(use);\n alg = use === types.KeyUse.Read ? constants.RSA_READ_ALG : constants.RSA_WRITE_ALG;\n uses = use === types.KeyUse.Read ? ['encrypt', 'decrypt'] : ['sign', 'verify'];\n return [2 /*return*/, globalThis.crypto.subtle.generateKey({\n name: alg,\n modulusLength: size,\n publicExponent: utils.default.publicExponent(),\n hash: { name: hashAlg }\n }, false, uses)];\n });\n });\n }\n var makeKeypair_1 = makeKeypair;\n function stripKeyHeader(base64Key) {\n return base64Key\n .replace('-----BEGIN PUBLIC KEY-----\\n', '')\n .replace('\\n-----END PUBLIC KEY-----', '');\n }\n function importPublicKey(base64Key, hashAlg, use) {\n return __awaiter$1(this, void 0, void 0, function () {\n var alg, uses, buf;\n return __generator$1(this, function (_a) {\n errors.checkValidKeyUse(use);\n alg = use === types.KeyUse.Read ? constants.RSA_READ_ALG : constants.RSA_WRITE_ALG;\n uses = use === types.KeyUse.Read ? ['encrypt'] : ['verify'];\n buf = utils.default.base64ToArrBuf(stripKeyHeader(base64Key));\n return [2 /*return*/, globalThis.crypto.subtle.importKey('spki', buf, { name: alg, hash: { name: hashAlg } }, true, uses)];\n });\n });\n }\n var importPublicKey_1 = importPublicKey;\n var _default = {\n makeKeypair: makeKeypair,\n importPublicKey: importPublicKey\n };\n //# sourceMappingURL=keys.js.map\n\n var keys = /*#__PURE__*/Object.defineProperty({\n \tmakeKeypair: makeKeypair_1,\n \timportPublicKey: importPublicKey_1,\n \tdefault: _default\n }, '__esModule', {value: true});\n\n var __awaiter$2 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n var __generator$2 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n\n\n\n\n\n function sign(msg, privateKey, charSize) {\n if (charSize === void 0) { charSize = constants.DEFAULT_CHAR_SIZE; }\n return __awaiter$2(this, void 0, void 0, function () {\n return __generator$2(this, function (_a) {\n return [2 /*return*/, globalThis.crypto.subtle.sign({ name: constants.RSA_WRITE_ALG, saltLength: constants.SALT_LENGTH }, privateKey, utils.normalizeUnicodeToBuf(msg, charSize))];\n });\n });\n }\n var sign_1 = sign;\n function verify(msg, sig, publicKey, charSize, hashAlg) {\n if (charSize === void 0) { charSize = constants.DEFAULT_CHAR_SIZE; }\n if (hashAlg === void 0) { hashAlg = constants.DEFAULT_HASH_ALG; }\n return __awaiter$2(this, void 0, void 0, function () {\n var _a, _b, _c, _d;\n return __generator$2(this, function (_e) {\n switch (_e.label) {\n case 0:\n _b = (_a = globalThis.crypto.subtle).verify;\n _c = [{ name: constants.RSA_WRITE_ALG, saltLength: constants.SALT_LENGTH }];\n if (!(typeof publicKey === \"string\")) return [3 /*break*/, 2];\n return [4 /*yield*/, keys.default.importPublicKey(publicKey, hashAlg, types.KeyUse.Write)];\n case 1:\n _d = _e.sent();\n return [3 /*break*/, 3];\n case 2:\n _d = publicKey;\n _e.label = 3;\n case 3: return [2 /*return*/, _b.apply(_a, _c.concat([_d, utils.normalizeBase64ToBuf(sig),\n utils.normalizeUnicodeToBuf(msg, charSize)]))];\n }\n });\n });\n }\n var verify_1 = verify;\n function encrypt(msg, publicKey, charSize, hashAlg) {\n if (charSize === void 0) { charSize = constants.DEFAULT_CHAR_SIZE; }\n if (hashAlg === void 0) { hashAlg = constants.DEFAULT_HASH_ALG; }\n return __awaiter$2(this, void 0, void 0, function () {\n var _a, _b, _c, _d;\n return __generator$2(this, function (_e) {\n switch (_e.label) {\n case 0:\n _b = (_a = globalThis.crypto.subtle).encrypt;\n _c = [{ name: constants.RSA_READ_ALG }];\n if (!(typeof publicKey === \"string\")) return [3 /*break*/, 2];\n return [4 /*yield*/, keys.default.importPublicKey(publicKey, hashAlg, types.KeyUse.Read)];\n case 1:\n _d = _e.sent();\n return [3 /*break*/, 3];\n case 2:\n _d = publicKey;\n _e.label = 3;\n case 3: return [2 /*return*/, _b.apply(_a, _c.concat([_d, utils.normalizeUnicodeToBuf(msg, charSize)]))];\n }\n });\n });\n }\n var encrypt_1 = encrypt;\n function decrypt(msg, privateKey) {\n return __awaiter$2(this, void 0, void 0, function () {\n var normalized;\n return __generator$2(this, function (_a) {\n normalized = utils.normalizeBase64ToBuf(msg);\n return [2 /*return*/, globalThis.crypto.subtle.decrypt({ name: constants.RSA_READ_ALG }, privateKey, normalized)];\n });\n });\n }\n var decrypt_1 = decrypt;\n function getPublicKey(keypair) {\n return __awaiter$2(this, void 0, void 0, function () {\n var spki;\n return __generator$2(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, globalThis.crypto.subtle.exportKey('spki', keypair.publicKey)];\n case 1:\n spki = _a.sent();\n return [2 /*return*/, utils.default.arrBufToBase64(spki)];\n }\n });\n });\n }\n var getPublicKey_1 = getPublicKey;\n var _default$1 = {\n sign: sign,\n verify: verify,\n encrypt: encrypt,\n decrypt: decrypt,\n getPublicKey: getPublicKey,\n };\n //# sourceMappingURL=operations.js.map\n\n var operations = /*#__PURE__*/Object.defineProperty({\n \tsign: sign_1,\n \tverify: verify_1,\n \tencrypt: encrypt_1,\n \tdecrypt: decrypt_1,\n \tgetPublicKey: getPublicKey_1,\n \tdefault: _default$1\n }, '__esModule', {value: true});\n\n var __awaiter$3 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n var __generator$3 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n\n\n\n /* istanbul ignore next */\n function createStore(name) {\n return localforage.default.createInstance({ name: name });\n }\n var createStore_1 = createStore;\n function createIfDoesNotExist(id, makeFn, store) {\n if (store === void 0) { store = localforage.default; }\n return __awaiter$3(this, void 0, void 0, function () {\n var key;\n return __generator$3(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, exists(id, store)];\n case 1:\n if (_a.sent()) {\n return [2 /*return*/];\n }\n return [4 /*yield*/, makeFn()];\n case 2:\n key = _a.sent();\n return [4 /*yield*/, put(id, key, store)];\n case 3:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n }\n var createIfDoesNotExist_1 = createIfDoesNotExist;\n /* istanbul ignore next */\n function put(id, key, store) {\n if (store === void 0) { store = localforage.default; }\n return __awaiter$3(this, void 0, void 0, function () {\n return __generator$3(this, function (_a) {\n return [2 /*return*/, store.setItem(id, key)];\n });\n });\n }\n var put_1 = put;\n /* istanbul ignore next */\n function getKeypair(id, store) {\n if (store === void 0) { store = localforage.default; }\n return __awaiter$3(this, void 0, void 0, function () {\n return __generator$3(this, function (_a) {\n return [2 /*return*/, get(id, errors.checkIsKeyPair, store)];\n });\n });\n }\n var getKeypair_1 = getKeypair;\n /* istanbul ignore next */\n function getKey(id, store) {\n if (store === void 0) { store = localforage.default; }\n return __awaiter$3(this, void 0, void 0, function () {\n return __generator$3(this, function (_a) {\n return [2 /*return*/, get(id, errors.checkIsKey, store)];\n });\n });\n }\n var getKey_1 = getKey;\n /* istanbul ignore next */\n function get(id, checkFn, store) {\n if (store === void 0) { store = localforage.default; }\n return __awaiter$3(this, void 0, void 0, function () {\n var item;\n return __generator$3(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, store.getItem(id)];\n case 1:\n item = _a.sent();\n return [2 /*return*/, item === null ? null : checkFn(item)];\n }\n });\n });\n }\n var get_1 = get;\n /* istanbul ignore next */\n function exists(id, store) {\n if (store === void 0) { store = localforage.default; }\n return __awaiter$3(this, void 0, void 0, function () {\n var key;\n return __generator$3(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, store.getItem(id)];\n case 1:\n key = _a.sent();\n return [2 /*return*/, key !== null];\n }\n });\n });\n }\n var exists_1 = exists;\n /* istanbul ignore next */\n function rm(id, store) {\n if (store === void 0) { store = localforage.default; }\n return __awaiter$3(this, void 0, void 0, function () {\n return __generator$3(this, function (_a) {\n return [2 /*return*/, store.removeItem(id)];\n });\n });\n }\n var rm_1 = rm;\n function dropStore(store) {\n return __awaiter$3(this, void 0, void 0, function () {\n return __generator$3(this, function (_a) {\n return [2 /*return*/, store.dropInstance()];\n });\n });\n }\n var dropStore_1 = dropStore;\n /* istanbul ignore next */\n function clear(store) {\n return __awaiter$3(this, void 0, void 0, function () {\n return __generator$3(this, function (_a) {\n if (store) {\n return [2 /*return*/, dropStore(store)];\n }\n else {\n return [2 /*return*/, localforage.default.clear()];\n }\n });\n });\n }\n var clear_1 = clear;\n var _default$2 = {\n createStore: createStore,\n createIfDoesNotExist: createIfDoesNotExist,\n put: put,\n getKeypair: getKeypair,\n getKey: getKey,\n exists: exists,\n rm: rm,\n dropStore: dropStore,\n clear: clear\n };\n\n\n var idb = /*#__PURE__*/Object.defineProperty({\n \tcreateStore: createStore_1,\n \tcreateIfDoesNotExist: createIfDoesNotExist_1,\n \tput: put_1,\n \tgetKeypair: getKeypair_1,\n \tgetKey: getKey_1,\n \tget: get_1,\n \texists: exists_1,\n \trm: rm_1,\n \tdropStore: dropStore_1,\n \tclear: clear_1,\n \tdefault: _default$2\n }, '__esModule', {value: true});\n\n var __awaiter$4 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n var __generator$4 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n\n\n\n\n\n function makeKeypair$1(curve, use) {\n return __awaiter$4(this, void 0, void 0, function () {\n var alg, uses;\n return __generator$4(this, function (_a) {\n errors.checkValidKeyUse(use);\n alg = use === types.KeyUse.Read ? constants.ECC_READ_ALG : constants.ECC_WRITE_ALG;\n uses = use === types.KeyUse.Read ? ['deriveKey', 'deriveBits'] : ['sign', 'verify'];\n return [2 /*return*/, globalThis.crypto.subtle.generateKey({ name: alg, namedCurve: curve }, false, uses)];\n });\n });\n }\n var makeKeypair_1$1 = makeKeypair$1;\n function importPublicKey$1(base64Key, curve, use) {\n return __awaiter$4(this, void 0, void 0, function () {\n var alg, uses, buf;\n return __generator$4(this, function (_a) {\n errors.checkValidKeyUse(use);\n alg = use === types.KeyUse.Read ? constants.ECC_READ_ALG : constants.ECC_WRITE_ALG;\n uses = use === types.KeyUse.Read ? [] : ['verify'];\n buf = utils.default.base64ToArrBuf(base64Key);\n return [2 /*return*/, globalThis.crypto.subtle.importKey('raw', buf, { name: alg, namedCurve: curve }, true, uses)];\n });\n });\n }\n var importPublicKey_1$1 = importPublicKey$1;\n var _default$3 = {\n makeKeypair: makeKeypair$1,\n importPublicKey: importPublicKey$1\n };\n //# sourceMappingURL=keys.js.map\n\n var keys$1 = /*#__PURE__*/Object.defineProperty({\n \tmakeKeypair: makeKeypair_1$1,\n \timportPublicKey: importPublicKey_1$1,\n \tdefault: _default$3\n }, '__esModule', {value: true});\n\n var config$1 = createCommonjsModule(function (module, exports) {\n var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n\n\n\n\n exports.defaultConfig = {\n type: constants.DEFAULT_CRYPTOSYSTEM,\n curve: constants.DEFAULT_ECC_CURVE,\n rsaSize: constants.DEFAULT_RSA_SIZE,\n symmAlg: constants.DEFAULT_SYMM_ALG,\n symmLen: constants.DEFAULT_SYMM_LEN,\n hashAlg: constants.DEFAULT_HASH_ALG,\n charSize: constants.DEFAULT_CHAR_SIZE,\n storeName: constants.DEFAULT_STORE_NAME,\n readKeyName: constants.DEFAULT_READ_KEY_NAME,\n writeKeyName: constants.DEFAULT_WRITE_KEY_NAME\n };\n function normalize(maybeCfg, eccEnabled) {\n if (eccEnabled === void 0) { eccEnabled = true; }\n var cfg;\n if (!maybeCfg) {\n cfg = exports.defaultConfig;\n }\n else {\n cfg = __assign(__assign({}, exports.defaultConfig), maybeCfg);\n }\n if (!(maybeCfg === null || maybeCfg === void 0 ? void 0 : maybeCfg.type)) {\n cfg.type = eccEnabled ? types.CryptoSystem.ECC : types.CryptoSystem.RSA;\n }\n return cfg;\n }\n exports.normalize = normalize;\n // Attempt a structural clone of an ECC Key (required to store in IndexedDB)\n // If it throws an error, use RSA, otherwise use ECC\n function eccEnabled() {\n return __awaiter(this, void 0, void 0, function () {\n var keypair;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, keys$1.default.makeKeypair(constants.DEFAULT_ECC_CURVE, types.KeyUse.Read)];\n case 1:\n keypair = _a.sent();\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, utils.default.structuralClone(keypair)];\n case 3:\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n _a.sent();\n return [2 /*return*/, false];\n case 5: return [2 /*return*/, true];\n }\n });\n });\n }\n exports.eccEnabled = eccEnabled;\n function merge(cfg, overwrites) {\n if (overwrites === void 0) { overwrites = {}; }\n return __assign(__assign({}, cfg), overwrites);\n }\n exports.merge = merge;\n function symmKeyOpts(cfg) {\n return { alg: cfg.symmAlg, length: cfg.symmLen };\n }\n exports.symmKeyOpts = symmKeyOpts;\n exports.default = {\n defaultConfig: exports.defaultConfig,\n normalize: normalize,\n eccEnabled: eccEnabled,\n merge: merge,\n symmKeyOpts: symmKeyOpts\n };\n\n });\n\n var __awaiter$5 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n var __generator$5 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n\n\n\n function makeKey(opts) {\n return __awaiter$5(this, void 0, void 0, function () {\n return __generator$5(this, function (_a) {\n return [2 /*return*/, globalThis.crypto.subtle.generateKey({\n name: (opts === null || opts === void 0 ? void 0 : opts.alg) || constants.DEFAULT_SYMM_ALG,\n length: (opts === null || opts === void 0 ? void 0 : opts.length) || constants.DEFAULT_SYMM_LEN,\n }, true, ['encrypt', 'decrypt'])];\n });\n });\n }\n var makeKey_1 = makeKey;\n function importKey(base64key, opts) {\n return __awaiter$5(this, void 0, void 0, function () {\n var buf;\n return __generator$5(this, function (_a) {\n buf = utils.default.base64ToArrBuf(base64key);\n return [2 /*return*/, globalThis.crypto.subtle.importKey('raw', buf, {\n name: (opts === null || opts === void 0 ? void 0 : opts.alg) || constants.DEFAULT_SYMM_ALG,\n length: (opts === null || opts === void 0 ? void 0 : opts.length) || constants.DEFAULT_SYMM_LEN,\n }, true, ['encrypt', 'decrypt'])];\n });\n });\n }\n var importKey_1 = importKey;\n var _default$4 = {\n makeKey: makeKey,\n importKey: importKey,\n };\n //# sourceMappingURL=keys.js.map\n\n var keys$2 = /*#__PURE__*/Object.defineProperty({\n \tmakeKey: makeKey_1,\n \timportKey: importKey_1,\n \tdefault: _default$4\n }, '__esModule', {value: true});\n\n var __awaiter$6 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n var __generator$6 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n\n\n\n\n\n function encryptBytes(msg, key, opts) {\n return __awaiter$6(this, void 0, void 0, function () {\n var data, importedKey, _a, alg, iv, cipherBuf;\n return __generator$6(this, function (_b) {\n switch (_b.label) {\n case 0:\n data = utils.default.normalizeUtf16ToBuf(msg);\n if (!(typeof key === 'string')) return [3 /*break*/, 2];\n return [4 /*yield*/, keys$2.default.importKey(key, opts)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _a = key;\n _b.label = 3;\n case 3:\n importedKey = _a;\n alg = (opts === null || opts === void 0 ? void 0 : opts.alg) || constants.DEFAULT_SYMM_ALG;\n iv = (opts === null || opts === void 0 ? void 0 : opts.iv) || utils.default.randomBuf(16);\n return [4 /*yield*/, globalThis.crypto.subtle.encrypt({\n name: alg,\n // AES-CTR uses a counter, AES-GCM/AES-CBC use an initialization vector\n iv: alg === types.SymmAlg.AES_CTR ? undefined : iv,\n counter: alg === types.SymmAlg.AES_CTR ? new Uint8Array(iv) : undefined,\n length: alg === types.SymmAlg.AES_CTR ? constants.DEFAULT_CTR_LEN : undefined,\n }, importedKey, data)];\n case 4:\n cipherBuf = _b.sent();\n return [2 /*return*/, utils.default.joinBufs(iv, cipherBuf)];\n }\n });\n });\n }\n var encryptBytes_1 = encryptBytes;\n function decryptBytes(msg, key, opts) {\n return __awaiter$6(this, void 0, void 0, function () {\n var cipherText, importedKey, _a, alg, iv, cipherBytes, msgBuff;\n return __generator$6(this, function (_b) {\n switch (_b.label) {\n case 0:\n cipherText = utils.default.normalizeBase64ToBuf(msg);\n if (!(typeof key === 'string')) return [3 /*break*/, 2];\n return [4 /*yield*/, keys$2.default.importKey(key, opts)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _a = key;\n _b.label = 3;\n case 3:\n importedKey = _a;\n alg = (opts === null || opts === void 0 ? void 0 : opts.alg) || constants.DEFAULT_SYMM_ALG;\n iv = cipherText.slice(0, 16);\n cipherBytes = cipherText.slice(16);\n return [4 /*yield*/, globalThis.crypto.subtle.decrypt({ name: alg,\n // AES-CTR uses a counter, AES-GCM/AES-CBC use an initialization vector\n iv: alg === types.SymmAlg.AES_CTR ? undefined : iv,\n counter: alg === types.SymmAlg.AES_CTR ? new Uint8Array(iv) : undefined,\n length: alg === types.SymmAlg.AES_CTR ? constants.DEFAULT_CTR_LEN : undefined,\n }, importedKey, cipherBytes)];\n case 4:\n msgBuff = _b.sent();\n return [2 /*return*/, msgBuff];\n }\n });\n });\n }\n var decryptBytes_1 = decryptBytes;\n function encrypt$1(msg, key, opts) {\n return __awaiter$6(this, void 0, void 0, function () {\n var cipherText;\n return __generator$6(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, encryptBytes(msg, key, opts)];\n case 1:\n cipherText = _a.sent();\n return [2 /*return*/, utils.default.arrBufToBase64(cipherText)];\n }\n });\n });\n }\n var encrypt_1$1 = encrypt$1;\n function decrypt$1(msg, key, opts) {\n return __awaiter$6(this, void 0, void 0, function () {\n var msgBytes;\n return __generator$6(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, decryptBytes(msg, key, opts)];\n case 1:\n msgBytes = _a.sent();\n return [2 /*return*/, utils.default.arrBufToStr(msgBytes, 16)];\n }\n });\n });\n }\n var decrypt_1$1 = decrypt$1;\n function exportKey(key) {\n return __awaiter$6(this, void 0, void 0, function () {\n var raw;\n return __generator$6(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, globalThis.crypto.subtle.exportKey('raw', key)];\n case 1:\n raw = _a.sent();\n return [2 /*return*/, utils.default.arrBufToBase64(raw)];\n }\n });\n });\n }\n var exportKey_1 = exportKey;\n var _default$5 = {\n encryptBytes: encryptBytes,\n decryptBytes: decryptBytes,\n encrypt: encrypt$1,\n decrypt: decrypt$1,\n exportKey: exportKey\n };\n //# sourceMappingURL=operations.js.map\n\n var operations$1 = /*#__PURE__*/Object.defineProperty({\n \tencryptBytes: encryptBytes_1,\n \tdecryptBytes: decryptBytes_1,\n \tencrypt: encrypt_1$1,\n \tdecrypt: decrypt_1$1,\n \texportKey: exportKey_1,\n \tdefault: _default$5\n }, '__esModule', {value: true});\n\n var aes = createCommonjsModule(function (module, exports) {\n var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n Object.defineProperty(exports, \"__esModule\", { value: true });\n\n\n __export(keys$2);\n __export(operations$1);\n exports.default = __assign(__assign({}, keys$2.default), operations$1.default);\n\n });\n\n var aes$1 = /*@__PURE__*/getDefaultExportFromCjs(aes);\n\n var __awaiter$7 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n var __generator$7 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n\n\n\n\n\n\n var KeyStoreBase = /** @class */ (function () {\n function KeyStoreBase(cfg, store) {\n this.cfg = cfg;\n this.store = store;\n }\n KeyStoreBase.prototype.writeKey = function () {\n return __awaiter$7(this, void 0, void 0, function () {\n var maybeKey;\n return __generator$7(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, idb.default.getKeypair(this.cfg.writeKeyName, this.store)];\n case 1:\n maybeKey = _a.sent();\n return [2 /*return*/, errors.checkIsKeyPair(maybeKey)];\n }\n });\n });\n };\n KeyStoreBase.prototype.readKey = function () {\n return __awaiter$7(this, void 0, void 0, function () {\n var maybeKey;\n return __generator$7(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, idb.default.getKeypair(this.cfg.readKeyName, this.store)];\n case 1:\n maybeKey = _a.sent();\n return [2 /*return*/, errors.checkIsKeyPair(maybeKey)];\n }\n });\n });\n };\n KeyStoreBase.prototype.getSymmKey = function (keyName, cfg) {\n return __awaiter$7(this, void 0, void 0, function () {\n var mergedCfg, maybeKey, key;\n return __generator$7(this, function (_a) {\n switch (_a.label) {\n case 0:\n mergedCfg = config$1.default.merge(this.cfg, cfg);\n return [4 /*yield*/, idb.default.getKey(keyName, this.store)];\n case 1:\n maybeKey = _a.sent();\n if (maybeKey !== null) {\n return [2 /*return*/, maybeKey];\n }\n return [4 /*yield*/, aes.default.makeKey(config$1.default.symmKeyOpts(mergedCfg))];\n case 2:\n key = _a.sent();\n return [4 /*yield*/, idb.default.put(keyName, key, this.store)];\n case 3:\n _a.sent();\n return [2 /*return*/, key];\n }\n });\n });\n };\n KeyStoreBase.prototype.keyExists = function (keyName) {\n return __awaiter$7(this, void 0, void 0, function () {\n var key;\n return __generator$7(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, idb.default.getKey(keyName, this.store)];\n case 1:\n key = _a.sent();\n return [2 /*return*/, key !== null];\n }\n });\n });\n };\n KeyStoreBase.prototype.deleteKey = function (keyName) {\n return __awaiter$7(this, void 0, void 0, function () {\n return __generator$7(this, function (_a) {\n return [2 /*return*/, idb.default.rm(keyName, this.store)];\n });\n });\n };\n KeyStoreBase.prototype.destroy = function () {\n return __awaiter$7(this, void 0, void 0, function () {\n return __generator$7(this, function (_a) {\n return [2 /*return*/, idb.default.dropStore(this.store)];\n });\n });\n };\n KeyStoreBase.prototype.importSymmKey = function (keyStr, keyName, cfg) {\n return __awaiter$7(this, void 0, void 0, function () {\n var mergedCfg, key;\n return __generator$7(this, function (_a) {\n switch (_a.label) {\n case 0:\n mergedCfg = config$1.default.merge(this.cfg, cfg);\n return [4 /*yield*/, aes.default.importKey(keyStr, config$1.default.symmKeyOpts(mergedCfg))];\n case 1:\n key = _a.sent();\n return [4 /*yield*/, idb.default.put(keyName, key, this.store)];\n case 2:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n KeyStoreBase.prototype.exportSymmKey = function (keyName, cfg) {\n return __awaiter$7(this, void 0, void 0, function () {\n var key;\n return __generator$7(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.getSymmKey(keyName, cfg)];\n case 1:\n key = _a.sent();\n return [2 /*return*/, aes.default.exportKey(key)];\n }\n });\n });\n };\n KeyStoreBase.prototype.encryptWithSymmKey = function (msg, keyName, cfg) {\n return __awaiter$7(this, void 0, void 0, function () {\n var mergedCfg, key, cipherText;\n return __generator$7(this, function (_a) {\n switch (_a.label) {\n case 0:\n mergedCfg = config$1.default.merge(this.cfg, cfg);\n return [4 /*yield*/, this.getSymmKey(keyName, cfg)];\n case 1:\n key = _a.sent();\n return [4 /*yield*/, aes.default.encryptBytes(utils.default.strToArrBuf(msg, mergedCfg.charSize), key, config$1.default.symmKeyOpts(mergedCfg))];\n case 2:\n cipherText = _a.sent();\n return [2 /*return*/, utils.default.arrBufToBase64(cipherText)];\n }\n });\n });\n };\n KeyStoreBase.prototype.decryptWithSymmKey = function (cipherText, keyName, cfg) {\n return __awaiter$7(this, void 0, void 0, function () {\n var mergedCfg, key, msgBytes;\n return __generator$7(this, function (_a) {\n switch (_a.label) {\n case 0:\n mergedCfg = config$1.default.merge(this.cfg, cfg);\n return [4 /*yield*/, this.getSymmKey(keyName, cfg)];\n case 1:\n key = _a.sent();\n return [4 /*yield*/, aes.default.decryptBytes(utils.default.base64ToArrBuf(cipherText), key, config$1.default.symmKeyOpts(mergedCfg))];\n case 2:\n msgBytes = _a.sent();\n return [2 /*return*/, utils.default.arrBufToStr(msgBytes, mergedCfg.charSize)];\n }\n });\n });\n };\n return KeyStoreBase;\n }());\n var _default$6 = KeyStoreBase;\n\n\n var base = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$6\n }, '__esModule', {value: true});\n\n var __extends$1 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var __assign$1 = (commonjsGlobal && commonjsGlobal.__assign) || function () {\n __assign$1 = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign$1.apply(this, arguments);\n };\n var __awaiter$8 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n var __generator$8 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n\n\n\n\n\n\n\n\n var RSAKeyStore = /** @class */ (function (_super) {\n __extends$1(RSAKeyStore, _super);\n function RSAKeyStore() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RSAKeyStore.init = function (maybeCfg) {\n return __awaiter$8(this, void 0, void 0, function () {\n var cfg, rsaSize, hashAlg, storeName, readKeyName, writeKeyName, store;\n return __generator$8(this, function (_a) {\n switch (_a.label) {\n case 0:\n cfg = config$1.default.normalize(__assign$1(__assign$1({}, (maybeCfg || {})), { type: types.CryptoSystem.RSA }));\n rsaSize = cfg.rsaSize, hashAlg = cfg.hashAlg, storeName = cfg.storeName, readKeyName = cfg.readKeyName, writeKeyName = cfg.writeKeyName;\n store = idb.default.createStore(storeName);\n return [4 /*yield*/, idb.default.createIfDoesNotExist(readKeyName, function () { return (keys.default.makeKeypair(rsaSize, hashAlg, types.KeyUse.Read)); }, store)];\n case 1:\n _a.sent();\n return [4 /*yield*/, idb.default.createIfDoesNotExist(writeKeyName, function () { return (keys.default.makeKeypair(rsaSize, hashAlg, types.KeyUse.Write)); }, store)];\n case 2:\n _a.sent();\n return [2 /*return*/, new RSAKeyStore(cfg, store)];\n }\n });\n });\n };\n RSAKeyStore.prototype.sign = function (msg, cfg) {\n return __awaiter$8(this, void 0, void 0, function () {\n var mergedCfg, writeKey, _a, _b;\n return __generator$8(this, function (_c) {\n switch (_c.label) {\n case 0:\n mergedCfg = config$1.default.merge(this.cfg, cfg);\n return [4 /*yield*/, this.writeKey()];\n case 1:\n writeKey = _c.sent();\n _b = (_a = utils.default).arrBufToBase64;\n return [4 /*yield*/, operations.default.sign(msg, writeKey.privateKey, mergedCfg.charSize)];\n case 2: return [2 /*return*/, _b.apply(_a, [_c.sent()])];\n }\n });\n });\n };\n RSAKeyStore.prototype.verify = function (msg, sig, publicKey, cfg) {\n return __awaiter$8(this, void 0, void 0, function () {\n var mergedCfg;\n return __generator$8(this, function (_a) {\n mergedCfg = config$1.default.merge(this.cfg, cfg);\n return [2 /*return*/, operations.default.verify(msg, sig, publicKey, mergedCfg.charSize, mergedCfg.hashAlg)];\n });\n });\n };\n RSAKeyStore.prototype.encrypt = function (msg, publicKey, cfg) {\n return __awaiter$8(this, void 0, void 0, function () {\n var mergedCfg, _a, _b;\n return __generator$8(this, function (_c) {\n switch (_c.label) {\n case 0:\n mergedCfg = config$1.default.merge(this.cfg, cfg);\n _b = (_a = utils.default).arrBufToBase64;\n return [4 /*yield*/, operations.default.encrypt(msg, publicKey, mergedCfg.charSize, mergedCfg.hashAlg)];\n case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];\n }\n });\n });\n };\n RSAKeyStore.prototype.decrypt = function (cipherText, publicKey, // unused param so that keystore interfaces match\n cfg) {\n return __awaiter$8(this, void 0, void 0, function () {\n var readKey, mergedCfg, _a, _b;\n return __generator$8(this, function (_c) {\n switch (_c.label) {\n case 0: return [4 /*yield*/, this.readKey()];\n case 1:\n readKey = _c.sent();\n mergedCfg = config$1.default.merge(this.cfg, cfg);\n _b = (_a = utils.default).arrBufToStr;\n return [4 /*yield*/, operations.default.decrypt(cipherText, readKey.privateKey)];\n case 2: return [2 /*return*/, _b.apply(_a, [_c.sent(),\n mergedCfg.charSize])];\n }\n });\n });\n };\n RSAKeyStore.prototype.publicReadKey = function () {\n return __awaiter$8(this, void 0, void 0, function () {\n var readKey;\n return __generator$8(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.readKey()];\n case 1:\n readKey = _a.sent();\n return [2 /*return*/, operations.default.getPublicKey(readKey)];\n }\n });\n });\n };\n RSAKeyStore.prototype.publicWriteKey = function () {\n return __awaiter$8(this, void 0, void 0, function () {\n var writeKey;\n return __generator$8(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.writeKey()];\n case 1:\n writeKey = _a.sent();\n return [2 /*return*/, operations.default.getPublicKey(writeKey)];\n }\n });\n });\n };\n return RSAKeyStore;\n }(base.default));\n var RSAKeyStore_1 = RSAKeyStore;\n var _default$7 = RSAKeyStore;\n\n\n var keystore = /*#__PURE__*/Object.defineProperty({\n \tRSAKeyStore: RSAKeyStore_1,\n \tdefault: _default$7\n }, '__esModule', {value: true});\n\n var rsa = createCommonjsModule(function (module, exports) {\n var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n Object.defineProperty(exports, \"__esModule\", { value: true });\n\n\n\n __export(keys);\n __export(operations);\n __export(keystore);\n exports.default = __assign(__assign(__assign({}, keys.default), operations.default), keystore.default);\n\n });\n\n var rsaOperations = /*@__PURE__*/getDefaultExportFromCjs(rsa);\n\n // Took this one-liner from: https://www.npmjs.com/package/browser-or-node\n var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n var assertBrowser = function (method) {\n if (!isBrowser) {\n throw new Error(\"Must be in browser to use method. Provide a node-compatible implementation for \" + method);\n }\n };\n\n var index_umd = createCommonjsModule(function (module, exports) {\n (function (global, factory) {\n module.exports = factory() ;\n }(commonjsGlobal, (function () {\n /*! *****************************************************************************\n Copyright (c) Microsoft Corporation. All rights reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\n this file except in compliance with the License. You may obtain a copy of the\n License at http://www.apache.org/licenses/LICENSE-2.0\n\n THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n MERCHANTABLITY OR NON-INFRINGEMENT.\n\n See the Apache Version 2.0 License for specific language governing permissions\n and limitations under the License.\n ***************************************************************************** */\n /* global Reflect, Promise */\n\n var extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n\n function __extends(d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n }\n\n var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n\n function __awaiter(thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n }\n\n function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n }\n\n (function (Object) {\n typeof globalThis !== 'object' && (\n this ?\n get() :\n (Object.defineProperty(Object.prototype, '_T_', {\n configurable: true,\n get: get\n }), _T_)\n );\n function get() {\n var global = this || self;\n global.globalThis = global;\n delete Object.prototype._T_;\n }\n }(Object));\n\n var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof self !== 'undefined' ? self : {};\n\n function commonjsRequire () {\n \tthrow new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');\n }\n\n function createCommonjsModule(fn, module) {\n \treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n }\n\n var localforage = createCommonjsModule(function (module, exports) {\n /*!\n localForage -- Offline Storage, Improved\n Version 1.7.3\n https://localforage.github.io/localForage\n (c) 2013-2017 Mozilla, Apache License 2.0\n */\n (function(f){{module.exports=f();}})(function(){return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof commonjsRequire==\"function\"&&commonjsRequire;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw (f.code=\"MODULE_NOT_FOUND\", f)}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r);}return n[o].exports}var i=typeof commonjsRequire==\"function\"&&commonjsRequire;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){\n (function (global){\n var Mutation = global.MutationObserver || global.WebKitMutationObserver;\n\n var scheduleDrain;\n\n {\n if (Mutation) {\n var called = 0;\n var observer = new Mutation(nextTick);\n var element = global.document.createTextNode('');\n observer.observe(element, {\n characterData: true\n });\n scheduleDrain = function () {\n element.data = (called = ++called % 2);\n };\n } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {\n var channel = new global.MessageChannel();\n channel.port1.onmessage = nextTick;\n scheduleDrain = function () {\n channel.port2.postMessage(0);\n };\n } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {\n scheduleDrain = function () {\n\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n var scriptEl = global.document.createElement('script');\n scriptEl.onreadystatechange = function () {\n nextTick();\n\n scriptEl.onreadystatechange = null;\n scriptEl.parentNode.removeChild(scriptEl);\n scriptEl = null;\n };\n global.document.documentElement.appendChild(scriptEl);\n };\n } else {\n scheduleDrain = function () {\n setTimeout(nextTick, 0);\n };\n }\n }\n\n var draining;\n var queue = [];\n //named nextTick for less confusing stack traces\n function nextTick() {\n draining = true;\n var i, oldQueue;\n var len = queue.length;\n while (len) {\n oldQueue = queue;\n queue = [];\n i = -1;\n while (++i < len) {\n oldQueue[i]();\n }\n len = queue.length;\n }\n draining = false;\n }\n\n module.exports = immediate;\n function immediate(task) {\n if (queue.push(task) === 1 && !draining) {\n scheduleDrain();\n }\n }\n\n }).call(this,typeof commonjsGlobal$1 !== \"undefined\" ? commonjsGlobal$1 : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n },{}],2:[function(_dereq_,module,exports){\n var immediate = _dereq_(1);\n\n /* istanbul ignore next */\n function INTERNAL() {}\n\n var handlers = {};\n\n var REJECTED = ['REJECTED'];\n var FULFILLED = ['FULFILLED'];\n var PENDING = ['PENDING'];\n\n module.exports = Promise;\n\n function Promise(resolver) {\n if (typeof resolver !== 'function') {\n throw new TypeError('resolver must be a function');\n }\n this.state = PENDING;\n this.queue = [];\n this.outcome = void 0;\n if (resolver !== INTERNAL) {\n safelyResolveThenable(this, resolver);\n }\n }\n\n Promise.prototype[\"catch\"] = function (onRejected) {\n return this.then(null, onRejected);\n };\n Promise.prototype.then = function (onFulfilled, onRejected) {\n if (typeof onFulfilled !== 'function' && this.state === FULFILLED ||\n typeof onRejected !== 'function' && this.state === REJECTED) {\n return this;\n }\n var promise = new this.constructor(INTERNAL);\n if (this.state !== PENDING) {\n var resolver = this.state === FULFILLED ? onFulfilled : onRejected;\n unwrap(promise, resolver, this.outcome);\n } else {\n this.queue.push(new QueueItem(promise, onFulfilled, onRejected));\n }\n\n return promise;\n };\n function QueueItem(promise, onFulfilled, onRejected) {\n this.promise = promise;\n if (typeof onFulfilled === 'function') {\n this.onFulfilled = onFulfilled;\n this.callFulfilled = this.otherCallFulfilled;\n }\n if (typeof onRejected === 'function') {\n this.onRejected = onRejected;\n this.callRejected = this.otherCallRejected;\n }\n }\n QueueItem.prototype.callFulfilled = function (value) {\n handlers.resolve(this.promise, value);\n };\n QueueItem.prototype.otherCallFulfilled = function (value) {\n unwrap(this.promise, this.onFulfilled, value);\n };\n QueueItem.prototype.callRejected = function (value) {\n handlers.reject(this.promise, value);\n };\n QueueItem.prototype.otherCallRejected = function (value) {\n unwrap(this.promise, this.onRejected, value);\n };\n\n function unwrap(promise, func, value) {\n immediate(function () {\n var returnValue;\n try {\n returnValue = func(value);\n } catch (e) {\n return handlers.reject(promise, e);\n }\n if (returnValue === promise) {\n handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));\n } else {\n handlers.resolve(promise, returnValue);\n }\n });\n }\n\n handlers.resolve = function (self, value) {\n var result = tryCatch(getThen, value);\n if (result.status === 'error') {\n return handlers.reject(self, result.value);\n }\n var thenable = result.value;\n\n if (thenable) {\n safelyResolveThenable(self, thenable);\n } else {\n self.state = FULFILLED;\n self.outcome = value;\n var i = -1;\n var len = self.queue.length;\n while (++i < len) {\n self.queue[i].callFulfilled(value);\n }\n }\n return self;\n };\n handlers.reject = function (self, error) {\n self.state = REJECTED;\n self.outcome = error;\n var i = -1;\n var len = self.queue.length;\n while (++i < len) {\n self.queue[i].callRejected(error);\n }\n return self;\n };\n\n function getThen(obj) {\n // Make sure we only access the accessor once as required by the spec\n var then = obj && obj.then;\n if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') {\n return function appyThen() {\n then.apply(obj, arguments);\n };\n }\n }\n\n function safelyResolveThenable(self, thenable) {\n // Either fulfill, reject or reject with error\n var called = false;\n function onError(value) {\n if (called) {\n return;\n }\n called = true;\n handlers.reject(self, value);\n }\n\n function onSuccess(value) {\n if (called) {\n return;\n }\n called = true;\n handlers.resolve(self, value);\n }\n\n function tryToUnwrap() {\n thenable(onSuccess, onError);\n }\n\n var result = tryCatch(tryToUnwrap);\n if (result.status === 'error') {\n onError(result.value);\n }\n }\n\n function tryCatch(func, value) {\n var out = {};\n try {\n out.value = func(value);\n out.status = 'success';\n } catch (e) {\n out.status = 'error';\n out.value = e;\n }\n return out;\n }\n\n Promise.resolve = resolve;\n function resolve(value) {\n if (value instanceof this) {\n return value;\n }\n return handlers.resolve(new this(INTERNAL), value);\n }\n\n Promise.reject = reject;\n function reject(reason) {\n var promise = new this(INTERNAL);\n return handlers.reject(promise, reason);\n }\n\n Promise.all = all;\n function all(iterable) {\n var self = this;\n if (Object.prototype.toString.call(iterable) !== '[object Array]') {\n return this.reject(new TypeError('must be an array'));\n }\n\n var len = iterable.length;\n var called = false;\n if (!len) {\n return this.resolve([]);\n }\n\n var values = new Array(len);\n var resolved = 0;\n var i = -1;\n var promise = new this(INTERNAL);\n\n while (++i < len) {\n allResolver(iterable[i], i);\n }\n return promise;\n function allResolver(value, i) {\n self.resolve(value).then(resolveFromAll, function (error) {\n if (!called) {\n called = true;\n handlers.reject(promise, error);\n }\n });\n function resolveFromAll(outValue) {\n values[i] = outValue;\n if (++resolved === len && !called) {\n called = true;\n handlers.resolve(promise, values);\n }\n }\n }\n }\n\n Promise.race = race;\n function race(iterable) {\n var self = this;\n if (Object.prototype.toString.call(iterable) !== '[object Array]') {\n return this.reject(new TypeError('must be an array'));\n }\n\n var len = iterable.length;\n var called = false;\n if (!len) {\n return this.resolve([]);\n }\n\n var i = -1;\n var promise = new this(INTERNAL);\n\n while (++i < len) {\n resolver(iterable[i]);\n }\n return promise;\n function resolver(value) {\n self.resolve(value).then(function (response) {\n if (!called) {\n called = true;\n handlers.resolve(promise, response);\n }\n }, function (error) {\n if (!called) {\n called = true;\n handlers.reject(promise, error);\n }\n });\n }\n }\n\n },{\"1\":1}],3:[function(_dereq_,module,exports){\n (function (global){\n if (typeof global.Promise !== 'function') {\n global.Promise = _dereq_(2);\n }\n\n }).call(this,typeof commonjsGlobal$1 !== \"undefined\" ? commonjsGlobal$1 : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n },{\"2\":2}],4:[function(_dereq_,module,exports){\n\n var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n function getIDB() {\n /* global indexedDB,webkitIndexedDB,mozIndexedDB,OIndexedDB,msIndexedDB */\n try {\n if (typeof indexedDB !== 'undefined') {\n return indexedDB;\n }\n if (typeof webkitIndexedDB !== 'undefined') {\n return webkitIndexedDB;\n }\n if (typeof mozIndexedDB !== 'undefined') {\n return mozIndexedDB;\n }\n if (typeof OIndexedDB !== 'undefined') {\n return OIndexedDB;\n }\n if (typeof msIndexedDB !== 'undefined') {\n return msIndexedDB;\n }\n } catch (e) {\n return;\n }\n }\n\n var idb = getIDB();\n\n function isIndexedDBValid() {\n try {\n // Initialize IndexedDB; fall back to vendor-prefixed versions\n // if needed.\n if (!idb) {\n return false;\n }\n // We mimic PouchDB here;\n //\n // We test for openDatabase because IE Mobile identifies itself\n // as Safari. Oh the lulz...\n var isSafari = typeof openDatabase !== 'undefined' && /(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) && !/BlackBerry/.test(navigator.platform);\n\n var hasFetch = typeof fetch === 'function' && fetch.toString().indexOf('[native code') !== -1;\n\n // Safari <10.1 does not meet our requirements for IDB support (#5572)\n // since Safari 10.1 shipped with fetch, we can use that to detect it\n return (!isSafari || hasFetch) && typeof indexedDB !== 'undefined' &&\n // some outdated implementations of IDB that appear on Samsung\n // and HTC Android devices <4.4 are missing IDBKeyRange\n // See: https://github.com/mozilla/localForage/issues/128\n // See: https://github.com/mozilla/localForage/issues/272\n typeof IDBKeyRange !== 'undefined';\n } catch (e) {\n return false;\n }\n }\n\n // Abstracts constructing a Blob object, so it also works in older\n // browsers that don't support the native Blob constructor. (i.e.\n // old QtWebKit versions, at least).\n // Abstracts constructing a Blob object, so it also works in older\n // browsers that don't support the native Blob constructor. (i.e.\n // old QtWebKit versions, at least).\n function createBlob(parts, properties) {\n /* global BlobBuilder,MSBlobBuilder,MozBlobBuilder,WebKitBlobBuilder */\n parts = parts || [];\n properties = properties || {};\n try {\n return new Blob(parts, properties);\n } catch (e) {\n if (e.name !== 'TypeError') {\n throw e;\n }\n var Builder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : WebKitBlobBuilder;\n var builder = new Builder();\n for (var i = 0; i < parts.length; i += 1) {\n builder.append(parts[i]);\n }\n return builder.getBlob(properties.type);\n }\n }\n\n // This is CommonJS because lie is an external dependency, so Rollup\n // can just ignore it.\n if (typeof Promise === 'undefined') {\n // In the \"nopromises\" build this will just throw if you don't have\n // a global promise object, but it would throw anyway later.\n _dereq_(3);\n }\n var Promise$1 = Promise;\n\n function executeCallback(promise, callback) {\n if (callback) {\n promise.then(function (result) {\n callback(null, result);\n }, function (error) {\n callback(error);\n });\n }\n }\n\n function executeTwoCallbacks(promise, callback, errorCallback) {\n if (typeof callback === 'function') {\n promise.then(callback);\n }\n\n if (typeof errorCallback === 'function') {\n promise[\"catch\"](errorCallback);\n }\n }\n\n function normalizeKey(key) {\n // Cast the key to a string, as that's all we can set as a key.\n if (typeof key !== 'string') {\n console.warn(key + ' used as a key, but it is not a string.');\n key = String(key);\n }\n\n return key;\n }\n\n function getCallback() {\n if (arguments.length && typeof arguments[arguments.length - 1] === 'function') {\n return arguments[arguments.length - 1];\n }\n }\n\n // Some code originally from async_storage.js in\n // [Gaia](https://github.com/mozilla-b2g/gaia).\n\n var DETECT_BLOB_SUPPORT_STORE = 'local-forage-detect-blob-support';\n var supportsBlobs = void 0;\n var dbContexts = {};\n var toString = Object.prototype.toString;\n\n // Transaction Modes\n var READ_ONLY = 'readonly';\n var READ_WRITE = 'readwrite';\n\n // Transform a binary string to an array buffer, because otherwise\n // weird stuff happens when you try to work with the binary string directly.\n // It is known.\n // From http://stackoverflow.com/questions/14967647/ (continues on next line)\n // encode-decode-image-with-base64-breaks-image (2013-04-21)\n function _binStringToArrayBuffer(bin) {\n var length = bin.length;\n var buf = new ArrayBuffer(length);\n var arr = new Uint8Array(buf);\n for (var i = 0; i < length; i++) {\n arr[i] = bin.charCodeAt(i);\n }\n return buf;\n }\n\n //\n // Blobs are not supported in all versions of IndexedDB, notably\n // Chrome <37 and Android <5. In those versions, storing a blob will throw.\n //\n // Various other blob bugs exist in Chrome v37-42 (inclusive).\n // Detecting them is expensive and confusing to users, and Chrome 37-42\n // is at very low usage worldwide, so we do a hacky userAgent check instead.\n //\n // content-type bug: https://code.google.com/p/chromium/issues/detail?id=408120\n // 404 bug: https://code.google.com/p/chromium/issues/detail?id=447916\n // FileReader bug: https://code.google.com/p/chromium/issues/detail?id=447836\n //\n // Code borrowed from PouchDB. See:\n // https://github.com/pouchdb/pouchdb/blob/master/packages/node_modules/pouchdb-adapter-idb/src/blobSupport.js\n //\n function _checkBlobSupportWithoutCaching(idb) {\n return new Promise$1(function (resolve) {\n var txn = idb.transaction(DETECT_BLOB_SUPPORT_STORE, READ_WRITE);\n var blob = createBlob(['']);\n txn.objectStore(DETECT_BLOB_SUPPORT_STORE).put(blob, 'key');\n\n txn.onabort = function (e) {\n // If the transaction aborts now its due to not being able to\n // write to the database, likely due to the disk being full\n e.preventDefault();\n e.stopPropagation();\n resolve(false);\n };\n\n txn.oncomplete = function () {\n var matchedChrome = navigator.userAgent.match(/Chrome\\/(\\d+)/);\n var matchedEdge = navigator.userAgent.match(/Edge\\//);\n // MS Edge pretends to be Chrome 42:\n // https://msdn.microsoft.com/en-us/library/hh869301%28v=vs.85%29.aspx\n resolve(matchedEdge || !matchedChrome || parseInt(matchedChrome[1], 10) >= 43);\n };\n })[\"catch\"](function () {\n return false; // error, so assume unsupported\n });\n }\n\n function _checkBlobSupport(idb) {\n if (typeof supportsBlobs === 'boolean') {\n return Promise$1.resolve(supportsBlobs);\n }\n return _checkBlobSupportWithoutCaching(idb).then(function (value) {\n supportsBlobs = value;\n return supportsBlobs;\n });\n }\n\n function _deferReadiness(dbInfo) {\n var dbContext = dbContexts[dbInfo.name];\n\n // Create a deferred object representing the current database operation.\n var deferredOperation = {};\n\n deferredOperation.promise = new Promise$1(function (resolve, reject) {\n deferredOperation.resolve = resolve;\n deferredOperation.reject = reject;\n });\n\n // Enqueue the deferred operation.\n dbContext.deferredOperations.push(deferredOperation);\n\n // Chain its promise to the database readiness.\n if (!dbContext.dbReady) {\n dbContext.dbReady = deferredOperation.promise;\n } else {\n dbContext.dbReady = dbContext.dbReady.then(function () {\n return deferredOperation.promise;\n });\n }\n }\n\n function _advanceReadiness(dbInfo) {\n var dbContext = dbContexts[dbInfo.name];\n\n // Dequeue a deferred operation.\n var deferredOperation = dbContext.deferredOperations.pop();\n\n // Resolve its promise (which is part of the database readiness\n // chain of promises).\n if (deferredOperation) {\n deferredOperation.resolve();\n return deferredOperation.promise;\n }\n }\n\n function _rejectReadiness(dbInfo, err) {\n var dbContext = dbContexts[dbInfo.name];\n\n // Dequeue a deferred operation.\n var deferredOperation = dbContext.deferredOperations.pop();\n\n // Reject its promise (which is part of the database readiness\n // chain of promises).\n if (deferredOperation) {\n deferredOperation.reject(err);\n return deferredOperation.promise;\n }\n }\n\n function _getConnection(dbInfo, upgradeNeeded) {\n return new Promise$1(function (resolve, reject) {\n dbContexts[dbInfo.name] = dbContexts[dbInfo.name] || createDbContext();\n\n if (dbInfo.db) {\n if (upgradeNeeded) {\n _deferReadiness(dbInfo);\n dbInfo.db.close();\n } else {\n return resolve(dbInfo.db);\n }\n }\n\n var dbArgs = [dbInfo.name];\n\n if (upgradeNeeded) {\n dbArgs.push(dbInfo.version);\n }\n\n var openreq = idb.open.apply(idb, dbArgs);\n\n if (upgradeNeeded) {\n openreq.onupgradeneeded = function (e) {\n var db = openreq.result;\n try {\n db.createObjectStore(dbInfo.storeName);\n if (e.oldVersion <= 1) {\n // Added when support for blob shims was added\n db.createObjectStore(DETECT_BLOB_SUPPORT_STORE);\n }\n } catch (ex) {\n if (ex.name === 'ConstraintError') {\n console.warn('The database \"' + dbInfo.name + '\"' + ' has been upgraded from version ' + e.oldVersion + ' to version ' + e.newVersion + ', but the storage \"' + dbInfo.storeName + '\" already exists.');\n } else {\n throw ex;\n }\n }\n };\n }\n\n openreq.onerror = function (e) {\n e.preventDefault();\n reject(openreq.error);\n };\n\n openreq.onsuccess = function () {\n resolve(openreq.result);\n _advanceReadiness(dbInfo);\n };\n });\n }\n\n function _getOriginalConnection(dbInfo) {\n return _getConnection(dbInfo, false);\n }\n\n function _getUpgradedConnection(dbInfo) {\n return _getConnection(dbInfo, true);\n }\n\n function _isUpgradeNeeded(dbInfo, defaultVersion) {\n if (!dbInfo.db) {\n return true;\n }\n\n var isNewStore = !dbInfo.db.objectStoreNames.contains(dbInfo.storeName);\n var isDowngrade = dbInfo.version < dbInfo.db.version;\n var isUpgrade = dbInfo.version > dbInfo.db.version;\n\n if (isDowngrade) {\n // If the version is not the default one\n // then warn for impossible downgrade.\n if (dbInfo.version !== defaultVersion) {\n console.warn('The database \"' + dbInfo.name + '\"' + \" can't be downgraded from version \" + dbInfo.db.version + ' to version ' + dbInfo.version + '.');\n }\n // Align the versions to prevent errors.\n dbInfo.version = dbInfo.db.version;\n }\n\n if (isUpgrade || isNewStore) {\n // If the store is new then increment the version (if needed).\n // This will trigger an \"upgradeneeded\" event which is required\n // for creating a store.\n if (isNewStore) {\n var incVersion = dbInfo.db.version + 1;\n if (incVersion > dbInfo.version) {\n dbInfo.version = incVersion;\n }\n }\n\n return true;\n }\n\n return false;\n }\n\n // encode a blob for indexeddb engines that don't support blobs\n function _encodeBlob(blob) {\n return new Promise$1(function (resolve, reject) {\n var reader = new FileReader();\n reader.onerror = reject;\n reader.onloadend = function (e) {\n var base64 = btoa(e.target.result || '');\n resolve({\n __local_forage_encoded_blob: true,\n data: base64,\n type: blob.type\n });\n };\n reader.readAsBinaryString(blob);\n });\n }\n\n // decode an encoded blob\n function _decodeBlob(encodedBlob) {\n var arrayBuff = _binStringToArrayBuffer(atob(encodedBlob.data));\n return createBlob([arrayBuff], { type: encodedBlob.type });\n }\n\n // is this one of our fancy encoded blobs?\n function _isEncodedBlob(value) {\n return value && value.__local_forage_encoded_blob;\n }\n\n // Specialize the default `ready()` function by making it dependent\n // on the current database operations. Thus, the driver will be actually\n // ready when it's been initialized (default) *and* there are no pending\n // operations on the database (initiated by some other instances).\n function _fullyReady(callback) {\n var self = this;\n\n var promise = self._initReady().then(function () {\n var dbContext = dbContexts[self._dbInfo.name];\n\n if (dbContext && dbContext.dbReady) {\n return dbContext.dbReady;\n }\n });\n\n executeTwoCallbacks(promise, callback, callback);\n return promise;\n }\n\n // Try to establish a new db connection to replace the\n // current one which is broken (i.e. experiencing\n // InvalidStateError while creating a transaction).\n function _tryReconnect(dbInfo) {\n _deferReadiness(dbInfo);\n\n var dbContext = dbContexts[dbInfo.name];\n var forages = dbContext.forages;\n\n for (var i = 0; i < forages.length; i++) {\n var forage = forages[i];\n if (forage._dbInfo.db) {\n forage._dbInfo.db.close();\n forage._dbInfo.db = null;\n }\n }\n dbInfo.db = null;\n\n return _getOriginalConnection(dbInfo).then(function (db) {\n dbInfo.db = db;\n if (_isUpgradeNeeded(dbInfo)) {\n // Reopen the database for upgrading.\n return _getUpgradedConnection(dbInfo);\n }\n return db;\n }).then(function (db) {\n // store the latest db reference\n // in case the db was upgraded\n dbInfo.db = dbContext.db = db;\n for (var i = 0; i < forages.length; i++) {\n forages[i]._dbInfo.db = db;\n }\n })[\"catch\"](function (err) {\n _rejectReadiness(dbInfo, err);\n throw err;\n });\n }\n\n // FF doesn't like Promises (micro-tasks) and IDDB store operations,\n // so we have to do it with callbacks\n function createTransaction(dbInfo, mode, callback, retries) {\n if (retries === undefined) {\n retries = 1;\n }\n\n try {\n var tx = dbInfo.db.transaction(dbInfo.storeName, mode);\n callback(null, tx);\n } catch (err) {\n if (retries > 0 && (!dbInfo.db || err.name === 'InvalidStateError' || err.name === 'NotFoundError')) {\n return Promise$1.resolve().then(function () {\n if (!dbInfo.db || err.name === 'NotFoundError' && !dbInfo.db.objectStoreNames.contains(dbInfo.storeName) && dbInfo.version <= dbInfo.db.version) {\n // increase the db version, to create the new ObjectStore\n if (dbInfo.db) {\n dbInfo.version = dbInfo.db.version + 1;\n }\n // Reopen the database for upgrading.\n return _getUpgradedConnection(dbInfo);\n }\n }).then(function () {\n return _tryReconnect(dbInfo).then(function () {\n createTransaction(dbInfo, mode, callback, retries - 1);\n });\n })[\"catch\"](callback);\n }\n\n callback(err);\n }\n }\n\n function createDbContext() {\n return {\n // Running localForages sharing a database.\n forages: [],\n // Shared database.\n db: null,\n // Database readiness (promise).\n dbReady: null,\n // Deferred operations on the database.\n deferredOperations: []\n };\n }\n\n // Open the IndexedDB database (automatically creates one if one didn't\n // previously exist), using any options set in the config.\n function _initStorage(options) {\n var self = this;\n var dbInfo = {\n db: null\n };\n\n if (options) {\n for (var i in options) {\n dbInfo[i] = options[i];\n }\n }\n\n // Get the current context of the database;\n var dbContext = dbContexts[dbInfo.name];\n\n // ...or create a new context.\n if (!dbContext) {\n dbContext = createDbContext();\n // Register the new context in the global container.\n dbContexts[dbInfo.name] = dbContext;\n }\n\n // Register itself as a running localForage in the current context.\n dbContext.forages.push(self);\n\n // Replace the default `ready()` function with the specialized one.\n if (!self._initReady) {\n self._initReady = self.ready;\n self.ready = _fullyReady;\n }\n\n // Create an array of initialization states of the related localForages.\n var initPromises = [];\n\n function ignoreErrors() {\n // Don't handle errors here,\n // just makes sure related localForages aren't pending.\n return Promise$1.resolve();\n }\n\n for (var j = 0; j < dbContext.forages.length; j++) {\n var forage = dbContext.forages[j];\n if (forage !== self) {\n // Don't wait for itself...\n initPromises.push(forage._initReady()[\"catch\"](ignoreErrors));\n }\n }\n\n // Take a snapshot of the related localForages.\n var forages = dbContext.forages.slice(0);\n\n // Initialize the connection process only when\n // all the related localForages aren't pending.\n return Promise$1.all(initPromises).then(function () {\n dbInfo.db = dbContext.db;\n // Get the connection or open a new one without upgrade.\n return _getOriginalConnection(dbInfo);\n }).then(function (db) {\n dbInfo.db = db;\n if (_isUpgradeNeeded(dbInfo, self._defaultConfig.version)) {\n // Reopen the database for upgrading.\n return _getUpgradedConnection(dbInfo);\n }\n return db;\n }).then(function (db) {\n dbInfo.db = dbContext.db = db;\n self._dbInfo = dbInfo;\n // Share the final connection amongst related localForages.\n for (var k = 0; k < forages.length; k++) {\n var forage = forages[k];\n if (forage !== self) {\n // Self is already up-to-date.\n forage._dbInfo.db = dbInfo.db;\n forage._dbInfo.version = dbInfo.version;\n }\n }\n });\n }\n\n function getItem(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var req = store.get(key);\n\n req.onsuccess = function () {\n var value = req.result;\n if (value === undefined) {\n value = null;\n }\n if (_isEncodedBlob(value)) {\n value = _decodeBlob(value);\n }\n resolve(value);\n };\n\n req.onerror = function () {\n reject(req.error);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Iterate over all items stored in database.\n function iterate(iterator, callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var req = store.openCursor();\n var iterationNumber = 1;\n\n req.onsuccess = function () {\n var cursor = req.result;\n\n if (cursor) {\n var value = cursor.value;\n if (_isEncodedBlob(value)) {\n value = _decodeBlob(value);\n }\n var result = iterator(value, cursor.key, iterationNumber++);\n\n // when the iterator callback retuns any\n // (non-`undefined`) value, then we stop\n // the iteration immediately\n if (result !== void 0) {\n resolve(result);\n } else {\n cursor[\"continue\"]();\n }\n } else {\n resolve();\n }\n };\n\n req.onerror = function () {\n reject(req.error);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n\n return promise;\n }\n\n function setItem(key, value, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n var dbInfo;\n self.ready().then(function () {\n dbInfo = self._dbInfo;\n if (toString.call(value) === '[object Blob]') {\n return _checkBlobSupport(dbInfo.db).then(function (blobSupport) {\n if (blobSupport) {\n return value;\n }\n return _encodeBlob(value);\n });\n }\n return value;\n }).then(function (value) {\n createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n\n // The reason we don't _save_ null is because IE 10 does\n // not support saving the `null` type in IndexedDB. How\n // ironic, given the bug below!\n // See: https://github.com/mozilla/localForage/issues/161\n if (value === null) {\n value = undefined;\n }\n\n var req = store.put(value, key);\n\n transaction.oncomplete = function () {\n // Cast to undefined so the value passed to\n // callback/promise is the same as what one would get out\n // of `getItem()` later. This leads to some weirdness\n // (setItem('foo', undefined) will return `null`), but\n // it's not my fault localStorage is our baseline and that\n // it's weird.\n if (value === undefined) {\n value = null;\n }\n\n resolve(value);\n };\n transaction.onabort = transaction.onerror = function () {\n var err = req.error ? req.error : req.transaction.error;\n reject(err);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function removeItem(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n // We use a Grunt task to make this safe for IE and some\n // versions of Android (including those used by Cordova).\n // Normally IE won't like `.delete()` and will insist on\n // using `['delete']()`, but we have a build step that\n // fixes this for us now.\n var req = store[\"delete\"](key);\n transaction.oncomplete = function () {\n resolve();\n };\n\n transaction.onerror = function () {\n reject(req.error);\n };\n\n // The request will be also be aborted if we've exceeded our storage\n // space.\n transaction.onabort = function () {\n var err = req.error ? req.error : req.transaction.error;\n reject(err);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function clear(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var req = store.clear();\n\n transaction.oncomplete = function () {\n resolve();\n };\n\n transaction.onabort = transaction.onerror = function () {\n var err = req.error ? req.error : req.transaction.error;\n reject(err);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function length(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var req = store.count();\n\n req.onsuccess = function () {\n resolve(req.result);\n };\n\n req.onerror = function () {\n reject(req.error);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function key(n, callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n if (n < 0) {\n resolve(null);\n\n return;\n }\n\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var advanced = false;\n var req = store.openCursor();\n\n req.onsuccess = function () {\n var cursor = req.result;\n if (!cursor) {\n // this means there weren't enough keys\n resolve(null);\n\n return;\n }\n\n if (n === 0) {\n // We have the first key, return it if that's what they\n // wanted.\n resolve(cursor.key);\n } else {\n if (!advanced) {\n // Otherwise, ask the cursor to skip ahead n\n // records.\n advanced = true;\n cursor.advance(n);\n } else {\n // When we get here, we've got the nth key.\n resolve(cursor.key);\n }\n }\n };\n\n req.onerror = function () {\n reject(req.error);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function keys(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) {\n if (err) {\n return reject(err);\n }\n\n try {\n var store = transaction.objectStore(self._dbInfo.storeName);\n var req = store.openCursor();\n var keys = [];\n\n req.onsuccess = function () {\n var cursor = req.result;\n\n if (!cursor) {\n resolve(keys);\n return;\n }\n\n keys.push(cursor.key);\n cursor[\"continue\"]();\n };\n\n req.onerror = function () {\n reject(req.error);\n };\n } catch (e) {\n reject(e);\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function dropInstance(options, callback) {\n callback = getCallback.apply(this, arguments);\n\n var currentConfig = this.config();\n options = typeof options !== 'function' && options || {};\n if (!options.name) {\n options.name = options.name || currentConfig.name;\n options.storeName = options.storeName || currentConfig.storeName;\n }\n\n var self = this;\n var promise;\n if (!options.name) {\n promise = Promise$1.reject('Invalid arguments');\n } else {\n var isCurrentDb = options.name === currentConfig.name && self._dbInfo.db;\n\n var dbPromise = isCurrentDb ? Promise$1.resolve(self._dbInfo.db) : _getOriginalConnection(options).then(function (db) {\n var dbContext = dbContexts[options.name];\n var forages = dbContext.forages;\n dbContext.db = db;\n for (var i = 0; i < forages.length; i++) {\n forages[i]._dbInfo.db = db;\n }\n return db;\n });\n\n if (!options.storeName) {\n promise = dbPromise.then(function (db) {\n _deferReadiness(options);\n\n var dbContext = dbContexts[options.name];\n var forages = dbContext.forages;\n\n db.close();\n for (var i = 0; i < forages.length; i++) {\n var forage = forages[i];\n forage._dbInfo.db = null;\n }\n\n var dropDBPromise = new Promise$1(function (resolve, reject) {\n var req = idb.deleteDatabase(options.name);\n\n req.onerror = req.onblocked = function (err) {\n var db = req.result;\n if (db) {\n db.close();\n }\n reject(err);\n };\n\n req.onsuccess = function () {\n var db = req.result;\n if (db) {\n db.close();\n }\n resolve(db);\n };\n });\n\n return dropDBPromise.then(function (db) {\n dbContext.db = db;\n for (var i = 0; i < forages.length; i++) {\n var _forage = forages[i];\n _advanceReadiness(_forage._dbInfo);\n }\n })[\"catch\"](function (err) {\n (_rejectReadiness(options, err) || Promise$1.resolve())[\"catch\"](function () {});\n throw err;\n });\n });\n } else {\n promise = dbPromise.then(function (db) {\n if (!db.objectStoreNames.contains(options.storeName)) {\n return;\n }\n\n var newVersion = db.version + 1;\n\n _deferReadiness(options);\n\n var dbContext = dbContexts[options.name];\n var forages = dbContext.forages;\n\n db.close();\n for (var i = 0; i < forages.length; i++) {\n var forage = forages[i];\n forage._dbInfo.db = null;\n forage._dbInfo.version = newVersion;\n }\n\n var dropObjectPromise = new Promise$1(function (resolve, reject) {\n var req = idb.open(options.name, newVersion);\n\n req.onerror = function (err) {\n var db = req.result;\n db.close();\n reject(err);\n };\n\n req.onupgradeneeded = function () {\n var db = req.result;\n db.deleteObjectStore(options.storeName);\n };\n\n req.onsuccess = function () {\n var db = req.result;\n db.close();\n resolve(db);\n };\n });\n\n return dropObjectPromise.then(function (db) {\n dbContext.db = db;\n for (var j = 0; j < forages.length; j++) {\n var _forage2 = forages[j];\n _forage2._dbInfo.db = db;\n _advanceReadiness(_forage2._dbInfo);\n }\n })[\"catch\"](function (err) {\n (_rejectReadiness(options, err) || Promise$1.resolve())[\"catch\"](function () {});\n throw err;\n });\n });\n }\n }\n\n executeCallback(promise, callback);\n return promise;\n }\n\n var asyncStorage = {\n _driver: 'asyncStorage',\n _initStorage: _initStorage,\n _support: isIndexedDBValid(),\n iterate: iterate,\n getItem: getItem,\n setItem: setItem,\n removeItem: removeItem,\n clear: clear,\n length: length,\n key: key,\n keys: keys,\n dropInstance: dropInstance\n };\n\n function isWebSQLValid() {\n return typeof openDatabase === 'function';\n }\n\n // Sadly, the best way to save binary data in WebSQL/localStorage is serializing\n // it to Base64, so this is how we store it to prevent very strange errors with less\n // verbose ways of binary <-> string data storage.\n var BASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n var BLOB_TYPE_PREFIX = '~~local_forage_type~';\n var BLOB_TYPE_PREFIX_REGEX = /^~~local_forage_type~([^~]+)~/;\n\n var SERIALIZED_MARKER = '__lfsc__:';\n var SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER.length;\n\n // OMG the serializations!\n var TYPE_ARRAYBUFFER = 'arbf';\n var TYPE_BLOB = 'blob';\n var TYPE_INT8ARRAY = 'si08';\n var TYPE_UINT8ARRAY = 'ui08';\n var TYPE_UINT8CLAMPEDARRAY = 'uic8';\n var TYPE_INT16ARRAY = 'si16';\n var TYPE_INT32ARRAY = 'si32';\n var TYPE_UINT16ARRAY = 'ur16';\n var TYPE_UINT32ARRAY = 'ui32';\n var TYPE_FLOAT32ARRAY = 'fl32';\n var TYPE_FLOAT64ARRAY = 'fl64';\n var TYPE_SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER_LENGTH + TYPE_ARRAYBUFFER.length;\n\n var toString$1 = Object.prototype.toString;\n\n function stringToBuffer(serializedString) {\n // Fill the string into a ArrayBuffer.\n var bufferLength = serializedString.length * 0.75;\n var len = serializedString.length;\n var i;\n var p = 0;\n var encoded1, encoded2, encoded3, encoded4;\n\n if (serializedString[serializedString.length - 1] === '=') {\n bufferLength--;\n if (serializedString[serializedString.length - 2] === '=') {\n bufferLength--;\n }\n }\n\n var buffer = new ArrayBuffer(bufferLength);\n var bytes = new Uint8Array(buffer);\n\n for (i = 0; i < len; i += 4) {\n encoded1 = BASE_CHARS.indexOf(serializedString[i]);\n encoded2 = BASE_CHARS.indexOf(serializedString[i + 1]);\n encoded3 = BASE_CHARS.indexOf(serializedString[i + 2]);\n encoded4 = BASE_CHARS.indexOf(serializedString[i + 3]);\n\n /*jslint bitwise: true */\n bytes[p++] = encoded1 << 2 | encoded2 >> 4;\n bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;\n bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;\n }\n return buffer;\n }\n\n // Converts a buffer to a string to store, serialized, in the backend\n // storage library.\n function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n }\n\n // Serialize a value, afterwards executing a callback (which usually\n // instructs the `setItem()` callback/promise to be executed). This is how\n // we store binary data with localStorage.\n function serialize(value, callback) {\n var valueType = '';\n if (value) {\n valueType = toString$1.call(value);\n }\n\n // Cannot use `value instanceof ArrayBuffer` or such here, as these\n // checks fail when running the tests using casper.js...\n //\n // TODO: See why those tests fail and use a better solution.\n if (value && (valueType === '[object ArrayBuffer]' || value.buffer && toString$1.call(value.buffer) === '[object ArrayBuffer]')) {\n // Convert binary arrays to a string and prefix the string with\n // a special marker.\n var buffer;\n var marker = SERIALIZED_MARKER;\n\n if (value instanceof ArrayBuffer) {\n buffer = value;\n marker += TYPE_ARRAYBUFFER;\n } else {\n buffer = value.buffer;\n\n if (valueType === '[object Int8Array]') {\n marker += TYPE_INT8ARRAY;\n } else if (valueType === '[object Uint8Array]') {\n marker += TYPE_UINT8ARRAY;\n } else if (valueType === '[object Uint8ClampedArray]') {\n marker += TYPE_UINT8CLAMPEDARRAY;\n } else if (valueType === '[object Int16Array]') {\n marker += TYPE_INT16ARRAY;\n } else if (valueType === '[object Uint16Array]') {\n marker += TYPE_UINT16ARRAY;\n } else if (valueType === '[object Int32Array]') {\n marker += TYPE_INT32ARRAY;\n } else if (valueType === '[object Uint32Array]') {\n marker += TYPE_UINT32ARRAY;\n } else if (valueType === '[object Float32Array]') {\n marker += TYPE_FLOAT32ARRAY;\n } else if (valueType === '[object Float64Array]') {\n marker += TYPE_FLOAT64ARRAY;\n } else {\n callback(new Error('Failed to get type for BinaryArray'));\n }\n }\n\n callback(marker + bufferToString(buffer));\n } else if (valueType === '[object Blob]') {\n // Conver the blob to a binaryArray and then to a string.\n var fileReader = new FileReader();\n\n fileReader.onload = function () {\n // Backwards-compatible prefix for the blob type.\n var str = BLOB_TYPE_PREFIX + value.type + '~' + bufferToString(this.result);\n\n callback(SERIALIZED_MARKER + TYPE_BLOB + str);\n };\n\n fileReader.readAsArrayBuffer(value);\n } else {\n try {\n callback(JSON.stringify(value));\n } catch (e) {\n console.error(\"Couldn't convert value into a JSON string: \", value);\n\n callback(null, e);\n }\n }\n }\n\n // Deserialize data we've inserted into a value column/field. We place\n // special markers into our strings to mark them as encoded; this isn't\n // as nice as a meta field, but it's the only sane thing we can do whilst\n // keeping localStorage support intact.\n //\n // Oftentimes this will just deserialize JSON content, but if we have a\n // special marker (SERIALIZED_MARKER, defined above), we will extract\n // some kind of arraybuffer/binary data/typed array out of the string.\n function deserialize(value) {\n // If we haven't marked this string as being specially serialized (i.e.\n // something other than serialized JSON), we can just return it and be\n // done with it.\n if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {\n return JSON.parse(value);\n }\n\n // The following code deals with deserializing some kind of Blob or\n // TypedArray. First we separate out the type of data we're dealing\n // with from the data itself.\n var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);\n var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);\n\n var blobType;\n // Backwards-compatible blob type serialization strategy.\n // DBs created with older versions of localForage will simply not have the blob type.\n if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {\n var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);\n blobType = matcher[1];\n serializedString = serializedString.substring(matcher[0].length);\n }\n var buffer = stringToBuffer(serializedString);\n\n // Return the right type based on the code/type set during\n // serialization.\n switch (type) {\n case TYPE_ARRAYBUFFER:\n return buffer;\n case TYPE_BLOB:\n return createBlob([buffer], { type: blobType });\n case TYPE_INT8ARRAY:\n return new Int8Array(buffer);\n case TYPE_UINT8ARRAY:\n return new Uint8Array(buffer);\n case TYPE_UINT8CLAMPEDARRAY:\n return new Uint8ClampedArray(buffer);\n case TYPE_INT16ARRAY:\n return new Int16Array(buffer);\n case TYPE_UINT16ARRAY:\n return new Uint16Array(buffer);\n case TYPE_INT32ARRAY:\n return new Int32Array(buffer);\n case TYPE_UINT32ARRAY:\n return new Uint32Array(buffer);\n case TYPE_FLOAT32ARRAY:\n return new Float32Array(buffer);\n case TYPE_FLOAT64ARRAY:\n return new Float64Array(buffer);\n default:\n throw new Error('Unkown type: ' + type);\n }\n }\n\n var localforageSerializer = {\n serialize: serialize,\n deserialize: deserialize,\n stringToBuffer: stringToBuffer,\n bufferToString: bufferToString\n };\n\n /*\n * Includes code from:\n *\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n */\n\n function createDbTable(t, dbInfo, callback, errorCallback) {\n t.executeSql('CREATE TABLE IF NOT EXISTS ' + dbInfo.storeName + ' ' + '(id INTEGER PRIMARY KEY, key unique, value)', [], callback, errorCallback);\n }\n\n // Open the WebSQL database (automatically creates one if one didn't\n // previously exist), using any options set in the config.\n function _initStorage$1(options) {\n var self = this;\n var dbInfo = {\n db: null\n };\n\n if (options) {\n for (var i in options) {\n dbInfo[i] = typeof options[i] !== 'string' ? options[i].toString() : options[i];\n }\n }\n\n var dbInfoPromise = new Promise$1(function (resolve, reject) {\n // Open the database; the openDatabase API will automatically\n // create it for us if it doesn't exist.\n try {\n dbInfo.db = openDatabase(dbInfo.name, String(dbInfo.version), dbInfo.description, dbInfo.size);\n } catch (e) {\n return reject(e);\n }\n\n // Create our key/value table if it doesn't exist.\n dbInfo.db.transaction(function (t) {\n createDbTable(t, dbInfo, function () {\n self._dbInfo = dbInfo;\n resolve();\n }, function (t, error) {\n reject(error);\n });\n }, reject);\n });\n\n dbInfo.serializer = localforageSerializer;\n return dbInfoPromise;\n }\n\n function tryExecuteSql(t, dbInfo, sqlStatement, args, callback, errorCallback) {\n t.executeSql(sqlStatement, args, callback, function (t, error) {\n if (error.code === error.SYNTAX_ERR) {\n t.executeSql('SELECT name FROM sqlite_master ' + \"WHERE type='table' AND name = ?\", [dbInfo.storeName], function (t, results) {\n if (!results.rows.length) {\n // if the table is missing (was deleted)\n // re-create it table and retry\n createDbTable(t, dbInfo, function () {\n t.executeSql(sqlStatement, args, callback, errorCallback);\n }, errorCallback);\n } else {\n errorCallback(t, error);\n }\n }, errorCallback);\n } else {\n errorCallback(t, error);\n }\n }, errorCallback);\n }\n\n function getItem$1(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'SELECT * FROM ' + dbInfo.storeName + ' WHERE key = ? LIMIT 1', [key], function (t, results) {\n var result = results.rows.length ? results.rows.item(0).value : null;\n\n // Check to see if this is serialized content we need to\n // unpack.\n if (result) {\n result = dbInfo.serializer.deserialize(result);\n }\n\n resolve(result);\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function iterate$1(iterator, callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'SELECT * FROM ' + dbInfo.storeName, [], function (t, results) {\n var rows = results.rows;\n var length = rows.length;\n\n for (var i = 0; i < length; i++) {\n var item = rows.item(i);\n var result = item.value;\n\n // Check to see if this is serialized content\n // we need to unpack.\n if (result) {\n result = dbInfo.serializer.deserialize(result);\n }\n\n result = iterator(result, item.key, i + 1);\n\n // void(0) prevents problems with redefinition\n // of `undefined`.\n if (result !== void 0) {\n resolve(result);\n return;\n }\n }\n\n resolve();\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function _setItem(key, value, callback, retriesLeft) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n // The localStorage API doesn't return undefined values in an\n // \"expected\" way, so undefined is always cast to null in all\n // drivers. See: https://github.com/mozilla/localForage/pull/42\n if (value === undefined) {\n value = null;\n }\n\n // Save the original value to pass to the callback.\n var originalValue = value;\n\n var dbInfo = self._dbInfo;\n dbInfo.serializer.serialize(value, function (value, error) {\n if (error) {\n reject(error);\n } else {\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'INSERT OR REPLACE INTO ' + dbInfo.storeName + ' ' + '(key, value) VALUES (?, ?)', [key, value], function () {\n resolve(originalValue);\n }, function (t, error) {\n reject(error);\n });\n }, function (sqlError) {\n // The transaction failed; check\n // to see if it's a quota error.\n if (sqlError.code === sqlError.QUOTA_ERR) {\n // We reject the callback outright for now, but\n // it's worth trying to re-run the transaction.\n // Even if the user accepts the prompt to use\n // more storage on Safari, this error will\n // be called.\n //\n // Try to re-run the transaction.\n if (retriesLeft > 0) {\n resolve(_setItem.apply(self, [key, originalValue, callback, retriesLeft - 1]));\n return;\n }\n reject(sqlError);\n }\n });\n }\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function setItem$1(key, value, callback) {\n return _setItem.apply(this, [key, value, callback, 1]);\n }\n\n function removeItem$1(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'DELETE FROM ' + dbInfo.storeName + ' WHERE key = ?', [key], function () {\n resolve();\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Deletes every item in the table.\n // TODO: Find out if this resets the AUTO_INCREMENT number.\n function clear$1(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'DELETE FROM ' + dbInfo.storeName, [], function () {\n resolve();\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Does a simple `COUNT(key)` to get the number of items stored in\n // localForage.\n function length$1(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n // Ahhh, SQL makes this one soooooo easy.\n tryExecuteSql(t, dbInfo, 'SELECT COUNT(key) as c FROM ' + dbInfo.storeName, [], function (t, results) {\n var result = results.rows.item(0).c;\n resolve(result);\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Return the key located at key index X; essentially gets the key from a\n // `WHERE id = ?`. This is the most efficient way I can think to implement\n // this rarely-used (in my experience) part of the API, but it can seem\n // inconsistent, because we do `INSERT OR REPLACE INTO` on `setItem()`, so\n // the ID of each key will change every time it's updated. Perhaps a stored\n // procedure for the `setItem()` SQL would solve this problem?\n // TODO: Don't change ID on `setItem()`.\n function key$1(n, callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'SELECT key FROM ' + dbInfo.storeName + ' WHERE id = ? LIMIT 1', [n + 1], function (t, results) {\n var result = results.rows.length ? results.rows.item(0).key : null;\n resolve(result);\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function keys$1(callback) {\n var self = this;\n\n var promise = new Promise$1(function (resolve, reject) {\n self.ready().then(function () {\n var dbInfo = self._dbInfo;\n dbInfo.db.transaction(function (t) {\n tryExecuteSql(t, dbInfo, 'SELECT key FROM ' + dbInfo.storeName, [], function (t, results) {\n var keys = [];\n\n for (var i = 0; i < results.rows.length; i++) {\n keys.push(results.rows.item(i).key);\n }\n\n resolve(keys);\n }, function (t, error) {\n reject(error);\n });\n });\n })[\"catch\"](reject);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // https://www.w3.org/TR/webdatabase/#databases\n // > There is no way to enumerate or delete the databases available for an origin from this API.\n function getAllStoreNames(db) {\n return new Promise$1(function (resolve, reject) {\n db.transaction(function (t) {\n t.executeSql('SELECT name FROM sqlite_master ' + \"WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'\", [], function (t, results) {\n var storeNames = [];\n\n for (var i = 0; i < results.rows.length; i++) {\n storeNames.push(results.rows.item(i).name);\n }\n\n resolve({\n db: db,\n storeNames: storeNames\n });\n }, function (t, error) {\n reject(error);\n });\n }, function (sqlError) {\n reject(sqlError);\n });\n });\n }\n\n function dropInstance$1(options, callback) {\n callback = getCallback.apply(this, arguments);\n\n var currentConfig = this.config();\n options = typeof options !== 'function' && options || {};\n if (!options.name) {\n options.name = options.name || currentConfig.name;\n options.storeName = options.storeName || currentConfig.storeName;\n }\n\n var self = this;\n var promise;\n if (!options.name) {\n promise = Promise$1.reject('Invalid arguments');\n } else {\n promise = new Promise$1(function (resolve) {\n var db;\n if (options.name === currentConfig.name) {\n // use the db reference of the current instance\n db = self._dbInfo.db;\n } else {\n db = openDatabase(options.name, '', '', 0);\n }\n\n if (!options.storeName) {\n // drop all database tables\n resolve(getAllStoreNames(db));\n } else {\n resolve({\n db: db,\n storeNames: [options.storeName]\n });\n }\n }).then(function (operationInfo) {\n return new Promise$1(function (resolve, reject) {\n operationInfo.db.transaction(function (t) {\n function dropTable(storeName) {\n return new Promise$1(function (resolve, reject) {\n t.executeSql('DROP TABLE IF EXISTS ' + storeName, [], function () {\n resolve();\n }, function (t, error) {\n reject(error);\n });\n });\n }\n\n var operations = [];\n for (var i = 0, len = operationInfo.storeNames.length; i < len; i++) {\n operations.push(dropTable(operationInfo.storeNames[i]));\n }\n\n Promise$1.all(operations).then(function () {\n resolve();\n })[\"catch\"](function (e) {\n reject(e);\n });\n }, function (sqlError) {\n reject(sqlError);\n });\n });\n });\n }\n\n executeCallback(promise, callback);\n return promise;\n }\n\n var webSQLStorage = {\n _driver: 'webSQLStorage',\n _initStorage: _initStorage$1,\n _support: isWebSQLValid(),\n iterate: iterate$1,\n getItem: getItem$1,\n setItem: setItem$1,\n removeItem: removeItem$1,\n clear: clear$1,\n length: length$1,\n key: key$1,\n keys: keys$1,\n dropInstance: dropInstance$1\n };\n\n function isLocalStorageValid() {\n try {\n return typeof localStorage !== 'undefined' && 'setItem' in localStorage &&\n // in IE8 typeof localStorage.setItem === 'object'\n !!localStorage.setItem;\n } catch (e) {\n return false;\n }\n }\n\n function _getKeyPrefix(options, defaultConfig) {\n var keyPrefix = options.name + '/';\n\n if (options.storeName !== defaultConfig.storeName) {\n keyPrefix += options.storeName + '/';\n }\n return keyPrefix;\n }\n\n // Check if localStorage throws when saving an item\n function checkIfLocalStorageThrows() {\n var localStorageTestKey = '_localforage_support_test';\n\n try {\n localStorage.setItem(localStorageTestKey, true);\n localStorage.removeItem(localStorageTestKey);\n\n return false;\n } catch (e) {\n return true;\n }\n }\n\n // Check if localStorage is usable and allows to save an item\n // This method checks if localStorage is usable in Safari Private Browsing\n // mode, or in any other case where the available quota for localStorage\n // is 0 and there wasn't any saved items yet.\n function _isLocalStorageUsable() {\n return !checkIfLocalStorageThrows() || localStorage.length > 0;\n }\n\n // Config the localStorage backend, using options set in the config.\n function _initStorage$2(options) {\n var self = this;\n var dbInfo = {};\n if (options) {\n for (var i in options) {\n dbInfo[i] = options[i];\n }\n }\n\n dbInfo.keyPrefix = _getKeyPrefix(options, self._defaultConfig);\n\n if (!_isLocalStorageUsable()) {\n return Promise$1.reject();\n }\n\n self._dbInfo = dbInfo;\n dbInfo.serializer = localforageSerializer;\n\n return Promise$1.resolve();\n }\n\n // Remove all keys from the datastore, effectively destroying all data in\n // the app's key/value store!\n function clear$2(callback) {\n var self = this;\n var promise = self.ready().then(function () {\n var keyPrefix = self._dbInfo.keyPrefix;\n\n for (var i = localStorage.length - 1; i >= 0; i--) {\n var key = localStorage.key(i);\n\n if (key.indexOf(keyPrefix) === 0) {\n localStorage.removeItem(key);\n }\n }\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Retrieve an item from the store. Unlike the original async_storage\n // library in Gaia, we don't modify return values at all. If a key's value\n // is `undefined`, we pass that value to the callback function.\n function getItem$2(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = self.ready().then(function () {\n var dbInfo = self._dbInfo;\n var result = localStorage.getItem(dbInfo.keyPrefix + key);\n\n // If a result was found, parse it from the serialized\n // string into a JS object. If result isn't truthy, the key\n // is likely undefined and we'll pass it straight to the\n // callback.\n if (result) {\n result = dbInfo.serializer.deserialize(result);\n }\n\n return result;\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Iterate over all items in the store.\n function iterate$2(iterator, callback) {\n var self = this;\n\n var promise = self.ready().then(function () {\n var dbInfo = self._dbInfo;\n var keyPrefix = dbInfo.keyPrefix;\n var keyPrefixLength = keyPrefix.length;\n var length = localStorage.length;\n\n // We use a dedicated iterator instead of the `i` variable below\n // so other keys we fetch in localStorage aren't counted in\n // the `iterationNumber` argument passed to the `iterate()`\n // callback.\n //\n // See: github.com/mozilla/localForage/pull/435#discussion_r38061530\n var iterationNumber = 1;\n\n for (var i = 0; i < length; i++) {\n var key = localStorage.key(i);\n if (key.indexOf(keyPrefix) !== 0) {\n continue;\n }\n var value = localStorage.getItem(key);\n\n // If a result was found, parse it from the serialized\n // string into a JS object. If result isn't truthy, the\n // key is likely undefined and we'll pass it straight\n // to the iterator.\n if (value) {\n value = dbInfo.serializer.deserialize(value);\n }\n\n value = iterator(value, key.substring(keyPrefixLength), iterationNumber++);\n\n if (value !== void 0) {\n return value;\n }\n }\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Same as localStorage's key() method, except takes a callback.\n function key$2(n, callback) {\n var self = this;\n var promise = self.ready().then(function () {\n var dbInfo = self._dbInfo;\n var result;\n try {\n result = localStorage.key(n);\n } catch (error) {\n result = null;\n }\n\n // Remove the prefix from the key, if a key is found.\n if (result) {\n result = result.substring(dbInfo.keyPrefix.length);\n }\n\n return result;\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function keys$2(callback) {\n var self = this;\n var promise = self.ready().then(function () {\n var dbInfo = self._dbInfo;\n var length = localStorage.length;\n var keys = [];\n\n for (var i = 0; i < length; i++) {\n var itemKey = localStorage.key(i);\n if (itemKey.indexOf(dbInfo.keyPrefix) === 0) {\n keys.push(itemKey.substring(dbInfo.keyPrefix.length));\n }\n }\n\n return keys;\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Supply the number of keys in the datastore to the callback function.\n function length$2(callback) {\n var self = this;\n var promise = self.keys().then(function (keys) {\n return keys.length;\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Remove an item from the store, nice and simple.\n function removeItem$2(key, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = self.ready().then(function () {\n var dbInfo = self._dbInfo;\n localStorage.removeItem(dbInfo.keyPrefix + key);\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n // Set a key's value and run an optional callback once the value is set.\n // Unlike Gaia's implementation, the callback function is passed the value,\n // in case you want to operate on that value only after you're sure it\n // saved, or something like that.\n function setItem$2(key, value, callback) {\n var self = this;\n\n key = normalizeKey(key);\n\n var promise = self.ready().then(function () {\n // Convert undefined values to null.\n // https://github.com/mozilla/localForage/pull/42\n if (value === undefined) {\n value = null;\n }\n\n // Save the original value to pass to the callback.\n var originalValue = value;\n\n return new Promise$1(function (resolve, reject) {\n var dbInfo = self._dbInfo;\n dbInfo.serializer.serialize(value, function (value, error) {\n if (error) {\n reject(error);\n } else {\n try {\n localStorage.setItem(dbInfo.keyPrefix + key, value);\n resolve(originalValue);\n } catch (e) {\n // localStorage capacity exceeded.\n // TODO: Make this a specific error/event.\n if (e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') {\n reject(e);\n }\n reject(e);\n }\n }\n });\n });\n });\n\n executeCallback(promise, callback);\n return promise;\n }\n\n function dropInstance$2(options, callback) {\n callback = getCallback.apply(this, arguments);\n\n options = typeof options !== 'function' && options || {};\n if (!options.name) {\n var currentConfig = this.config();\n options.name = options.name || currentConfig.name;\n options.storeName = options.storeName || currentConfig.storeName;\n }\n\n var self = this;\n var promise;\n if (!options.name) {\n promise = Promise$1.reject('Invalid arguments');\n } else {\n promise = new Promise$1(function (resolve) {\n if (!options.storeName) {\n resolve(options.name + '/');\n } else {\n resolve(_getKeyPrefix(options, self._defaultConfig));\n }\n }).then(function (keyPrefix) {\n for (var i = localStorage.length - 1; i >= 0; i--) {\n var key = localStorage.key(i);\n\n if (key.indexOf(keyPrefix) === 0) {\n localStorage.removeItem(key);\n }\n }\n });\n }\n\n executeCallback(promise, callback);\n return promise;\n }\n\n var localStorageWrapper = {\n _driver: 'localStorageWrapper',\n _initStorage: _initStorage$2,\n _support: isLocalStorageValid(),\n iterate: iterate$2,\n getItem: getItem$2,\n setItem: setItem$2,\n removeItem: removeItem$2,\n clear: clear$2,\n length: length$2,\n key: key$2,\n keys: keys$2,\n dropInstance: dropInstance$2\n };\n\n var sameValue = function sameValue(x, y) {\n return x === y || typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y);\n };\n\n var includes = function includes(array, searchElement) {\n var len = array.length;\n var i = 0;\n while (i < len) {\n if (sameValue(array[i], searchElement)) {\n return true;\n }\n i++;\n }\n\n return false;\n };\n\n var isArray = Array.isArray || function (arg) {\n return Object.prototype.toString.call(arg) === '[object Array]';\n };\n\n // Drivers are stored here when `defineDriver()` is called.\n // They are shared across all instances of localForage.\n var DefinedDrivers = {};\n\n var DriverSupport = {};\n\n var DefaultDrivers = {\n INDEXEDDB: asyncStorage,\n WEBSQL: webSQLStorage,\n LOCALSTORAGE: localStorageWrapper\n };\n\n var DefaultDriverOrder = [DefaultDrivers.INDEXEDDB._driver, DefaultDrivers.WEBSQL._driver, DefaultDrivers.LOCALSTORAGE._driver];\n\n var OptionalDriverMethods = ['dropInstance'];\n\n var LibraryMethods = ['clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem'].concat(OptionalDriverMethods);\n\n var DefaultConfig = {\n description: '',\n driver: DefaultDriverOrder.slice(),\n name: 'localforage',\n // Default DB size is _JUST UNDER_ 5MB, as it's the highest size\n // we can use without a prompt.\n size: 4980736,\n storeName: 'keyvaluepairs',\n version: 1.0\n };\n\n function callWhenReady(localForageInstance, libraryMethod) {\n localForageInstance[libraryMethod] = function () {\n var _args = arguments;\n return localForageInstance.ready().then(function () {\n return localForageInstance[libraryMethod].apply(localForageInstance, _args);\n });\n };\n }\n\n function extend() {\n for (var i = 1; i < arguments.length; i++) {\n var arg = arguments[i];\n\n if (arg) {\n for (var _key in arg) {\n if (arg.hasOwnProperty(_key)) {\n if (isArray(arg[_key])) {\n arguments[0][_key] = arg[_key].slice();\n } else {\n arguments[0][_key] = arg[_key];\n }\n }\n }\n }\n }\n\n return arguments[0];\n }\n\n var LocalForage = function () {\n function LocalForage(options) {\n _classCallCheck(this, LocalForage);\n\n for (var driverTypeKey in DefaultDrivers) {\n if (DefaultDrivers.hasOwnProperty(driverTypeKey)) {\n var driver = DefaultDrivers[driverTypeKey];\n var driverName = driver._driver;\n this[driverTypeKey] = driverName;\n\n if (!DefinedDrivers[driverName]) {\n // we don't need to wait for the promise,\n // since the default drivers can be defined\n // in a blocking manner\n this.defineDriver(driver);\n }\n }\n }\n\n this._defaultConfig = extend({}, DefaultConfig);\n this._config = extend({}, this._defaultConfig, options);\n this._driverSet = null;\n this._initDriver = null;\n this._ready = false;\n this._dbInfo = null;\n\n this._wrapLibraryMethodsWithReady();\n this.setDriver(this._config.driver)[\"catch\"](function () {});\n }\n\n // Set any config values for localForage; can be called anytime before\n // the first API call (e.g. `getItem`, `setItem`).\n // We loop through options so we don't overwrite existing config\n // values.\n\n\n LocalForage.prototype.config = function config(options) {\n // If the options argument is an object, we use it to set values.\n // Otherwise, we return either a specified config value or all\n // config values.\n if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {\n // If localforage is ready and fully initialized, we can't set\n // any new configuration values. Instead, we return an error.\n if (this._ready) {\n return new Error(\"Can't call config() after localforage \" + 'has been used.');\n }\n\n for (var i in options) {\n if (i === 'storeName') {\n options[i] = options[i].replace(/\\W/g, '_');\n }\n\n if (i === 'version' && typeof options[i] !== 'number') {\n return new Error('Database version must be a number.');\n }\n\n this._config[i] = options[i];\n }\n\n // after all config options are set and\n // the driver option is used, try setting it\n if ('driver' in options && options.driver) {\n return this.setDriver(this._config.driver);\n }\n\n return true;\n } else if (typeof options === 'string') {\n return this._config[options];\n } else {\n return this._config;\n }\n };\n\n // Used to define a custom driver, shared across all instances of\n // localForage.\n\n\n LocalForage.prototype.defineDriver = function defineDriver(driverObject, callback, errorCallback) {\n var promise = new Promise$1(function (resolve, reject) {\n try {\n var driverName = driverObject._driver;\n var complianceError = new Error('Custom driver not compliant; see ' + 'https://mozilla.github.io/localForage/#definedriver');\n\n // A driver name should be defined and not overlap with the\n // library-defined, default drivers.\n if (!driverObject._driver) {\n reject(complianceError);\n return;\n }\n\n var driverMethods = LibraryMethods.concat('_initStorage');\n for (var i = 0, len = driverMethods.length; i < len; i++) {\n var driverMethodName = driverMethods[i];\n\n // when the property is there,\n // it should be a method even when optional\n var isRequired = !includes(OptionalDriverMethods, driverMethodName);\n if ((isRequired || driverObject[driverMethodName]) && typeof driverObject[driverMethodName] !== 'function') {\n reject(complianceError);\n return;\n }\n }\n\n var configureMissingMethods = function configureMissingMethods() {\n var methodNotImplementedFactory = function methodNotImplementedFactory(methodName) {\n return function () {\n var error = new Error('Method ' + methodName + ' is not implemented by the current driver');\n var promise = Promise$1.reject(error);\n executeCallback(promise, arguments[arguments.length - 1]);\n return promise;\n };\n };\n\n for (var _i = 0, _len = OptionalDriverMethods.length; _i < _len; _i++) {\n var optionalDriverMethod = OptionalDriverMethods[_i];\n if (!driverObject[optionalDriverMethod]) {\n driverObject[optionalDriverMethod] = methodNotImplementedFactory(optionalDriverMethod);\n }\n }\n };\n\n configureMissingMethods();\n\n var setDriverSupport = function setDriverSupport(support) {\n if (DefinedDrivers[driverName]) {\n console.info('Redefining LocalForage driver: ' + driverName);\n }\n DefinedDrivers[driverName] = driverObject;\n DriverSupport[driverName] = support;\n // don't use a then, so that we can define\n // drivers that have simple _support methods\n // in a blocking manner\n resolve();\n };\n\n if ('_support' in driverObject) {\n if (driverObject._support && typeof driverObject._support === 'function') {\n driverObject._support().then(setDriverSupport, reject);\n } else {\n setDriverSupport(!!driverObject._support);\n }\n } else {\n setDriverSupport(true);\n }\n } catch (e) {\n reject(e);\n }\n });\n\n executeTwoCallbacks(promise, callback, errorCallback);\n return promise;\n };\n\n LocalForage.prototype.driver = function driver() {\n return this._driver || null;\n };\n\n LocalForage.prototype.getDriver = function getDriver(driverName, callback, errorCallback) {\n var getDriverPromise = DefinedDrivers[driverName] ? Promise$1.resolve(DefinedDrivers[driverName]) : Promise$1.reject(new Error('Driver not found.'));\n\n executeTwoCallbacks(getDriverPromise, callback, errorCallback);\n return getDriverPromise;\n };\n\n LocalForage.prototype.getSerializer = function getSerializer(callback) {\n var serializerPromise = Promise$1.resolve(localforageSerializer);\n executeTwoCallbacks(serializerPromise, callback);\n return serializerPromise;\n };\n\n LocalForage.prototype.ready = function ready(callback) {\n var self = this;\n\n var promise = self._driverSet.then(function () {\n if (self._ready === null) {\n self._ready = self._initDriver();\n }\n\n return self._ready;\n });\n\n executeTwoCallbacks(promise, callback, callback);\n return promise;\n };\n\n LocalForage.prototype.setDriver = function setDriver(drivers, callback, errorCallback) {\n var self = this;\n\n if (!isArray(drivers)) {\n drivers = [drivers];\n }\n\n var supportedDrivers = this._getSupportedDrivers(drivers);\n\n function setDriverToConfig() {\n self._config.driver = self.driver();\n }\n\n function extendSelfWithDriver(driver) {\n self._extend(driver);\n setDriverToConfig();\n\n self._ready = self._initStorage(self._config);\n return self._ready;\n }\n\n function initDriver(supportedDrivers) {\n return function () {\n var currentDriverIndex = 0;\n\n function driverPromiseLoop() {\n while (currentDriverIndex < supportedDrivers.length) {\n var driverName = supportedDrivers[currentDriverIndex];\n currentDriverIndex++;\n\n self._dbInfo = null;\n self._ready = null;\n\n return self.getDriver(driverName).then(extendSelfWithDriver)[\"catch\"](driverPromiseLoop);\n }\n\n setDriverToConfig();\n var error = new Error('No available storage method found.');\n self._driverSet = Promise$1.reject(error);\n return self._driverSet;\n }\n\n return driverPromiseLoop();\n };\n }\n\n // There might be a driver initialization in progress\n // so wait for it to finish in order to avoid a possible\n // race condition to set _dbInfo\n var oldDriverSetDone = this._driverSet !== null ? this._driverSet[\"catch\"](function () {\n return Promise$1.resolve();\n }) : Promise$1.resolve();\n\n this._driverSet = oldDriverSetDone.then(function () {\n var driverName = supportedDrivers[0];\n self._dbInfo = null;\n self._ready = null;\n\n return self.getDriver(driverName).then(function (driver) {\n self._driver = driver._driver;\n setDriverToConfig();\n self._wrapLibraryMethodsWithReady();\n self._initDriver = initDriver(supportedDrivers);\n });\n })[\"catch\"](function () {\n setDriverToConfig();\n var error = new Error('No available storage method found.');\n self._driverSet = Promise$1.reject(error);\n return self._driverSet;\n });\n\n executeTwoCallbacks(this._driverSet, callback, errorCallback);\n return this._driverSet;\n };\n\n LocalForage.prototype.supports = function supports(driverName) {\n return !!DriverSupport[driverName];\n };\n\n LocalForage.prototype._extend = function _extend(libraryMethodsAndProperties) {\n extend(this, libraryMethodsAndProperties);\n };\n\n LocalForage.prototype._getSupportedDrivers = function _getSupportedDrivers(drivers) {\n var supportedDrivers = [];\n for (var i = 0, len = drivers.length; i < len; i++) {\n var driverName = drivers[i];\n if (this.supports(driverName)) {\n supportedDrivers.push(driverName);\n }\n }\n return supportedDrivers;\n };\n\n LocalForage.prototype._wrapLibraryMethodsWithReady = function _wrapLibraryMethodsWithReady() {\n // Add a stub for each driver API method that delays the call to the\n // corresponding driver method until localForage is ready. These stubs\n // will be replaced by the driver methods as soon as the driver is\n // loaded, so there is no performance impact.\n for (var i = 0, len = LibraryMethods.length; i < len; i++) {\n callWhenReady(this, LibraryMethods[i]);\n }\n };\n\n LocalForage.prototype.createInstance = function createInstance(options) {\n return new LocalForage(options);\n };\n\n return LocalForage;\n }();\n\n // The actual localForage object that we expose as a module or via a\n // global. It's extended by pulling in one of our other libraries.\n\n\n var localforage_js = new LocalForage();\n\n module.exports = localforage_js;\n\n },{\"3\":3}]},{},[4])(4)\n });\n });\n\n var CryptoSystem;\n (function (CryptoSystem) {\n CryptoSystem[\"ECC\"] = \"ecc\";\n CryptoSystem[\"RSA\"] = \"rsa\";\n })(CryptoSystem || (CryptoSystem = {}));\n var EccCurve;\n (function (EccCurve) {\n EccCurve[\"P_256\"] = \"P-256\";\n EccCurve[\"P_384\"] = \"P-384\";\n EccCurve[\"P_521\"] = \"P-521\";\n })(EccCurve || (EccCurve = {}));\n var RsaSize;\n (function (RsaSize) {\n RsaSize[RsaSize[\"B1024\"] = 1024] = \"B1024\";\n RsaSize[RsaSize[\"B2048\"] = 2048] = \"B2048\";\n RsaSize[RsaSize[\"B4096\"] = 4096] = \"B4096\";\n })(RsaSize || (RsaSize = {}));\n var SymmAlg;\n (function (SymmAlg) {\n SymmAlg[\"AES_CTR\"] = \"AES-CTR\";\n SymmAlg[\"AES_CBC\"] = \"AES-CBC\";\n })(SymmAlg || (SymmAlg = {}));\n var SymmKeyLength;\n (function (SymmKeyLength) {\n SymmKeyLength[SymmKeyLength[\"B128\"] = 128] = \"B128\";\n SymmKeyLength[SymmKeyLength[\"B192\"] = 192] = \"B192\";\n SymmKeyLength[SymmKeyLength[\"B256\"] = 256] = \"B256\";\n })(SymmKeyLength || (SymmKeyLength = {}));\n var HashAlg;\n (function (HashAlg) {\n HashAlg[\"SHA_1\"] = \"SHA-1\";\n HashAlg[\"SHA_256\"] = \"SHA-256\";\n HashAlg[\"SHA_384\"] = \"SHA-384\";\n HashAlg[\"SHA_512\"] = \"SHA-512\";\n })(HashAlg || (HashAlg = {}));\n var CharSize;\n (function (CharSize) {\n CharSize[CharSize[\"B8\"] = 8] = \"B8\";\n CharSize[CharSize[\"B16\"] = 16] = \"B16\";\n })(CharSize || (CharSize = {}));\n var KeyUse;\n (function (KeyUse) {\n KeyUse[\"Read\"] = \"read\";\n KeyUse[\"Write\"] = \"write\";\n })(KeyUse || (KeyUse = {}));\n\n var types = /*#__PURE__*/Object.freeze({\n __proto__: null,\n get CryptoSystem () { return CryptoSystem; },\n get EccCurve () { return EccCurve; },\n get RsaSize () { return RsaSize; },\n get SymmAlg () { return SymmAlg; },\n get SymmKeyLength () { return SymmKeyLength; },\n get HashAlg () { return HashAlg; },\n get CharSize () { return CharSize; },\n get KeyUse () { return KeyUse; }\n });\n\n var KeyDoesNotExist = new Error(\"Key does not exist. Make sure you properly instantiated the keystore.\");\n var NotKeyPair = new Error(\"Retrieved a symmetric key when an asymmetric keypair was expected. Please use a different key name.\");\n var NotKey = new Error(\"Retrieved an asymmetric keypair when an symmetric key was expected. Please use a different key name.\");\n var ECCNotEnabled = new Error(\"ECC is not enabled for this browser. Please use RSA instead.\");\n var UnsupportedCrypto = new Error(\"Cryptosystem not supported. Please use ECC or RSA\");\n var InvalidKeyUse = new Error(\"Invalid key use. Please use 'read' or 'write\");\n function checkIsKeyPair(keypair) {\n if (!keypair || keypair === null) {\n throw KeyDoesNotExist;\n }\n else if (keypair.privateKey === undefined) {\n throw NotKeyPair;\n }\n return keypair;\n }\n function checkIsKey(key) {\n if (!key || key === null) {\n throw KeyDoesNotExist;\n }\n else if (key.privateKey !== undefined || key.algorithm === undefined) {\n throw NotKey;\n }\n return key;\n }\n function checkValidCryptoSystem(type) {\n checkValid(type, [CryptoSystem.ECC, CryptoSystem.RSA], UnsupportedCrypto);\n }\n function checkValidKeyUse(use) {\n checkValid(use, [KeyUse.Read, KeyUse.Write], InvalidKeyUse);\n }\n function checkValid(toCheck, opts, error) {\n var match = opts.some(function (opt) { return opt === toCheck; });\n if (!match) {\n throw error;\n }\n }\n\n /* istanbul ignore next */\n function createStore(name) {\n return localforage.createInstance({ name: name });\n }\n function createIfDoesNotExist(id, makeFn, store) {\n if (store === void 0) { store = localforage; }\n return __awaiter(this, void 0, void 0, function () {\n var key;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, exists(id, store)];\n case 1:\n if (_a.sent()) {\n return [2 /*return*/];\n }\n return [4 /*yield*/, makeFn()];\n case 2:\n key = _a.sent();\n return [4 /*yield*/, put(id, key, store)];\n case 3:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n }\n /* istanbul ignore next */\n function put(id, key, store) {\n if (store === void 0) { store = localforage; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, store.setItem(id, key)];\n });\n });\n }\n /* istanbul ignore next */\n function getKeypair(id, store) {\n if (store === void 0) { store = localforage; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, get(id, checkIsKeyPair, store)];\n });\n });\n }\n /* istanbul ignore next */\n function getKey(id, store) {\n if (store === void 0) { store = localforage; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, get(id, checkIsKey, store)];\n });\n });\n }\n /* istanbul ignore next */\n function get(id, checkFn, store) {\n if (store === void 0) { store = localforage; }\n return __awaiter(this, void 0, void 0, function () {\n var item;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, store.getItem(id)];\n case 1:\n item = _a.sent();\n return [2 /*return*/, item === null ? null : checkFn(item)];\n }\n });\n });\n }\n /* istanbul ignore next */\n function exists(id, store) {\n if (store === void 0) { store = localforage; }\n return __awaiter(this, void 0, void 0, function () {\n var key;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, store.getItem(id)];\n case 1:\n key = _a.sent();\n return [2 /*return*/, key !== null];\n }\n });\n });\n }\n /* istanbul ignore next */\n function rm(id, store) {\n if (store === void 0) { store = localforage; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, store.removeItem(id)];\n });\n });\n }\n function dropStore(store) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, store.dropInstance()];\n });\n });\n }\n /* istanbul ignore next */\n function clear(store) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (store) {\n return [2 /*return*/, dropStore(store)];\n }\n else {\n return [2 /*return*/, localforage.clear()];\n }\n });\n });\n }\n var IDB = {\n createStore: createStore,\n createIfDoesNotExist: createIfDoesNotExist,\n put: put,\n getKeypair: getKeypair,\n getKey: getKey,\n exists: exists,\n rm: rm,\n dropStore: dropStore,\n clear: clear\n };\n\n var idb = /*#__PURE__*/Object.freeze({\n __proto__: null,\n createStore: createStore,\n createIfDoesNotExist: createIfDoesNotExist,\n put: put,\n getKeypair: getKeypair,\n getKey: getKey,\n get: get,\n exists: exists,\n rm: rm,\n dropStore: dropStore,\n clear: clear,\n 'default': IDB\n });\n\n var byteLength_1 = byteLength;\n var toByteArray_1 = toByteArray;\n var fromByteArray_1 = fromByteArray;\n\n var lookup = [];\n var revLookup = [];\n var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;\n\n var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n for (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n }\n\n // Support decoding URL-safe base64 strings, as Node.js does.\n // See: https://en.wikipedia.org/wiki/Base64#URL_applications\n revLookup['-'.charCodeAt(0)] = 62;\n revLookup['_'.charCodeAt(0)] = 63;\n\n function getLens (b64) {\n var len = b64.length;\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=');\n if (validLen === -1) validLen = len;\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4);\n\n return [validLen, placeHoldersLen]\n }\n\n // base64 is 4/3 + up to two characters of the original data\n function byteLength (b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n }\n\n function _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n }\n\n function toByteArray (b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n\n var curByte = 0;\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen;\n\n var i;\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)];\n arr[curByte++] = (tmp >> 16) & 0xFF;\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4);\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2);\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n return arr\n }\n\n function tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n }\n\n function encodeChunk (uint8, start, end) {\n var tmp;\n var output = [];\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF);\n output.push(tripletToBase64(tmp));\n }\n return output.join('')\n }\n\n function fromByteArray (uint8) {\n var tmp;\n var len = uint8.length;\n var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes\n var parts = [];\n var maxChunkLength = 16383; // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1];\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n );\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1];\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n );\n }\n\n return parts.join('')\n }\n\n var base64Js = {\n \tbyteLength: byteLength_1,\n \ttoByteArray: toByteArray_1,\n \tfromByteArray: fromByteArray_1\n };\n\n /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\n var read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m;\n var eLen = (nBytes * 8) - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var nBits = -7;\n var i = isLE ? (nBytes - 1) : 0;\n var d = isLE ? -1 : 1;\n var s = buffer[offset + i];\n\n i += d;\n\n e = s & ((1 << (-nBits)) - 1);\n s >>= (-nBits);\n nBits += eLen;\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1);\n e >>= (-nBits);\n nBits += mLen;\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n };\n\n var write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c;\n var eLen = (nBytes * 8) - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);\n var i = isLE ? 0 : (nBytes - 1);\n var d = isLE ? 1 : -1;\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n value = Math.abs(value);\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128;\n };\n\n var ieee754 = {\n \tread: read,\n \twrite: write\n };\n\n var buffer = createCommonjsModule(function (module, exports) {\n\n\n\n const customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null;\n\n exports.Buffer = Buffer;\n exports.SlowBuffer = SlowBuffer;\n exports.INSPECT_MAX_BYTES = 50;\n\n const K_MAX_LENGTH = 0x7fffffff;\n exports.kMaxLength = K_MAX_LENGTH;\n\n /**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\n Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();\n\n if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n );\n }\n\n function typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1);\n const proto = { foo: function () { return 42 } };\n Object.setPrototypeOf(proto, Uint8Array.prototype);\n Object.setPrototypeOf(arr, proto);\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n }\n\n Object.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n });\n\n Object.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n });\n\n function createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length);\n Object.setPrototypeOf(buf, Buffer.prototype);\n return buf\n }\n\n /**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\n function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n }\n\n Buffer.poolSize = 8192; // not used by this implementation\n\n function from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf();\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value);\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n /**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\n Buffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n };\n\n // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n // https://github.com/feross/buffer/pull/148\n Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);\n Object.setPrototypeOf(Buffer, Uint8Array);\n\n function assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n }\n\n function alloc (size, fill, encoding) {\n assertSize(size);\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n }\n\n /**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\n Buffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n };\n\n function allocUnsafe (size) {\n assertSize(size);\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n }\n\n /**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\n Buffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n };\n /**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\n Buffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n };\n\n function fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8';\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0;\n let buf = createBuffer(length);\n\n const actual = buf.write(string, encoding);\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual);\n }\n\n return buf\n }\n\n function fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0;\n const buf = createBuffer(length);\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255;\n }\n return buf\n }\n\n function fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView);\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n }\n\n function fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf;\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array);\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset);\n } else {\n buf = new Uint8Array(array, byteOffset, length);\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype);\n\n return buf\n }\n\n function fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0;\n const buf = createBuffer(len);\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len);\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n }\n\n function checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n }\n\n function SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0;\n }\n return Buffer.alloc(+length)\n }\n\n Buffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n };\n\n Buffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length;\n let y = b.length;\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n };\n\n Buffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n };\n\n Buffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i;\n if (length === undefined) {\n length = 0;\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n\n const buffer = Buffer.allocUnsafe(length);\n let pos = 0;\n for (i = 0; i < list.length; ++i) {\n let buf = list[i];\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);\n buf.copy(buffer, pos);\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n );\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos);\n }\n pos += buf.length;\n }\n return buffer\n };\n\n function byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length;\n const mustMatch = (arguments.length > 2 && arguments[2] === true);\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false;\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer.byteLength = byteLength;\n\n function slowToString (encoding, start, end) {\n let loweredCase = false;\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0;\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length;\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0;\n start >>>= 0;\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8';\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase();\n loweredCase = true;\n }\n }\n }\n\n // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n // to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n // reliably in a browserify context because there could be multiple different\n // copies of the 'buffer' package in use. This method works even for Buffer\n // instances that were created from another copy of the `buffer` package.\n // See: https://github.com/feross/buffer/issues/154\n Buffer.prototype._isBuffer = true;\n\n function swap (b, n, m) {\n const i = b[n];\n b[n] = b[m];\n b[m] = i;\n }\n\n Buffer.prototype.swap16 = function swap16 () {\n const len = this.length;\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n return this\n };\n\n Buffer.prototype.swap32 = function swap32 () {\n const len = this.length;\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this\n };\n\n Buffer.prototype.swap64 = function swap64 () {\n const len = this.length;\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this\n };\n\n Buffer.prototype.toString = function toString () {\n const length = this.length;\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n };\n\n Buffer.prototype.toLocaleString = Buffer.prototype.toString;\n\n Buffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n };\n\n Buffer.prototype.inspect = function inspect () {\n let str = '';\n const max = exports.INSPECT_MAX_BYTES;\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();\n if (this.length > max) str += ' ... ';\n return '<Buffer ' + str + '>'\n };\n if (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;\n }\n\n Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength);\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0;\n }\n if (end === undefined) {\n end = target ? target.length : 0;\n }\n if (thisStart === undefined) {\n thisStart = 0;\n }\n if (thisEnd === undefined) {\n thisEnd = this.length;\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart;\n let y = end - start;\n const len = Math.min(x, y);\n\n const thisCopy = this.slice(thisStart, thisEnd);\n const targetCopy = target.slice(start, end);\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n };\n\n // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n // OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n //\n // Arguments:\n // - buffer - a Buffer to search\n // - val - a string, Buffer, or number\n // - byteOffset - an index into `buffer`; will be clamped to an int32\n // - encoding - an optional encoding, relevant is val is a string\n // - dir - true for indexOf, false for lastIndexOf\n function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff;\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000;\n }\n byteOffset = +byteOffset; // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1);\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset;\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0;\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding);\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF; // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n }\n\n function arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1;\n let arrLength = arr.length;\n let valLength = val.length;\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase();\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i;\n if (dir) {\n let foundIndex = -1;\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i;\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n for (i = byteOffset; i >= 0; i--) {\n let found = true;\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false;\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n }\n\n Buffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n };\n\n Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n };\n\n Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n };\n\n function hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0;\n const remaining = buf.length - offset;\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n if (length > remaining) {\n length = remaining;\n }\n }\n\n const strLen = string.length;\n\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n let i;\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16);\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed;\n }\n return i\n }\n\n function utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n }\n\n function asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n }\n\n function base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n }\n\n function ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n }\n\n Buffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8';\n length = this.length;\n offset = 0;\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset;\n length = this.length;\n offset = 0;\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0;\n if (isFinite(length)) {\n length = length >>> 0;\n if (encoding === undefined) encoding = 'utf8';\n } else {\n encoding = length;\n length = undefined;\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset;\n if (length === undefined || length > remaining) length = remaining;\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8';\n\n let loweredCase = false;\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n };\n\n Buffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n };\n\n function base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64Js.fromByteArray(buf)\n } else {\n return base64Js.fromByteArray(buf.slice(start, end))\n }\n }\n\n function utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end);\n const res = [];\n\n let i = start;\n while (i < end) {\n const firstByte = buf[i];\n let codePoint = null;\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1;\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint;\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte;\n }\n break\n case 2:\n secondByte = buf[i + 1];\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint;\n }\n }\n break\n case 3:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint;\n }\n }\n break\n case 4:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n fourthByte = buf[i + 3];\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint;\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD;\n bytesPerSequence = 1;\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000;\n res.push(codePoint >>> 10 & 0x3FF | 0xD800);\n codePoint = 0xDC00 | codePoint & 0x3FF;\n }\n\n res.push(codePoint);\n i += bytesPerSequence;\n }\n\n return decodeCodePointsArray(res)\n }\n\n // Based on http://stackoverflow.com/a/22747272/680742, the browser with\n // the lowest limit is Chrome, with 0x10000 args.\n // We go 1 magnitude less, for safety\n const MAX_ARGUMENTS_LENGTH = 0x1000;\n\n function decodeCodePointsArray (codePoints) {\n const len = codePoints.length;\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = '';\n let i = 0;\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n );\n }\n return res\n }\n\n function asciiSlice (buf, start, end) {\n let ret = '';\n end = Math.min(buf.length, end);\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F);\n }\n return ret\n }\n\n function latin1Slice (buf, start, end) {\n let ret = '';\n end = Math.min(buf.length, end);\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i]);\n }\n return ret\n }\n\n function hexSlice (buf, start, end) {\n const len = buf.length;\n\n if (!start || start < 0) start = 0;\n if (!end || end < 0 || end > len) end = len;\n\n let out = '';\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]];\n }\n return out\n }\n\n function utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end);\n let res = '';\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256));\n }\n return res\n }\n\n Buffer.prototype.slice = function slice (start, end) {\n const len = this.length;\n start = ~~start;\n end = end === undefined ? len : ~~end;\n\n if (start < 0) {\n start += len;\n if (start < 0) start = 0;\n } else if (start > len) {\n start = len;\n }\n\n if (end < 0) {\n end += len;\n if (end < 0) end = 0;\n } else if (end > len) {\n end = len;\n }\n\n if (end < start) end = start;\n\n const newBuf = this.subarray(start, end);\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype);\n\n return newBuf\n };\n\n /*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\n function checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n }\n\n Buffer.prototype.readUintLE =\n Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n\n return val\n };\n\n Buffer.prototype.readUintBE =\n Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length);\n }\n\n let val = this[offset + --byteLength];\n let mul = 1;\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul;\n }\n\n return val\n };\n\n Buffer.prototype.readUint8 =\n Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n return this[offset]\n };\n\n Buffer.prototype.readUint16LE =\n Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] | (this[offset + 1] << 8)\n };\n\n Buffer.prototype.readUint16BE =\n Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return (this[offset] << 8) | this[offset + 1]\n };\n\n Buffer.prototype.readUint32LE =\n Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n };\n\n Buffer.prototype.readUint32BE =\n Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n };\n\n Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0;\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8);\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24;\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24;\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n });\n\n Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0;\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8);\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset];\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last;\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n });\n\n Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n let val = this[offset];\n let mul = 1;\n let i = 0;\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n mul *= 0x80;\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n return val\n };\n\n Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n let i = byteLength;\n let mul = 1;\n let val = this[offset + --i];\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul;\n }\n mul *= 0x80;\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n return val\n };\n\n Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n };\n\n Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n const val = this[offset] | (this[offset + 1] << 8);\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n };\n\n Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n const val = this[offset + 1] | (this[offset] << 8);\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n };\n\n Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n };\n\n Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n };\n\n Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0;\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8);\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24); // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n });\n\n Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0;\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8);\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset];\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n });\n\n Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, true, 23, 4)\n };\n\n Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, false, 23, 4)\n };\n\n Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, true, 52, 8)\n };\n\n Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, false, 52, 8)\n };\n\n function checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n }\n\n Buffer.prototype.writeUintLE =\n Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n let mul = 1;\n let i = 0;\n this[offset] = value & 0xFF;\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeUintBE =\n Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n let i = byteLength - 1;\n let mul = 1;\n this[offset + i] = value & 0xFF;\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeUint8 =\n Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);\n this[offset] = (value & 0xff);\n return offset + 1\n };\n\n Buffer.prototype.writeUint16LE =\n Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n return offset + 2\n };\n\n Buffer.prototype.writeUint16BE =\n Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n this[offset] = (value >>> 8);\n this[offset + 1] = (value & 0xff);\n return offset + 2\n };\n\n Buffer.prototype.writeUint32LE =\n Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n this[offset + 3] = (value >>> 24);\n this[offset + 2] = (value >>> 16);\n this[offset + 1] = (value >>> 8);\n this[offset] = (value & 0xff);\n return offset + 4\n };\n\n Buffer.prototype.writeUint32BE =\n Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n this[offset] = (value >>> 24);\n this[offset + 1] = (value >>> 16);\n this[offset + 2] = (value >>> 8);\n this[offset + 3] = (value & 0xff);\n return offset + 4\n };\n\n function wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7);\n\n let lo = Number(value & BigInt(0xffffffff));\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n return offset\n }\n\n function wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7);\n\n let lo = Number(value & BigInt(0xffffffff));\n buf[offset + 7] = lo;\n lo = lo >> 8;\n buf[offset + 6] = lo;\n lo = lo >> 8;\n buf[offset + 5] = lo;\n lo = lo >> 8;\n buf[offset + 4] = lo;\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));\n buf[offset + 3] = hi;\n hi = hi >> 8;\n buf[offset + 2] = hi;\n hi = hi >> 8;\n buf[offset + 1] = hi;\n hi = hi >> 8;\n buf[offset] = hi;\n return offset + 8\n }\n\n Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n });\n\n Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n });\n\n Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1);\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n let i = 0;\n let mul = 1;\n let sub = 0;\n this[offset] = value & 0xFF;\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1);\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n let i = byteLength - 1;\n let mul = 1;\n let sub = 0;\n this[offset + i] = value & 0xFF;\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);\n if (value < 0) value = 0xff + value + 1;\n this[offset] = (value & 0xff);\n return offset + 1\n };\n\n Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n return offset + 2\n };\n\n Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n this[offset] = (value >>> 8);\n this[offset + 1] = (value & 0xff);\n return offset + 2\n };\n\n Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n this[offset + 2] = (value >>> 16);\n this[offset + 3] = (value >>> 24);\n return offset + 4\n };\n\n Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n if (value < 0) value = 0xffffffff + value + 1;\n this[offset] = (value >>> 24);\n this[offset + 1] = (value >>> 16);\n this[offset + 2] = (value >>> 8);\n this[offset + 3] = (value & 0xff);\n return offset + 4\n };\n\n Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n });\n\n Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n });\n\n function checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n }\n\n function writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4);\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4);\n return offset + 4\n }\n\n Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n };\n\n Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n };\n\n function writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8);\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8);\n return offset + 8\n }\n\n Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n };\n\n Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n };\n\n // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\n Buffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0;\n if (!end && end !== 0) end = this.length;\n if (targetStart >= target.length) targetStart = target.length;\n if (!targetStart) targetStart = 0;\n if (end > 0 && end < start) end = start;\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length;\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n\n const len = end - start;\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end);\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n );\n }\n\n return len\n };\n\n // Usage:\n // buffer.fill(number[, offset[, end]])\n // buffer.fill(buffer[, offset[, end]])\n // buffer.fill(string[, offset[, end]][, encoding])\n Buffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === 'string') {\n encoding = end;\n end = this.length;\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0);\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code;\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255;\n } else if (typeof val === 'boolean') {\n val = Number(val);\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0;\n end = end === undefined ? this.length : end >>> 0;\n\n if (!val) val = 0;\n\n let i;\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding);\n const len = bytes.length;\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n\n return this\n };\n\n // CUSTOM ERRORS\n // =============\n\n // Simplified versions from Node, changed for Buffer-only usage\n const errors = {};\n function E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super();\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n });\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`;\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack; // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name;\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n });\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n };\n }\n\n E('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError);\n E('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError);\n E('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`;\n let received = input;\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input));\n } else if (typeof input === 'bigint') {\n received = String(input);\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received);\n }\n received += 'n';\n }\n msg += ` It must be ${range}. Received ${received}`;\n return msg\n }, RangeError);\n\n function addNumericalSeparator (val) {\n let res = '';\n let i = val.length;\n const start = val[0] === '-' ? 1 : 0;\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`;\n }\n return `${val.slice(0, i)}${res}`\n }\n\n // CHECK FUNCTIONS\n // ===============\n\n function checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset');\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1));\n }\n }\n\n function checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : '';\n let range;\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`;\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`;\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`;\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength);\n }\n\n function validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n }\n\n function boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type);\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n }\n\n // HELPER FUNCTIONS\n // ================\n\n const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\n\n function base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0];\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '');\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '=';\n }\n return str\n }\n\n function utf8ToBytes (string, units) {\n units = units || Infinity;\n let codePoint;\n const length = string.length;\n let leadSurrogate = null;\n const bytes = [];\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i);\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint;\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n leadSurrogate = codePoint;\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n }\n\n leadSurrogate = null;\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint);\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n );\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n );\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n );\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n }\n\n function asciiToBytes (str) {\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF);\n }\n return byteArray\n }\n\n function utf16leToBytes (str, units) {\n let c, hi, lo;\n const byteArray = [];\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n\n return byteArray\n }\n\n function base64ToBytes (str) {\n return base64Js.toByteArray(base64clean(str))\n }\n\n function blitBuffer (src, dst, offset, length) {\n let i;\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i];\n }\n return i\n }\n\n // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n // the `instanceof` check but they should be treated as of that type.\n // See: https://github.com/feross/buffer/issues/166\n function isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n }\n function numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n }\n\n // Create lookup table for `toString('hex')`\n // See: https://github.com/feross/buffer/issues/219\n const hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef';\n const table = new Array(256);\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16;\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j];\n }\n }\n return table\n })();\n\n // Return not function with Error if BigInt not supported\n function defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n }\n\n function BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n }\n });\n var buffer_1 = buffer.Buffer;\n buffer.SlowBuffer;\n buffer.INSPECT_MAX_BYTES;\n buffer.kMaxLength;\n\n function arrBufToStr(buf, charSize) {\n var arr = charSize === 8 ? new Uint8Array(buf) : new Uint16Array(buf);\n return Array.from(arr)\n .map(function (b) { return String.fromCharCode(b); })\n .join('');\n }\n function arrBufToBase64(buf) {\n var str = arrBufToStr(buf, 8);\n return buffer_1.from(str, 'binary').toString('base64');\n }\n function strToArrBuf(str, charSize) {\n var view = charSize === 8 ? new Uint8Array(str.length) : new Uint16Array(str.length);\n for (var i = 0, strLen = str.length; i < strLen; i++) {\n view[i] = str.charCodeAt(i);\n }\n return view.buffer;\n }\n function base64ToArrBuf(base64) {\n var str = buffer_1.from(base64, 'base64').toString('binary');\n return strToArrBuf(str, 8);\n }\n function publicExponent() {\n return new Uint8Array([0x01, 0x00, 0x01]);\n }\n function randomBuf(length) {\n var arr = new Uint8Array(length);\n globalThis.crypto.getRandomValues(arr);\n return arr.buffer;\n }\n function joinBufs(fst, snd) {\n var view1 = new Uint8Array(fst);\n var view2 = new Uint8Array(snd);\n var joined = new Uint8Array(view1.length + view2.length);\n joined.set(view1);\n joined.set(view2, view1.length);\n return joined.buffer;\n }\n var normalizeUtf8ToBuf = function (msg) {\n return normalizeToBuf(msg, function (str) { return strToArrBuf(str, CharSize.B8); });\n };\n var normalizeUtf16ToBuf = function (msg) {\n return normalizeToBuf(msg, function (str) { return strToArrBuf(str, CharSize.B16); });\n };\n var normalizeBase64ToBuf = function (msg) {\n return normalizeToBuf(msg, base64ToArrBuf);\n };\n var normalizeUnicodeToBuf = function (msg, charSize) {\n switch (charSize) {\n case 8: return normalizeUtf8ToBuf(msg);\n default: return normalizeUtf16ToBuf(msg);\n }\n };\n var normalizeToBuf = function (msg, strConv) {\n if (typeof msg === 'string') {\n return strConv(msg);\n }\n else if (typeof msg === 'object' && msg.byteLength !== undefined) {\n // this is the best runtime check I could find for ArrayBuffer/Uint8Array\n var temp = new Uint8Array(msg);\n return temp.buffer;\n }\n else {\n throw new Error(\"Improper value. Must be a string, ArrayBuffer, Uint8Array\");\n }\n };\n /* istanbul ignore next */\n function structuralClone(obj) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve) {\n var _a = new MessageChannel(), port1 = _a.port1, port2 = _a.port2;\n port2.onmessage = function (ev) { return resolve(ev.data); };\n port1.postMessage(obj);\n })];\n });\n });\n }\n var utils = {\n arrBufToStr: arrBufToStr,\n arrBufToBase64: arrBufToBase64,\n strToArrBuf: strToArrBuf,\n base64ToArrBuf: base64ToArrBuf,\n publicExponent: publicExponent,\n randomBuf: randomBuf,\n joinBufs: joinBufs,\n normalizeUtf8ToBuf: normalizeUtf8ToBuf,\n normalizeUtf16ToBuf: normalizeUtf16ToBuf,\n normalizeBase64ToBuf: normalizeBase64ToBuf,\n normalizeToBuf: normalizeToBuf,\n structuralClone: structuralClone\n };\n\n var utils$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n arrBufToStr: arrBufToStr,\n arrBufToBase64: arrBufToBase64,\n strToArrBuf: strToArrBuf,\n base64ToArrBuf: base64ToArrBuf,\n publicExponent: publicExponent,\n randomBuf: randomBuf,\n joinBufs: joinBufs,\n normalizeUtf8ToBuf: normalizeUtf8ToBuf,\n normalizeUtf16ToBuf: normalizeUtf16ToBuf,\n normalizeBase64ToBuf: normalizeBase64ToBuf,\n normalizeUnicodeToBuf: normalizeUnicodeToBuf,\n normalizeToBuf: normalizeToBuf,\n structuralClone: structuralClone,\n 'default': utils\n });\n\n var ECC_READ_ALG = 'ECDH';\n var ECC_WRITE_ALG = 'ECDSA';\n var RSA_READ_ALG = 'RSA-OAEP';\n var RSA_WRITE_ALG = 'RSASSA-PKCS1-v1_5';\n var SALT_LENGTH = 128;\n var DEFAULT_CRYPTOSYSTEM = 'ecc';\n var DEFAULT_ECC_CURVE = EccCurve.P_256;\n var DEFAULT_RSA_SIZE = RsaSize.B2048;\n var DEFAULT_SYMM_ALG = SymmAlg.AES_CTR;\n var DEFAULT_SYMM_LEN = SymmKeyLength.B256;\n var DEFAULT_CTR_LEN = 64;\n var DEFAULT_HASH_ALG = HashAlg.SHA_256;\n var DEFAULT_CHAR_SIZE = CharSize.B16;\n var DEFAULT_STORE_NAME = 'keystore';\n var DEFAULT_READ_KEY_NAME = 'read-key';\n var DEFAULT_WRITE_KEY_NAME = 'write-key';\n var constants = {\n ECC_READ_ALG: ECC_READ_ALG,\n ECC_WRITE_ALG: ECC_WRITE_ALG,\n RSA_READ_ALG: RSA_READ_ALG,\n RSA_WRITE_ALG: RSA_WRITE_ALG,\n SALT_LENGTH: SALT_LENGTH,\n DEFAULT_CRYPTOSYSTEM: DEFAULT_CRYPTOSYSTEM,\n DEFAULT_ECC_CURVE: DEFAULT_ECC_CURVE,\n DEFAULT_RSA_SIZE: DEFAULT_RSA_SIZE,\n DEFAULT_SYMM_ALG: DEFAULT_SYMM_ALG,\n DEFAULT_CTR_LEN: DEFAULT_CTR_LEN,\n DEFAULT_HASH_ALG: DEFAULT_HASH_ALG,\n DEFAULT_CHAR_SIZE: DEFAULT_CHAR_SIZE,\n DEFAULT_STORE_NAME: DEFAULT_STORE_NAME,\n DEFAULT_READ_KEY_NAME: DEFAULT_READ_KEY_NAME,\n DEFAULT_WRITE_KEY_NAME: DEFAULT_WRITE_KEY_NAME,\n };\n\n var constants$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n ECC_READ_ALG: ECC_READ_ALG,\n ECC_WRITE_ALG: ECC_WRITE_ALG,\n RSA_READ_ALG: RSA_READ_ALG,\n RSA_WRITE_ALG: RSA_WRITE_ALG,\n SALT_LENGTH: SALT_LENGTH,\n DEFAULT_CRYPTOSYSTEM: DEFAULT_CRYPTOSYSTEM,\n DEFAULT_ECC_CURVE: DEFAULT_ECC_CURVE,\n DEFAULT_RSA_SIZE: DEFAULT_RSA_SIZE,\n DEFAULT_SYMM_ALG: DEFAULT_SYMM_ALG,\n DEFAULT_SYMM_LEN: DEFAULT_SYMM_LEN,\n DEFAULT_CTR_LEN: DEFAULT_CTR_LEN,\n DEFAULT_HASH_ALG: DEFAULT_HASH_ALG,\n DEFAULT_CHAR_SIZE: DEFAULT_CHAR_SIZE,\n DEFAULT_STORE_NAME: DEFAULT_STORE_NAME,\n DEFAULT_READ_KEY_NAME: DEFAULT_READ_KEY_NAME,\n DEFAULT_WRITE_KEY_NAME: DEFAULT_WRITE_KEY_NAME,\n 'default': constants\n });\n\n function makeKeypair(curve, use) {\n return __awaiter(this, void 0, void 0, function () {\n var alg, uses;\n return __generator(this, function (_a) {\n checkValidKeyUse(use);\n alg = use === KeyUse.Read ? ECC_READ_ALG : ECC_WRITE_ALG;\n uses = use === KeyUse.Read ? ['deriveKey', 'deriveBits'] : ['sign', 'verify'];\n return [2 /*return*/, globalThis.crypto.subtle.generateKey({ name: alg, namedCurve: curve }, false, uses)];\n });\n });\n }\n function importPublicKey(base64Key, curve, use) {\n return __awaiter(this, void 0, void 0, function () {\n var alg, uses, buf;\n return __generator(this, function (_a) {\n checkValidKeyUse(use);\n alg = use === KeyUse.Read ? ECC_READ_ALG : ECC_WRITE_ALG;\n uses = use === KeyUse.Read ? [] : ['verify'];\n buf = utils.base64ToArrBuf(base64Key);\n return [2 /*return*/, globalThis.crypto.subtle.importKey('raw', buf, { name: alg, namedCurve: curve }, true, uses)];\n });\n });\n }\n var keys = {\n makeKeypair: makeKeypair,\n importPublicKey: importPublicKey\n };\n\n function makeKey(opts) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, globalThis.crypto.subtle.generateKey({\n name: (opts === null || opts === void 0 ? void 0 : opts.alg) || DEFAULT_SYMM_ALG,\n length: (opts === null || opts === void 0 ? void 0 : opts.length) || DEFAULT_SYMM_LEN,\n }, true, ['encrypt', 'decrypt'])];\n });\n });\n }\n function importKey(base64key, opts) {\n return __awaiter(this, void 0, void 0, function () {\n var buf;\n return __generator(this, function (_a) {\n buf = utils.base64ToArrBuf(base64key);\n return [2 /*return*/, globalThis.crypto.subtle.importKey('raw', buf, {\n name: (opts === null || opts === void 0 ? void 0 : opts.alg) || DEFAULT_SYMM_ALG,\n length: (opts === null || opts === void 0 ? void 0 : opts.length) || DEFAULT_SYMM_LEN,\n }, true, ['encrypt', 'decrypt'])];\n });\n });\n }\n var keys$1 = {\n makeKey: makeKey,\n importKey: importKey,\n };\n\n function encryptBytes(msg, key, opts) {\n return __awaiter(this, void 0, void 0, function () {\n var data, importedKey, _a, alg, iv, cipherBuf;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n data = utils.normalizeUtf16ToBuf(msg);\n if (!(typeof key === 'string')) return [3 /*break*/, 2];\n return [4 /*yield*/, keys$1.importKey(key, opts)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _a = key;\n _b.label = 3;\n case 3:\n importedKey = _a;\n alg = (opts === null || opts === void 0 ? void 0 : opts.alg) || DEFAULT_SYMM_ALG;\n iv = (opts === null || opts === void 0 ? void 0 : opts.iv) || utils.randomBuf(16);\n return [4 /*yield*/, globalThis.crypto.subtle.encrypt({\n name: alg,\n // AES-CTR uses a counter, AES-GCM/AES-CBC use an initialization vector\n iv: alg === SymmAlg.AES_CTR ? undefined : iv,\n counter: alg === SymmAlg.AES_CTR ? new Uint8Array(iv) : undefined,\n length: alg === SymmAlg.AES_CTR ? DEFAULT_CTR_LEN : undefined,\n }, importedKey, data)];\n case 4:\n cipherBuf = _b.sent();\n return [2 /*return*/, utils.joinBufs(iv, cipherBuf)];\n }\n });\n });\n }\n function decryptBytes(msg, key, opts) {\n return __awaiter(this, void 0, void 0, function () {\n var cipherText, importedKey, _a, alg, iv, cipherBytes, msgBuff;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n cipherText = utils.normalizeBase64ToBuf(msg);\n if (!(typeof key === 'string')) return [3 /*break*/, 2];\n return [4 /*yield*/, keys$1.importKey(key, opts)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _a = key;\n _b.label = 3;\n case 3:\n importedKey = _a;\n alg = (opts === null || opts === void 0 ? void 0 : opts.alg) || DEFAULT_SYMM_ALG;\n iv = cipherText.slice(0, 16);\n cipherBytes = cipherText.slice(16);\n return [4 /*yield*/, globalThis.crypto.subtle.decrypt({ name: alg,\n // AES-CTR uses a counter, AES-GCM/AES-CBC use an initialization vector\n iv: alg === SymmAlg.AES_CTR ? undefined : iv,\n counter: alg === SymmAlg.AES_CTR ? new Uint8Array(iv) : undefined,\n length: alg === SymmAlg.AES_CTR ? DEFAULT_CTR_LEN : undefined,\n }, importedKey, cipherBytes)];\n case 4:\n msgBuff = _b.sent();\n return [2 /*return*/, msgBuff];\n }\n });\n });\n }\n function encrypt(msg, key, opts) {\n return __awaiter(this, void 0, void 0, function () {\n var cipherText;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, encryptBytes(msg, key, opts)];\n case 1:\n cipherText = _a.sent();\n return [2 /*return*/, utils.arrBufToBase64(cipherText)];\n }\n });\n });\n }\n function decrypt(msg, key, opts) {\n return __awaiter(this, void 0, void 0, function () {\n var msgBytes;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, decryptBytes(msg, key, opts)];\n case 1:\n msgBytes = _a.sent();\n return [2 /*return*/, utils.arrBufToStr(msgBytes, 16)];\n }\n });\n });\n }\n function exportKey(key) {\n return __awaiter(this, void 0, void 0, function () {\n var raw;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, globalThis.crypto.subtle.exportKey('raw', key)];\n case 1:\n raw = _a.sent();\n return [2 /*return*/, utils.arrBufToBase64(raw)];\n }\n });\n });\n }\n var operations = {\n encryptBytes: encryptBytes,\n decryptBytes: decryptBytes,\n encrypt: encrypt,\n decrypt: decrypt,\n exportKey: exportKey\n };\n\n var aes = __assign(__assign({}, keys$1), operations);\n\n function sign(msg, privateKey, charSize, hashAlg) {\n if (charSize === void 0) { charSize = DEFAULT_CHAR_SIZE; }\n if (hashAlg === void 0) { hashAlg = DEFAULT_HASH_ALG; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, globalThis.crypto.subtle.sign({ name: ECC_WRITE_ALG, hash: { name: hashAlg } }, privateKey, normalizeUnicodeToBuf(msg, charSize))];\n });\n });\n }\n function verify(msg, sig, publicKey, charSize, curve, hashAlg) {\n if (charSize === void 0) { charSize = DEFAULT_CHAR_SIZE; }\n if (curve === void 0) { curve = DEFAULT_ECC_CURVE; }\n if (hashAlg === void 0) { hashAlg = DEFAULT_HASH_ALG; }\n return __awaiter(this, void 0, void 0, function () {\n var _a, _b, _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n _b = (_a = globalThis.crypto.subtle).verify;\n _c = [{ name: ECC_WRITE_ALG, hash: { name: hashAlg } }];\n if (!(typeof publicKey === \"string\")) return [3 /*break*/, 2];\n return [4 /*yield*/, keys.importPublicKey(publicKey, curve, KeyUse.Write)];\n case 1:\n _d = _e.sent();\n return [3 /*break*/, 3];\n case 2:\n _d = publicKey;\n _e.label = 3;\n case 3: return [2 /*return*/, _b.apply(_a, _c.concat([_d, normalizeBase64ToBuf(sig),\n normalizeUnicodeToBuf(msg, charSize)]))];\n }\n });\n });\n }\n function encrypt$1(msg, privateKey, publicKey, charSize, curve, opts) {\n if (charSize === void 0) { charSize = DEFAULT_CHAR_SIZE; }\n if (curve === void 0) { curve = DEFAULT_ECC_CURVE; }\n return __awaiter(this, void 0, void 0, function () {\n var importedPublicKey, _a, cipherKey;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!(typeof publicKey === \"string\")) return [3 /*break*/, 2];\n return [4 /*yield*/, keys.importPublicKey(publicKey, curve, KeyUse.Read)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _a = publicKey;\n _b.label = 3;\n case 3:\n importedPublicKey = _a;\n return [4 /*yield*/, getSharedKey(privateKey, importedPublicKey, opts)];\n case 4:\n cipherKey = _b.sent();\n return [2 /*return*/, aes.encryptBytes(normalizeUnicodeToBuf(msg, charSize), cipherKey, opts)];\n }\n });\n });\n }\n function decrypt$1(msg, privateKey, publicKey, curve, opts) {\n if (curve === void 0) { curve = DEFAULT_ECC_CURVE; }\n return __awaiter(this, void 0, void 0, function () {\n var importedPublicKey, _a, cipherKey;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!(typeof publicKey === \"string\")) return [3 /*break*/, 2];\n return [4 /*yield*/, keys.importPublicKey(publicKey, curve, KeyUse.Read)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _a = publicKey;\n _b.label = 3;\n case 3:\n importedPublicKey = _a;\n return [4 /*yield*/, getSharedKey(privateKey, importedPublicKey, opts)];\n case 4:\n cipherKey = _b.sent();\n return [2 /*return*/, aes.decryptBytes(normalizeBase64ToBuf(msg), cipherKey, opts)];\n }\n });\n });\n }\n function getPublicKey(keypair) {\n return __awaiter(this, void 0, void 0, function () {\n var raw;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, globalThis.crypto.subtle.exportKey('raw', keypair.publicKey)];\n case 1:\n raw = _a.sent();\n return [2 /*return*/, utils.arrBufToBase64(raw)];\n }\n });\n });\n }\n function getSharedKey(privateKey, publicKey, opts) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, globalThis.crypto.subtle.deriveKey({ name: ECC_READ_ALG, public: publicKey }, privateKey, {\n name: (opts === null || opts === void 0 ? void 0 : opts.alg) || DEFAULT_SYMM_ALG,\n length: (opts === null || opts === void 0 ? void 0 : opts.length) || DEFAULT_SYMM_LEN\n }, false, ['encrypt', 'decrypt'])];\n });\n });\n }\n var operations$1 = {\n sign: sign,\n verify: verify,\n encrypt: encrypt$1,\n decrypt: decrypt$1,\n getPublicKey: getPublicKey,\n getSharedKey: getSharedKey\n };\n\n var defaultConfig = {\n type: DEFAULT_CRYPTOSYSTEM,\n curve: DEFAULT_ECC_CURVE,\n rsaSize: DEFAULT_RSA_SIZE,\n symmAlg: DEFAULT_SYMM_ALG,\n symmLen: DEFAULT_SYMM_LEN,\n hashAlg: DEFAULT_HASH_ALG,\n charSize: DEFAULT_CHAR_SIZE,\n storeName: DEFAULT_STORE_NAME,\n readKeyName: DEFAULT_READ_KEY_NAME,\n writeKeyName: DEFAULT_WRITE_KEY_NAME\n };\n function normalize(maybeCfg, eccEnabled) {\n if (eccEnabled === void 0) { eccEnabled = true; }\n var cfg;\n if (!maybeCfg) {\n cfg = defaultConfig;\n }\n else {\n cfg = __assign(__assign({}, defaultConfig), maybeCfg);\n }\n if (!(maybeCfg === null || maybeCfg === void 0 ? void 0 : maybeCfg.type)) {\n cfg.type = eccEnabled ? CryptoSystem.ECC : CryptoSystem.RSA;\n }\n return cfg;\n }\n // Attempt a structural clone of an ECC Key (required to store in IndexedDB)\n // If it throws an error, use RSA, otherwise use ECC\n function eccEnabled() {\n return __awaiter(this, void 0, void 0, function () {\n var keypair;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, keys.makeKeypair(DEFAULT_ECC_CURVE, KeyUse.Read)];\n case 1:\n keypair = _a.sent();\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, utils.structuralClone(keypair)];\n case 3:\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n _a.sent();\n return [2 /*return*/, false];\n case 5: return [2 /*return*/, true];\n }\n });\n });\n }\n function merge(cfg, overwrites) {\n if (overwrites === void 0) { overwrites = {}; }\n return __assign(__assign({}, cfg), overwrites);\n }\n function symmKeyOpts(cfg) {\n return { alg: cfg.symmAlg, length: cfg.symmLen };\n }\n var config = {\n defaultConfig: defaultConfig,\n normalize: normalize,\n eccEnabled: eccEnabled,\n merge: merge,\n symmKeyOpts: symmKeyOpts\n };\n\n var config$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n defaultConfig: defaultConfig,\n normalize: normalize,\n eccEnabled: eccEnabled,\n merge: merge,\n symmKeyOpts: symmKeyOpts,\n 'default': config\n });\n\n var KeyStoreBase = /** @class */ (function () {\n function KeyStoreBase(cfg, store) {\n this.cfg = cfg;\n this.store = store;\n }\n KeyStoreBase.prototype.writeKey = function () {\n return __awaiter(this, void 0, void 0, function () {\n var maybeKey;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, IDB.getKeypair(this.cfg.writeKeyName, this.store)];\n case 1:\n maybeKey = _a.sent();\n return [2 /*return*/, checkIsKeyPair(maybeKey)];\n }\n });\n });\n };\n KeyStoreBase.prototype.readKey = function () {\n return __awaiter(this, void 0, void 0, function () {\n var maybeKey;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, IDB.getKeypair(this.cfg.readKeyName, this.store)];\n case 1:\n maybeKey = _a.sent();\n return [2 /*return*/, checkIsKeyPair(maybeKey)];\n }\n });\n });\n };\n KeyStoreBase.prototype.getSymmKey = function (keyName, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var mergedCfg, maybeKey, key;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n mergedCfg = config.merge(this.cfg, cfg);\n return [4 /*yield*/, IDB.getKey(keyName, this.store)];\n case 1:\n maybeKey = _a.sent();\n if (maybeKey !== null) {\n return [2 /*return*/, maybeKey];\n }\n return [4 /*yield*/, aes.makeKey(config.symmKeyOpts(mergedCfg))];\n case 2:\n key = _a.sent();\n return [4 /*yield*/, IDB.put(keyName, key, this.store)];\n case 3:\n _a.sent();\n return [2 /*return*/, key];\n }\n });\n });\n };\n KeyStoreBase.prototype.keyExists = function (keyName) {\n return __awaiter(this, void 0, void 0, function () {\n var key;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, IDB.getKey(keyName, this.store)];\n case 1:\n key = _a.sent();\n return [2 /*return*/, key !== null];\n }\n });\n });\n };\n KeyStoreBase.prototype.deleteKey = function (keyName) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, IDB.rm(keyName, this.store)];\n });\n });\n };\n KeyStoreBase.prototype.destroy = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, IDB.dropStore(this.store)];\n });\n });\n };\n KeyStoreBase.prototype.importSymmKey = function (keyStr, keyName, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var mergedCfg, key;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n mergedCfg = config.merge(this.cfg, cfg);\n return [4 /*yield*/, aes.importKey(keyStr, config.symmKeyOpts(mergedCfg))];\n case 1:\n key = _a.sent();\n return [4 /*yield*/, IDB.put(keyName, key, this.store)];\n case 2:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n KeyStoreBase.prototype.exportSymmKey = function (keyName, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var key;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.getSymmKey(keyName, cfg)];\n case 1:\n key = _a.sent();\n return [2 /*return*/, aes.exportKey(key)];\n }\n });\n });\n };\n KeyStoreBase.prototype.encryptWithSymmKey = function (msg, keyName, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var mergedCfg, key, cipherText;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n mergedCfg = config.merge(this.cfg, cfg);\n return [4 /*yield*/, this.getSymmKey(keyName, cfg)];\n case 1:\n key = _a.sent();\n return [4 /*yield*/, aes.encryptBytes(utils.strToArrBuf(msg, mergedCfg.charSize), key, config.symmKeyOpts(mergedCfg))];\n case 2:\n cipherText = _a.sent();\n return [2 /*return*/, utils.arrBufToBase64(cipherText)];\n }\n });\n });\n };\n KeyStoreBase.prototype.decryptWithSymmKey = function (cipherText, keyName, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var mergedCfg, key, msgBytes;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n mergedCfg = config.merge(this.cfg, cfg);\n return [4 /*yield*/, this.getSymmKey(keyName, cfg)];\n case 1:\n key = _a.sent();\n return [4 /*yield*/, aes.decryptBytes(utils.base64ToArrBuf(cipherText), key, config.symmKeyOpts(mergedCfg))];\n case 2:\n msgBytes = _a.sent();\n return [2 /*return*/, utils.arrBufToStr(msgBytes, mergedCfg.charSize)];\n }\n });\n });\n };\n return KeyStoreBase;\n }());\n\n var ECCKeyStore = /** @class */ (function (_super) {\n __extends(ECCKeyStore, _super);\n function ECCKeyStore() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ECCKeyStore.init = function (maybeCfg) {\n return __awaiter(this, void 0, void 0, function () {\n var cfg, curve, storeName, readKeyName, writeKeyName, store;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n cfg = config.normalize(__assign(__assign({}, (maybeCfg || {})), { type: CryptoSystem.ECC }));\n curve = cfg.curve, storeName = cfg.storeName, readKeyName = cfg.readKeyName, writeKeyName = cfg.writeKeyName;\n store = IDB.createStore(storeName);\n return [4 /*yield*/, IDB.createIfDoesNotExist(readKeyName, function () { return (keys.makeKeypair(curve, KeyUse.Read)); }, store)];\n case 1:\n _a.sent();\n return [4 /*yield*/, IDB.createIfDoesNotExist(writeKeyName, function () { return (keys.makeKeypair(curve, KeyUse.Write)); }, store)];\n case 2:\n _a.sent();\n return [2 /*return*/, new ECCKeyStore(cfg, store)];\n }\n });\n });\n };\n ECCKeyStore.prototype.sign = function (msg, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var mergedCfg, writeKey, _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n mergedCfg = config.merge(this.cfg, cfg);\n return [4 /*yield*/, this.writeKey()];\n case 1:\n writeKey = _c.sent();\n _b = (_a = utils).arrBufToBase64;\n return [4 /*yield*/, operations$1.sign(msg, writeKey.privateKey, mergedCfg.charSize, mergedCfg.hashAlg)];\n case 2: return [2 /*return*/, _b.apply(_a, [_c.sent()])];\n }\n });\n });\n };\n ECCKeyStore.prototype.verify = function (msg, sig, publicKey, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var mergedCfg;\n return __generator(this, function (_a) {\n mergedCfg = config.merge(this.cfg, cfg);\n return [2 /*return*/, operations$1.verify(msg, sig, publicKey, mergedCfg.charSize, mergedCfg.curve, mergedCfg.hashAlg)];\n });\n });\n };\n ECCKeyStore.prototype.encrypt = function (msg, publicKey, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var mergedCfg, readKey, _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n mergedCfg = config.merge(this.cfg, cfg);\n return [4 /*yield*/, this.readKey()];\n case 1:\n readKey = _c.sent();\n _b = (_a = utils).arrBufToBase64;\n return [4 /*yield*/, operations$1.encrypt(msg, readKey.privateKey, publicKey, mergedCfg.charSize, mergedCfg.curve)];\n case 2: return [2 /*return*/, _b.apply(_a, [_c.sent()])];\n }\n });\n });\n };\n ECCKeyStore.prototype.decrypt = function (cipherText, publicKey, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var mergedCfg, readKey, _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n mergedCfg = config.merge(this.cfg, cfg);\n return [4 /*yield*/, this.readKey()];\n case 1:\n readKey = _c.sent();\n _b = (_a = utils).arrBufToStr;\n return [4 /*yield*/, operations$1.decrypt(cipherText, readKey.privateKey, publicKey, mergedCfg.curve)];\n case 2: return [2 /*return*/, _b.apply(_a, [_c.sent(),\n mergedCfg.charSize])];\n }\n });\n });\n };\n ECCKeyStore.prototype.publicReadKey = function () {\n return __awaiter(this, void 0, void 0, function () {\n var readKey;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.readKey()];\n case 1:\n readKey = _a.sent();\n return [2 /*return*/, operations$1.getPublicKey(readKey)];\n }\n });\n });\n };\n ECCKeyStore.prototype.publicWriteKey = function () {\n return __awaiter(this, void 0, void 0, function () {\n var writeKey;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.writeKey()];\n case 1:\n writeKey = _a.sent();\n return [2 /*return*/, operations$1.getPublicKey(writeKey)];\n }\n });\n });\n };\n return ECCKeyStore;\n }(KeyStoreBase));\n\n function makeKeypair$1(size, hashAlg, use) {\n return __awaiter(this, void 0, void 0, function () {\n var alg, uses;\n return __generator(this, function (_a) {\n checkValidKeyUse(use);\n alg = use === KeyUse.Read ? RSA_READ_ALG : RSA_WRITE_ALG;\n uses = use === KeyUse.Read ? ['encrypt', 'decrypt'] : ['sign', 'verify'];\n return [2 /*return*/, globalThis.crypto.subtle.generateKey({\n name: alg,\n modulusLength: size,\n publicExponent: utils.publicExponent(),\n hash: { name: hashAlg }\n }, false, uses)];\n });\n });\n }\n function stripKeyHeader(base64Key) {\n return base64Key\n .replace('-----BEGIN PUBLIC KEY-----\\n', '')\n .replace('\\n-----END PUBLIC KEY-----', '');\n }\n function importPublicKey$1(base64Key, hashAlg, use) {\n return __awaiter(this, void 0, void 0, function () {\n var alg, uses, buf;\n return __generator(this, function (_a) {\n checkValidKeyUse(use);\n alg = use === KeyUse.Read ? RSA_READ_ALG : RSA_WRITE_ALG;\n uses = use === KeyUse.Read ? ['encrypt'] : ['verify'];\n buf = utils.base64ToArrBuf(stripKeyHeader(base64Key));\n return [2 /*return*/, globalThis.crypto.subtle.importKey('spki', buf, { name: alg, hash: { name: hashAlg } }, true, uses)];\n });\n });\n }\n var keys$2 = {\n makeKeypair: makeKeypair$1,\n importPublicKey: importPublicKey$1\n };\n\n function sign$1(msg, privateKey, charSize) {\n if (charSize === void 0) { charSize = DEFAULT_CHAR_SIZE; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, globalThis.crypto.subtle.sign({ name: RSA_WRITE_ALG, saltLength: SALT_LENGTH }, privateKey, normalizeUnicodeToBuf(msg, charSize))];\n });\n });\n }\n function verify$1(msg, sig, publicKey, charSize, hashAlg) {\n if (charSize === void 0) { charSize = DEFAULT_CHAR_SIZE; }\n if (hashAlg === void 0) { hashAlg = DEFAULT_HASH_ALG; }\n return __awaiter(this, void 0, void 0, function () {\n var _a, _b, _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n _b = (_a = globalThis.crypto.subtle).verify;\n _c = [{ name: RSA_WRITE_ALG, saltLength: SALT_LENGTH }];\n if (!(typeof publicKey === \"string\")) return [3 /*break*/, 2];\n return [4 /*yield*/, keys$2.importPublicKey(publicKey, hashAlg, KeyUse.Write)];\n case 1:\n _d = _e.sent();\n return [3 /*break*/, 3];\n case 2:\n _d = publicKey;\n _e.label = 3;\n case 3: return [2 /*return*/, _b.apply(_a, _c.concat([_d, normalizeBase64ToBuf(sig),\n normalizeUnicodeToBuf(msg, charSize)]))];\n }\n });\n });\n }\n function encrypt$2(msg, publicKey, charSize, hashAlg) {\n if (charSize === void 0) { charSize = DEFAULT_CHAR_SIZE; }\n if (hashAlg === void 0) { hashAlg = DEFAULT_HASH_ALG; }\n return __awaiter(this, void 0, void 0, function () {\n var _a, _b, _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n _b = (_a = globalThis.crypto.subtle).encrypt;\n _c = [{ name: RSA_READ_ALG }];\n if (!(typeof publicKey === \"string\")) return [3 /*break*/, 2];\n return [4 /*yield*/, keys$2.importPublicKey(publicKey, hashAlg, KeyUse.Read)];\n case 1:\n _d = _e.sent();\n return [3 /*break*/, 3];\n case 2:\n _d = publicKey;\n _e.label = 3;\n case 3: return [2 /*return*/, _b.apply(_a, _c.concat([_d, normalizeUnicodeToBuf(msg, charSize)]))];\n }\n });\n });\n }\n function decrypt$2(msg, privateKey) {\n return __awaiter(this, void 0, void 0, function () {\n var normalized;\n return __generator(this, function (_a) {\n normalized = normalizeBase64ToBuf(msg);\n return [2 /*return*/, globalThis.crypto.subtle.decrypt({ name: RSA_READ_ALG }, privateKey, normalized)];\n });\n });\n }\n function getPublicKey$1(keypair) {\n return __awaiter(this, void 0, void 0, function () {\n var spki;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, globalThis.crypto.subtle.exportKey('spki', keypair.publicKey)];\n case 1:\n spki = _a.sent();\n return [2 /*return*/, utils.arrBufToBase64(spki)];\n }\n });\n });\n }\n var operations$2 = {\n sign: sign$1,\n verify: verify$1,\n encrypt: encrypt$2,\n decrypt: decrypt$2,\n getPublicKey: getPublicKey$1,\n };\n\n var RSAKeyStore = /** @class */ (function (_super) {\n __extends(RSAKeyStore, _super);\n function RSAKeyStore() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RSAKeyStore.init = function (maybeCfg) {\n return __awaiter(this, void 0, void 0, function () {\n var cfg, rsaSize, hashAlg, storeName, readKeyName, writeKeyName, store;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n cfg = config.normalize(__assign(__assign({}, (maybeCfg || {})), { type: CryptoSystem.RSA }));\n rsaSize = cfg.rsaSize, hashAlg = cfg.hashAlg, storeName = cfg.storeName, readKeyName = cfg.readKeyName, writeKeyName = cfg.writeKeyName;\n store = IDB.createStore(storeName);\n return [4 /*yield*/, IDB.createIfDoesNotExist(readKeyName, function () { return (keys$2.makeKeypair(rsaSize, hashAlg, KeyUse.Read)); }, store)];\n case 1:\n _a.sent();\n return [4 /*yield*/, IDB.createIfDoesNotExist(writeKeyName, function () { return (keys$2.makeKeypair(rsaSize, hashAlg, KeyUse.Write)); }, store)];\n case 2:\n _a.sent();\n return [2 /*return*/, new RSAKeyStore(cfg, store)];\n }\n });\n });\n };\n RSAKeyStore.prototype.sign = function (msg, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var mergedCfg, writeKey, _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n mergedCfg = config.merge(this.cfg, cfg);\n return [4 /*yield*/, this.writeKey()];\n case 1:\n writeKey = _c.sent();\n _b = (_a = utils).arrBufToBase64;\n return [4 /*yield*/, operations$2.sign(msg, writeKey.privateKey, mergedCfg.charSize)];\n case 2: return [2 /*return*/, _b.apply(_a, [_c.sent()])];\n }\n });\n });\n };\n RSAKeyStore.prototype.verify = function (msg, sig, publicKey, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var mergedCfg;\n return __generator(this, function (_a) {\n mergedCfg = config.merge(this.cfg, cfg);\n return [2 /*return*/, operations$2.verify(msg, sig, publicKey, mergedCfg.charSize, mergedCfg.hashAlg)];\n });\n });\n };\n RSAKeyStore.prototype.encrypt = function (msg, publicKey, cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var mergedCfg, _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n mergedCfg = config.merge(this.cfg, cfg);\n _b = (_a = utils).arrBufToBase64;\n return [4 /*yield*/, operations$2.encrypt(msg, publicKey, mergedCfg.charSize, mergedCfg.hashAlg)];\n case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];\n }\n });\n });\n };\n RSAKeyStore.prototype.decrypt = function (cipherText, publicKey, // unused param so that keystore interfaces match\n cfg) {\n return __awaiter(this, void 0, void 0, function () {\n var readKey, mergedCfg, _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0: return [4 /*yield*/, this.readKey()];\n case 1:\n readKey = _c.sent();\n mergedCfg = config.merge(this.cfg, cfg);\n _b = (_a = utils).arrBufToStr;\n return [4 /*yield*/, operations$2.decrypt(cipherText, readKey.privateKey)];\n case 2: return [2 /*return*/, _b.apply(_a, [_c.sent(),\n mergedCfg.charSize])];\n }\n });\n });\n };\n RSAKeyStore.prototype.publicReadKey = function () {\n return __awaiter(this, void 0, void 0, function () {\n var readKey;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.readKey()];\n case 1:\n readKey = _a.sent();\n return [2 /*return*/, operations$2.getPublicKey(readKey)];\n }\n });\n });\n };\n RSAKeyStore.prototype.publicWriteKey = function () {\n return __awaiter(this, void 0, void 0, function () {\n var writeKey;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.writeKey()];\n case 1:\n writeKey = _a.sent();\n return [2 /*return*/, operations$2.getPublicKey(writeKey)];\n }\n });\n });\n };\n return RSAKeyStore;\n }(KeyStoreBase));\n\n function init(maybeCfg) {\n return __awaiter(this, void 0, void 0, function () {\n var eccEnabled, cfg;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, config.eccEnabled()];\n case 1:\n eccEnabled = _a.sent();\n if (!eccEnabled && (maybeCfg === null || maybeCfg === void 0 ? void 0 : maybeCfg.type) === 'ecc') {\n throw ECCNotEnabled;\n }\n cfg = config.normalize(maybeCfg, eccEnabled);\n checkValidCryptoSystem(cfg.type);\n if (cfg.type === 'ecc') {\n return [2 /*return*/, ECCKeyStore.init(cfg)];\n }\n else {\n return [2 /*return*/, RSAKeyStore.init(cfg)];\n }\n }\n });\n });\n }\n function clear$1() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, IDB.clear()];\n });\n });\n }\n\n var index = __assign(__assign(__assign({}, keys), operations$1), ECCKeyStore);\n\n var ecc = /*#__PURE__*/Object.freeze({\n __proto__: null,\n 'default': index,\n makeKeypair: makeKeypair,\n importPublicKey: importPublicKey,\n sign: sign,\n verify: verify,\n encrypt: encrypt$1,\n decrypt: decrypt$1,\n getPublicKey: getPublicKey,\n getSharedKey: getSharedKey,\n ECCKeyStore: ECCKeyStore\n });\n\n var index$1 = __assign(__assign(__assign({}, keys$2), operations$2), RSAKeyStore);\n\n var rsa = /*#__PURE__*/Object.freeze({\n __proto__: null,\n 'default': index$1,\n makeKeypair: makeKeypair$1,\n importPublicKey: importPublicKey$1,\n sign: sign$1,\n verify: verify$1,\n encrypt: encrypt$2,\n decrypt: decrypt$2,\n getPublicKey: getPublicKey$1,\n RSAKeyStore: RSAKeyStore\n });\n\n var index$2 = __assign(__assign(__assign(__assign(__assign({ init: init,\n clear: clear$1 }, types), constants$1), config$1), utils$1), { ecc: ecc,\n rsa: rsa,\n idb: idb });\n\n return index$2;\n\n })));\n //# sourceMappingURL=index.umd.js.map\n });\n\n var KEYSTORE_CFG = { type: types.CryptoSystem.RSA };\n var ks = null;\n var clear$1 = function () { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!ks) return [3 /*break*/, 2];\n return [4 /*yield*/, ks.destroy()];\n case 1:\n _a.sent();\n ks = null;\n _a.label = 2;\n case 2: return [2 /*return*/];\n }\n });\n }); };\n var create = function () { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, index_umd.init(KEYSTORE_CFG)];\n case 1: return [2 /*return*/, (_a.sent())];\n }\n });\n }); };\n var set = function (userKeystore) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n ks = userKeystore;\n return [2 /*return*/];\n });\n }); };\n var get$1 = function () { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (ks)\n return [2 /*return*/, ks];\n return [4 /*yield*/, index_umd.init(KEYSTORE_CFG)];\n case 1:\n ks = (_a.sent());\n return [2 /*return*/, ks];\n }\n });\n }); };\n\n var keystore$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n clear: clear$1,\n create: create,\n set: set,\n get: get$1\n });\n\n var encrypt$2 = function (data, keyStr) { return __awaiter(void 0, void 0, void 0, function () {\n var key, encrypted;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('aes.encrypt');\n return [4 /*yield*/, aes$1.importKey(keyStr, { length: types.SymmKeyLength.B256 })];\n case 1:\n key = _a.sent();\n return [4 /*yield*/, aes$1.encryptBytes(data.buffer, key)];\n case 2:\n encrypted = _a.sent();\n return [2 /*return*/, new Uint8Array(encrypted)];\n }\n });\n }); };\n var decrypt$2 = function (encrypted, keyStr) { return __awaiter(void 0, void 0, void 0, function () {\n var key, decryptedBuf;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('aes.decrypt');\n return [4 /*yield*/, aes$1.importKey(keyStr, { length: types.SymmKeyLength.B256 })];\n case 1:\n key = _a.sent();\n return [4 /*yield*/, aes$1.decryptBytes(encrypted.buffer, key)];\n case 2:\n decryptedBuf = _a.sent();\n return [2 /*return*/, new Uint8Array(decryptedBuf)];\n }\n });\n }); };\n var genKeyStr = function () { return __awaiter(void 0, void 0, void 0, function () {\n var key;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('aes.genKeyStr');\n return [4 /*yield*/, aes$1.makeKey({ length: types.SymmKeyLength.B256 })];\n case 1:\n key = _a.sent();\n return [2 /*return*/, aes$1.exportKey(key)];\n }\n });\n }); };\n var decryptGCM = function (encrypted, keyStr, ivStr) { return __awaiter(void 0, void 0, void 0, function () {\n var iv, sessionKey, decrypted;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('aes.decryptGCM');\n iv = utils$1.base64ToArrBuf(ivStr);\n return [4 /*yield*/, window.crypto.subtle.importKey(\"raw\", utils$1.base64ToArrBuf(keyStr), \"AES-GCM\", false, [\"encrypt\", \"decrypt\"])\n // Decrypt secrets\n ];\n case 1:\n sessionKey = _a.sent();\n return [4 /*yield*/, window.crypto.subtle.decrypt({\n name: \"AES-GCM\",\n iv: iv\n }, sessionKey, utils$1.base64ToArrBuf(encrypted))];\n case 2:\n decrypted = _a.sent();\n return [2 /*return*/, utils$1.arrBufToStr(decrypted, types.CharSize.B8)];\n }\n });\n }); };\n var sha256 = function (bytes) { return __awaiter(void 0, void 0, void 0, function () {\n var buf, hash;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('hash.sha256');\n buf = bytes.buffer;\n return [4 /*yield*/, crypto.subtle.digest('SHA-256', buf)];\n case 1:\n hash = _a.sent();\n return [2 /*return*/, new Uint8Array(hash)];\n }\n });\n }); };\n var rsaVerify = function (message, signature, publicKey) {\n assertBrowser('rsa.verify');\n var keyStr = utils$1.arrBufToBase64(publicKey.buffer);\n return rsaOperations.verify(message, signature, keyStr);\n };\n var ed25519Verify = function (message, signature, publicKey) {\n return nobleEd25519.verify(signature, message, publicKey);\n };\n var ksPublicReadKey = function () { return __awaiter(void 0, void 0, void 0, function () {\n var ks;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('keystore.publicReadKey');\n return [4 /*yield*/, get$1()];\n case 1:\n ks = _a.sent();\n return [2 /*return*/, ks.publicReadKey()];\n }\n });\n }); };\n var ksPublicWriteKey = function () { return __awaiter(void 0, void 0, void 0, function () {\n var ks;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('keystore.publicWriteKey');\n return [4 /*yield*/, get$1()];\n case 1:\n ks = _a.sent();\n return [2 /*return*/, ks.publicWriteKey()];\n }\n });\n }); };\n var ksDecrypt = function (encrypted) { return __awaiter(void 0, void 0, void 0, function () {\n var ks;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('keystore.decrypt');\n return [4 /*yield*/, get$1()];\n case 1:\n ks = _a.sent();\n return [2 /*return*/, ks.decrypt(encrypted)];\n }\n });\n }); };\n var ksSign = function (message, charSize) { return __awaiter(void 0, void 0, void 0, function () {\n var ks;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('keystore.sign');\n return [4 /*yield*/, get$1()];\n case 1:\n ks = _a.sent();\n return [2 /*return*/, ks.sign(message, { charSize: charSize })];\n }\n });\n }); };\n var ksImportSymmKey = function (key, name) { return __awaiter(void 0, void 0, void 0, function () {\n var ks;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('keystore.importSymmKey');\n return [4 /*yield*/, get$1()];\n case 1:\n ks = _a.sent();\n return [2 /*return*/, ks.importSymmKey(key, name)];\n }\n });\n }); };\n var ksExportSymmKey = function (name) { return __awaiter(void 0, void 0, void 0, function () {\n var ks;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('keystore.exportSymmKey');\n return [4 /*yield*/, get$1()];\n case 1:\n ks = _a.sent();\n return [2 /*return*/, ks.exportSymmKey(name)];\n }\n });\n }); };\n var ksKeyExists = function (name) { return __awaiter(void 0, void 0, void 0, function () {\n var ks;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('keystore.keyExists');\n return [4 /*yield*/, get$1()];\n case 1:\n ks = _a.sent();\n return [2 /*return*/, ks.keyExists(name)];\n }\n });\n }); };\n var ksGetAlg = function () { return __awaiter(void 0, void 0, void 0, function () {\n var ks;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertBrowser('keystore.getAlg');\n return [4 /*yield*/, get$1()];\n case 1:\n ks = _a.sent();\n return [2 /*return*/, ks.cfg.type];\n }\n });\n }); };\n var ksClear = function () { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n assertBrowser('keystore.clear');\n return [2 /*return*/, clear$1()];\n });\n }); };\n\n var getItem = function (key) {\n assertBrowser('storage.getItem');\n return localforage.getItem(key);\n };\n var setItem = function (key, val) {\n assertBrowser('storage.setItem');\n return localforage.setItem(key, val);\n };\n var removeItem = function (key) {\n assertBrowser('storage.removeItem');\n return localforage.removeItem(key);\n };\n var clear$2 = function () {\n assertBrowser('storage.clear');\n return localforage.clear();\n };\n\n var DEFAULT_IMPLEMENTATION = {\n hash: {\n sha256: sha256\n },\n aes: {\n encrypt: encrypt$2,\n decrypt: decrypt$2,\n genKeyStr: genKeyStr,\n decryptGCM: decryptGCM,\n },\n rsa: {\n verify: rsaVerify\n },\n ed25519: {\n verify: ed25519Verify\n },\n keystore: {\n publicReadKey: ksPublicReadKey,\n publicWriteKey: ksPublicWriteKey,\n decrypt: ksDecrypt,\n sign: ksSign,\n importSymmKey: ksImportSymmKey,\n exportSymmKey: ksExportSymmKey,\n keyExists: ksKeyExists,\n getAlg: ksGetAlg,\n clear: ksClear,\n },\n storage: {\n getItem: getItem,\n setItem: setItem,\n removeItem: removeItem,\n clear: clear$2,\n }\n };\n var impl = DEFAULT_IMPLEMENTATION;\n var setDependencies = function (fns) {\n impl = {\n hash: merge(impl.hash, fns.hash),\n aes: merge(impl.aes, fns.aes),\n rsa: merge(impl.rsa, fns.rsa),\n ed25519: merge(impl.ed25519, fns.ed25519),\n keystore: merge(impl.keystore, fns.keystore),\n storage: merge(impl.storage, fns.storage),\n };\n return impl;\n };\n var merge = function (first, second) {\n return __assign(__assign({}, first), (second || {}));\n };\n\n var getItem$1 = function (key) {\n return impl.storage.getItem(key);\n };\n var setItem$1 = function (key, val) {\n return impl.storage.setItem(key, val);\n };\n var removeItem$1 = function (key) {\n return impl.storage.removeItem(key);\n };\n\n var isDefined = function (val) {\n return val !== undefined;\n };\n var notNull = function (val) {\n return val !== null;\n };\n var isJust = notNull;\n var isValue = function (val) {\n return isDefined(val) && notNull(val);\n };\n var isBool = function (val) {\n return typeof val === 'boolean';\n };\n var isNum = function (val) {\n return typeof val === 'number';\n };\n var isString = function (val) {\n return typeof val === 'string';\n };\n var isObject = function (val) {\n return val !== null && typeof val === 'object';\n };\n var isBlob = function (val) {\n var _a;\n if (typeof Blob === 'undefined')\n return false;\n return val instanceof Blob || (isObject(val) && ((_a = val === null || val === void 0 ? void 0 : val.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Blob');\n };\n\n var removeKeyFromObj = function (obj, key) {\n var _a = obj, _b = key; _a[_b]; var rest = __rest(_a, [typeof _b === \"symbol\" ? _b : _b + \"\"]); // eslint-disable-line\n return rest;\n };\n var updateOrRemoveKeyFromObj = function (obj, key, val) {\n var _a;\n return (val === null\n ? removeKeyFromObj(obj, key)\n : __assign(__assign({}, obj), (_a = {}, _a[key] = val, _a)));\n };\n var mapObj = function (obj, fn) {\n var newObj = {};\n Object.entries(obj).forEach(function (_a) {\n var key = _a[0], value = _a[1];\n newObj[key] = fn(value, key);\n });\n return newObj;\n };\n var mapObjAsync = function (obj, fn) { return __awaiter(void 0, void 0, void 0, function () {\n var newObj;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n newObj = {};\n return [4 /*yield*/, Promise.all(Object.entries(obj).map(function (_a) {\n var key = _a[0], value = _a[1];\n return __awaiter(void 0, void 0, void 0, function () {\n var _b, _c;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n _b = newObj;\n _c = key;\n return [4 /*yield*/, fn(value, key)];\n case 1:\n _b[_c] = _d.sent();\n return [2 /*return*/];\n }\n });\n });\n }))];\n case 1:\n _a.sent();\n return [2 /*return*/, newObj];\n }\n });\n }); };\n var arrContains = function (arr, val) {\n return arr.indexOf(val) > -1;\n };\n var asyncWaterfall = function (val, operations) { return __awaiter(void 0, void 0, void 0, function () {\n var acc, i;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n acc = val;\n i = 0;\n _a.label = 1;\n case 1:\n if (!(i < operations.length)) return [3 /*break*/, 4];\n return [4 /*yield*/, operations[i](acc)];\n case 2:\n acc = _a.sent();\n _a.label = 3;\n case 3:\n i++;\n return [3 /*break*/, 1];\n case 4: return [2 /*return*/, acc];\n }\n });\n }); };\n\n var VERSION = \"0.24.1\";\n\n var UCANS_STORAGE_KEY = \"webnative.auth_ucans\";\n var USERNAME_STORAGE_KEY = \"webnative.auth_username\";\n /**\n * Retrieve the authenticated username.\n */\n function authenticatedUsername() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, getItem$1(USERNAME_STORAGE_KEY).then(function (u) { return u ? u : null; })];\n });\n });\n }\n\n var index$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n api: api,\n arrbufs: arrbufs,\n base64: base64,\n blob: blob,\n UCANS_STORAGE_KEY: UCANS_STORAGE_KEY,\n USERNAME_STORAGE_KEY: USERNAME_STORAGE_KEY,\n authenticatedUsername: authenticatedUsername,\n isDefined: isDefined,\n notNull: notNull,\n isJust: isJust,\n isValue: isValue,\n isBool: isBool,\n isNum: isNum,\n isString: isString,\n isObject: isObject,\n isBlob: isBlob,\n removeKeyFromObj: removeKeyFromObj,\n updateOrRemoveKeyFromObj: updateOrRemoveKeyFromObj,\n mapObj: mapObj,\n mapObjAsync: mapObjAsync,\n arrContains: arrContains,\n asyncWaterfall: asyncWaterfall,\n VERSION: VERSION,\n isBrowser: isBrowser,\n assertBrowser: assertBrowser\n });\n\n var fromBytes = function (bytes) {\n return Array.prototype.map.call(bytes, function (x) { return ('00' + x.toString(16)).slice(-2); } // '00' is for left padding\n ).join('');\n };\n var toBytes = function (hex) {\n var arr = new Uint8Array(hex.length / 2);\n for (var i = 0; i < arr.length; i++) {\n arr[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);\n }\n return arr;\n };\n\n var sha256Str = function (str) { return __awaiter(void 0, void 0, void 0, function () {\n var buf, arr, hash;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n buf = utils.strToArrBuf(str, 8);\n arr = new Uint8Array(buf);\n return [4 /*yield*/, impl.hash.sha256(arr)];\n case 1:\n hash = _a.sent();\n return [2 /*return*/, fromBytes(hash)];\n }\n });\n }); };\n var hash = {\n sha256: function (bytes) {\n return impl.hash.sha256(bytes);\n },\n sha256Str: sha256Str\n };\n var aes$2 = {\n encrypt: function (bytes, key) {\n return impl.aes.encrypt(bytes, key);\n },\n decrypt: function (bytes, key) {\n return impl.aes.decrypt(bytes, key);\n },\n genKeyStr: function () {\n return impl.aes.genKeyStr();\n },\n decryptGCM: function (encrypted, keyStr, ivStr) {\n return impl.aes.decryptGCM(encrypted, keyStr, ivStr);\n }\n };\n var rsa$1 = {\n verify: function (message, signature, publicKey) {\n return impl.rsa.verify(message, signature, publicKey);\n }\n };\n var ed25519 = {\n verify: function (message, signature, publicKey) {\n return impl.ed25519.verify(message, signature, publicKey);\n }\n };\n var keystore$2 = {\n publicReadKey: function () {\n return impl.keystore.publicReadKey();\n },\n publicWriteKey: function () {\n return impl.keystore.publicWriteKey();\n },\n decrypt: function (encrypted) {\n return impl.keystore.decrypt(encrypted);\n },\n sign: function (message, charSize) {\n return impl.keystore.sign(message, charSize);\n },\n importSymmKey: function (key, name) {\n return impl.keystore.importSymmKey(key, name);\n },\n exportSymmKey: function (name) {\n return impl.keystore.exportSymmKey(name);\n },\n keyExists: function (keyName) {\n return impl.keystore.keyExists(keyName);\n },\n getAlg: function () {\n return impl.keystore.getAlg();\n },\n clear: function () {\n return impl.keystore.clear();\n }\n };\n\n var index$2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n sha256Str: sha256Str,\n hash: hash,\n aes: aes$2,\n rsa: rsa$1,\n ed25519: ed25519,\n keystore: keystore$2\n });\n\n var Branch;\n (function (Branch) {\n Branch[\"Public\"] = \"public\";\n Branch[\"Pretty\"] = \"p\";\n Branch[\"Private\"] = \"private\";\n Branch[\"PrivateLog\"] = \"privateLog\";\n Branch[\"Version\"] = \"version\";\n })(Branch || (Branch = {}));\n var Kind;\n (function (Kind) {\n Kind[\"Directory\"] = \"directory\";\n Kind[\"File\"] = \"file\";\n })(Kind || (Kind = {}));\n // CREATION\n /**\n * Utility function to create a `DirectoryPath`\n */\n function directory() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (args.some(function (p) { return p.includes(\"/\"); })) {\n throw new Error(\"Forward slashes `/` are not allowed\");\n }\n return { directory: args };\n }\n /**\n * Utility function to create a `FilePath`\n */\n function file() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (args.some(function (p) { return p.includes(\"/\"); })) {\n throw new Error(\"Forward slashes `/` are not allowed\");\n }\n return { file: args };\n }\n /**\n * Utility function to create a root `DirectoryPath`\n */\n function root() {\n return { directory: [] };\n }\n // POSIX\n /**\n * Transform a string into a `DistinctivePath`.\n *\n * Directories should have the format `path/to/dir/` and\n * files should have the format `path/to/file`.\n *\n * Leading forward slashes are removed too, so you can pass absolute paths.\n */\n function fromPosix(path) {\n var split = path.replace(/^\\/+/, \"\").split(\"/\");\n if (path.endsWith(\"/\"))\n return { directory: split.slice(0, -1) };\n else if (path === \"\")\n return root();\n return { file: split };\n }\n /**\n * Transform a `DistinctivePath` into a string.\n *\n * Directories will have the format `path/to/dir/` and\n * files will have the format `path/to/file`.\n */\n function toPosix(path, _a) {\n var _b = _a === void 0 ? { absolute: false } : _a, absolute = _b.absolute;\n var prefix = absolute ? \"/\" : \"\";\n var joinedPath = unwrap(path).join(\"/\");\n if (isDirectory(path))\n return prefix + joinedPath + (joinedPath.length ? \"/\" : \"\");\n return prefix + joinedPath;\n }\n // 🛠\n /**\n * Combine two `DistinctivePath`s.\n */\n function combine(a, b) {\n return map(function (p) { return unwrap(a).concat(p); }, b);\n }\n /**\n * Is this `DistinctivePath` of the given `Branch`?\n */\n function isBranch(branch, path) {\n return unwrap(path)[0] === branch;\n }\n /**\n * Is this `DistinctivePath` a directory?\n */\n function isDirectory(path) {\n return !!path.directory;\n }\n /**\n * Is this `DistinctivePath` a file?\n */\n function isFile(path) {\n return !!path.file;\n }\n /**\n * Is this `DirectoryPath` a root directory?\n */\n function isRootDirectory(path) {\n return path.directory.length === 0;\n }\n /**\n * Check if two `DistinctivePath` have the same `Branch`.\n */\n function isSameBranch(a, b) {\n return unwrap(a)[0] === unwrap(b)[0];\n }\n /**\n * Check if two `DistinctivePath` are of the same kind.\n */\n function isSameKind(a, b) {\n if (isDirectory(a) && isDirectory(b))\n return true;\n else if (isFile(a) && isFile(b))\n return true;\n else\n return false;\n }\n /**\n * What `Kind` of path are we dealing with?\n */\n function kind(path) {\n if (isDirectory(path))\n return Kind.Directory;\n return Kind.File;\n }\n /**\n * Map a `DistinctivePath`.\n */\n function map(fn, path) {\n if (isDirectory(path))\n return { directory: fn(path.directory) };\n else if (isFile(path))\n return { file: fn(path.file) };\n return path;\n }\n /**\n * Get the parent directory of a `DistinctivePath`.\n */\n function parent(path) {\n return isDirectory(path) && isRootDirectory(path)\n ? null\n : directory.apply(void 0, unwrap(path).slice(0, -1));\n }\n /**\n * Remove the `Branch` of a `DistinctivePath` (ie. the top-level directory)\n */\n function removeBranch(path) {\n return map(function (p) { return isDirectory(path) || p.length > 1 ? p.slice(1) : p; }, path);\n }\n /**\n * Unwrap a `DistinctivePath`.\n */\n function unwrap(path) {\n if (isDirectory(path)) {\n return path.directory;\n }\n else if (isFile(path)) {\n return path.file;\n }\n return [];\n }\n // ⚗️\n /**\n * Render a raw `Path` to a string for logging purposes.\n */\n function log(path) {\n return \"[ \" + path.join(\", \") + \" ]\";\n }\n\n var pathing = /*#__PURE__*/Object.freeze({\n __proto__: null,\n get Branch () { return Branch; },\n get Kind () { return Kind; },\n directory: directory,\n file: file,\n root: root,\n fromPosix: fromPosix,\n toPosix: toPosix,\n combine: combine,\n isBranch: isBranch,\n isDirectory: isDirectory,\n isFile: isFile,\n isRootDirectory: isRootDirectory,\n isSameBranch: isSameBranch,\n isSameKind: isSameKind,\n kind: kind,\n map: map,\n parent: parent,\n removeBranch: removeBranch,\n unwrap: unwrap,\n log: log\n });\n\n function bareNameFilter(_a) {\n var path = _a.path;\n return __awaiter(this, void 0, void 0, function () {\n var hash$1;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, hash.sha256Str(pathToString(path))];\n case 1:\n hash$1 = _b.sent();\n return [2 /*return*/, \"wnfs__bareNameFilter__\" + hash$1];\n }\n });\n });\n }\n function readKey(_a) {\n var path = _a.path;\n return __awaiter(this, void 0, void 0, function () {\n var hash$1;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, hash.sha256Str(pathToString(path))];\n case 1:\n hash$1 = _b.sent();\n return [2 /*return*/, \"wnfs__readKey__\" + hash$1];\n }\n });\n });\n }\n /**\n * This bit needs to backwards compatible.\n *\n * In webnative version < 0.24, we used to have `readKey({ path: \"/private\" })`\n * for the private root tree (aka. directory).\n */\n function pathToString(path) {\n return \"/\" + unwrap(path).join(\"/\");\n }\n\n /* eslint-env browser */\n\n /**\n * @typedef {Error|ErrorData} EncodedError\n *\n * Properties added by err-code library\n * @typedef {Object} ErrorExtension\n * @property {string} [code]\n * @property {string} [detail]\n */\n\n /**\n * @typedef {Error & ErrorExtension} ExtendedError\n */\n\n /**\n * @typedef {Object} ErrorData\n * @property {string} name\n * @property {string} message\n * @property {string|undefined} stack\n * @property {string|undefined} code\n * @property {string|undefined} detail\n *\n * @param {ExtendedError} error\n * @returns {EncodedError}\n */\n const encodeError = error => {\n const { name, message, stack, code, detail } = error;\n return { name, message, stack, code, detail }\n };\n var encodeError_1 = encodeError;\n\n /**\n * @param {EncodedError} error\n * @returns {Error}\n */\n const decodeError = error => {\n if (error instanceof Error) {\n return error\n } else {\n const { name, message, stack, code } = error;\n return Object.assign(createError(name, message), { name, stack, code })\n }\n };\n var decodeError_1 = decodeError;\n\n /**\n * Create error by error name.\n *\n * @param {string} name\n * @param {string} message\n * @returns {Error}\n */\n const createError = (name, message) => {\n switch (name) {\n case 'RangeError': {\n return new RangeError(message)\n }\n case 'ReferenceError': {\n return ReferenceError(message)\n }\n case 'SyntaxError': {\n return new SyntaxError(message)\n }\n case 'TypeError': {\n return new TypeError(message)\n }\n case 'URIError': {\n return new URIError(message)\n }\n default: {\n return new Error(message)\n }\n }\n };\n\n var error = {\n \tencodeError: encodeError_1,\n \tdecodeError: decodeError_1\n };\n\n /**\n * Transforms an array of ArrayBuffers into a Set,\n * and makes sure the buffers are not detached.\n *\n * @param {Transferable[]} values\n * @returns {Set<Transferable>}\n */\n const ensureUniqueBuffers = values => new Set(values);\n var ensureUniqueBuffers_1 = ensureUniqueBuffers;\n\n var buffer$1 = {\n \tensureUniqueBuffers: ensureUniqueBuffers_1\n };\n\n var TimeoutError_1 = class TimeoutError extends Error {\n get name () {\n return this.constructor.name\n }\n };\n\n var AbortError_1 = class AbortError extends Error {\n get name () {\n return this.constructor.name\n }\n };\n\n var DisconnectError_1 = class DisconnectError extends Error {\n get name () {\n return this.constructor.name\n }\n };\n\n var error$1 = {\n \tTimeoutError: TimeoutError_1,\n \tAbortError: AbortError_1,\n \tDisconnectError: DisconnectError_1\n };\n\n const { decodeError: decodeError$1 } = error;\n const { ensureUniqueBuffers: ensureUniqueBuffers$1 } = buffer$1;\n const { DisconnectError, TimeoutError, AbortError } = error$1;\n\n /**\n * RPC Transport over `MessagePort` that can execute queries. It takes care of\n * executing queries by issuing a message with unique ID and fullfilling a\n * query when corresponding response message is received. It also makes sure\n * that aborted / timed out queries are cancelled as needed.\n *\n * It is expected that there will be at most one transport for a message port\n * instance.\n *\n */\n var transport = class MessageTransport {\n /**\n * Create transport for the underlying message port.\n *\n * @param {MessagePort} [port]\n */\n constructor (port) {\n this.port = null;\n // Assigining a random enough identifier to the transport, to ensure that\n // query.id will be unique when multiple tabs are communicating with a\n // a server in the SharedWorker.\n this.id = Math.random()\n .toString(32)\n .slice(2);\n\n // Local unique id on the transport which is incremented for each query.\n this.nextID = 0;\n\n // Dictionary of pending requests\n /** @type {Record<string, Query<any, any>>} */\n this.queries = Object.create(null);\n\n // If port is provided connect this transport to it. If not transport can\n // queue queries and execute those once it's connected.\n if (port) {\n this.connect(port);\n }\n }\n\n /**\n * Executes given query with this transport and returns promise for it's\n * result. Promise fails with an error if query fails.\n *\n * @template I, O\n * @param {Query<I, O>} query\n * @returns {Promise<O>}\n */\n execute (query) {\n const id = `${this.id}@${this.nextID++}`;\n this.queries[id] = query;\n\n // If query has a timeout set a timer.\n if (query.timeout > 0 && query.timeout < Infinity) {\n query.timerID = setTimeout(MessageTransport.timeout, query.timeout, this, id);\n }\n\n if (query.signal) {\n query.signal.addEventListener('abort', () => this.abort(id), {\n once: true\n });\n }\n\n // If transport is connected (it has port) post a query, otherwise it\n // will remain in the pending queries queue.\n if (this.port) {\n MessageTransport.postQuery(this.port, id, query);\n }\n\n return query.result\n }\n\n /**\n * Connects this transport to the given message port. Throws `Error` if\n * transport is already connected. All the pending queries will be executed\n * as connection occurs.\n *\n * @param {MessagePort} port\n */\n connect (port) {\n if (this.port) {\n throw new Error('Transport is already open')\n } else {\n this.port = port;\n this.port.addEventListener('message', this);\n this.port.start();\n\n // Go ever pending queries (that were submitted before transport was\n // connected) and post them. This loop is safe because messages will not\n // arrive while this loop is running so no mutation can occur.\n for (const [id, query] of Object.entries(this.queries)) {\n MessageTransport.postQuery(port, id, query);\n }\n }\n }\n\n /**\n * Disconnects this transport. This will cause all the pending queries\n * to be aborted and undelying message port to be closed.\n *\n * Once disconnected transport can not be reconnected back.\n */\n disconnect () {\n const error = new DisconnectError();\n for (const [id, query] of Object.entries(this.queries)) {\n query.fail(error);\n this.abort(id);\n }\n\n // Note that reference to port is kept that ensures that attempt to\n // reconnect will throw an error.\n if (this.port) {\n this.port.removeEventListener('message', this);\n this.port.close();\n }\n }\n\n /**\n * Invoked on query timeout. If query is still pending it will fail and\n * abort message will be send to a the server.\n *\n * @param {MessageTransport} self\n * @param {string} id\n */\n static timeout (self, id) {\n const { queries } = self;\n const query = queries[id];\n if (query) {\n delete queries[id];\n query.fail(new TimeoutError('request timed out'));\n if (self.port) {\n self.port.postMessage({ type: 'abort', id });\n }\n }\n }\n\n /**\n * Aborts this query by failing with `AbortError` and sending an abort message\n * to the server. If query is no longer pending this has no effect.\n *\n * @param {string} id\n */\n abort (id) {\n const { queries } = this;\n const query = queries[id];\n if (query) {\n delete queries[id];\n\n query.fail(new AbortError());\n if (this.port) {\n this.port.postMessage({ type: 'abort', id });\n }\n\n if (query.timerID != null) {\n clearTimeout(query.timerID);\n }\n }\n }\n\n /**\n * Sends a given `query` with a given `id` over the message channel.\n *\n * @param {MessagePort} port\n * @param {string} id\n * @param {Query<any, any>} query\n */\n static postQuery (port, id, query) {\n port.postMessage(\n {\n type: 'query',\n namespace: query.namespace,\n method: query.method,\n id,\n input: query.toJSON()\n },\n // @ts-expect-error - TS seems to want second arg to postMessage to not be undefined\n ensureUniqueBuffers$1(query.transfer() || [])\n );\n }\n\n /**\n * Handler is invoked when message on the message port is received.\n *\n * @param {MessageEvent} event\n */\n handleEvent (event) {\n const { id, result } = event.data;\n const query = this.queries[id];\n // If query with a the given ID is found it is completed with the result,\n // otherwise it is cancelled.\n // Note: query may not be found when it was aborted on the client and at the\n // same time server posted response.\n if (query) {\n delete this.queries[id];\n if (result.ok) {\n query.succeed(result.value);\n } else {\n query.fail(decodeError$1(result.error));\n }\n\n if (query.timerID != null) {\n clearTimeout(query.timerID);\n }\n }\n }\n };\n\n /**\n * Represents server query, encapsulating inputs to the server endpoint and\n * promise of it's result.\n *\n * @template I,O\n */\n var query = class Query {\n /**\n * @param {string} namespace - component namespace on the server.\n * @param {string} method - remote method this is a query of.\n * @param {QueryInput<I>} input - query input.\n */\n constructor (namespace, method, input) {\n /** @type {Promise<O>} */\n this.result = new Promise((resolve, reject) => {\n this.succeed = resolve;\n this.fail = reject;\n this.signal = input.signal;\n this.input = input;\n this.namespace = namespace;\n this.method = method;\n this.timeout = input.timeout == null ? Infinity : input.timeout;\n /** @type {number|null} */\n this.timerID = null;\n });\n }\n\n /**\n * Data that will be structure cloned over message channel.\n *\n * @returns {Object}\n */\n toJSON () {\n return this.input\n }\n\n /**\n * Data that will be transferred over message channel.\n *\n * @returns {Transferable[]|void}\n */\n transfer () {\n return this.input.transfer\n }\n };\n\n /**\n * Service represents an API to a remote service `T`. It will have all the\n * methods with the same signatures as `T`.\n *\n * @template T\n */\n var service = class Service {\n /**\n * @param {string} namespace - Namespace that remote API is served under.\n * @param {ProcedureNames<T>} methods - Method names of the remote API.\n * @param {MessageTransport} transport - Transport to issue queries over.\n */\n constructor (namespace, methods, transport) {\n this.transport = transport;\n // Type script does not like using classes as some dicitionaries, so\n // we explicitly type it as dictionary.\n /** @type {Object.<ProcedureNames<T>, Function>} */\n const api = this;\n for (const method of methods) {\n /**\n * @template I, O\n * @param {I} input\n * @returns {Promise<O>}\n */\n api[method] = input =>\n this.transport.execute(new query(namespace, method.toString(), input));\n }\n }\n };\n\n /* eslint-env browser */\n\n\n\n /**\n * @template T\n * @typedef {import('ipfs-message-port-protocol/src/rpc').Remote<T>} Remote\n */\n\n /**\n * @template T\n * @typedef {import('ipfs-message-port-protocol/src/rpc').ProcedureNames<T>} ProcedureNames\n */\n\n /**\n * @template T\n * @typedef {Array<keyof T>} Keys\n */\n\n /**\n * @template T\n * @typedef {Remote<T> & Service<T>} RemoteService\n */\n\n /**\n * Client represents the client to remote `T` service. It is a base clase that\n * specific API clients will subclass to provide a higher level API for end\n * user. Client implementations take care of encoding arguments into quries\n * and issing those to `remote` service.\n *\n * @class\n * @template T\n */\n var client = class Client {\n /**\n * @param {string} namespace\n * @param {ProcedureNames<T>} methods\n * @param {MessageTransport} transport\n */\n constructor (namespace, methods, transport) {\n /** @type {RemoteService<T>} */\n this.remote = (new service(namespace, methods, transport));\n }\n };\n\n // base-x encoding / decoding\n // Copyright (c) 2018 base-x contributors\n // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)\n // Distributed under the MIT software license, see the accompanying\n // file LICENSE or http://www.opensource.org/licenses/mit-license.php.\n function base$1 (ALPHABET) {\n if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }\n var BASE_MAP = new Uint8Array(256);\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255;\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i);\n var xc = x.charCodeAt(0);\n if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }\n BASE_MAP[xc] = i;\n }\n var BASE = ALPHABET.length;\n var LEADER = ALPHABET.charAt(0);\n var FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up\n var iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up\n function encode (source) {\n if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);\n } else if (Array.isArray(source)) {\n source = Uint8Array.from(source);\n }\n if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }\n if (source.length === 0) { return '' }\n // Skip & count leading zeroes.\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n // Allocate enough space in big-endian base58 representation.\n var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;\n var b58 = new Uint8Array(size);\n // Process the bytes.\n while (pbegin !== pend) {\n var carry = source[pbegin];\n // Apply \"b58 = b58 * 256 + ch\".\n var i = 0;\n for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {\n carry += (256 * b58[it1]) >>> 0;\n b58[it1] = (carry % BASE) >>> 0;\n carry = (carry / BASE) >>> 0;\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i;\n pbegin++;\n }\n // Skip leading zeroes in base58 result.\n var it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n // Translate the result into a string.\n var str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }\n return str\n }\n function decodeUnsafe (source) {\n if (typeof source !== 'string') { throw new TypeError('Expected String') }\n if (source.length === 0) { return new Uint8Array() }\n var psz = 0;\n // Skip leading spaces.\n if (source[psz] === ' ') { return }\n // Skip and count leading '1's.\n var zeroes = 0;\n var length = 0;\n while (source[psz] === LEADER) {\n zeroes++;\n psz++;\n }\n // Allocate enough space in big-endian base256 representation.\n var size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.\n var b256 = new Uint8Array(size);\n // Process the characters.\n while (source[psz]) {\n // Decode character\n var carry = BASE_MAP[source.charCodeAt(psz)];\n // Invalid character\n if (carry === 255) { return }\n var i = 0;\n for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {\n carry += (BASE * b256[it3]) >>> 0;\n b256[it3] = (carry % 256) >>> 0;\n carry = (carry / 256) >>> 0;\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i;\n psz++;\n }\n // Skip trailing spaces.\n if (source[psz] === ' ') { return }\n // Skip leading zeroes in b256.\n var it4 = size - length;\n while (it4 !== size && b256[it4] === 0) {\n it4++;\n }\n var vch = new Uint8Array(zeroes + (size - it4));\n var j = zeroes;\n while (it4 !== size) {\n vch[j++] = b256[it4++];\n }\n return vch\n }\n function decode (string) {\n var buffer = decodeUnsafe(string);\n if (buffer) { return buffer }\n throw new Error('Non-base' + BASE + ' character')\n }\n return {\n encode: encode,\n decodeUnsafe: decodeUnsafe,\n decode: decode\n }\n }\n var src = base$1;\n\n var inherits;\n if (typeof Object.create === 'function'){\n inherits = function inherits(ctor, superCtor) {\n // implementation from standard node.js 'util' module\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n } else {\n inherits = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n };\n }\n var inherits$1 = inherits;\n\n var formatRegExp = /%[sdj%]/g;\n function format(f) {\n if (!isString$1(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject$1(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n }\n\n // Mark that a method should not be used.\n // Returns a modified function which warns once by default.\n // If --no-deprecation is set, then it is a no-op.\n function deprecate(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global$1.process)) {\n return function() {\n return deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n }\n\n var debugs = {};\n var debugEnviron;\n function debuglog(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = 0;\n debugs[set] = function() {\n var msg = format.apply(null, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n }\n\n /**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n /* legacy: obj, showHidden, depth, colors*/\n function inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n _extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n }\n\n // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\n inspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n };\n\n // Don't use 'blue' not visible on cmd.exe\n inspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n };\n\n\n function stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n }\n\n\n function stylizeNoColor(str, styleType) {\n return str;\n }\n\n\n function arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n }\n\n\n function formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString$1(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n }\n\n\n function formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString$1(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n }\n\n\n function formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n }\n\n\n function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n }\n\n\n function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n }\n\n\n function reduceToSingleString(output, base, braces) {\n var length = output.reduce(function(prev, cur) {\n if (cur.indexOf('\\n') >= 0) ;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n }\n\n\n // NOTE: These type checking functions intentionally don't use `instanceof`\n // because it is fragile and can be easily faked with `Object.create()`.\n function isArray(ar) {\n return Array.isArray(ar);\n }\n\n function isBoolean(arg) {\n return typeof arg === 'boolean';\n }\n\n function isNull(arg) {\n return arg === null;\n }\n\n function isNullOrUndefined(arg) {\n return arg == null;\n }\n\n function isNumber(arg) {\n return typeof arg === 'number';\n }\n\n function isString$1(arg) {\n return typeof arg === 'string';\n }\n\n function isSymbol(arg) {\n return typeof arg === 'symbol';\n }\n\n function isUndefined(arg) {\n return arg === void 0;\n }\n\n function isRegExp(re) {\n return isObject$1(re) && objectToString(re) === '[object RegExp]';\n }\n\n function isObject$1(arg) {\n return typeof arg === 'object' && arg !== null;\n }\n\n function isDate(d) {\n return isObject$1(d) && objectToString(d) === '[object Date]';\n }\n\n function isError(e) {\n return isObject$1(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n }\n\n function isFunction(arg) {\n return typeof arg === 'function';\n }\n\n function isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n }\n\n function isBuffer(maybeBuf) {\n return buffer.Buffer.isBuffer(maybeBuf);\n }\n\n function objectToString(o) {\n return Object.prototype.toString.call(o);\n }\n\n\n function pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n }\n\n\n var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n // 26 Feb 16:19:34\n function timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n }\n\n\n // log is just a thin wrapper to console.log that prepends a timestamp\n function log$1() {\n console.log('%s - %s', timestamp(), format.apply(null, arguments));\n }\n\n function _extend(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject$1(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n }\n function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n }\n\n var util = {\n inherits: inherits$1,\n _extend: _extend,\n log: log$1,\n isBuffer: isBuffer,\n isPrimitive: isPrimitive,\n isFunction: isFunction,\n isError: isError,\n isDate: isDate,\n isObject: isObject$1,\n isRegExp: isRegExp,\n isUndefined: isUndefined,\n isSymbol: isSymbol,\n isString: isString$1,\n isNumber: isNumber,\n isNullOrUndefined: isNullOrUndefined,\n isNull: isNull,\n isBoolean: isBoolean,\n isArray: isArray,\n inspect: inspect,\n deprecate: deprecate,\n format: format,\n debuglog: debuglog\n };\n\n var util$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n format: format,\n deprecate: deprecate,\n debuglog: debuglog,\n inspect: inspect,\n isArray: isArray,\n isBoolean: isBoolean,\n isNull: isNull,\n isNullOrUndefined: isNullOrUndefined,\n isNumber: isNumber,\n isString: isString$1,\n isSymbol: isSymbol,\n isUndefined: isUndefined,\n isRegExp: isRegExp,\n isObject: isObject$1,\n isDate: isDate,\n isError: isError,\n isFunction: isFunction,\n isPrimitive: isPrimitive,\n isBuffer: isBuffer,\n log: log$1,\n inherits: inherits$1,\n _extend: _extend,\n 'default': util\n });\n\n var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(util$1);\n\n var TextEncoder_1 =\n typeof TextEncoder !== \"undefined\" ? TextEncoder : require$$0$1.TextEncoder;\n\n var TextDecoder_1 =\n typeof TextDecoder !== \"undefined\" ? TextDecoder : require$$0$1.TextDecoder;\n\n var lib = {\n \tTextEncoder: TextEncoder_1,\n \tTextDecoder: TextDecoder_1\n };\n\n // @ts-ignore\n const { TextEncoder: TextEncoder$1, TextDecoder: TextDecoder$1 } = lib;\n\n const textDecoder = new TextDecoder$1();\n /**\n * @param {ArrayBufferView|ArrayBuffer} bytes\n * @returns {string}\n */\n const decodeText = (bytes) => textDecoder.decode(bytes);\n\n const textEncoder = new TextEncoder$1();\n /**\n * @param {string} text\n * @returns {Uint8Array}\n */\n const encodeText = (text) => textEncoder.encode(text);\n\n /**\n * Returns a new Uint8Array created by concatenating the passed Arrays\n *\n * @param {Array<ArrayLike<number>>} arrs\n * @param {number} length\n * @returns {Uint8Array}\n */\n function concat (arrs, length) {\n const output = new Uint8Array(length);\n let offset = 0;\n\n for (const arr of arrs) {\n output.set(arr, offset);\n offset += arr.length;\n }\n\n return output\n }\n\n var util$2 = { decodeText, encodeText, concat };\n\n const { encodeText: encodeText$1 } = util$2;\n\n /** @typedef {import('./types').CodecFactory} CodecFactory */\n /** @typedef {import(\"./types\").BaseName} BaseName */\n /** @typedef {import(\"./types\").BaseCode} BaseCode */\n\n /**\n * Class to encode/decode in the supported Bases\n *\n */\n class Base {\n /**\n * @param {BaseName} name\n * @param {BaseCode} code\n * @param {CodecFactory} factory\n * @param {string} alphabet\n */\n constructor (name, code, factory, alphabet) {\n this.name = name;\n this.code = code;\n this.codeBuf = encodeText$1(this.code);\n this.alphabet = alphabet;\n this.codec = factory(alphabet);\n }\n\n /**\n * @param {Uint8Array} buf\n * @returns {string}\n */\n encode (buf) {\n return this.codec.encode(buf)\n }\n\n /**\n * @param {string} string\n * @returns {Uint8Array}\n */\n decode (string) {\n for (const char of string) {\n if (this.alphabet && this.alphabet.indexOf(char) < 0) {\n throw new Error(`invalid character '${char}' in '${string}'`)\n }\n }\n return this.codec.decode(string)\n }\n }\n\n var base$2 = Base;\n\n /** @typedef {import('./types').CodecFactory} CodecFactory */\n\n /**\n * @param {string} string\n * @param {string} alphabet\n * @param {number} bitsPerChar\n * @returns {Uint8Array}\n */\n const decode$1 = (string, alphabet, bitsPerChar) => {\n // Build the character lookup table:\n /** @type {Record<string, number>} */\n const codes = {};\n for (let i = 0; i < alphabet.length; ++i) {\n codes[alphabet[i]] = i;\n }\n\n // Count the padding bytes:\n let end = string.length;\n while (string[end - 1] === '=') {\n --end;\n }\n\n // Allocate the output:\n const out = new Uint8Array((end * bitsPerChar / 8) | 0);\n\n // Parse the data:\n let bits = 0; // Number of bits currently in the buffer\n let buffer = 0; // Bits waiting to be written out, MSB first\n let written = 0; // Next byte to write\n for (let i = 0; i < end; ++i) {\n // Read one character from the string:\n const value = codes[string[i]];\n if (value === undefined) {\n throw new SyntaxError('Invalid character ' + string[i])\n }\n\n // Append the bits to the buffer:\n buffer = (buffer << bitsPerChar) | value;\n bits += bitsPerChar;\n\n // Write out some bits if the buffer has a byte's worth:\n if (bits >= 8) {\n bits -= 8;\n out[written++] = 0xff & (buffer >> bits);\n }\n }\n\n // Verify that we have received just enough bits:\n if (bits >= bitsPerChar || 0xff & (buffer << (8 - bits))) {\n throw new SyntaxError('Unexpected end of data')\n }\n\n return out\n };\n\n /**\n * @param {Uint8Array} data\n * @param {string} alphabet\n * @param {number} bitsPerChar\n * @returns {string}\n */\n const encode$1 = (data, alphabet, bitsPerChar) => {\n const pad = alphabet[alphabet.length - 1] === '=';\n const mask = (1 << bitsPerChar) - 1;\n let out = '';\n\n let bits = 0; // Number of bits currently in the buffer\n let buffer = 0; // Bits waiting to be written out, MSB first\n for (let i = 0; i < data.length; ++i) {\n // Slurp data into the buffer:\n buffer = (buffer << 8) | data[i];\n bits += 8;\n\n // Write out as much as we can:\n while (bits > bitsPerChar) {\n bits -= bitsPerChar;\n out += alphabet[mask & (buffer >> bits)];\n }\n }\n\n // Partial character:\n if (bits) {\n out += alphabet[mask & (buffer << (bitsPerChar - bits))];\n }\n\n // Add padding characters until we hit a byte boundary:\n if (pad) {\n while ((out.length * bitsPerChar) & 7) {\n out += '=';\n }\n }\n\n return out\n };\n\n /**\n * RFC4648 Factory\n *\n * @param {number} bitsPerChar\n * @returns {CodecFactory}\n */\n const rfc4648 = (bitsPerChar) => (alphabet) => {\n return {\n /**\n * @param {Uint8Array} input\n * @returns {string}\n */\n encode (input) {\n return encode$1(input, alphabet, bitsPerChar)\n },\n /**\n * @param {string} input\n * @returns {Uint8Array}\n */\n decode (input) {\n return decode$1(input, alphabet, bitsPerChar)\n }\n }\n };\n\n var rfc4648_1 = { rfc4648 };\n\n const { rfc4648: rfc4648$1 } = rfc4648_1;\n const { decodeText: decodeText$1, encodeText: encodeText$2 } = util$2;\n\n /** @typedef {import('./types').CodecFactory} CodecFactory */\n /** @typedef {import('./types').Codec} Codec */\n /** @typedef {import('./types').BaseName} BaseName */\n /** @typedef {import('./types').BaseCode} BaseCode */\n\n /** @type {CodecFactory} */\n const identity = () => {\n return {\n encode: decodeText$1,\n decode: encodeText$2\n }\n };\n\n /**\n *\n * name, code, implementation, alphabet\n *\n * @type {Array<[BaseName, BaseCode, CodecFactory, string]>}\n */\n const constants$1 = [\n ['identity', '\\x00', identity, ''],\n ['base2', '0', rfc4648$1(1), '01'],\n ['base8', '7', rfc4648$1(3), '01234567'],\n ['base10', '9', src, '0123456789'],\n ['base16', 'f', rfc4648$1(4), '0123456789abcdef'],\n ['base16upper', 'F', rfc4648$1(4), '0123456789ABCDEF'],\n ['base32hex', 'v', rfc4648$1(5), '0123456789abcdefghijklmnopqrstuv'],\n ['base32hexupper', 'V', rfc4648$1(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV'],\n ['base32hexpad', 't', rfc4648$1(5), '0123456789abcdefghijklmnopqrstuv='],\n ['base32hexpadupper', 'T', rfc4648$1(5), '0123456789ABCDEFGHIJKLMNOPQRSTUV='],\n ['base32', 'b', rfc4648$1(5), 'abcdefghijklmnopqrstuvwxyz234567'],\n ['base32upper', 'B', rfc4648$1(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'],\n ['base32pad', 'c', rfc4648$1(5), 'abcdefghijklmnopqrstuvwxyz234567='],\n ['base32padupper', 'C', rfc4648$1(5), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='],\n ['base32z', 'h', rfc4648$1(5), 'ybndrfg8ejkmcpqxot1uwisza345h769'],\n ['base36', 'k', src, '0123456789abcdefghijklmnopqrstuvwxyz'],\n ['base36upper', 'K', src, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'],\n ['base58btc', 'z', src, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'],\n ['base58flickr', 'Z', src, '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'],\n ['base64', 'm', rfc4648$1(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'],\n ['base64pad', 'M', rfc4648$1(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='],\n ['base64url', 'u', rfc4648$1(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'],\n ['base64urlpad', 'U', rfc4648$1(6), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=']\n ];\n\n /** @type {Record<BaseName,Base>} */\n const names = constants$1.reduce((prev, tupple) => {\n prev[tupple[0]] = new base$2(tupple[0], tupple[1], tupple[2], tupple[3]);\n return prev\n }, /** @type {Record<BaseName,Base>} */({}));\n\n /** @type {Record<BaseCode,Base>} */\n const codes = constants$1.reduce((prev, tupple) => {\n prev[tupple[1]] = names[tupple[0]];\n return prev\n }, /** @type {Record<BaseCode,Base>} */({}));\n\n var constants_1 = {\n names,\n codes\n };\n\n /**\n * Implementation of the [multibase](https://github.com/multiformats/multibase) specification.\n *\n */\n\n var src$1 = createCommonjsModule(function (module, exports) {\n\n\n const { encodeText, decodeText, concat } = util$2;\n\n /** @typedef {import('./base')} Base */\n /** @typedef {import(\"./types\").BaseNameOrCode} BaseNameOrCode */\n /** @typedef {import(\"./types\").BaseCode} BaseCode */\n /** @typedef {import(\"./types\").BaseName} BaseName */\n\n /**\n * Create a new Uint8Array with the multibase varint+code.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be prefixed with multibase.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n */\n function multibase (nameOrCode, buf) {\n if (!buf) {\n throw new Error('requires an encoded Uint8Array')\n }\n const { name, codeBuf } = encoding(nameOrCode);\n validEncode(name, buf);\n\n return concat([codeBuf, buf], codeBuf.length + buf.length)\n }\n\n /**\n * Encode data with the specified base and add the multibase prefix.\n *\n * @param {BaseNameOrCode} nameOrCode - The multibase name or code number.\n * @param {Uint8Array} buf - The data to be encoded.\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\n function encode (nameOrCode, buf) {\n const enc = encoding(nameOrCode);\n const data = encodeText(enc.encode(buf));\n\n return concat([enc.codeBuf, data], enc.codeBuf.length + data.length)\n }\n\n /**\n * Takes a Uint8Array or string encoded with multibase header, decodes it and\n * returns the decoded buffer\n *\n * @param {Uint8Array|string} data\n * @returns {Uint8Array}\n * @throws {Error} Will throw if the encoding is not supported\n *\n */\n function decode (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data);\n }\n const prefix = data[0];\n\n // Make all encodings case-insensitive except the ones that include upper and lower chars in the alphabet\n if (['f', 'F', 'v', 'V', 't', 'T', 'b', 'B', 'c', 'C', 'h', 'k', 'K'].includes(prefix)) {\n data = data.toLowerCase();\n }\n const enc = encoding(/** @type {BaseCode} */(data[0]));\n return enc.decode(data.substring(1))\n }\n\n /**\n * Is the given data multibase encoded?\n *\n * @param {Uint8Array|string} data\n * @returns {false | string}\n */\n function isEncoded (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data);\n }\n\n // Ensure bufOrString is a string\n if (Object.prototype.toString.call(data) !== '[object String]') {\n return false\n }\n\n try {\n const enc = encoding(/** @type {BaseCode} */(data[0]));\n return enc.name\n } catch (err) {\n return false\n }\n }\n\n /**\n * Validate encoded data\n *\n * @param {BaseNameOrCode} name\n * @param {Uint8Array} buf\n * @returns {void}\n * @throws {Error} Will throw if the encoding is not supported\n */\n function validEncode (name, buf) {\n const enc = encoding(name);\n enc.decode(decodeText(buf));\n }\n\n /**\n * Get the encoding by name or code\n *\n * @param {BaseNameOrCode} nameOrCode\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\n function encoding (nameOrCode) {\n if (constants_1.names[/** @type {BaseName} */(nameOrCode)]) {\n return constants_1.names[/** @type {BaseName} */(nameOrCode)]\n } else if (constants_1.codes[/** @type {BaseCode} */(nameOrCode)]) {\n return constants_1.codes[/** @type {BaseCode} */(nameOrCode)]\n } else {\n throw new Error(`Unsupported encoding: ${nameOrCode}`)\n }\n }\n\n /**\n * Get encoding from data\n *\n * @param {string|Uint8Array} data\n * @returns {Base}\n * @throws {Error} Will throw if the encoding is not supported\n */\n function encodingFromData (data) {\n if (data instanceof Uint8Array) {\n data = decodeText(data);\n }\n\n return encoding(/** @type {BaseCode} */(data[0]))\n }\n\n exports = module.exports = multibase;\n exports.encode = encode;\n exports.decode = decode;\n exports.isEncoded = isEncoded;\n exports.encoding = encoding;\n exports.encodingFromData = encodingFromData;\n exports.names = Object.freeze(constants_1.names);\n exports.codes = Object.freeze(constants_1.codes);\n });\n\n var encode_1 = encode$2;\n\n var MSB = 0x80\n , REST = 0x7F\n , MSBALL = ~REST\n , INT = Math.pow(2, 31);\n\n function encode$2(num, out, offset) {\n if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {\n encode$2.bytes = 0;\n throw new RangeError('Could not encode varint')\n }\n out = out || [];\n offset = offset || 0;\n var oldOffset = offset;\n\n while(num >= INT) {\n out[offset++] = (num & 0xFF) | MSB;\n num /= 128;\n }\n while(num & MSBALL) {\n out[offset++] = (num & 0xFF) | MSB;\n num >>>= 7;\n }\n out[offset] = num | 0;\n \n encode$2.bytes = offset - oldOffset + 1;\n \n return out\n }\n\n var decode$2 = read$1;\n\n var MSB$1 = 0x80\n , REST$1 = 0x7F;\n\n function read$1(buf, offset) {\n var res = 0\n , offset = offset || 0\n , shift = 0\n , counter = offset\n , b\n , l = buf.length;\n\n do {\n if (counter >= l || shift > 49) {\n read$1.bytes = 0;\n throw new RangeError('Could not decode varint')\n }\n b = buf[counter++];\n res += shift < 28\n ? (b & REST$1) << shift\n : (b & REST$1) * Math.pow(2, shift);\n shift += 7;\n } while (b >= MSB$1)\n\n read$1.bytes = counter - offset;\n\n return res\n }\n\n var N1 = Math.pow(2, 7);\n var N2 = Math.pow(2, 14);\n var N3 = Math.pow(2, 21);\n var N4 = Math.pow(2, 28);\n var N5 = Math.pow(2, 35);\n var N6 = Math.pow(2, 42);\n var N7 = Math.pow(2, 49);\n var N8 = Math.pow(2, 56);\n var N9 = Math.pow(2, 63);\n\n var length = function (value) {\n return (\n value < N1 ? 1\n : value < N2 ? 2\n : value < N3 ? 3\n : value < N4 ? 4\n : value < N5 ? 5\n : value < N6 ? 6\n : value < N7 ? 7\n : value < N8 ? 8\n : value < N9 ? 9\n : 10\n )\n };\n\n var varint = {\n encode: encode_1\n , decode: decode$2\n , encodingLength: length\n };\n\n /* eslint quote-props: off */\n\n /**\n * Names for all available hashes\n *\n * @typedef { \"identity\" | \"sha1\" | \"sha2-256\" | \"sha2-512\" | \"sha3-512\" | \"sha3-384\" | \"sha3-256\" | \"sha3-224\" | \"shake-128\" | \"shake-256\" | \"keccak-224\" | \"keccak-256\" | \"keccak-384\" | \"keccak-512\" | \"blake3\" | \"murmur3-128\" | \"murmur3-32\" | \"dbl-sha2-256\" | \"md4\" | \"md5\" | \"bmt\" | \"sha2-256-trunc254-padded\" | \"ripemd-128\" | \"ripemd-160\" | \"ripemd-256\" | \"ripemd-320\" | \"x11\" | \"kangarootwelve\" | \"sm3-256\" | \"blake2b-8\" | \"blake2b-16\" | \"blake2b-24\" | \"blake2b-32\" | \"blake2b-40\" | \"blake2b-48\" | \"blake2b-56\" | \"blake2b-64\" | \"blake2b-72\" | \"blake2b-80\" | \"blake2b-88\" | \"blake2b-96\" | \"blake2b-104\" | \"blake2b-112\" | \"blake2b-120\" | \"blake2b-128\" | \"blake2b-136\" | \"blake2b-144\" | \"blake2b-152\" | \"blake2b-160\" | \"blake2b-168\" | \"blake2b-176\" | \"blake2b-184\" | \"blake2b-192\" | \"blake2b-200\" | \"blake2b-208\" | \"blake2b-216\" | \"blake2b-224\" | \"blake2b-232\" | \"blake2b-240\" | \"blake2b-248\" | \"blake2b-256\" | \"blake2b-264\" | \"blake2b-272\" | \"blake2b-280\" | \"blake2b-288\" | \"blake2b-296\" | \"blake2b-304\" | \"blake2b-312\" | \"blake2b-320\" | \"blake2b-328\" | \"blake2b-336\" | \"blake2b-344\" | \"blake2b-352\" | \"blake2b-360\" | \"blake2b-368\" | \"blake2b-376\" | \"blake2b-384\" | \"blake2b-392\" | \"blake2b-400\" | \"blake2b-408\" | \"blake2b-416\" | \"blake2b-424\" | \"blake2b-432\" | \"blake2b-440\" | \"blake2b-448\" | \"blake2b-456\" | \"blake2b-464\" | \"blake2b-472\" | \"blake2b-480\" | \"blake2b-488\" | \"blake2b-496\" | \"blake2b-504\" | \"blake2b-512\" | \"blake2s-8\" | \"blake2s-16\" | \"blake2s-24\" | \"blake2s-32\" | \"blake2s-40\" | \"blake2s-48\" | \"blake2s-56\" | \"blake2s-64\" | \"blake2s-72\" | \"blake2s-80\" | \"blake2s-88\" | \"blake2s-96\" | \"blake2s-104\" | \"blake2s-112\" | \"blake2s-120\" | \"blake2s-128\" | \"blake2s-136\" | \"blake2s-144\" | \"blake2s-152\" | \"blake2s-160\" | \"blake2s-168\" | \"blake2s-176\" | \"blake2s-184\" | \"blake2s-192\" | \"blake2s-200\" | \"blake2s-208\" | \"blake2s-216\" | \"blake2s-224\" | \"blake2s-232\" | \"blake2s-240\" | \"blake2s-248\" | \"blake2s-256\" | \"skein256-8\" | \"skein256-16\" | \"skein256-24\" | \"skein256-32\" | \"skein256-40\" | \"skein256-48\" | \"skein256-56\" | \"skein256-64\" | \"skein256-72\" | \"skein256-80\" | \"skein256-88\" | \"skein256-96\" | \"skein256-104\" | \"skein256-112\" | \"skein256-120\" | \"skein256-128\" | \"skein256-136\" | \"skein256-144\" | \"skein256-152\" | \"skein256-160\" | \"skein256-168\" | \"skein256-176\" | \"skein256-184\" | \"skein256-192\" | \"skein256-200\" | \"skein256-208\" | \"skein256-216\" | \"skein256-224\" | \"skein256-232\" | \"skein256-240\" | \"skein256-248\" | \"skein256-256\" | \"skein512-8\" | \"skein512-16\" | \"skein512-24\" | \"skein512-32\" | \"skein512-40\" | \"skein512-48\" | \"skein512-56\" | \"skein512-64\" | \"skein512-72\" | \"skein512-80\" | \"skein512-88\" | \"skein512-96\" | \"skein512-104\" | \"skein512-112\" | \"skein512-120\" | \"skein512-128\" | \"skein512-136\" | \"skein512-144\" | \"skein512-152\" | \"skein512-160\" | \"skein512-168\" | \"skein512-176\" | \"skein512-184\" | \"skein512-192\" | \"skein512-200\" | \"skein512-208\" | \"skein512-216\" | \"skein512-224\" | \"skein512-232\" | \"skein512-240\" | \"skein512-248\" | \"skein512-256\" | \"skein512-264\" | \"skein512-272\" | \"skein512-280\" | \"skein512-288\" | \"skein512-296\" | \"skein512-304\" | \"skein512-312\" | \"skein512-320\" | \"skein512-328\" | \"skein512-336\" | \"skein512-344\" | \"skein512-352\" | \"skein512-360\" | \"skein512-368\" | \"skein512-376\" | \"skein512-384\" | \"skein512-392\" | \"skein512-400\" | \"skein512-408\" | \"skein512-416\" | \"skein512-424\" | \"skein512-432\" | \"skein512-440\" | \"skein512-448\" | \"skein512-456\" | \"skein512-464\" | \"skein512-472\" | \"skein512-480\" | \"skein512-488\" | \"skein512-496\" | \"skein512-504\" | \"skein512-512\" | \"skein1024-8\" | \"skein1024-16\" | \"skein1024-24\" | \"skein1024-32\" | \"skein1024-40\" | \"skein1024-48\" | \"skein1024-56\" | \"skein1024-64\" | \"skein1024-72\" | \"skein1024-80\" | \"skein1024-88\" | \"skein1024-96\" | \"skein1024-104\" | \"skein1024-112\" | \"skein1024-120\" | \"skein1024-128\" | \"skein1024-136\" | \"skein1024-144\" | \"skein1024-152\" | \"skein1024-160\" | \"skein1024-168\" | \"skein1024-176\" | \"skein1024-184\" | \"skein1024-192\" | \"skein1024-200\" | \"skein1024-208\" | \"skein1024-216\" | \"skein1024-224\" | \"skein1024-232\" | \"skein1024-240\" | \"skein1024-248\" | \"skein1024-256\" | \"skein1024-264\" | \"skein1024-272\" | \"skein1024-280\" | \"skein1024-288\" | \"skein1024-296\" | \"skein1024-304\" | \"skein1024-312\" | \"skein1024-320\" | \"skein1024-328\" | \"skein1024-336\" | \"skein1024-344\" | \"skein1024-352\" | \"skein1024-360\" | \"skein1024-368\" | \"skein1024-376\" | \"skein1024-384\" | \"skein1024-392\" | \"skein1024-400\" | \"skein1024-408\" | \"skein1024-416\" | \"skein1024-424\" | \"skein1024-432\" | \"skein1024-440\" | \"skein1024-448\" | \"skein1024-456\" | \"skein1024-464\" | \"skein1024-472\" | \"skein1024-480\" | \"skein1024-488\" | \"skein1024-496\" | \"skein1024-504\" | \"skein1024-512\" | \"skein1024-520\" | \"skein1024-528\" | \"skein1024-536\" | \"skein1024-544\" | \"skein1024-552\" | \"skein1024-560\" | \"skein1024-568\" | \"skein1024-576\" | \"skein1024-584\" | \"skein1024-592\" | \"skein1024-600\" | \"skein1024-608\" | \"skein1024-616\" | \"skein1024-624\" | \"skein1024-632\" | \"skein1024-640\" | \"skein1024-648\" | \"skein1024-656\" | \"skein1024-664\" | \"skein1024-672\" | \"skein1024-680\" | \"skein1024-688\" | \"skein1024-696\" | \"skein1024-704\" | \"skein1024-712\" | \"skein1024-720\" | \"skein1024-728\" | \"skein1024-736\" | \"skein1024-744\" | \"skein1024-752\" | \"skein1024-760\" | \"skein1024-768\" | \"skein1024-776\" | \"skein1024-784\" | \"skein1024-792\" | \"skein1024-800\" | \"skein1024-808\" | \"skein1024-816\" | \"skein1024-824\" | \"skein1024-832\" | \"skein1024-840\" | \"skein1024-848\" | \"skein1024-856\" | \"skein1024-864\" | \"skein1024-872\" | \"skein1024-880\" | \"skein1024-888\" | \"skein1024-896\" | \"skein1024-904\" | \"skein1024-912\" | \"skein1024-920\" | \"skein1024-928\" | \"skein1024-936\" | \"skein1024-944\" | \"skein1024-952\" | \"skein1024-960\" | \"skein1024-968\" | \"skein1024-976\" | \"skein1024-984\" | \"skein1024-992\" | \"skein1024-1000\" | \"skein1024-1008\" | \"skein1024-1016\" | \"skein1024-1024\" | \"poseidon-bls12_381-a2-fc1\" | \"poseidon-bls12_381-a2-fc1-sc\" } HashName\n */\n /**\n * Codes for all available hashes\n *\n * @typedef { 0x00 | 0x11 | 0x12 | 0x13 | 0x14 | 0x15 | 0x16 | 0x17 | 0x18 | 0x19 | 0x1a | 0x1b | 0x1c | 0x1d | 0x1e | 0x22 | 0x23 | 0x56 | 0xd4 | 0xd5 | 0xd6 | 0x1012 | 0x1052 | 0x1053 | 0x1054 | 0x1055 | 0x1100 | 0x1d01 | 0x534d | 0xb201 | 0xb202 | 0xb203 | 0xb204 | 0xb205 | 0xb206 | 0xb207 | 0xb208 | 0xb209 | 0xb20a | 0xb20b | 0xb20c | 0xb20d | 0xb20e | 0xb20f | 0xb210 | 0xb211 | 0xb212 | 0xb213 | 0xb214 | 0xb215 | 0xb216 | 0xb217 | 0xb218 | 0xb219 | 0xb21a | 0xb21b | 0xb21c | 0xb21d | 0xb21e | 0xb21f | 0xb220 | 0xb221 | 0xb222 | 0xb223 | 0xb224 | 0xb225 | 0xb226 | 0xb227 | 0xb228 | 0xb229 | 0xb22a | 0xb22b | 0xb22c | 0xb22d | 0xb22e | 0xb22f | 0xb230 | 0xb231 | 0xb232 | 0xb233 | 0xb234 | 0xb235 | 0xb236 | 0xb237 | 0xb238 | 0xb239 | 0xb23a | 0xb23b | 0xb23c | 0xb23d | 0xb23e | 0xb23f | 0xb240 | 0xb241 | 0xb242 | 0xb243 | 0xb244 | 0xb245 | 0xb246 | 0xb247 | 0xb248 | 0xb249 | 0xb24a | 0xb24b | 0xb24c | 0xb24d | 0xb24e | 0xb24f | 0xb250 | 0xb251 | 0xb252 | 0xb253 | 0xb254 | 0xb255 | 0xb256 | 0xb257 | 0xb258 | 0xb259 | 0xb25a | 0xb25b | 0xb25c | 0xb25d | 0xb25e | 0xb25f | 0xb260 | 0xb301 | 0xb302 | 0xb303 | 0xb304 | 0xb305 | 0xb306 | 0xb307 | 0xb308 | 0xb309 | 0xb30a | 0xb30b | 0xb30c | 0xb30d | 0xb30e | 0xb30f | 0xb310 | 0xb311 | 0xb312 | 0xb313 | 0xb314 | 0xb315 | 0xb316 | 0xb317 | 0xb318 | 0xb319 | 0xb31a | 0xb31b | 0xb31c | 0xb31d | 0xb31e | 0xb31f | 0xb320 | 0xb321 | 0xb322 | 0xb323 | 0xb324 | 0xb325 | 0xb326 | 0xb327 | 0xb328 | 0xb329 | 0xb32a | 0xb32b | 0xb32c | 0xb32d | 0xb32e | 0xb32f | 0xb330 | 0xb331 | 0xb332 | 0xb333 | 0xb334 | 0xb335 | 0xb336 | 0xb337 | 0xb338 | 0xb339 | 0xb33a | 0xb33b | 0xb33c | 0xb33d | 0xb33e | 0xb33f | 0xb340 | 0xb341 | 0xb342 | 0xb343 | 0xb344 | 0xb345 | 0xb346 | 0xb347 | 0xb348 | 0xb349 | 0xb34a | 0xb34b | 0xb34c | 0xb34d | 0xb34e | 0xb34f | 0xb350 | 0xb351 | 0xb352 | 0xb353 | 0xb354 | 0xb355 | 0xb356 | 0xb357 | 0xb358 | 0xb359 | 0xb35a | 0xb35b | 0xb35c | 0xb35d | 0xb35e | 0xb35f | 0xb360 | 0xb361 | 0xb362 | 0xb363 | 0xb364 | 0xb365 | 0xb366 | 0xb367 | 0xb368 | 0xb369 | 0xb36a | 0xb36b | 0xb36c | 0xb36d | 0xb36e | 0xb36f | 0xb370 | 0xb371 | 0xb372 | 0xb373 | 0xb374 | 0xb375 | 0xb376 | 0xb377 | 0xb378 | 0xb379 | 0xb37a | 0xb37b | 0xb37c | 0xb37d | 0xb37e | 0xb37f | 0xb380 | 0xb381 | 0xb382 | 0xb383 | 0xb384 | 0xb385 | 0xb386 | 0xb387 | 0xb388 | 0xb389 | 0xb38a | 0xb38b | 0xb38c | 0xb38d | 0xb38e | 0xb38f | 0xb390 | 0xb391 | 0xb392 | 0xb393 | 0xb394 | 0xb395 | 0xb396 | 0xb397 | 0xb398 | 0xb399 | 0xb39a | 0xb39b | 0xb39c | 0xb39d | 0xb39e | 0xb39f | 0xb3a0 | 0xb3a1 | 0xb3a2 | 0xb3a3 | 0xb3a4 | 0xb3a5 | 0xb3a6 | 0xb3a7 | 0xb3a8 | 0xb3a9 | 0xb3aa | 0xb3ab | 0xb3ac | 0xb3ad | 0xb3ae | 0xb3af | 0xb3b0 | 0xb3b1 | 0xb3b2 | 0xb3b3 | 0xb3b4 | 0xb3b5 | 0xb3b6 | 0xb3b7 | 0xb3b8 | 0xb3b9 | 0xb3ba | 0xb3bb | 0xb3bc | 0xb3bd | 0xb3be | 0xb3bf | 0xb3c0 | 0xb3c1 | 0xb3c2 | 0xb3c3 | 0xb3c4 | 0xb3c5 | 0xb3c6 | 0xb3c7 | 0xb3c8 | 0xb3c9 | 0xb3ca | 0xb3cb | 0xb3cc | 0xb3cd | 0xb3ce | 0xb3cf | 0xb3d0 | 0xb3d1 | 0xb3d2 | 0xb3d3 | 0xb3d4 | 0xb3d5 | 0xb3d6 | 0xb3d7 | 0xb3d8 | 0xb3d9 | 0xb3da | 0xb3db | 0xb3dc | 0xb3dd | 0xb3de | 0xb3df | 0xb3e0 | 0xb401 | 0xb402 } HashCode\n */\n\n /**\n * @type { Record<HashName,HashCode> }\n */\n const names$1 = Object.freeze({\n 'identity': 0x00,\n 'sha1': 0x11,\n 'sha2-256': 0x12,\n 'sha2-512': 0x13,\n 'sha3-512': 0x14,\n 'sha3-384': 0x15,\n 'sha3-256': 0x16,\n 'sha3-224': 0x17,\n 'shake-128': 0x18,\n 'shake-256': 0x19,\n 'keccak-224': 0x1a,\n 'keccak-256': 0x1b,\n 'keccak-384': 0x1c,\n 'keccak-512': 0x1d,\n 'blake3': 0x1e,\n 'murmur3-128': 0x22,\n 'murmur3-32': 0x23,\n 'dbl-sha2-256': 0x56,\n 'md4': 0xd4,\n 'md5': 0xd5,\n 'bmt': 0xd6,\n 'sha2-256-trunc254-padded': 0x1012,\n 'ripemd-128': 0x1052,\n 'ripemd-160': 0x1053,\n 'ripemd-256': 0x1054,\n 'ripemd-320': 0x1055,\n 'x11': 0x1100,\n 'kangarootwelve': 0x1d01,\n 'sm3-256': 0x534d,\n 'blake2b-8': 0xb201,\n 'blake2b-16': 0xb202,\n 'blake2b-24': 0xb203,\n 'blake2b-32': 0xb204,\n 'blake2b-40': 0xb205,\n 'blake2b-48': 0xb206,\n 'blake2b-56': 0xb207,\n 'blake2b-64': 0xb208,\n 'blake2b-72': 0xb209,\n 'blake2b-80': 0xb20a,\n 'blake2b-88': 0xb20b,\n 'blake2b-96': 0xb20c,\n 'blake2b-104': 0xb20d,\n 'blake2b-112': 0xb20e,\n 'blake2b-120': 0xb20f,\n 'blake2b-128': 0xb210,\n 'blake2b-136': 0xb211,\n 'blake2b-144': 0xb212,\n 'blake2b-152': 0xb213,\n 'blake2b-160': 0xb214,\n 'blake2b-168': 0xb215,\n 'blake2b-176': 0xb216,\n 'blake2b-184': 0xb217,\n 'blake2b-192': 0xb218,\n 'blake2b-200': 0xb219,\n 'blake2b-208': 0xb21a,\n 'blake2b-216': 0xb21b,\n 'blake2b-224': 0xb21c,\n 'blake2b-232': 0xb21d,\n 'blake2b-240': 0xb21e,\n 'blake2b-248': 0xb21f,\n 'blake2b-256': 0xb220,\n 'blake2b-264': 0xb221,\n 'blake2b-272': 0xb222,\n 'blake2b-280': 0xb223,\n 'blake2b-288': 0xb224,\n 'blake2b-296': 0xb225,\n 'blake2b-304': 0xb226,\n 'blake2b-312': 0xb227,\n 'blake2b-320': 0xb228,\n 'blake2b-328': 0xb229,\n 'blake2b-336': 0xb22a,\n 'blake2b-344': 0xb22b,\n 'blake2b-352': 0xb22c,\n 'blake2b-360': 0xb22d,\n 'blake2b-368': 0xb22e,\n 'blake2b-376': 0xb22f,\n 'blake2b-384': 0xb230,\n 'blake2b-392': 0xb231,\n 'blake2b-400': 0xb232,\n 'blake2b-408': 0xb233,\n 'blake2b-416': 0xb234,\n 'blake2b-424': 0xb235,\n 'blake2b-432': 0xb236,\n 'blake2b-440': 0xb237,\n 'blake2b-448': 0xb238,\n 'blake2b-456': 0xb239,\n 'blake2b-464': 0xb23a,\n 'blake2b-472': 0xb23b,\n 'blake2b-480': 0xb23c,\n 'blake2b-488': 0xb23d,\n 'blake2b-496': 0xb23e,\n 'blake2b-504': 0xb23f,\n 'blake2b-512': 0xb240,\n 'blake2s-8': 0xb241,\n 'blake2s-16': 0xb242,\n 'blake2s-24': 0xb243,\n 'blake2s-32': 0xb244,\n 'blake2s-40': 0xb245,\n 'blake2s-48': 0xb246,\n 'blake2s-56': 0xb247,\n 'blake2s-64': 0xb248,\n 'blake2s-72': 0xb249,\n 'blake2s-80': 0xb24a,\n 'blake2s-88': 0xb24b,\n 'blake2s-96': 0xb24c,\n 'blake2s-104': 0xb24d,\n 'blake2s-112': 0xb24e,\n 'blake2s-120': 0xb24f,\n 'blake2s-128': 0xb250,\n 'blake2s-136': 0xb251,\n 'blake2s-144': 0xb252,\n 'blake2s-152': 0xb253,\n 'blake2s-160': 0xb254,\n 'blake2s-168': 0xb255,\n 'blake2s-176': 0xb256,\n 'blake2s-184': 0xb257,\n 'blake2s-192': 0xb258,\n 'blake2s-200': 0xb259,\n 'blake2s-208': 0xb25a,\n 'blake2s-216': 0xb25b,\n 'blake2s-224': 0xb25c,\n 'blake2s-232': 0xb25d,\n 'blake2s-240': 0xb25e,\n 'blake2s-248': 0xb25f,\n 'blake2s-256': 0xb260,\n 'skein256-8': 0xb301,\n 'skein256-16': 0xb302,\n 'skein256-24': 0xb303,\n 'skein256-32': 0xb304,\n 'skein256-40': 0xb305,\n 'skein256-48': 0xb306,\n 'skein256-56': 0xb307,\n 'skein256-64': 0xb308,\n 'skein256-72': 0xb309,\n 'skein256-80': 0xb30a,\n 'skein256-88': 0xb30b,\n 'skein256-96': 0xb30c,\n 'skein256-104': 0xb30d,\n 'skein256-112': 0xb30e,\n 'skein256-120': 0xb30f,\n 'skein256-128': 0xb310,\n 'skein256-136': 0xb311,\n 'skein256-144': 0xb312,\n 'skein256-152': 0xb313,\n 'skein256-160': 0xb314,\n 'skein256-168': 0xb315,\n 'skein256-176': 0xb316,\n 'skein256-184': 0xb317,\n 'skein256-192': 0xb318,\n 'skein256-200': 0xb319,\n 'skein256-208': 0xb31a,\n 'skein256-216': 0xb31b,\n 'skein256-224': 0xb31c,\n 'skein256-232': 0xb31d,\n 'skein256-240': 0xb31e,\n 'skein256-248': 0xb31f,\n 'skein256-256': 0xb320,\n 'skein512-8': 0xb321,\n 'skein512-16': 0xb322,\n 'skein512-24': 0xb323,\n 'skein512-32': 0xb324,\n 'skein512-40': 0xb325,\n 'skein512-48': 0xb326,\n 'skein512-56': 0xb327,\n 'skein512-64': 0xb328,\n 'skein512-72': 0xb329,\n 'skein512-80': 0xb32a,\n 'skein512-88': 0xb32b,\n 'skein512-96': 0xb32c,\n 'skein512-104': 0xb32d,\n 'skein512-112': 0xb32e,\n 'skein512-120': 0xb32f,\n 'skein512-128': 0xb330,\n 'skein512-136': 0xb331,\n 'skein512-144': 0xb332,\n 'skein512-152': 0xb333,\n 'skein512-160': 0xb334,\n 'skein512-168': 0xb335,\n 'skein512-176': 0xb336,\n 'skein512-184': 0xb337,\n 'skein512-192': 0xb338,\n 'skein512-200': 0xb339,\n 'skein512-208': 0xb33a,\n 'skein512-216': 0xb33b,\n 'skein512-224': 0xb33c,\n 'skein512-232': 0xb33d,\n 'skein512-240': 0xb33e,\n 'skein512-248': 0xb33f,\n 'skein512-256': 0xb340,\n 'skein512-264': 0xb341,\n 'skein512-272': 0xb342,\n 'skein512-280': 0xb343,\n 'skein512-288': 0xb344,\n 'skein512-296': 0xb345,\n 'skein512-304': 0xb346,\n 'skein512-312': 0xb347,\n 'skein512-320': 0xb348,\n 'skein512-328': 0xb349,\n 'skein512-336': 0xb34a,\n 'skein512-344': 0xb34b,\n 'skein512-352': 0xb34c,\n 'skein512-360': 0xb34d,\n 'skein512-368': 0xb34e,\n 'skein512-376': 0xb34f,\n 'skein512-384': 0xb350,\n 'skein512-392': 0xb351,\n 'skein512-400': 0xb352,\n 'skein512-408': 0xb353,\n 'skein512-416': 0xb354,\n 'skein512-424': 0xb355,\n 'skein512-432': 0xb356,\n 'skein512-440': 0xb357,\n 'skein512-448': 0xb358,\n 'skein512-456': 0xb359,\n 'skein512-464': 0xb35a,\n 'skein512-472': 0xb35b,\n 'skein512-480': 0xb35c,\n 'skein512-488': 0xb35d,\n 'skein512-496': 0xb35e,\n 'skein512-504': 0xb35f,\n 'skein512-512': 0xb360,\n 'skein1024-8': 0xb361,\n 'skein1024-16': 0xb362,\n 'skein1024-24': 0xb363,\n 'skein1024-32': 0xb364,\n 'skein1024-40': 0xb365,\n 'skein1024-48': 0xb366,\n 'skein1024-56': 0xb367,\n 'skein1024-64': 0xb368,\n 'skein1024-72': 0xb369,\n 'skein1024-80': 0xb36a,\n 'skein1024-88': 0xb36b,\n 'skein1024-96': 0xb36c,\n 'skein1024-104': 0xb36d,\n 'skein1024-112': 0xb36e,\n 'skein1024-120': 0xb36f,\n 'skein1024-128': 0xb370,\n 'skein1024-136': 0xb371,\n 'skein1024-144': 0xb372,\n 'skein1024-152': 0xb373,\n 'skein1024-160': 0xb374,\n 'skein1024-168': 0xb375,\n 'skein1024-176': 0xb376,\n 'skein1024-184': 0xb377,\n 'skein1024-192': 0xb378,\n 'skein1024-200': 0xb379,\n 'skein1024-208': 0xb37a,\n 'skein1024-216': 0xb37b,\n 'skein1024-224': 0xb37c,\n 'skein1024-232': 0xb37d,\n 'skein1024-240': 0xb37e,\n 'skein1024-248': 0xb37f,\n 'skein1024-256': 0xb380,\n 'skein1024-264': 0xb381,\n 'skein1024-272': 0xb382,\n 'skein1024-280': 0xb383,\n 'skein1024-288': 0xb384,\n 'skein1024-296': 0xb385,\n 'skein1024-304': 0xb386,\n 'skein1024-312': 0xb387,\n 'skein1024-320': 0xb388,\n 'skein1024-328': 0xb389,\n 'skein1024-336': 0xb38a,\n 'skein1024-344': 0xb38b,\n 'skein1024-352': 0xb38c,\n 'skein1024-360': 0xb38d,\n 'skein1024-368': 0xb38e,\n 'skein1024-376': 0xb38f,\n 'skein1024-384': 0xb390,\n 'skein1024-392': 0xb391,\n 'skein1024-400': 0xb392,\n 'skein1024-408': 0xb393,\n 'skein1024-416': 0xb394,\n 'skein1024-424': 0xb395,\n 'skein1024-432': 0xb396,\n 'skein1024-440': 0xb397,\n 'skein1024-448': 0xb398,\n 'skein1024-456': 0xb399,\n 'skein1024-464': 0xb39a,\n 'skein1024-472': 0xb39b,\n 'skein1024-480': 0xb39c,\n 'skein1024-488': 0xb39d,\n 'skein1024-496': 0xb39e,\n 'skein1024-504': 0xb39f,\n 'skein1024-512': 0xb3a0,\n 'skein1024-520': 0xb3a1,\n 'skein1024-528': 0xb3a2,\n 'skein1024-536': 0xb3a3,\n 'skein1024-544': 0xb3a4,\n 'skein1024-552': 0xb3a5,\n 'skein1024-560': 0xb3a6,\n 'skein1024-568': 0xb3a7,\n 'skein1024-576': 0xb3a8,\n 'skein1024-584': 0xb3a9,\n 'skein1024-592': 0xb3aa,\n 'skein1024-600': 0xb3ab,\n 'skein1024-608': 0xb3ac,\n 'skein1024-616': 0xb3ad,\n 'skein1024-624': 0xb3ae,\n 'skein1024-632': 0xb3af,\n 'skein1024-640': 0xb3b0,\n 'skein1024-648': 0xb3b1,\n 'skein1024-656': 0xb3b2,\n 'skein1024-664': 0xb3b3,\n 'skein1024-672': 0xb3b4,\n 'skein1024-680': 0xb3b5,\n 'skein1024-688': 0xb3b6,\n 'skein1024-696': 0xb3b7,\n 'skein1024-704': 0xb3b8,\n 'skein1024-712': 0xb3b9,\n 'skein1024-720': 0xb3ba,\n 'skein1024-728': 0xb3bb,\n 'skein1024-736': 0xb3bc,\n 'skein1024-744': 0xb3bd,\n 'skein1024-752': 0xb3be,\n 'skein1024-760': 0xb3bf,\n 'skein1024-768': 0xb3c0,\n 'skein1024-776': 0xb3c1,\n 'skein1024-784': 0xb3c2,\n 'skein1024-792': 0xb3c3,\n 'skein1024-800': 0xb3c4,\n 'skein1024-808': 0xb3c5,\n 'skein1024-816': 0xb3c6,\n 'skein1024-824': 0xb3c7,\n 'skein1024-832': 0xb3c8,\n 'skein1024-840': 0xb3c9,\n 'skein1024-848': 0xb3ca,\n 'skein1024-856': 0xb3cb,\n 'skein1024-864': 0xb3cc,\n 'skein1024-872': 0xb3cd,\n 'skein1024-880': 0xb3ce,\n 'skein1024-888': 0xb3cf,\n 'skein1024-896': 0xb3d0,\n 'skein1024-904': 0xb3d1,\n 'skein1024-912': 0xb3d2,\n 'skein1024-920': 0xb3d3,\n 'skein1024-928': 0xb3d4,\n 'skein1024-936': 0xb3d5,\n 'skein1024-944': 0xb3d6,\n 'skein1024-952': 0xb3d7,\n 'skein1024-960': 0xb3d8,\n 'skein1024-968': 0xb3d9,\n 'skein1024-976': 0xb3da,\n 'skein1024-984': 0xb3db,\n 'skein1024-992': 0xb3dc,\n 'skein1024-1000': 0xb3dd,\n 'skein1024-1008': 0xb3de,\n 'skein1024-1016': 0xb3df,\n 'skein1024-1024': 0xb3e0,\n 'poseidon-bls12_381-a2-fc1': 0xb401,\n 'poseidon-bls12_381-a2-fc1-sc': 0xb402\n });\n\n var constants$2 = { names: names$1 };\n\n const { encoding: getCodec } = src$1;\n const { TextDecoder: TextDecoder$2 } = lib;\n const utf8Decoder = new TextDecoder$2('utf8');\n\n /**\n * @typedef {import('multibase/src/types').BaseName} BaseName\n */\n\n /**\n * Turns a Uint8Array of bytes into a string with each\n * character being the char code of the corresponding byte\n *\n * @param {Uint8Array} array - The array to turn into a string\n * @returns {string}\n */\n function uint8ArrayToAsciiString (array) {\n let string = '';\n\n for (let i = 0; i < array.length; i++) {\n string += String.fromCharCode(array[i]);\n }\n return string\n }\n\n /**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {Uint8Array} array - The array to turn into a string\n * @param {BaseName | 'utf8' | 'utf-8' | 'ascii'} [encoding=utf8] - The encoding to use\n * @returns {string}\n */\n function toString (array, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Decoder.decode(array)\n }\n\n if (encoding === 'ascii') {\n return uint8ArrayToAsciiString(array)\n }\n\n return getCodec(encoding).encode(array)\n }\n\n var toString_1 = toString;\n\n const { encoding: getCodec$1 } = src$1;\n const { TextEncoder: TextEncoder$2 } = lib;\n const utf8Encoder = new TextEncoder$2();\n\n /**\n * @typedef {import('multibase/src/types').BaseName} BaseName\n */\n\n /**\n * Interprets each character in a string as a byte and\n * returns a Uint8Array of those bytes.\n *\n * @param {string} string - The string to turn into an array\n * @returns {Uint8Array}\n */\n function asciiStringToUint8Array (string) {\n const array = new Uint8Array(string.length);\n\n for (let i = 0; i < string.length; i++) {\n array[i] = string.charCodeAt(i);\n }\n\n return array\n }\n\n /**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {string} string\n * @param {BaseName | 'utf8' | 'utf-8' | 'ascii'} [encoding=utf8] - utf8, base16, base64, base64urlpad, etc\n * @returns {Uint8Array}\n */\n function fromString (string, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Encoder.encode(string)\n }\n\n if (encoding === 'ascii') {\n return asciiStringToUint8Array(string)\n }\n\n return getCodec$1(encoding).decode(string)\n }\n\n var fromString_1 = fromString;\n\n /**\n * Returns a new Uint8Array created by concatenating the passed ArrayLikes\n *\n * @param {Array<ArrayLike<number>>} arrays\n * @param {number} [length]\n * @returns {Uint8Array}\n */\n function concat$1 (arrays, length) {\n if (!length) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n\n const output = new Uint8Array(length);\n let offset = 0;\n\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n\n return output\n }\n\n var concat_1 = concat$1;\n\n /**\n * Multihash implementation in JavaScript.\n *\n * @module multihash\n */\n\n\n\n const { names: names$2 } = constants$2;\n\n\n\n\n const codes$1 = /** @type {import('./types').CodeNameMap} */({});\n\n // eslint-disable-next-line guard-for-in\n for (const key in names$2) {\n const name = /** @type {HashName} */(key);\n codes$1[names$2[name]] = name;\n }\n\n /**\n * Convert the given multihash to a hex encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\n function toHexString (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return toString_1(hash, 'base16')\n }\n\n /**\n * Convert the given hex encoded string to a multihash.\n *\n * @param {string} hash\n * @returns {Uint8Array}\n */\n function fromHexString (hash) {\n return fromString_1(hash, 'base16')\n }\n\n /**\n * Convert the given multihash to a base58 encoded string.\n *\n * @param {Uint8Array} hash\n * @returns {string}\n */\n function toB58String (hash) {\n if (!(hash instanceof Uint8Array)) {\n throw new Error('must be passed a Uint8Array')\n }\n\n return toString_1(src$1.encode('base58btc', hash)).slice(1)\n }\n\n /**\n * Convert the given base58 encoded string to a multihash.\n *\n * @param {string|Uint8Array} hash\n * @returns {Uint8Array}\n */\n function fromB58String (hash) {\n const encoded = hash instanceof Uint8Array\n ? toString_1(hash)\n : hash;\n\n return src$1.decode('z' + encoded)\n }\n\n /**\n * Decode a hash from the given multihash.\n *\n * @param {Uint8Array} bytes\n * @returns {{code: HashCode, name: HashName, length: number, digest: Uint8Array}} result\n */\n function decode$3 (bytes) {\n if (!(bytes instanceof Uint8Array)) {\n throw new Error('multihash must be a Uint8Array')\n }\n\n if (bytes.length < 2) {\n throw new Error('multihash too short. must be > 2 bytes.')\n }\n\n const code = /** @type {HashCode} */(varint.decode(bytes));\n if (!isValidCode(code)) {\n throw new Error(`multihash unknown function code: 0x${code.toString(16)}`)\n }\n bytes = bytes.slice(varint.decode.bytes);\n\n const len = varint.decode(bytes);\n if (len < 0) {\n throw new Error(`multihash invalid length: ${len}`)\n }\n bytes = bytes.slice(varint.decode.bytes);\n\n if (bytes.length !== len) {\n throw new Error(`multihash length inconsistent: 0x${toString_1(bytes, 'base16')}`)\n }\n\n return {\n code,\n name: codes$1[code],\n length: len,\n digest: bytes\n }\n }\n\n /**\n * Encode a hash digest along with the specified function code.\n *\n * > **Note:** the length is derived from the length of the digest itself.\n *\n * @param {Uint8Array} digest\n * @param {HashName | HashCode} code\n * @param {number} [length]\n * @returns {Uint8Array}\n */\n function encode$3 (digest, code, length) {\n if (!digest || code === undefined) {\n throw new Error('multihash encode requires at least two args: digest, code')\n }\n\n // ensure it's a hashfunction code.\n const hashfn = coerceCode(code);\n\n if (!(digest instanceof Uint8Array)) {\n throw new Error('digest should be a Uint8Array')\n }\n\n if (length == null) {\n length = digest.length;\n }\n\n if (length && digest.length !== length) {\n throw new Error('digest length should be equal to specified length.')\n }\n\n const hash = varint.encode(hashfn);\n const len = varint.encode(length);\n return concat_1([hash, len, digest], hash.length + len.length + digest.length)\n }\n\n /**\n * Converts a hash function name into the matching code.\n * If passed a number it will return the number if it's a valid code.\n *\n * @param {HashName | number} name\n * @returns {number}\n */\n function coerceCode (name) {\n let code = name;\n\n if (typeof name === 'string') {\n if (names$2[name] === undefined) {\n throw new Error(`Unrecognized hash function named: ${name}`)\n }\n code = names$2[name];\n }\n\n if (typeof code !== 'number') {\n throw new Error(`Hash function code should be a number. Got: ${code}`)\n }\n\n // @ts-ignore\n if (codes$1[code] === undefined && !isAppCode(code)) {\n throw new Error(`Unrecognized function code: ${code}`)\n }\n\n return code\n }\n\n /**\n * Checks if a code is part of the app range\n *\n * @param {number} code\n * @returns {boolean}\n */\n function isAppCode (code) {\n return code > 0 && code < 0x10\n }\n\n /**\n * Checks whether a multihash code is valid.\n *\n * @param {HashCode} code\n * @returns {boolean}\n */\n function isValidCode (code) {\n if (isAppCode(code)) {\n return true\n }\n\n if (codes$1[code]) {\n return true\n }\n\n return false\n }\n\n /**\n * Check if the given buffer is a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {void}\n * @throws {Error}\n */\n function validate (multihash) {\n decode$3(multihash); // throws if bad.\n }\n\n /**\n * Returns a prefix from a valid multihash. Throws an error if it is not valid.\n *\n * @param {Uint8Array} multihash\n * @returns {Uint8Array}\n * @throws {Error}\n */\n function prefix (multihash) {\n validate(multihash);\n\n return multihash.subarray(0, 2)\n }\n\n var src$2 = {\n names: names$2,\n codes: Object.freeze(codes$1),\n toHexString,\n fromHexString,\n toB58String,\n fromB58String,\n decode: decode$3,\n encode: encode$3,\n coerceCode,\n isAppCode,\n validate,\n prefix,\n isValidCode\n };\n\n var encode_1$1 = encode$4;\n\n var MSB$2 = 0x80\n , REST$2 = 0x7F\n , MSBALL$1 = ~REST$2\n , INT$1 = Math.pow(2, 31);\n\n function encode$4(num, out, offset) {\n if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {\n encode$4.bytes = 0;\n throw new RangeError('Could not encode varint')\n }\n out = out || [];\n offset = offset || 0;\n var oldOffset = offset;\n\n while(num >= INT$1) {\n out[offset++] = (num & 0xFF) | MSB$2;\n num /= 128;\n }\n while(num & MSBALL$1) {\n out[offset++] = (num & 0xFF) | MSB$2;\n num >>>= 7;\n }\n out[offset] = num | 0;\n \n encode$4.bytes = offset - oldOffset + 1;\n \n return out\n }\n\n var decode$4 = read$2;\n\n var MSB$3 = 0x80\n , REST$3 = 0x7F;\n\n function read$2(buf, offset) {\n var res = 0\n , offset = offset || 0\n , shift = 0\n , counter = offset\n , b\n , l = buf.length;\n\n do {\n if (counter >= l || shift > 49) {\n read$2.bytes = 0;\n throw new RangeError('Could not decode varint')\n }\n b = buf[counter++];\n res += shift < 28\n ? (b & REST$3) << shift\n : (b & REST$3) * Math.pow(2, shift);\n shift += 7;\n } while (b >= MSB$3)\n\n read$2.bytes = counter - offset;\n\n return res\n }\n\n var N1$1 = Math.pow(2, 7);\n var N2$1 = Math.pow(2, 14);\n var N3$1 = Math.pow(2, 21);\n var N4$1 = Math.pow(2, 28);\n var N5$1 = Math.pow(2, 35);\n var N6$1 = Math.pow(2, 42);\n var N7$1 = Math.pow(2, 49);\n var N8$1 = Math.pow(2, 56);\n var N9$1 = Math.pow(2, 63);\n\n var length$1 = function (value) {\n return (\n value < N1$1 ? 1\n : value < N2$1 ? 2\n : value < N3$1 ? 3\n : value < N4$1 ? 4\n : value < N5$1 ? 5\n : value < N6$1 ? 6\n : value < N7$1 ? 7\n : value < N8$1 ? 8\n : value < N9$1 ? 9\n : 10\n )\n };\n\n var varint$1 = {\n encode: encode_1$1\n , decode: decode$4\n , encodingLength: length$1\n };\n\n // DO NOT CHANGE THIS FILE. IT IS GENERATED BY tools/update-table.js\n\n /**\n * @type {import('./generated-types').NameNumberMap}\n */\n const baseTable = Object.freeze({\n 'identity': 0x00,\n 'cidv1': 0x01,\n 'cidv2': 0x02,\n 'cidv3': 0x03,\n 'ip4': 0x04,\n 'tcp': 0x06,\n 'sha1': 0x11,\n 'sha2-256': 0x12,\n 'sha2-512': 0x13,\n 'sha3-512': 0x14,\n 'sha3-384': 0x15,\n 'sha3-256': 0x16,\n 'sha3-224': 0x17,\n 'shake-128': 0x18,\n 'shake-256': 0x19,\n 'keccak-224': 0x1a,\n 'keccak-256': 0x1b,\n 'keccak-384': 0x1c,\n 'keccak-512': 0x1d,\n 'blake3': 0x1e,\n 'dccp': 0x21,\n 'murmur3-128': 0x22,\n 'murmur3-32': 0x23,\n 'ip6': 0x29,\n 'ip6zone': 0x2a,\n 'path': 0x2f,\n 'multicodec': 0x30,\n 'multihash': 0x31,\n 'multiaddr': 0x32,\n 'multibase': 0x33,\n 'dns': 0x35,\n 'dns4': 0x36,\n 'dns6': 0x37,\n 'dnsaddr': 0x38,\n 'protobuf': 0x50,\n 'cbor': 0x51,\n 'raw': 0x55,\n 'dbl-sha2-256': 0x56,\n 'rlp': 0x60,\n 'bencode': 0x63,\n 'dag-pb': 0x70,\n 'dag-cbor': 0x71,\n 'libp2p-key': 0x72,\n 'git-raw': 0x78,\n 'torrent-info': 0x7b,\n 'torrent-file': 0x7c,\n 'leofcoin-block': 0x81,\n 'leofcoin-tx': 0x82,\n 'leofcoin-pr': 0x83,\n 'sctp': 0x84,\n 'dag-jose': 0x85,\n 'dag-cose': 0x86,\n 'eth-block': 0x90,\n 'eth-block-list': 0x91,\n 'eth-tx-trie': 0x92,\n 'eth-tx': 0x93,\n 'eth-tx-receipt-trie': 0x94,\n 'eth-tx-receipt': 0x95,\n 'eth-state-trie': 0x96,\n 'eth-account-snapshot': 0x97,\n 'eth-storage-trie': 0x98,\n 'bitcoin-block': 0xb0,\n 'bitcoin-tx': 0xb1,\n 'bitcoin-witness-commitment': 0xb2,\n 'zcash-block': 0xc0,\n 'zcash-tx': 0xc1,\n 'docid': 0xce,\n 'stellar-block': 0xd0,\n 'stellar-tx': 0xd1,\n 'md4': 0xd4,\n 'md5': 0xd5,\n 'bmt': 0xd6,\n 'decred-block': 0xe0,\n 'decred-tx': 0xe1,\n 'ipld-ns': 0xe2,\n 'ipfs-ns': 0xe3,\n 'swarm-ns': 0xe4,\n 'ipns-ns': 0xe5,\n 'zeronet': 0xe6,\n 'secp256k1-pub': 0xe7,\n 'bls12_381-g1-pub': 0xea,\n 'bls12_381-g2-pub': 0xeb,\n 'x25519-pub': 0xec,\n 'ed25519-pub': 0xed,\n 'bls12_381-g1g2-pub': 0xee,\n 'dash-block': 0xf0,\n 'dash-tx': 0xf1,\n 'swarm-manifest': 0xfa,\n 'swarm-feed': 0xfb,\n 'udp': 0x0111,\n 'p2p-webrtc-star': 0x0113,\n 'p2p-webrtc-direct': 0x0114,\n 'p2p-stardust': 0x0115,\n 'p2p-circuit': 0x0122,\n 'dag-json': 0x0129,\n 'udt': 0x012d,\n 'utp': 0x012e,\n 'unix': 0x0190,\n 'p2p': 0x01a5,\n 'ipfs': 0x01a5,\n 'https': 0x01bb,\n 'onion': 0x01bc,\n 'onion3': 0x01bd,\n 'garlic64': 0x01be,\n 'garlic32': 0x01bf,\n 'tls': 0x01c0,\n 'quic': 0x01cc,\n 'ws': 0x01dd,\n 'wss': 0x01de,\n 'p2p-websocket-star': 0x01df,\n 'http': 0x01e0,\n 'json': 0x0200,\n 'messagepack': 0x0201,\n 'libp2p-peer-record': 0x0301,\n 'sha2-256-trunc254-padded': 0x1012,\n 'ripemd-128': 0x1052,\n 'ripemd-160': 0x1053,\n 'ripemd-256': 0x1054,\n 'ripemd-320': 0x1055,\n 'x11': 0x1100,\n 'p256-pub': 0x1200,\n 'p384-pub': 0x1201,\n 'p521-pub': 0x1202,\n 'ed448-pub': 0x1203,\n 'x448-pub': 0x1204,\n 'ed25519-priv': 0x1300,\n 'kangarootwelve': 0x1d01,\n 'sm3-256': 0x534d,\n 'blake2b-8': 0xb201,\n 'blake2b-16': 0xb202,\n 'blake2b-24': 0xb203,\n 'blake2b-32': 0xb204,\n 'blake2b-40': 0xb205,\n 'blake2b-48': 0xb206,\n 'blake2b-56': 0xb207,\n 'blake2b-64': 0xb208,\n 'blake2b-72': 0xb209,\n 'blake2b-80': 0xb20a,\n 'blake2b-88': 0xb20b,\n 'blake2b-96': 0xb20c,\n 'blake2b-104': 0xb20d,\n 'blake2b-112': 0xb20e,\n 'blake2b-120': 0xb20f,\n 'blake2b-128': 0xb210,\n 'blake2b-136': 0xb211,\n 'blake2b-144': 0xb212,\n 'blake2b-152': 0xb213,\n 'blake2b-160': 0xb214,\n 'blake2b-168': 0xb215,\n 'blake2b-176': 0xb216,\n 'blake2b-184': 0xb217,\n 'blake2b-192': 0xb218,\n 'blake2b-200': 0xb219,\n 'blake2b-208': 0xb21a,\n 'blake2b-216': 0xb21b,\n 'blake2b-224': 0xb21c,\n 'blake2b-232': 0xb21d,\n 'blake2b-240': 0xb21e,\n 'blake2b-248': 0xb21f,\n 'blake2b-256': 0xb220,\n 'blake2b-264': 0xb221,\n 'blake2b-272': 0xb222,\n 'blake2b-280': 0xb223,\n 'blake2b-288': 0xb224,\n 'blake2b-296': 0xb225,\n 'blake2b-304': 0xb226,\n 'blake2b-312': 0xb227,\n 'blake2b-320': 0xb228,\n 'blake2b-328': 0xb229,\n 'blake2b-336': 0xb22a,\n 'blake2b-344': 0xb22b,\n 'blake2b-352': 0xb22c,\n 'blake2b-360': 0xb22d,\n 'blake2b-368': 0xb22e,\n 'blake2b-376': 0xb22f,\n 'blake2b-384': 0xb230,\n 'blake2b-392': 0xb231,\n 'blake2b-400': 0xb232,\n 'blake2b-408': 0xb233,\n 'blake2b-416': 0xb234,\n 'blake2b-424': 0xb235,\n 'blake2b-432': 0xb236,\n 'blake2b-440': 0xb237,\n 'blake2b-448': 0xb238,\n 'blake2b-456': 0xb239,\n 'blake2b-464': 0xb23a,\n 'blake2b-472': 0xb23b,\n 'blake2b-480': 0xb23c,\n 'blake2b-488': 0xb23d,\n 'blake2b-496': 0xb23e,\n 'blake2b-504': 0xb23f,\n 'blake2b-512': 0xb240,\n 'blake2s-8': 0xb241,\n 'blake2s-16': 0xb242,\n 'blake2s-24': 0xb243,\n 'blake2s-32': 0xb244,\n 'blake2s-40': 0xb245,\n 'blake2s-48': 0xb246,\n 'blake2s-56': 0xb247,\n 'blake2s-64': 0xb248,\n 'blake2s-72': 0xb249,\n 'blake2s-80': 0xb24a,\n 'blake2s-88': 0xb24b,\n 'blake2s-96': 0xb24c,\n 'blake2s-104': 0xb24d,\n 'blake2s-112': 0xb24e,\n 'blake2s-120': 0xb24f,\n 'blake2s-128': 0xb250,\n 'blake2s-136': 0xb251,\n 'blake2s-144': 0xb252,\n 'blake2s-152': 0xb253,\n 'blake2s-160': 0xb254,\n 'blake2s-168': 0xb255,\n 'blake2s-176': 0xb256,\n 'blake2s-184': 0xb257,\n 'blake2s-192': 0xb258,\n 'blake2s-200': 0xb259,\n 'blake2s-208': 0xb25a,\n 'blake2s-216': 0xb25b,\n 'blake2s-224': 0xb25c,\n 'blake2s-232': 0xb25d,\n 'blake2s-240': 0xb25e,\n 'blake2s-248': 0xb25f,\n 'blake2s-256': 0xb260,\n 'skein256-8': 0xb301,\n 'skein256-16': 0xb302,\n 'skein256-24': 0xb303,\n 'skein256-32': 0xb304,\n 'skein256-40': 0xb305,\n 'skein256-48': 0xb306,\n 'skein256-56': 0xb307,\n 'skein256-64': 0xb308,\n 'skein256-72': 0xb309,\n 'skein256-80': 0xb30a,\n 'skein256-88': 0xb30b,\n 'skein256-96': 0xb30c,\n 'skein256-104': 0xb30d,\n 'skein256-112': 0xb30e,\n 'skein256-120': 0xb30f,\n 'skein256-128': 0xb310,\n 'skein256-136': 0xb311,\n 'skein256-144': 0xb312,\n 'skein256-152': 0xb313,\n 'skein256-160': 0xb314,\n 'skein256-168': 0xb315,\n 'skein256-176': 0xb316,\n 'skein256-184': 0xb317,\n 'skein256-192': 0xb318,\n 'skein256-200': 0xb319,\n 'skein256-208': 0xb31a,\n 'skein256-216': 0xb31b,\n 'skein256-224': 0xb31c,\n 'skein256-232': 0xb31d,\n 'skein256-240': 0xb31e,\n 'skein256-248': 0xb31f,\n 'skein256-256': 0xb320,\n 'skein512-8': 0xb321,\n 'skein512-16': 0xb322,\n 'skein512-24': 0xb323,\n 'skein512-32': 0xb324,\n 'skein512-40': 0xb325,\n 'skein512-48': 0xb326,\n 'skein512-56': 0xb327,\n 'skein512-64': 0xb328,\n 'skein512-72': 0xb329,\n 'skein512-80': 0xb32a,\n 'skein512-88': 0xb32b,\n 'skein512-96': 0xb32c,\n 'skein512-104': 0xb32d,\n 'skein512-112': 0xb32e,\n 'skein512-120': 0xb32f,\n 'skein512-128': 0xb330,\n 'skein512-136': 0xb331,\n 'skein512-144': 0xb332,\n 'skein512-152': 0xb333,\n 'skein512-160': 0xb334,\n 'skein512-168': 0xb335,\n 'skein512-176': 0xb336,\n 'skein512-184': 0xb337,\n 'skein512-192': 0xb338,\n 'skein512-200': 0xb339,\n 'skein512-208': 0xb33a,\n 'skein512-216': 0xb33b,\n 'skein512-224': 0xb33c,\n 'skein512-232': 0xb33d,\n 'skein512-240': 0xb33e,\n 'skein512-248': 0xb33f,\n 'skein512-256': 0xb340,\n 'skein512-264': 0xb341,\n 'skein512-272': 0xb342,\n 'skein512-280': 0xb343,\n 'skein512-288': 0xb344,\n 'skein512-296': 0xb345,\n 'skein512-304': 0xb346,\n 'skein512-312': 0xb347,\n 'skein512-320': 0xb348,\n 'skein512-328': 0xb349,\n 'skein512-336': 0xb34a,\n 'skein512-344': 0xb34b,\n 'skein512-352': 0xb34c,\n 'skein512-360': 0xb34d,\n 'skein512-368': 0xb34e,\n 'skein512-376': 0xb34f,\n 'skein512-384': 0xb350,\n 'skein512-392': 0xb351,\n 'skein512-400': 0xb352,\n 'skein512-408': 0xb353,\n 'skein512-416': 0xb354,\n 'skein512-424': 0xb355,\n 'skein512-432': 0xb356,\n 'skein512-440': 0xb357,\n 'skein512-448': 0xb358,\n 'skein512-456': 0xb359,\n 'skein512-464': 0xb35a,\n 'skein512-472': 0xb35b,\n 'skein512-480': 0xb35c,\n 'skein512-488': 0xb35d,\n 'skein512-496': 0xb35e,\n 'skein512-504': 0xb35f,\n 'skein512-512': 0xb360,\n 'skein1024-8': 0xb361,\n 'skein1024-16': 0xb362,\n 'skein1024-24': 0xb363,\n 'skein1024-32': 0xb364,\n 'skein1024-40': 0xb365,\n 'skein1024-48': 0xb366,\n 'skein1024-56': 0xb367,\n 'skein1024-64': 0xb368,\n 'skein1024-72': 0xb369,\n 'skein1024-80': 0xb36a,\n 'skein1024-88': 0xb36b,\n 'skein1024-96': 0xb36c,\n 'skein1024-104': 0xb36d,\n 'skein1024-112': 0xb36e,\n 'skein1024-120': 0xb36f,\n 'skein1024-128': 0xb370,\n 'skein1024-136': 0xb371,\n 'skein1024-144': 0xb372,\n 'skein1024-152': 0xb373,\n 'skein1024-160': 0xb374,\n 'skein1024-168': 0xb375,\n 'skein1024-176': 0xb376,\n 'skein1024-184': 0xb377,\n 'skein1024-192': 0xb378,\n 'skein1024-200': 0xb379,\n 'skein1024-208': 0xb37a,\n 'skein1024-216': 0xb37b,\n 'skein1024-224': 0xb37c,\n 'skein1024-232': 0xb37d,\n 'skein1024-240': 0xb37e,\n 'skein1024-248': 0xb37f,\n 'skein1024-256': 0xb380,\n 'skein1024-264': 0xb381,\n 'skein1024-272': 0xb382,\n 'skein1024-280': 0xb383,\n 'skein1024-288': 0xb384,\n 'skein1024-296': 0xb385,\n 'skein1024-304': 0xb386,\n 'skein1024-312': 0xb387,\n 'skein1024-320': 0xb388,\n 'skein1024-328': 0xb389,\n 'skein1024-336': 0xb38a,\n 'skein1024-344': 0xb38b,\n 'skein1024-352': 0xb38c,\n 'skein1024-360': 0xb38d,\n 'skein1024-368': 0xb38e,\n 'skein1024-376': 0xb38f,\n 'skein1024-384': 0xb390,\n 'skein1024-392': 0xb391,\n 'skein1024-400': 0xb392,\n 'skein1024-408': 0xb393,\n 'skein1024-416': 0xb394,\n 'skein1024-424': 0xb395,\n 'skein1024-432': 0xb396,\n 'skein1024-440': 0xb397,\n 'skein1024-448': 0xb398,\n 'skein1024-456': 0xb399,\n 'skein1024-464': 0xb39a,\n 'skein1024-472': 0xb39b,\n 'skein1024-480': 0xb39c,\n 'skein1024-488': 0xb39d,\n 'skein1024-496': 0xb39e,\n 'skein1024-504': 0xb39f,\n 'skein1024-512': 0xb3a0,\n 'skein1024-520': 0xb3a1,\n 'skein1024-528': 0xb3a2,\n 'skein1024-536': 0xb3a3,\n 'skein1024-544': 0xb3a4,\n 'skein1024-552': 0xb3a5,\n 'skein1024-560': 0xb3a6,\n 'skein1024-568': 0xb3a7,\n 'skein1024-576': 0xb3a8,\n 'skein1024-584': 0xb3a9,\n 'skein1024-592': 0xb3aa,\n 'skein1024-600': 0xb3ab,\n 'skein1024-608': 0xb3ac,\n 'skein1024-616': 0xb3ad,\n 'skein1024-624': 0xb3ae,\n 'skein1024-632': 0xb3af,\n 'skein1024-640': 0xb3b0,\n 'skein1024-648': 0xb3b1,\n 'skein1024-656': 0xb3b2,\n 'skein1024-664': 0xb3b3,\n 'skein1024-672': 0xb3b4,\n 'skein1024-680': 0xb3b5,\n 'skein1024-688': 0xb3b6,\n 'skein1024-696': 0xb3b7,\n 'skein1024-704': 0xb3b8,\n 'skein1024-712': 0xb3b9,\n 'skein1024-720': 0xb3ba,\n 'skein1024-728': 0xb3bb,\n 'skein1024-736': 0xb3bc,\n 'skein1024-744': 0xb3bd,\n 'skein1024-752': 0xb3be,\n 'skein1024-760': 0xb3bf,\n 'skein1024-768': 0xb3c0,\n 'skein1024-776': 0xb3c1,\n 'skein1024-784': 0xb3c2,\n 'skein1024-792': 0xb3c3,\n 'skein1024-800': 0xb3c4,\n 'skein1024-808': 0xb3c5,\n 'skein1024-816': 0xb3c6,\n 'skein1024-824': 0xb3c7,\n 'skein1024-832': 0xb3c8,\n 'skein1024-840': 0xb3c9,\n 'skein1024-848': 0xb3ca,\n 'skein1024-856': 0xb3cb,\n 'skein1024-864': 0xb3cc,\n 'skein1024-872': 0xb3cd,\n 'skein1024-880': 0xb3ce,\n 'skein1024-888': 0xb3cf,\n 'skein1024-896': 0xb3d0,\n 'skein1024-904': 0xb3d1,\n 'skein1024-912': 0xb3d2,\n 'skein1024-920': 0xb3d3,\n 'skein1024-928': 0xb3d4,\n 'skein1024-936': 0xb3d5,\n 'skein1024-944': 0xb3d6,\n 'skein1024-952': 0xb3d7,\n 'skein1024-960': 0xb3d8,\n 'skein1024-968': 0xb3d9,\n 'skein1024-976': 0xb3da,\n 'skein1024-984': 0xb3db,\n 'skein1024-992': 0xb3dc,\n 'skein1024-1000': 0xb3dd,\n 'skein1024-1008': 0xb3de,\n 'skein1024-1016': 0xb3df,\n 'skein1024-1024': 0xb3e0,\n 'poseidon-bls12_381-a2-fc1': 0xb401,\n 'poseidon-bls12_381-a2-fc1-sc': 0xb402,\n 'zeroxcert-imprint-256': 0xce11,\n 'fil-commitment-unsealed': 0xf101,\n 'fil-commitment-sealed': 0xf102,\n 'holochain-adr-v0': 0x807124,\n 'holochain-adr-v1': 0x817124,\n 'holochain-key-v0': 0x947124,\n 'holochain-key-v1': 0x957124,\n 'holochain-sig-v0': 0xa27124,\n 'holochain-sig-v1': 0xa37124,\n 'skynet-ns': 0xb19910\n });\n\n var baseTable_1 = { baseTable };\n\n /** @typedef {import('./generated-types').CodecName} CodecName */\n /** @typedef {import('./generated-types').CodecNumber} CodecNumber */\n\n const { baseTable: baseTable$1 } = baseTable_1;\n\n /**\n * @type {Map<CodecNumber,CodecName>}\n */\n const nameTable = new Map();\n\n for (const encodingName in baseTable$1) {\n const code = baseTable$1[encodingName];\n nameTable.set(code, /** @type {CodecName} */(encodingName));\n }\n\n var intTable = Object.freeze(nameTable);\n\n const { names: names$3 } = constants_1;\n const { TextDecoder: TextDecoder$3 } = lib;\n const utf8Decoder$1 = new TextDecoder$3('utf8');\n\n /**\n * Turns a Uint8Array of bytes into a string with each\n * character being the char code of the corresponding byte\n *\n * @param {Uint8Array} array The array to turn into a string\n * @returns {String}\n */\n function uint8ArrayToAsciiString$1 (array) {\n let string = '';\n\n for (let i = 0; i < array.length; i++) {\n string += String.fromCharCode(array[i]);\n }\n return string\n }\n\n /**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {Uint8Array} array The array to turn into a string\n * @param {String} [encoding=utf8] The encoding to use\n * @returns {String}\n * @see {@link https://www.npmjs.com/package/multibase|multibase} for supported encodings other than `utf8`\n */\n function toString$1 (array, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Decoder$1.decode(array)\n }\n\n if (encoding === 'ascii') {\n return uint8ArrayToAsciiString$1(array)\n }\n\n const codec = names$3[encoding];\n\n if (!codec) {\n throw new Error('Unknown base')\n }\n\n return codec.encode(array)\n }\n\n var toString_1$1 = toString$1;\n\n const { names: names$4 } = constants_1;\n const { TextEncoder: TextEncoder$3 } = lib;\n const utf8Encoder$1 = new TextEncoder$3();\n\n /**\n * Interperets each character in a string as a byte and\n * returns a Uint8Array of those bytes.\n *\n * @param {String} string The string to turn into an array\n * @returns {Uint8Array}\n */\n function asciiStringToUint8Array$1 (string) {\n const array = new Uint8Array(string.length);\n\n for (let i = 0; i < string.length; i++) {\n array[i] = string.charCodeAt(i);\n }\n\n return array\n }\n\n /**\n * Create a `Uint8Array` from the passed string\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {String} string\n * @param {String} [encoding=utf8] utf8, base16, base64, base64urlpad, etc\n * @returns {Uint8Array}\n * @see {@link https://www.npmjs.com/package/multibase|multibase} for supported encodings other than `utf8`\n */\n function fromString$1 (string, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Encoder$1.encode(string)\n }\n\n if (encoding === 'ascii') {\n return asciiStringToUint8Array$1(string)\n }\n\n const codec = names$4[encoding];\n\n if (!codec) {\n throw new Error('Unknown base')\n }\n\n return codec.decode(string)\n }\n\n var fromString_1$1 = fromString$1;\n\n var util$3 = {\n numberToUint8Array,\n uint8ArrayToNumber,\n varintUint8ArrayEncode,\n varintEncode\n };\n\n function uint8ArrayToNumber (buf) {\n return parseInt(toString_1$1(buf, 'base16'), 16)\n }\n\n function numberToUint8Array (num) {\n let hexString = num.toString(16);\n if (hexString.length % 2 === 1) {\n hexString = '0' + hexString;\n }\n return fromString_1$1(hexString, 'base16')\n }\n\n function varintUint8ArrayEncode (input) {\n return Uint8Array.from(varint$1.encode(uint8ArrayToNumber(input)))\n }\n\n function varintEncode (num) {\n return Uint8Array.from(varint$1.encode(num))\n }\n\n /** @typedef {import('./generated-types').NameUint8ArrayMap} NameUint8ArrayMap */\n\n const { baseTable: baseTable$2 } = baseTable_1;\n const varintEncode$1 = util$3.varintEncode;\n\n const varintTable = /** @type {NameUint8ArrayMap} */ ({});\n\n for (const encodingName in baseTable$2) {\n const code = baseTable$2[encodingName];\n varintTable[encodingName] = varintEncode$1(code);\n }\n\n var varintTable_1 = Object.freeze(varintTable);\n\n /**\n * Returns a new Uint8Array created by concatenating the passed ArrayLikes\n *\n * @param {Array<ArrayLike<number>>} arrays\n * @param {Number} length\n * @returns {Uint8Array}\n */\n function concat$2 (arrays, length) {\n if (!length) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n\n const output = new Uint8Array(length);\n let offset = 0;\n\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n\n return output\n }\n\n var concat_1$1 = concat$2;\n\n /** @typedef {import('./generated-types').ConstantNumberMap} ConstantNumberMap */\n\n const { baseTable: baseTable$3 } = baseTable_1;\n\n const constants$3 = /** @type {ConstantNumberMap} */({});\n\n for (const [name, code] of Object.entries(baseTable$3)) {\n const constant = name.toUpperCase().replace(/-/g, '_');\n constants$3[constant] = code;\n }\n\n var constants_1$1 = Object.freeze(constants$3);\n\n /** @typedef {import('./generated-types').CodecName} CodecName */\n /** @typedef {import('./generated-types').NumberNameMap} NumberNameMap */\n\n const { baseTable: baseTable$4 } = baseTable_1;\n\n const tableByCode = /** @type {NumberNameMap} */({});\n\n for (const [name, code] of Object.entries(baseTable$4)) {\n if (tableByCode[code] === undefined) {\n tableByCode[code] = /** @type {CodecName} **/(name);\n }\n }\n\n var print = /** @type {NumberNameMap} */(Object.freeze(tableByCode));\n\n /**\n * Implementation of the multicodec specification.\n *\n * @module multicodec\n * @example\n * const multicodec = require('multicodec')\n *\n * const prefixedProtobuf = multicodec.addPrefix('protobuf', protobufBuffer)\n * // prefixedProtobuf 0x50...\n *\n */\n\n /** @typedef {import('./generated-types').CodecName} CodecName */\n /** @typedef {import('./generated-types').CodecNumber} CodecNumber */\n\n\n\n\n\n\n\n /**\n * Prefix a buffer with a multicodec-packed.\n *\n * @param {CodecName|Uint8Array} multicodecStrOrCode\n * @param {Uint8Array} data\n * @returns {Uint8Array}\n */\n function addPrefix (multicodecStrOrCode, data) {\n let prefix;\n\n if (multicodecStrOrCode instanceof Uint8Array) {\n prefix = util$3.varintUint8ArrayEncode(multicodecStrOrCode);\n } else {\n if (varintTable_1[multicodecStrOrCode]) {\n prefix = varintTable_1[multicodecStrOrCode];\n } else {\n throw new Error('multicodec not recognized')\n }\n }\n return concat_1$1([prefix, data], prefix.length + data.length)\n }\n\n /**\n * Decapsulate the multicodec-packed prefix from the data.\n *\n * @param {Uint8Array} data\n * @returns {Uint8Array}\n */\n function rmPrefix (data) {\n varint$1.decode(data);\n return data.slice(varint$1.decode.bytes)\n }\n\n /**\n * Get the codec of the prefixed data.\n *\n * @param {Uint8Array} prefixedData\n * @returns {CodecName}\n */\n function getCodec$2 (prefixedData) {\n const code = varint$1.decode(prefixedData);\n const codecName = intTable.get(code);\n if (codecName === undefined) {\n throw new Error(`Code ${code} not found`)\n }\n return codecName\n }\n\n /**\n * Get the name of the codec.\n *\n * @param {CodecNumber} codec\n * @returns {CodecName|undefined}\n */\n function getName (codec) {\n return intTable.get(codec)\n }\n\n /**\n * Get the code of the codec\n *\n * @param {CodecName} name\n * @returns {CodecNumber}\n */\n function getNumber (name) {\n const code = varintTable_1[name];\n if (code === undefined) {\n throw new Error('Codec `' + name + '` not found')\n }\n return varint$1.decode(code)\n }\n\n /**\n * Get the code of the prefixed data.\n *\n * @param {Uint8Array} prefixedData\n * @returns {CodecNumber}\n */\n function getCode (prefixedData) {\n return varint$1.decode(prefixedData)\n }\n\n /**\n * Get the code as varint of a codec name.\n *\n * @param {CodecName} codecName\n * @returns {Uint8Array}\n */\n function getCodeVarint (codecName) {\n const code = varintTable_1[codecName];\n if (code === undefined) {\n throw new Error('Codec `' + codecName + '` not found')\n }\n return code\n }\n\n /**\n * Get the varint of a code.\n *\n * @param {CodecNumber} code\n * @returns {Array.<number>}\n */\n function getVarint (code) {\n return varint$1.encode(code)\n }\n\n // Make the constants top-level constants\n\n\n // Human friendly names for printing, e.g. in error messages\n\n\n var src$3 = {\n addPrefix,\n rmPrefix,\n getCodec: getCodec$2,\n getName,\n getNumber,\n getCode,\n getCodeVarint,\n getVarint,\n print,\n ...constants_1$1\n };\n\n const CIDUtil = {\n /**\n * Test if the given input is a valid CID object.\n * Returns an error message if it is not.\n * Returns undefined if it is a valid CID.\n *\n * @param {any} other\n * @returns {string|undefined}\n */\n checkCIDComponents: function (other) {\n if (other == null) {\n return 'null values are not valid CIDs'\n }\n\n if (!(other.version === 0 || other.version === 1)) {\n return 'Invalid version, must be a number equal to 1 or 0'\n }\n\n if (typeof other.codec !== 'string') {\n return 'codec must be string'\n }\n\n if (other.version === 0) {\n if (other.codec !== 'dag-pb') {\n return \"codec must be 'dag-pb' for CIDv0\"\n }\n if (other.multibaseName !== 'base58btc') {\n return \"multibaseName must be 'base58btc' for CIDv0\"\n }\n }\n\n if (!(other.multihash instanceof Uint8Array)) {\n return 'multihash must be a Uint8Array'\n }\n\n try {\n src$2.validate(other.multihash);\n } catch (err) {\n let errorMsg = err.message;\n if (!errorMsg) { // Just in case mh.validate() throws an error with empty error message\n errorMsg = 'Multihash validation failed';\n }\n return errorMsg\n }\n }\n };\n\n var cidUtil = CIDUtil;\n\n /**\n * Returns a new Uint8Array created by concatenating the passed ArrayLikes\n *\n * @param {Array<ArrayLike<number>>} arrays\n * @param {number} [length]\n * @returns {Uint8Array}\n */\n function concat$3 (arrays, length) {\n if (!length) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0);\n }\n\n const output = new Uint8Array(length);\n let offset = 0;\n\n for (const arr of arrays) {\n output.set(arr, offset);\n offset += arr.length;\n }\n\n return output\n }\n\n var concat_1$2 = concat$3;\n\n const { encoding: getCodec$3 } = src$1;\n const { TextDecoder: TextDecoder$4 } = lib;\n const utf8Decoder$2 = new TextDecoder$4('utf8');\n\n /**\n * @typedef {import('multibase/src/types').BaseName} BaseName\n */\n\n /**\n * Turns a Uint8Array of bytes into a string with each\n * character being the char code of the corresponding byte\n *\n * @param {Uint8Array} array - The array to turn into a string\n * @returns {string}\n */\n function uint8ArrayToAsciiString$2 (array) {\n let string = '';\n\n for (let i = 0; i < array.length; i++) {\n string += String.fromCharCode(array[i]);\n }\n return string\n }\n\n /**\n * Turns a `Uint8Array` into a string.\n *\n * Supports `utf8`, `utf-8` and any encoding supported by the multibase module.\n *\n * Also `ascii` which is similar to node's 'binary' encoding.\n *\n * @param {Uint8Array} array - The array to turn into a string\n * @param {BaseName | 'utf8' | 'utf-8' | 'ascii'} [encoding=utf8] - The encoding to use\n * @returns {string}\n */\n function toString$2 (array, encoding = 'utf8') {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return utf8Decoder$2.decode(array)\n }\n\n if (encoding === 'ascii') {\n return uint8ArrayToAsciiString$2(array)\n }\n\n return getCodec$3(encoding).encode(array)\n }\n\n var toString_1$2 = toString$2;\n\n /**\n * Returns true if the two passed Uint8Arrays have the same content\n *\n * @param {Uint8Array} a\n * @param {Uint8Array} b\n * @returns {boolean}\n */\n function equals (a, b) {\n if (a === b) {\n return true\n }\n\n if (a.byteLength !== b.byteLength) {\n return false\n }\n\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false\n }\n }\n\n return true\n }\n\n var equals_1 = equals;\n\n const { baseTable: codecs } = baseTable_1;\n\n\n\n\n\n const codecInts = /** @type {CodecName[]} */(Object.keys(codecs)).reduce((p, name) => {\n p[codecs[name]] = name;\n return p\n }, /** @type {Record<CodecNumber, CodecName>} */({}));\n\n const symbol = Symbol.for('@ipld/js-cid/CID');\n\n /**\n * @typedef {Object} SerializedCID\n * @property {string} codec\n * @property {number} version\n * @property {Uint8Array} hash\n */\n /**\n * @typedef {0|1} CIDVersion\n * @typedef {import('multibase').BaseNameOrCode} BaseNameOrCode\n * @typedef {import('multicodec').CodecName} CodecName\n * @typedef {import('multicodec').CodecNumber} CodecNumber\n */\n\n /**\n * Class representing a CID `<mbase><version><mcodec><mhash>`\n * , as defined in [ipld/cid](https://github.com/multiformats/cid).\n *\n * @class CID\n */\n class CID {\n /**\n * Create a new CID.\n *\n * The algorithm for argument input is roughly:\n * ```\n * if (cid)\n * -> create a copy\n * else if (str)\n * if (1st char is on multibase table) -> CID String\n * else -> bs58 encoded multihash\n * else if (Uint8Array)\n * if (1st byte is 0 or 1) -> CID\n * else -> multihash\n * else if (Number)\n * -> construct CID by parts\n * ```\n *\n * @param {CIDVersion | string | Uint8Array | CID} version\n * @param {string|number} [codec]\n * @param {Uint8Array} [multihash]\n * @param {string} [multibaseName]\n *\n * @example\n * new CID(<version>, <codec>, <multihash>, <multibaseName>)\n * new CID(<cidStr>)\n * new CID(<cid.bytes>)\n * new CID(<multihash>)\n * new CID(<bs58 encoded multihash>)\n * new CID(<cid>)\n */\n constructor (version, codec, multihash, multibaseName) {\n // We have below three blank field accessors only because\n // otherwise TS will not pick them up if done after assignemnts\n\n /**\n * The version of the CID.\n *\n * @type {CIDVersion}\n */\n // eslint-disable-next-line no-unused-expressions\n this.version;\n\n /**\n * The codec of the CID.\n *\n * @deprecated\n * @type {CodecName}\n */\n // eslint-disable-next-line no-unused-expressions\n this.codec;\n\n /**\n * The multihash of the CID.\n *\n * @type {Uint8Array}\n */\n // eslint-disable-next-line no-unused-expressions\n this.multihash;\n\n Object.defineProperty(this, symbol, { value: true });\n if (CID.isCID(version)) {\n // version is an exising CID instance\n const cid = /** @type {CID} */(version);\n this.version = cid.version;\n this.codec = cid.codec;\n this.multihash = cid.multihash;\n // Default guard for when a CID < 0.7 is passed with no multibaseName\n // @ts-ignore\n this.multibaseName = cid.multibaseName || (cid.version === 0 ? 'base58btc' : 'base32');\n return\n }\n\n if (typeof version === 'string') {\n // e.g. 'base32' or false\n const baseName = src$1.isEncoded(version);\n if (baseName) {\n // version is a CID String encoded with multibase, so v1\n const cid = src$1.decode(version);\n this.version = /** @type {CIDVersion} */(parseInt(cid[0].toString(), 16));\n this.codec = src$3.getCodec(cid.slice(1));\n this.multihash = src$3.rmPrefix(cid.slice(1));\n this.multibaseName = baseName;\n } else {\n // version is a base58btc string multihash, so v0\n this.version = 0;\n this.codec = 'dag-pb';\n this.multihash = src$2.fromB58String(version);\n this.multibaseName = 'base58btc';\n }\n CID.validateCID(this);\n Object.defineProperty(this, 'string', { value: version });\n return\n }\n\n if (version instanceof Uint8Array) {\n const v = parseInt(version[0].toString(), 16);\n if (v === 1) {\n // version is a CID Uint8Array\n const cid = version;\n this.version = v;\n this.codec = src$3.getCodec(cid.slice(1));\n this.multihash = src$3.rmPrefix(cid.slice(1));\n this.multibaseName = 'base32';\n } else {\n // version is a raw multihash Uint8Array, so v0\n this.version = 0;\n this.codec = 'dag-pb';\n this.multihash = version;\n this.multibaseName = 'base58btc';\n }\n CID.validateCID(this);\n return\n }\n\n // otherwise, assemble the CID from the parameters\n\n this.version = version;\n\n if (typeof codec === 'number') {\n // @ts-ignore\n codec = codecInts[codec];\n }\n\n this.codec = /** @type {CodecName} */ (codec);\n\n this.multihash = /** @type {Uint8Array} */ (multihash);\n\n /**\n * Multibase name as string.\n *\n * @deprecated\n * @type {string}\n */\n this.multibaseName = multibaseName || (version === 0 ? 'base58btc' : 'base32');\n\n CID.validateCID(this);\n }\n\n /**\n * The CID as a `Uint8Array`\n *\n * @returns {Uint8Array}\n *\n */\n get bytes () {\n // @ts-ignore\n let bytes = this._bytes;\n\n if (!bytes) {\n if (this.version === 0) {\n bytes = this.multihash;\n } else if (this.version === 1) {\n const codec = src$3.getCodeVarint(this.codec);\n bytes = concat_1$2([\n [1], codec, this.multihash\n ], 1 + codec.byteLength + this.multihash.byteLength);\n } else {\n throw new Error('unsupported version')\n }\n\n // Cache this Uint8Array so it doesn't have to be recreated\n Object.defineProperty(this, '_bytes', { value: bytes });\n }\n\n return bytes\n }\n\n /**\n * The prefix of the CID.\n *\n * @returns {Uint8Array}\n */\n get prefix () {\n const codec = src$3.getCodeVarint(this.codec);\n const multihash = src$2.prefix(this.multihash);\n const prefix = concat_1$2([\n [this.version], codec, multihash\n ], 1 + codec.byteLength + multihash.byteLength);\n\n return prefix\n }\n\n /**\n * The codec of the CID in its number form.\n *\n * @returns {CodecNumber}\n */\n get code () {\n return codecs[this.codec]\n }\n\n /**\n * Convert to a CID of version `0`.\n *\n * @returns {CID}\n */\n toV0 () {\n if (this.codec !== 'dag-pb') {\n throw new Error('Cannot convert a non dag-pb CID to CIDv0')\n }\n\n const { name, length } = src$2.decode(this.multihash);\n\n if (name !== 'sha2-256') {\n throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0')\n }\n\n if (length !== 32) {\n throw new Error('Cannot convert non 32 byte multihash CID to CIDv0')\n }\n\n return new CID(0, this.codec, this.multihash)\n }\n\n /**\n * Convert to a CID of version `1`.\n *\n * @returns {CID}\n */\n toV1 () {\n return new CID(1, this.codec, this.multihash)\n }\n\n /**\n * Encode the CID into a string.\n *\n * @param {BaseNameOrCode} [base=this.multibaseName] - Base encoding to use.\n * @returns {string}\n */\n toBaseEncodedString (base = this.multibaseName) {\n // @ts-ignore non enumerable cache property\n if (this.string && this.string.length !== 0 && base === this.multibaseName) {\n // @ts-ignore non enumerable cache property\n return this.string\n }\n let str;\n if (this.version === 0) {\n if (base !== 'base58btc') {\n throw new Error('not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()')\n }\n str = src$2.toB58String(this.multihash);\n } else if (this.version === 1) {\n str = toString_1$2(src$1.encode(base, this.bytes));\n } else {\n throw new Error('unsupported version')\n }\n if (base === this.multibaseName) {\n // cache the string value\n Object.defineProperty(this, 'string', { value: str });\n }\n return str\n }\n\n /**\n * CID(QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n)\n *\n * @returns {string}\n */\n [Symbol.for('nodejs.util.inspect.custom')] () {\n return 'CID(' + this.toString() + ')'\n }\n\n /**\n * Encode the CID into a string.\n *\n * @param {BaseNameOrCode} [base=this.multibaseName] - Base encoding to use.\n * @returns {string}\n */\n toString (base) {\n return this.toBaseEncodedString(base)\n }\n\n /**\n * Serialize to a plain object.\n *\n * @returns {SerializedCID}\n */\n toJSON () {\n return {\n codec: this.codec,\n version: this.version,\n hash: this.multihash\n }\n }\n\n /**\n * Compare equality with another CID.\n *\n * @param {CID} other\n * @returns {boolean}\n */\n equals (other) {\n return this.codec === other.codec &&\n this.version === other.version &&\n equals_1(this.multihash, other.multihash)\n }\n\n /**\n * Test if the given input is a valid CID object.\n * Throws if it is not.\n *\n * @param {any} other - The other CID.\n * @returns {void}\n */\n static validateCID (other) {\n const errorMsg = cidUtil.checkCIDComponents(other);\n if (errorMsg) {\n throw new Error(errorMsg)\n }\n }\n\n /**\n * Check if object is a CID instance\n *\n * @param {any} value\n * @returns {value is CID}\n */\n static isCID (value) {\n return value instanceof CID || Boolean(value && value[symbol])\n }\n }\n\n CID.codecs = codecs;\n\n var src$4 = CID;\n\n /**\n * @typedef {Object} EncodedCID\n * @property {string} codec\n * @property {Uint8Array} multihash\n * @property {number} version\n */\n\n /**\n * Encodes CID (well not really encodes it as all own properties are going to be\n * be cloned anyway). If `transfer` array is passed underlying `ArrayBuffer`\n * will be added for the transfer list.\n *\n * @param {CID} cid\n * @param {Transferable[]} [transfer]\n * @returns {EncodedCID}\n */\n const encodeCID = (cid, transfer) => {\n if (transfer) {\n transfer.push(cid.multihash.buffer);\n }\n return cid\n };\n var encodeCID_1 = encodeCID;\n\n /**\n * Decodes encoded CID (well sort of instead it makes nasty mutations to turn\n * structure cloned CID back into itself).\n *\n * @param {EncodedCID} encodedCID\n * @returns {CID}\n */\n const decodeCID = encodedCID => {\n /** @type {CID} */\n const cid = (encodedCID);\n Object.setPrototypeOf(cid.multihash, Uint8Array.prototype);\n Object.setPrototypeOf(cid, src$4.prototype);\n // TODO: Figure out a way to avoid `Symbol.for` here as it can get out of\n // sync with cids implementation.\n // See: https://github.com/moxystudio/js-class-is/issues/25\n Object.defineProperty(cid, Symbol.for('@ipld/js-cid/CID'), { value: true });\n\n return cid\n };\n var decodeCID_1 = decodeCID;\n\n var CID_1 = src$4;\n\n var cid = {\n \tencodeCID: encodeCID_1,\n \tdecodeCID: decodeCID_1,\n \tCID: CID_1\n };\n\n var name = \"ipld-block\";\n var version$1 = \"0.11.0\";\n var description = \"JavaScript Implementation of IPLD Block\";\n var leadMaintainer = \"Volker Mische <volker.mische@gmail.com>\";\n var main = \"src/index.js\";\n var scripts = {\n \tlint: \"aegir lint\",\n \tcheck: \"tsc --noEmit --noErrorTruncation\",\n \tbuild: \"npm run build:js && npm run build:types\",\n \t\"build:js\": \"aegir build\",\n \t\"build:types\": \"tsc --emitDeclarationOnly --declarationDir dist\",\n \ttest: \"aegir test\",\n \t\"test:node\": \"aegir test --target node\",\n \t\"test:browser\": \"aegir test --target browser\",\n \trelease: \"aegir release --docs\",\n \t\"release-minor\": \"aegir release --type minor --docs\",\n \t\"release-major\": \"aegir release --type major --docs\",\n \tcoverage: \"aegir coverage\",\n \t\"coverage-publish\": \"aegir coverage --provider coveralls\",\n \tdocs: \"aegir docs\",\n \tprepare: \"npm run build:types\"\n };\n var repository = {\n \ttype: \"git\",\n \turl: \"git+https://github.com/ipld/js-ipld-block.git\"\n };\n var keywords = [\n \t\"IPLD\"\n ];\n var license = \"MIT\";\n var bugs = {\n \turl: \"https://github.com/ipld/js-ipld-block/issues\"\n };\n var homepage = \"https://github.com/ipld/js-ipld-block#readme\";\n var devDependencies = {\n \taegir: \"^27.0.0\",\n \tuint8arrays: \"^1.0.0\",\n \ttypescript: \"^4.0.3\"\n };\n var dependencies = {\n \tcids: \"^1.0.0\"\n };\n var engines = {\n \tnode: \">=6.0.0\",\n \tnpm: \">=3.0.0\"\n };\n var typesVersions = {\n \t\"*\": {\n \t\t\"*\": [\n \t\t\t\"dist/*\"\n \t\t]\n \t}\n };\n var contributors = [\n \t\"David Dias <daviddias.p@gmail.com>\",\n \t\"Volker Mische <volker.mische@gmail.com>\",\n \t\"Friedel Ziegelmayer <dignifiedquire@gmail.com>\",\n \t\"Irakli Gozalishvili <contact@gozala.io>\",\n \t\"achingbrain <alex@achingbrain.net>\",\n \t\"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>\",\n \t\"Alan Shaw <alan.shaw@protocol.ai>\",\n \t\"Charlie <the_charlie_daly@hotmail.co.uk>\",\n \t\"Diogo Silva <fsdiogo@gmail.com>\",\n \t\"Hugo Dias <hugomrdias@gmail.com>\",\n \t\"Mikeal Rogers <mikeal.rogers@gmail.com>\",\n \t\"Richard Littauer <richard.littauer@gmail.com>\",\n \t\"Richard Schneider <makaretu@gmail.com>\",\n \t\"Xmader <xmader@outlook.com>\"\n ];\n var require$$0$2 = {\n \tname: name,\n \tversion: version$1,\n \tdescription: description,\n \tleadMaintainer: leadMaintainer,\n \tmain: main,\n \tscripts: scripts,\n \t\"pre-push\": [\n \t\"lint\",\n \t\"test\"\n ],\n \trepository: repository,\n \tkeywords: keywords,\n \tlicense: license,\n \tbugs: bugs,\n \thomepage: homepage,\n \tdevDependencies: devDependencies,\n \tdependencies: dependencies,\n \tengines: engines,\n \ttypesVersions: typesVersions,\n \tcontributors: contributors\n };\n\n const { version: version$2 } = require$$0$2;\n const blockSymbol = Symbol.for('@ipld/js-ipld-block/block');\n const readonly = { writable: false, configurable: false, enumerable: true };\n\n /**\n * Represents an immutable block of data that is uniquely referenced with a cid.\n *\n * @example\n * const block = new Block(Uint8Array.from([0, 1, 2, 3]), new CID('...'))\n */\n class Block {\n /**\n * @param {Uint8Array} data - The data to be stored in the block as a Uint8Array.\n * @param {CID} cid - The cid of the data\n */\n constructor (data, cid) {\n if (!data || !(data instanceof Uint8Array)) {\n throw new Error('first argument must be a Uint8Array')\n }\n\n if (!cid || !src$4.isCID(cid)) {\n throw new Error('second argument must be a CID')\n }\n\n this.data = data;\n this.cid = cid;\n\n Object.defineProperties(this, {\n data: readonly,\n cid: readonly\n });\n }\n\n /**\n * The data of this block.\n *\n * @deprecated\n * @type {Uint8Array}\n */\n get _data () {\n deprecateData();\n return this.data\n }\n\n /**\n * The cid of the data this block represents.\n *\n * @deprecated\n * @type {CID}\n */\n get _cid () {\n deprecateCID();\n return this.cid\n }\n\n get [Symbol.toStringTag] () {\n return 'Block'\n }\n\n get [blockSymbol] () {\n return true\n }\n\n /**\n * Check if the given value is a Block.\n *\n * @param {any} other\n * @returns {other is Block}\n */\n static isBlock (other) {\n return Boolean(other && other[blockSymbol])\n }\n }\n\n /**\n * @param {RegExp} range\n * @param {string} message\n * @returns {() => void}\n */\n const deprecate$1 = (range, message) => {\n let warned = false;\n return () => {\n if (range.test(version$2)) {\n if (!warned) {\n warned = true;\n // eslint-disable-next-line no-console\n console.warn(message);\n }\n } else {\n throw new Error(message)\n }\n }\n };\n\n const deprecateCID = deprecate$1(/^0\\.10|^0\\.11/, 'block._cid is deprecated and will be removed in 0.12 release. Please use block.cid instead');\n const deprecateData = deprecate$1(/^0\\.10|^0.11/, 'block._data is deprecated and will be removed in 0.12 release. Please use block.data instead');\n\n var src$5 = Block;\n\n const { encodeCID: encodeCID$1, decodeCID: decodeCID$1 } = cid;\n\n\n /**\n * @typedef {import('./cid').EncodedCID} EncodedCID\n * @typedef {Object} EncodedBlock\n * @property {Uint8Array} data\n * @property {EncodedCID} cid\n */\n\n /**\n * Encodes Block for over the message channel transfer.\n *\n * If `transfer` array is provided all the encountered `ArrayBuffer`s within\n * this block will be added to the transfer so they are moved across without\n * copy.\n *\n * @param {Block} block\n * @param {Transferable[]} [transfer]\n * @returns {EncodedBlock}\n */\n const encodeBlock = ({ cid, data }, transfer) => {\n if (transfer) {\n transfer.push(data.buffer);\n }\n return { cid: encodeCID$1(cid, transfer), data }\n };\n var encodeBlock_1 = encodeBlock;\n\n /**\n * @param {EncodedBlock} encodedBlock\n * @returns {Block}\n */\n const decodeBlock = ({ cid, data }) => {\n return new src$5(data, decodeCID$1(cid))\n };\n\n var decodeBlock_1 = decodeBlock;\n\n var Block_1 = src$5;\n\n var block = {\n \tencodeBlock: encodeBlock_1,\n \tdecodeBlock: decodeBlock_1,\n \tBlock: Block_1\n };\n\n const { encodeCID: encodeCID$2, decodeCID: decodeCID$2 } = cid;\n const { decodeError: decodeError$2 } = error;\n const {\n encodeBlock: encodeBlock$1,\n decodeBlock: decodeBlock$1\n } = block;\n\n /**\n * @typedef {import('cids')} CID\n * @typedef {import('ipfs-message-port-server/src/block').Block} Block\n * @typedef {import('ipfs-message-port-server/src/block').EncodedBlock} EncodedBlock\n * @typedef {import('ipfs-message-port-server/src/block').Rm} EncodedRmEntry\n * @typedef {import('ipfs-message-port-server/src/block').BlockService} BlockService\n * @typedef {import('./client').MessageTransport} MessageTransport\n */\n\n /**\n * @class\n * @extends {Client<BlockService>}\n */\n class BlockClient extends client {\n /**\n * @param {MessageTransport} transport\n */\n constructor (transport) {\n super('block', ['put', 'get', 'rm', 'stat'], transport);\n }\n\n /**\n * Get a raw IPFS block.\n *\n * @param {CID} cid - A CID that corresponds to the desired block\n * @param {Object} [options]\n * @param {number} [options.timeout] - A timeout in ms\n * @param {AbortSignal} [options.signal] - Can be used to cancel any long\n * running requests started as a result of this call\n * @param {Transferable[]} [options.transfer] - References to transfer to the\n * worker if passed.\n * @returns {Promise<Block>}\n */\n async get (cid, options = {}) {\n const { transfer } = options;\n const { block } = await this.remote.get({\n ...options,\n cid: encodeCID$2(cid, transfer)\n });\n return decodeBlock$1(block)\n }\n\n /**\n * Stores input as an IPFS block.\n *\n * @param {Block|Uint8Array} block - A Block or Uint8Array of block data\n * @param {Object} [options]\n * @param {CID} [options.cid] - A CID to store the block under (if block is\n * `Uint8Array`)\n * @param {string} [options.format='dag-pb'] - The codec to use to create the\n * CID (if block is `Uint8Array`)\n * @param {string} [options.mhtype='sha2-256'] - The hashing algorithm to use\n * to create the CID (if block is `Uint8Array`)\n * @param {0|1} [options.version=0] - The version to use to create the CID\n * (if block is `Uint8Array`)\n * @param {number} [options.mhlen]\n * @param {boolean} [options.pin=false] - If true, pin added blocks recursively\n * @param {number} [options.timeout] - A timeout in ms\n * @param {AbortSignal} [options.signal] - Can be used to cancel any long\n * running requests started as a result of this call\n * @param {Transferable[]} [options.transfer] - References to transfer to the\n * worker if passed.\n * @returns {Promise<Block>}\n */\n async put (block, options = {}) {\n const { transfer } = options;\n // @ts-ignore - ipfs-unixfs-importer passes `progress` which causing errors\n // because functions can't be transferred.\n delete options.progress;\n const result = await this.remote.put({\n ...options,\n cid: options.cid == null ? undefined : encodeCID$2(options.cid, transfer),\n block: block instanceof Uint8Array ? block : encodeBlock$1(block, transfer)\n });\n return decodeBlock$1(result.block)\n }\n\n /**\n * Remove one or more IPFS block(s).\n *\n * @param {CID|CID[]} cids - Block(s) to be removed\n * @param {Object} [options]\n * @param {boolean} [options.force=false] - Ignores nonexistent blocks\n * @param {boolean} [options.quiet=false] - Write minimal output\n * @param {number} [options.timeout] - A timeout in ms\n * @param {AbortSignal} [options.signal] - Can be used to cancel any long\n * running requests started as a result of this call\n * @param {Transferable[]} [options.transfer] - References to transfer to the\n * worker if passed.\n * @returns {AsyncIterable<RmEntry>}\n *\n * @typedef {Object} RmEntry\n * @property {CID} cid\n * @property {Error|void} [error]\n */\n async * rm (cids, options = {}) {\n const { transfer } = options;\n const entries = await this.remote.rm({\n ...options,\n cids: Array.isArray(cids)\n ? cids.map(cid => encodeCID$2(cid, transfer))\n : [encodeCID$2(cids, transfer)]\n });\n\n yield * entries.map(decodeRmEntry);\n }\n\n /**\n * Returns information about a raw IPFS block.\n *\n * @param {CID} cid - Block to get information about.\n * @param {Object} [options]\n * @param {number} [options.timeout] - A timeout in ms\n * @param {AbortSignal} [options.signal] - Can be used to cancel any long\n * running requests started as a result of this call\n * @param {Transferable[]} [options.transfer] - References to transfer to the\n * worker if passed.\n * @returns {Promise<Stat>}\n *\n * @typedef {Object} Stat\n * @property {CID} cid\n * @property {number} size\n */\n async stat (cid, options = {}) {\n const { transfer } = options;\n const result = await this.remote.stat({\n ...options,\n cid: encodeCID$2(cid, transfer)\n });\n\n return { ...result, cid: decodeCID$2(result.cid) }\n }\n }\n\n /**\n * @param {EncodedRmEntry} entry\n * @returns {RmEntry}\n */\n const decodeRmEntry = entry => {\n const cid = decodeCID$2(entry.cid);\n if (entry.error) {\n return { cid, error: decodeError$2(entry.error) }\n } else {\n return { cid }\n }\n };\n\n var block$1 = BlockClient;\n\n const { encodeCID: encodeCID$3, decodeCID: decodeCID$3, CID: CID$1 } = cid;\n\n /**\n * @typedef {import('./data').JSONValue} JSONValue\n */\n\n /**\n * @template T\n * @typedef {import('./data').StringEncoded<T>} StringEncoded\n */\n\n /**\n * @typedef {Object} EncodedCID\n * @property {string} codec\n * @property {Uint8Array} multihash\n * @property {number} version\n * @typedef {JSONValue} DAGNode\n *\n * @typedef {Object} EncodedDAGNode\n * @property {DAGNode} dagNode\n * @property {CID[]} cids\n */\n\n /**\n * @param {EncodedDAGNode} encodedNode\n * @returns {DAGNode}\n */\n const decodeNode = ({ dagNode, cids }) => {\n // It is not ideal to have to mutate prototype chains like\n // this, but it removes a need of traversing node first on client\n // and now on server.\n for (const cid of cids) {\n decodeCID$3(cid);\n }\n\n return dagNode\n };\n\n var decodeNode_1 = decodeNode;\n\n /**\n * Encodes DAG node for over the message channel transfer by collecting all\n * the CID instances into an array so they could be turned back into CIDs\n * without traversal on the other end.\n *\n * If `transfer` array is provided all the encountered `ArrayBuffer`s within\n * this node will be added to transfer so they are moved across without copy.\n *\n * @param {DAGNode} dagNode\n * @param {Transferable[]} [transfer]\n * @returns {EncodedDAGNode}\n */\n const encodeNode = (dagNode, transfer) => {\n /** @type {CID[]} */\n const cids = [];\n collectNode(dagNode, cids, transfer);\n return { dagNode, cids }\n };\n var encodeNode_1 = encodeNode;\n\n /**\n * Recursively traverses passed `value` and collects encountered `CID` instances\n * into provided `cids` array. If `transfer` array is passed collects all the\n * `ArrayBuffer`s into it.\n *\n * @param {DAGNode} value\n * @param {CID[]} cids\n * @param {Transferable[]} [transfer]\n * @returns {void}\n */\n const collectNode = (value, cids, transfer) => {\n if (value != null && typeof value === 'object') {\n if (CID$1.isCID(value)) {\n cids.push(value);\n encodeCID$3(value, transfer);\n } else if (value instanceof ArrayBuffer) {\n if (transfer) {\n transfer.push(value);\n }\n } else if (ArrayBuffer.isView(value)) {\n if (transfer) {\n transfer.push(value.buffer);\n }\n } else if (Array.isArray(value)) {\n for (const member of value) {\n collectNode(member, cids, transfer);\n }\n } else {\n for (const member of Object.values(value)) {\n collectNode(member, cids, transfer);\n }\n }\n }\n };\n\n var dag = {\n \tdecodeNode: decodeNode_1,\n \tencodeNode: encodeNode_1\n };\n\n const { encodeCID: encodeCID$4, decodeCID: decodeCID$4 } = cid;\n const { encodeNode: encodeNode$1, decodeNode: decodeNode$1 } = dag;\n\n /**\n * @typedef {import('cids')} CID\n * @typedef {import('ipfs-message-port-server/src/dag').EncodedCID} EncodedCID\n * @typedef {import('ipfs-message-port-server/src/dag').DAGNode} DAGNode\n * @typedef {import('ipfs-message-port-server/src/dag').EncodedDAGNode} EncodedDAGNode\n * @typedef {import('ipfs-message-port-server/src/dag').DAGEntry} DAGEntry\n * @typedef {import('ipfs-message-port-server/src/dag').DAGService} DagService\n * @typedef {import('./client').MessageTransport} MessageTransport\n */\n\n /**\n * @class\n * @extends {Client<DagService>}\n */\n class DAGClient extends client {\n /**\n * @param {MessageTransport} transport\n */\n constructor (transport) {\n super('dag', ['put', 'get', 'resolve', 'tree'], transport);\n }\n\n /**\n * @param {DAGNode} dagNode\n * @param {Object} [options]\n * @param {string} [options.format=\"dag-cbor\"] - The IPLD format multicodec\n * @param {string} [options.hashAlg=\"sha2-256\"] - The hash algorithm to be used over the serialized DAG node\n * @param {CID} [options.cid]\n * @param {boolean} [options.pin=false] - Pin this node when adding to the blockstore\n * @param {boolean} [options.preload=true]\n * @param {Transferable[]} [options.transfer] - References to transfer to the\n * @param {number} [options.timeout] - A timeout in ms\n * @param {AbortSignal} [options.signal] - Can be used to cancel any long running requests started as a result of this call.\n * @returns {Promise<CID>}\n */\n async put (dagNode, options = {}) {\n const { cid } = options;\n\n const encodedCID = await this.remote.put({\n ...options,\n cid: cid != null ? encodeCID$4(cid) : undefined,\n dagNode: encodeNode$1(dagNode, options.transfer)\n });\n\n return decodeCID$4(encodedCID)\n }\n\n /**\n * @param {CID} cid\n * @param {Object} [options]\n * @param {string} [options.path]\n * @param {boolean} [options.localResolve]\n * @param {number} [options.timeout]\n * @param {Transferable[]} [options.transfer] - References to transfer to the\n * @param {AbortSignal} [options.signal]\n * @returns {Promise<DAGEntry>}\n */\n async get (cid, options = {}) {\n const { value, remainderPath } = await this.remote.get({\n ...options,\n cid: encodeCID$4(cid, options.transfer)\n });\n\n return { value: decodeNode$1(value), remainderPath }\n }\n\n /**\n * @typedef {Object} ResolveResult\n * @property {CID} cid\n * @property {string|void} remainderPath\n *\n * @param {CID} cid\n * @param {Object} [options]\n * @param {string} [options.path]\n * @param {number} [options.timeout]\n * @param {Transferable[]} [options.transfer] - References to transfer to the\n * @param {AbortSignal} [options.signal]\n * @returns {Promise<ResolveResult>}\n */\n async resolve (cid, options = {}) {\n const { cid: encodedCID, remainderPath } = await this.remote.resolve({\n ...options,\n cid: encodeCIDOrPath(cid, options.transfer)\n });\n\n return { cid: decodeCID$4(encodedCID), remainderPath }\n }\n\n /**\n * Enumerate all the entries in a graph\n *\n * @param {CID} cid - CID of the DAG node to enumerate\n * @param {Object} [options]\n * @param {string} [options.path]\n * @param {boolean} [options.recursive]\n * @param {Transferable[]} [options.transfer] - References to transfer to the\n * @param {number} [options.timeout]\n * @param {AbortSignal} [options.signal]\n * @returns {AsyncIterable<string>}\n */\n async * tree (cid, options = {}) {\n const paths = await this.remote.tree({\n ...options,\n cid: encodeCID$4(cid, options.transfer)\n });\n\n yield * paths;\n }\n }\n\n /**\n * @param {string|CID} input\n * @param {Transferable[]} [transfer]\n * @returns {string|EncodedCID}\n */\n const encodeCIDOrPath = (input, transfer) => {\n if (typeof input === 'string') {\n return input\n } else {\n return encodeCID$4(input, transfer)\n }\n };\n\n var dag$1 = DAGClient;\n\n /* eslint-env browser */\n const { encodeError: encodeError$1, decodeError: decodeError$3 } = error;\n const { ensureUniqueBuffers: ensureUniqueBuffers$2 } = buffer$1;\n\n /**\n * @template T\n * @typedef {Object} RemoteIterable\n * @property {'RemoteIterable'} type\n * @property {MessagePort} port\n */\n\n /**\n * @typedef {Object} RemoteCallback\n * @property {'RemoteCallback'} type\n * @property {MessagePort} port\n */\n\n /**\n * @template T\n * @typedef {Object} RemoteYield\n * @property {false} done\n * @property {T} value\n * @property {void} error\n */\n\n /**\n * @template T\n * @typedef {Object} RemoteDone\n * @property {true} done\n * @property {T|void} value\n * @property {void} error\n */\n\n /**\n * @typedef {import('./error').EncodedError} EncodedError\n * @typedef {Object} RemoteError\n * @property {true} done\n * @property {void} value\n * @property {EncodedError} error\n */\n\n /**\n * @template T\n * @typedef {RemoteYield<T>|RemoteDone<T>|RemoteError} RemoteNext\n */\n\n /**\n * @template I, O\n * @param {RemoteIterable<I>} remote\n * @param {function(I):O} decode\n * @returns {AsyncIterable<O>}\n */\n const decodeIterable = async function * ({ port }, decode) {\n /**\n * @param {RemoteNext<I>} _data\n */\n let receive = _data => {};\n /**\n * @returns {Promise<RemoteNext<I>>}\n */\n const wait = () => new Promise(resolve => (receive = resolve));\n const next = () => {\n port.postMessage({ method: 'next' });\n return wait()\n };\n\n /**\n * @param {MessageEvent} event\n * @returns {void}\n */\n port.onmessage = event => receive(event.data);\n\n let isDone = false;\n try {\n while (!isDone) {\n const { done, value, error } = await next();\n isDone = done;\n if (error != null) {\n throw decodeError$3(error)\n } else if (value != null) {\n yield decode(value);\n }\n }\n } finally {\n if (!isDone) {\n port.postMessage({ method: 'return' });\n }\n port.close();\n }\n };\n var decodeIterable_1 = decodeIterable;\n\n /**\n * @template I,O\n * @param {AsyncIterable<I>|Iterable<I>} iterable\n * @param {function(I, Transferable[]):O} encode\n * @param {Transferable[]} transfer\n * @returns {RemoteIterable<O>}\n */\n const encodeIterable = (iterable, encode, transfer) => {\n const { port1: port, port2: remote } = new MessageChannel();\n /** @type {Iterator<I>|AsyncIterator<I>} */\n const iterator = toIterator(iterable);\n\n port.onmessage = async ({ data: { method } }) => {\n switch (method) {\n case 'next': {\n try {\n const { done, value } = await iterator.next();\n if (done) {\n port.postMessage({ type: 'next', done: true });\n port.close();\n } else {\n /** @type {Transferable[]} */\n const itemTransfer = [];\n const encodedValue = encode(value, itemTransfer);\n\n port.postMessage(\n {\n type: 'next',\n done: false,\n value: encodedValue\n },\n // @ts-expect-error - Typescript expects the transfer list to be an Array, but it can actually be any iterable.\n ensureUniqueBuffers$2(itemTransfer)\n );\n }\n } catch (error) {\n port.postMessage({\n type: 'throw',\n error: encodeError$1(error)\n });\n port.close();\n }\n break\n }\n case 'return': {\n port.close();\n if (iterator.return) {\n iterator.return();\n }\n break\n }\n }\n };\n port.start();\n transfer.push(remote);\n\n return { type: 'RemoteIterable', port: remote }\n };\n var encodeIterable_1 = encodeIterable;\n\n /**\n * @template I\n * @param {any} iterable\n * @returns {Iterator<I>|AsyncIterator<I>}\n */\n const toIterator = iterable => {\n if (iterable != null) {\n if (typeof iterable[Symbol.asyncIterator] === 'function') {\n return iterable[Symbol.asyncIterator]()\n }\n\n if (typeof iterable[Symbol.iterator] === 'function') {\n return iterable[Symbol.iterator]()\n }\n }\n\n throw TypeError('Value must be async or sync iterable')\n };\n\n /**\n * @param {Function} callback\n * @param {Transferable[]} transfer\n * @returns {RemoteCallback}\n */\n const encodeCallback = (callback, transfer) => {\n // eslint-disable-next-line no-undef\n const { port1: port, port2: remote } = new MessageChannel();\n port.onmessage = ({ data }) => callback.apply(null, data);\n transfer.push(remote);\n return { type: 'RemoteCallback', port: remote }\n };\n var encodeCallback_1 = encodeCallback;\n\n /**\n * @template T\n * @param {RemoteCallback} remote\n * @returns {function(T[]):void | function(T[], Transferable[]):void}\n */\n const decodeCallback = ({ port }) => {\n /**\n * @param {T[]} args\n * @param {Transferable[]} [transfer]\n * @returns {void}\n */\n const callback = (args, transfer = []) => {\n // @ts-expect-error - Typescript expects the transfer list to be an Array, but it can actually be any iterable.\n port.postMessage(args, new Set(transfer));\n };\n\n return callback\n };\n var decodeCallback_1 = decodeCallback;\n\n var core = {\n \tdecodeIterable: decodeIterable_1,\n \tencodeIterable: encodeIterable_1,\n \tencodeCallback: encodeCallback_1,\n \tdecodeCallback: decodeCallback_1\n };\n\n /**\n * Turns a browser readable stream into an async iterable. Async iteration over\n * returned iterable will lock give stream, preventing any other consumer from\n * acquiring a reader. The lock will be released if iteration loop is broken. To\n * prevent stream cancelling optional `{ preventCancel: true }` could be passed\n * as a second argument.\n * @template T\n * @param {ReadableStream<T>} stream\n * @param {Object} [options]\n * @param {boolean} [options.preventCancel=boolean]\n * @returns {AsyncIterable<T>}\n */\n async function * browserReadableStreamToIt (stream, options = {}) {\n const reader = stream.getReader();\n\n try {\n while (true) {\n const result = await reader.read();\n\n if (result.done) {\n return\n }\n\n yield result.value;\n }\n } finally {\n if (options.preventCancel !== true) {\n reader.cancel();\n }\n\n reader.releaseLock();\n }\n }\n\n var browserReadablestreamToIt = browserReadableStreamToIt;\n\n /* eslint-env browser */\n\n\n const { encodeCID: encodeCID$5, decodeCID: decodeCID$5, CID: CID$2 } = cid;\n const {\n decodeIterable: decodeIterable$1,\n encodeIterable: encodeIterable$1,\n encodeCallback: encodeCallback$1\n } = core;\n /** @type {<T>(stream:ReadableStream<T>) => AsyncIterable<T>} */\n // @ts-ignore - browser-stream-to-it has not types\n\n\n /**\n * @template T\n * @typedef {import('ipfs-message-port-protocol/src/core').RemoteIterable<T>} RemoteIterable\n */\n /**\n * @typedef {import('ipfs-message-port-protocol/src/data').Time} Time\n * @typedef {import('ipfs-message-port-protocol/src/data').UnixFSTime} UnixFSTime\n * @typedef {import('ipfs-message-port-protocol/src/dag').EncodedCID} EncodedCID\n * @typedef {import('ipfs-message-port-server/src/core').SingleFileInput} EncodedAddInput\n * @typedef {import('ipfs-message-port-server/src/core').MultiFileInput} EncodedAddAllInput\n * @typedef {import('ipfs-message-port-server/src/core').FileInput} FileInput\n * @typedef {import('ipfs-message-port-server/src/core').FileContent} EncodedFileContent\n *\n * @typedef {Object} NoramilzedFileInput\n * @property {string} path\n * @property {AsyncIterable<ArrayBuffer>} content\n *\n * @typedef {ArrayBuffer|ArrayBufferView} Bytes\n *\n * @typedef {Blob|Bytes|string|Iterable<number>|Iterable<Bytes>|AsyncIterable<Bytes>} FileContent\n *\n * @typedef {Object} FileObject\n * @property {string} [path]\n * @property {FileContent} [content]\n * @property {string|number} [mode]\n * @property {UnixFSTime} [mtime]\n *\n *\n * @typedef {Blob|Bytes|string|FileObject|Iterable<number>|Iterable<Bytes>|AsyncIterable<Bytes>|ReadableStream} AddInput\n *\n * @typedef {Iterable<Blob|string|FileObject>|AsyncIterable<Blob|string|FileObject>} AddAllInput\n */\n\n /**\n * @typedef {import('ipfs-message-port-server/src/core').CoreService} CoreService\n * @typedef {import('ipfs-message-port-server/src/core').AddedEntry} AddedEntry\n * @typedef {import('ipfs-message-port-server/src/core').EncodedLsEntry} EncodedLsEntry\n * @typedef {import('ipfs-message-port-server/src/core').LsEntry} LsEntry\n * @typedef {import('./client').MessageTransport} MessageTransport\n */\n\n /**\n * @class\n * @extends {Client<CoreService>}\n */\n class CoreClient extends client {\n /**\n * @param {MessageTransport} transport\n */\n constructor (transport) {\n super('core', ['add', 'addAll', 'cat', 'ls'], transport);\n }\n\n /**\n * Import files and data into IPFS.\n *\n * If you pass binary data like `Uint8Array` it is recommended to provide\n * `transfer: [input.buffer]` which would allow transferring it instead of\n * copying.\n *\n * @type {import('.').Implements<typeof import('ipfs-core/src/components/add-all')>}\n */\n async * addAll (input, options = {}) {\n const { timeout, signal } = options;\n const transfer = [...(options.transfer || [])];\n const progress = options.progress\n ? encodeCallback$1(options.progress, transfer)\n : undefined;\n\n const result = await this.remote.addAll({\n ...options,\n input: encodeAddAllInput(input, transfer),\n progress,\n transfer,\n timeout,\n signal\n });\n yield * decodeIterable$1(result.data, decodeAddedData);\n }\n\n /**\n * Add file to IPFS.\n *\n * If you pass binary data like `Uint8Array` it is recommended to provide\n * `transfer: [input.buffer]` which would allow transferring it instead of\n * copying.\n *\n * @type {import('.').Implements<typeof import('ipfs-core/src/components/add')>}\n */\n async add (input, options = {}) {\n const { timeout, signal } = options;\n const transfer = [...(options.transfer || [])];\n const progress = options.progress\n ? encodeCallback$1(options.progress, transfer)\n : undefined;\n\n const result = await this.remote.add({\n ...options,\n input: encodeAddInput(input, transfer),\n progress,\n transfer,\n timeout,\n signal\n });\n\n return decodeAddedData(result.data)\n }\n\n /**\n * Returns content addressed by a valid IPFS Path.\n *\n * @param {string|CID} inputPath\n * @param {Object} [options]\n * @param {number} [options.offset]\n * @param {number} [options.length]\n * @param {number} [options.timeout]\n * @param {AbortSignal} [options.signal]\n * @returns {AsyncIterable<Uint8Array>}\n */\n async * cat (inputPath, options = {}) {\n const input = CID$2.isCID(inputPath) ? encodeCID$5(inputPath) : inputPath;\n const result = await this.remote.cat({ ...options, path: input });\n yield * decodeIterable$1(result.data, identity$1);\n }\n\n /**\n * Returns content addressed by a valid IPFS Path.\n *\n * @param {string|CID} inputPath\n * @param {Object} [options]\n * @param {boolean} [options.recursive]\n * @param {boolean} [options.preload]\n * @param {number} [options.timeout]\n * @param {AbortSignal} [options.signal]\n * @returns {AsyncIterable<LsEntry>}\n */\n async * ls (inputPath, options = {}) {\n const input = CID$2.isCID(inputPath) ? encodeCID$5(inputPath) : inputPath;\n const result = await this.remote.ls({ ...options, path: input });\n\n yield * decodeIterable$1(result.data, decodeLsEntry);\n }\n }\n\n /**\n * Decodes values yield by `ipfs.add`.\n *\n * @param {AddedEntry} data\n * @returns {import('ipfs-core-types/src/files').UnixFSEntry}\n */\n const decodeAddedData = ({ path, cid, mode, mtime, size }) => {\n return {\n path,\n cid: decodeCID$5(cid),\n mode,\n mtime,\n size\n }\n };\n\n /**\n * @param {EncodedLsEntry} encodedEntry\n * @returns {LsEntry}\n */\n const decodeLsEntry = ({ depth, name, path, size, cid, type, mode, mtime }) => ({\n cid: decodeCID$5(cid),\n type,\n name,\n path,\n mode,\n mtime,\n size,\n depth\n });\n\n /**\n * @template T\n * @param {T} v\n * @returns {T}\n */\n const identity$1 = (v) => v;\n\n /**\n * Encodes input passed to the `ipfs.add` via the best possible strategy for the\n * given input.\n *\n * @param {AddInput} input\n * @param {Transferable[]} transfer\n * @returns {EncodedAddInput}\n */\n const encodeAddInput = (input, transfer) => {\n // We want to get a Blob as input. If we got it we're set.\n if (input instanceof Blob) {\n return input\n } else if (typeof input === 'string') {\n return input\n } else if (input instanceof ArrayBuffer) {\n return input\n } else if (ArrayBuffer.isView(input)) {\n // Note we are not adding `input.buffer` into transfer list, it's on user.\n return input\n } else {\n // If input is (async) iterable or `ReadableStream` or \"FileObject\" it will\n // be encoded via own specific encoder.\n const iterable = asIterable(input);\n if (iterable) {\n return encodeIterable$1(iterable, encodeIterableContent, transfer)\n }\n\n const asyncIterable = asAsyncIterable(input);\n if (asyncIterable) {\n return encodeIterable$1(\n asyncIterable,\n encodeAsyncIterableContent,\n transfer\n )\n }\n\n const readableStream = asReadableStream(input);\n if (readableStream) {\n return encodeIterable$1(\n browserReadablestreamToIt(readableStream),\n encodeAsyncIterableContent,\n transfer\n )\n }\n\n const file = asFileObject(input);\n if (file) {\n return encodeFileObject(file, transfer)\n }\n\n throw TypeError('Unexpected input: ' + typeof input)\n }\n };\n\n /**\n * Encodes input passed to the `ipfs.add` via the best possible strategy for the\n * given input.\n *\n * @param {AddAllInput} input\n * @param {Transferable[]} transfer\n * @returns {EncodedAddAllInput}\n */\n const encodeAddAllInput = (input, transfer) => {\n // If input is (async) iterable or `ReadableStream` or \"FileObject\" it will\n // be encoded via own specific encoder.\n const iterable = asIterable(input);\n if (iterable) {\n return encodeIterable$1(iterable, encodeIterableContent, transfer)\n }\n\n const asyncIterable = asAsyncIterable(input);\n if (asyncIterable) {\n return encodeIterable$1(\n asyncIterable,\n encodeAsyncIterableContent,\n transfer\n )\n }\n\n const readableStream = asReadableStream(input);\n if (readableStream) {\n return encodeIterable$1(\n browserReadablestreamToIt(readableStream),\n encodeAsyncIterableContent,\n transfer\n )\n }\n\n throw TypeError('Unexpected input: ' + typeof input)\n };\n\n /**\n * Function encodes individual item of some `AsyncIterable` by choosing most\n * effective strategy.\n *\n * @param {ArrayBuffer|ArrayBufferView|Blob|string|FileObject} content\n * @param {Transferable[]} transfer\n * @returns {FileInput|ArrayBuffer|ArrayBufferView}\n */\n const encodeAsyncIterableContent = (content, transfer) => {\n if (content instanceof ArrayBuffer) {\n return content\n } else if (ArrayBuffer.isView(content)) {\n return content\n } else if (content instanceof Blob) {\n return { path: '', content }\n } else if (typeof content === 'string') {\n return { path: '', content }\n } else {\n const file = asFileObject(content);\n if (file) {\n return encodeFileObject(file, transfer)\n } else {\n throw TypeError('Unexpected input: ' + typeof content)\n }\n }\n };\n\n /**\n * @param {number|Bytes|Blob|string|FileObject|void} content\n * @param {Transferable[]} transfer\n * @returns {FileInput|ArrayBuffer|ArrayBufferView}\n */\n const encodeIterableContent = (content, transfer) => {\n if (typeof content === 'number') {\n throw TypeError('Iterable of numbers is not supported')\n } else if (content instanceof ArrayBuffer) {\n return content\n } else if (ArrayBuffer.isView(content)) {\n return content\n } else if (content instanceof Blob) {\n return { path: '', content }\n } else if (typeof content === 'string') {\n return { path: '', content }\n } else {\n const file = asFileObject(content);\n if (file) {\n return encodeFileObject(file, transfer)\n } else {\n throw TypeError('Unexpected input: ' + typeof content)\n }\n }\n };\n\n /**\n * @param {FileObject} file\n * @param {Transferable[]} transfer\n * @returns {FileInput}\n */\n const encodeFileObject = ({ path, mode, mtime, content }, transfer) => {\n return {\n path,\n mode,\n mtime,\n content: content ? encodeFileContent(content, transfer) : undefined\n }\n };\n\n /**\n *\n * @param {FileContent|undefined} content\n * @param {Transferable[]} transfer\n * @returns {EncodedFileContent}\n */\n const encodeFileContent = (content, transfer) => {\n if (content == null) {\n return ''\n } else if (content instanceof ArrayBuffer || ArrayBuffer.isView(content)) {\n return content\n } else if (content instanceof Blob) {\n return content\n } else if (typeof content === 'string') {\n return content\n } else {\n const iterable = asIterable(content);\n if (iterable) {\n return encodeIterable$1(iterable, encodeIterableContent, transfer)\n }\n\n const asyncIterable = asAsyncIterable(content);\n if (asyncIterable) {\n return encodeIterable$1(\n asyncIterable,\n encodeAsyncIterableContent,\n transfer\n )\n }\n\n const readableStream = asReadableStream(content);\n if (readableStream) {\n return encodeIterable$1(\n browserReadablestreamToIt(readableStream),\n encodeAsyncIterableContent,\n transfer\n )\n }\n\n throw TypeError('Unexpected input: ' + typeof content)\n }\n };\n\n /**\n * Pattern matches given input as `Iterable<I>` and returns back either matched\n * iterable or `null`.\n *\n * @template I\n * @param {Iterable<I>|AddInput|AddAllInput} input\n * @returns {Iterable<I>|null}\n */\n const asIterable = (input) => {\n /** @type {*} */\n const object = input;\n if (object && typeof object[Symbol.iterator] === 'function') {\n return object\n } else {\n return null\n }\n };\n\n /**\n * Pattern matches given `input` as `AsyncIterable<I>` and returns back either\n * matched `AsyncIterable` or `null`.\n *\n * @template I\n * @param {AsyncIterable<I>|AddInput|AddAllInput} input\n * @returns {AsyncIterable<I>|null}\n */\n const asAsyncIterable = (input) => {\n /** @type {*} */\n const object = input;\n if (object && typeof object[Symbol.asyncIterator] === 'function') {\n return object\n } else {\n return null\n }\n };\n\n /**\n * Pattern matches given `input` as `ReadableStream` and return back either\n * matched input or `null`.\n *\n * @param {any} input\n * @returns {ReadableStream<Uint8Array>|null}\n */\n const asReadableStream = (input) => {\n if (input && typeof input.getReader === 'function') {\n return input\n } else {\n return null\n }\n };\n\n /**\n * Pattern matches given input as \"FileObject\" and returns back eithr matched\n * input or `null`.\n *\n * @param {*} input\n * @returns {FileObject|null}\n */\n const asFileObject = (input) => {\n if (typeof input === 'object' && (input.path || input.content)) {\n return input\n } else {\n return null\n }\n };\n\n var core$1 = CoreClient;\n\n /* eslint-env browser */\n\n const { decodeCID: decodeCID$6, CID: CID$3 } = cid;\n\n /**\n * @typedef {import('ipfs-message-port-server/src/files').FilesService} FilesService\n * @typedef {import('ipfs-message-port-server/src/files').EncodedStat} EncodedStat\n * @typedef {import('./client').MessageTransport} MessageTransport\n */\n\n /**\n * @class\n * @extends {Client<FilesService>}\n */\n class FilesClient extends client {\n /**\n * @param {MessageTransport} transport\n */\n constructor (transport) {\n super('files', ['stat'], transport);\n }\n\n /**\n * @typedef {Object} Stat\n * @property {CID} cid Content identifier.\n * @property {number} size File size in bytes.\n * @property {number} cumulativeSize Size of the DAGNodes making up the file in bytes.\n * @property {\"directory\"|\"file\"} type\n * @property {number} blocks Number of files making up directory (when a direcotry)\n * or number of blocks that make up the file (when a file)\n * @property {boolean} withLocality True when locality information is present\n * @property {boolean} local True if the queried dag is fully present locally\n * @property {number} sizeLocal Cumulative size of the data present locally\n *\n * @param {string|CID} pathOrCID\n * @param {Object} [options]\n * @param {boolean} [options.hash=false] - If true will only return hash\n * @param {boolean} [options.size=false] - If true will only return size\n * @param {boolean} [options.withLocal=false] - If true computes size of the dag that is local, and total size when possible\n * @param {number} [options.timeout]\n * @param {AbortSignal} [options.signal]\n * @returns {Promise<Stat>}\n */\n async stat (pathOrCID, options = {}) {\n const { size, hash, withLocal, timeout, signal } = options;\n const { stat } = await this.remote.stat({\n path: encodeLocation(pathOrCID),\n size,\n hash,\n withLocal,\n timeout,\n signal\n });\n return decodeStat(stat)\n }\n }\n var files = FilesClient;\n\n /**\n * Turns content address (path or CID) into path.\n *\n * @param {string|CID} pathOrCID\n * @returns {string}\n */\n const encodeLocation = pathOrCID =>\n CID$3.isCID(pathOrCID) ? `/ipfs/${pathOrCID.toString()}` : pathOrCID;\n\n /**\n *\n * @param {EncodedStat} data\n * @returns {Stat}\n */\n const decodeStat = data => {\n return { ...data, cid: decodeCID$6(data.cid) }\n };\n\n /* eslint-env browser */\n\n const { decodeCID: decodeCID$7, CID: CID$4 } = cid;\n\n /**\n * @typedef {import('cids')} CID\n * @typedef {import('ipfs-message-port-server/src/pin').EncodedCID} EncodedCID\n * @typedef {import('ipfs-message-port-server/src/pin').PinService} PinService\n * @typedef {import('./client').MessageTransport} MessageTransport\n */\n\n /**\n * @class\n * @extends {Client<PinService>}\n */\n class PinClient extends client {\n /**\n * @param {MessageTransport} transport\n */\n constructor (transport) {\n super('pin', ['add'], transport);\n }\n\n async add (pathOrCID, options = {}) {\n const { recursive, timeout, signal } = options;\n const { cid } = await this.remote.add({\n path: encodeLocation$1(pathOrCID),\n recursive,\n timeout,\n signal\n });\n return decodeCID$7(cid)\n }\n }\n var pin = PinClient;\n\n /**\n * Turns content address (path or CID) into path.\n *\n * @param {string|CID} pathOrCID\n * @returns {string}\n */\n const encodeLocation$1 = pathOrCID =>\n CID$4.isCID(pathOrCID) ? `/ipfs/${pathOrCID.toString()}` : `${pathOrCID}`;\n\n /* eslint-env browser */\n\n\n\n\n\n\n\n\n /**\n * @typedef {import('./client').MessageTransport} MessageTransport\n *\n * @typedef {Object} ClientOptions\n * @property {MessagePort} port\n */\n\n class IPFSClient extends core$1 {\n /**\n * @param {MessageTransport} transport\n */\n constructor (transport) {\n super(transport);\n this.transport = transport;\n this.block = new block$1(this.transport);\n this.dag = new dag$1(this.transport);\n this.files = new files(this.transport);\n this.pin = new pin(this.transport);\n }\n\n /**\n * Attaches IPFS client to the given message port. Throws\n * exception if client is already attached.\n *\n * @param {IPFSClient} self\n * @param {MessagePort} port\n */\n static attach (self, port) {\n self.transport.connect(port);\n }\n\n /**\n * Creates IPFS client that is detached from the `ipfs-message-port-service`.\n * This can be useful when in a scenario where obtaining message port happens\n * later on in the application logic. Datached IPFS client will queue all the\n * API calls and flush them once client is attached.\n *\n * @returns {IPFSClient}\n */\n static detached () {\n return new IPFSClient(new transport(undefined))\n }\n\n /**\n * Creates IPFS client from the message port (assumes that\n * `ipfs-message-port-service` is instantiated on the other end)\n *\n * @param {MessagePort} port\n * @returns {IPFSClient}\n */\n static from (port) {\n return new IPFSClient(new transport(port))\n }\n }\n\n var src$6 = IPFSClient;\n\n var ipfs = null;\n var set$1 = function (userIpfs) {\n ipfs = userIpfs;\n };\n var get$2 = function () { return __awaiter(void 0, void 0, void 0, function () {\n var port;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!!ipfs) return [3 /*break*/, 2];\n return [4 /*yield*/, iframe()];\n case 1:\n port = _a.sent();\n ipfs = src$6.from(port);\n _a.label = 2;\n case 2: return [2 /*return*/, ipfs];\n }\n });\n }); };\n function iframe() {\n return new Promise(function (resolve, reject) {\n var iframe = document.createElement(\"iframe\");\n iframe.id = \"webnative-ipfs\";\n iframe.style.width = \"0\";\n iframe.style.height = \"0\";\n iframe.style.border = \"none\";\n iframe.style.display = \"none\";\n document.body.appendChild(iframe);\n iframe.onload = function () {\n var channel = new MessageChannel();\n channel.port1.onmessage = function (_a) {\n var ports = _a.ports;\n return resolve(ports[0]);\n };\n iframe.contentWindow\n ? iframe.contentWindow.postMessage(\"connect\", \"*\", [channel.port2])\n : reject(new Error(\"Don't have access to iframe.contentWindow\"));\n };\n iframe.src = setup.endpoints.lobby + \"/ipfs.html\";\n });\n }\n\n function withIs(Class, { className, symbolName }) {\n const symbol = Symbol.for(symbolName);\n\n const ClassIsWrapper = {\n // The code below assigns the class wrapper to an object to trick\n // JavaScript engines to show the name of the extended class when\n // logging an instances.\n // We are assigning an anonymous class (class wrapper) to the object\n // with key `className` to keep the correct name.\n // If this is not supported it falls back to logging `ClassIsWrapper`.\n [className]: class extends Class {\n constructor(...args) {\n super(...args);\n Object.defineProperty(this, symbol, { value: true });\n }\n\n get [Symbol.toStringTag]() {\n return className;\n }\n },\n }[className];\n\n ClassIsWrapper[`is${className}`] = (obj) => !!(obj && obj[symbol]);\n\n return ClassIsWrapper;\n }\n\n function withIsProto(Class, { className, symbolName, withoutNew }) {\n const symbol = Symbol.for(symbolName);\n\n /* eslint-disable object-shorthand */\n const ClassIsWrapper = {\n [className]: function (...args) {\n if (withoutNew && !(this instanceof ClassIsWrapper)) {\n return new ClassIsWrapper(...args);\n }\n\n const _this = Class.call(this, ...args) || this;\n\n if (_this && !_this[symbol]) {\n Object.defineProperty(_this, symbol, { value: true });\n }\n\n return _this;\n },\n }[className];\n /* eslint-enable object-shorthand */\n\n ClassIsWrapper.prototype = Object.create(Class.prototype);\n ClassIsWrapper.prototype.constructor = ClassIsWrapper;\n\n Object.defineProperty(ClassIsWrapper.prototype, Symbol.toStringTag, {\n get() {\n return className;\n },\n });\n\n ClassIsWrapper[`is${className}`] = (obj) => !!(obj && obj[symbol]);\n\n return ClassIsWrapper;\n }\n\n var classIs = withIs;\n var proto = withIsProto;\n classIs.proto = proto;\n\n var stable = createCommonjsModule(function (module, exports) {\n //! stable.js 0.1.8, https://github.com/Two-Screen/stable\n //! © 2018 Angry Bytes and contributors. MIT licensed.\n\n (function (global, factory) {\n module.exports = factory() ;\n }(commonjsGlobal, (function () {\n // A stable array sort, because `Array#sort()` is not guaranteed stable.\n // This is an implementation of merge sort, without recursion.\n\n var stable = function (arr, comp) {\n return exec(arr.slice(), comp)\n };\n\n stable.inplace = function (arr, comp) {\n var result = exec(arr, comp);\n\n // This simply copies back if the result isn't in the original array,\n // which happens on an odd number of passes.\n if (result !== arr) {\n pass(result, null, arr.length, arr);\n }\n\n return arr\n };\n\n // Execute the sort using the input array and a second buffer as work space.\n // Returns one of those two, containing the final result.\n function exec(arr, comp) {\n if (typeof(comp) !== 'function') {\n comp = function (a, b) {\n return String(a).localeCompare(b)\n };\n }\n\n // Short-circuit when there's nothing to sort.\n var len = arr.length;\n if (len <= 1) {\n return arr\n }\n\n // Rather than dividing input, simply iterate chunks of 1, 2, 4, 8, etc.\n // Chunks are the size of the left or right hand in merge sort.\n // Stop when the left-hand covers all of the array.\n var buffer = new Array(len);\n for (var chk = 1; chk < len; chk *= 2) {\n pass(arr, comp, chk, buffer);\n\n var tmp = arr;\n arr = buffer;\n buffer = tmp;\n }\n\n return arr\n }\n\n // Run a single pass with the given chunk size.\n var pass = function (arr, comp, chk, result) {\n var len = arr.length;\n var i = 0;\n // Step size / double chunk size.\n var dbl = chk * 2;\n // Bounds of the left and right chunks.\n var l, r, e;\n // Iterators over the left and right chunk.\n var li, ri;\n\n // Iterate over pairs of chunks.\n for (l = 0; l < len; l += dbl) {\n r = l + chk;\n e = r + chk;\n if (r > len) r = len;\n if (e > len) e = len;\n\n // Iterate both chunks in parallel.\n li = l;\n ri = r;\n while (true) {\n // Compare the chunks.\n if (li < r && ri < e) {\n // This works for a regular `sort()` compatible comparator,\n // but also for a simple comparator like: `a > b`\n if (comp(arr[li], arr[ri]) <= 0) {\n result[i++] = arr[li++];\n }\n else {\n result[i++] = arr[ri++];\n }\n }\n // Nothing to compare, just flush what's left.\n else if (li < r) {\n result[i++] = arr[li++];\n }\n else if (ri < e) {\n result[i++] = arr[ri++];\n }\n // Both iterators are at the chunk ends.\n else {\n break\n }\n }\n }\n };\n\n return stable;\n\n })));\n });\n\n /**\n * Can be used with Array.sort to sort and array with Uint8Array entries\n *\n * @param {Uint8Array} a\n * @param {Uint8Array} b\n * @returns {Number}\n */\n function compare (a, b) {\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] < b[i]) {\n return -1\n }\n\n if (a[i] > b[i]) {\n return 1\n }\n }\n\n if (a.byteLength > b.byteLength) {\n return 1\n }\n\n if (a.byteLength < b.byteLength) {\n return -1\n }\n\n return 0\n }\n\n var compare_1 = compare;\n\n const linkSort = (a, b) => {\n const buf1 = a.nameAsBuffer;\n const buf2 = b.nameAsBuffer;\n\n return compare_1(buf1, buf2)\n };\n\n /**\n * Sorts links in place (mutating given array)\n * @param {Array} links\n * @returns {void}\n */\n const sortLinks = (links) => {\n stable.inplace(links, linkSort);\n };\n\n var sortLinks_1 = sortLinks;\n\n var dagLink = createCommonjsModule(function (module, exports) {\n\n\n\n\n\n // Link represents an IPFS Merkle DAG Link between Nodes.\n class DAGLink {\n constructor (name, size, cid) {\n if (!cid) {\n throw new Error('A link requires a cid to point to')\n }\n\n // assert(size, 'A link requires a size')\n // note - links should include size, but this assert is disabled\n // for now to maintain consistency with go-ipfs pinset\n\n Object.defineProperties(this, {\n Name: { value: name || '', writable: false, enumerable: true },\n Tsize: { value: size, writable: false, enumerable: true },\n Hash: { value: new src$4(cid), writable: false, enumerable: true },\n _nameBuf: { value: null, writable: true, enumerable: false }\n });\n }\n\n toString () {\n return `DAGLink <${this.Hash.toBaseEncodedString()} - name: \"${this.Name}\", size: ${this.Tsize}>`\n }\n\n toJSON () {\n if (!this._json) {\n this._json = Object.freeze({\n name: this.Name,\n size: this.Tsize,\n cid: this.Hash.toBaseEncodedString()\n });\n }\n\n return Object.assign({}, this._json)\n }\n\n // Memoize the Uint8Array representation of name\n // We need this to sort the links, otherwise\n // we will reallocate new Uint8Arrays every time\n get nameAsBuffer () {\n if (this._nameBuf !== null) {\n return this._nameBuf\n }\n\n this._nameBuf = fromString_1$1(this.Name);\n return this._nameBuf\n }\n }\n\n module.exports = classIs(DAGLink, { className: 'DAGLink', symbolName: '@ipld/js-ipld-dag-pb/daglink' });\n });\n\n var tokenize = function (sch) {\n var noComments = function (line) {\n var i = line.indexOf('//');\n return i > -1 ? line.slice(0, i) : line\n };\n\n var noMultilineComments = function () {\n var inside = false;\n return function (token) {\n if (token === '/*') {\n inside = true;\n return false\n }\n if (token === '*/') {\n inside = false;\n return false\n }\n return !inside\n }\n };\n\n var trim = function (line) {\n return line.trim()\n };\n\n var removeQuotedLines = function (list) {\n return function (str) {\n var s = '$' + list.length + '$';\n list.push(str);\n return s\n }\n };\n\n var restoreQuotedLines = function (list) {\n var re = /^\\$(\\d+)\\$$/;\n return function (line) {\n var m = line.match(re);\n return m ? list[+m[1]] : line\n }\n };\n\n var replacements = [];\n return sch\n .replace(/\"(\\\\\"|[^\"\\n])*?\"|'(\\\\'|[^'\\n])*?'/gm, removeQuotedLines(replacements))\n .replace(/([;,{}()=:[\\]<>]|\\/\\*|\\*\\/)/g, ' $1 ')\n .split(/\\n/)\n .map(trim)\n .filter(Boolean)\n .map(noComments)\n .map(trim)\n .filter(Boolean)\n .join('\\n')\n .split(/\\s+|\\n+/gm)\n .filter(noMultilineComments())\n .map(restoreQuotedLines(replacements))\n };\n\n var MAX_RANGE = 0x1FFFFFFF;\n\n // \"Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared \"packed\".\"\n // https://developers.google.com/protocol-buffers/docs/encoding#optional\n var PACKABLE_TYPES = [\n // varint wire types\n 'int32', 'int64', 'uint32', 'uint64', 'sint32', 'sint64', 'bool',\n // + ENUMS\n // 64-bit wire types\n 'fixed64', 'sfixed64', 'double',\n // 32-bit wire types\n 'fixed32', 'sfixed32', 'float'\n ];\n\n var onfieldoptionvalue = function (tokens) {\n var value = tokens.shift();\n if (value !== '{') {\n return value\n }\n value = {};\n var field = '';\n while (tokens.length) {\n switch (tokens[0]) {\n case '}':\n tokens.shift();\n return value\n case ':':\n tokens.shift();\n value[field] = onfieldoptionvalue(tokens);\n break\n default:\n field = tokens.shift();\n }\n }\n };\n\n var onfieldoptions = function (tokens) {\n var opts = {};\n\n while (tokens.length) {\n switch (tokens[0]) {\n case '[':\n case ',': {\n tokens.shift();\n var name = tokens.shift();\n if (name === '(') { // handling [(A) = B]\n name = tokens.shift();\n tokens.shift(); // remove the end of bracket\n }\n var field = [];\n if (tokens[0][0] === '.') {\n field = tokens[0].substr(1).split('.');\n tokens.shift();\n }\n if (tokens[0] !== '=') throw new Error('Unexpected token in field options: ' + tokens[0])\n tokens.shift();\n if (tokens[0] === ']') throw new Error('Unexpected ] in field option')\n\n // for option (A).b.c\n // path will be ['A', 'b'] and lastFieldName 'c'\n var path = [name].concat(field);\n var lastFieldName = path.pop();\n\n // opt references opts.A.b\n var opt = path.reduce(function (opt, n, index) {\n if (opt[n] == null) {\n opt[n] = {};\n }\n return opt[n]\n }, opts);\n\n // now set opt['c'] that references opts.A.b['c']\n opt[lastFieldName] = onfieldoptionvalue(tokens);\n break\n }\n case ']':\n tokens.shift();\n return opts\n\n default:\n throw new Error('Unexpected token in field options: ' + tokens[0])\n }\n }\n\n throw new Error('No closing tag for field options')\n };\n\n var onfield = function (tokens) {\n var field = {\n name: null,\n type: null,\n tag: -1,\n map: null,\n oneof: null,\n required: false,\n repeated: false,\n options: {}\n };\n\n while (tokens.length) {\n switch (tokens[0]) {\n case '=':\n tokens.shift();\n field.tag = Number(tokens.shift());\n break\n\n case 'map':\n field.type = 'map';\n field.map = { from: null, to: null };\n tokens.shift();\n if (tokens[0] !== '<') throw new Error('Unexpected token in map type: ' + tokens[0])\n tokens.shift();\n field.map.from = tokens.shift();\n if (tokens[0] !== ',') throw new Error('Unexpected token in map type: ' + tokens[0])\n tokens.shift();\n field.map.to = tokens.shift();\n if (tokens[0] !== '>') throw new Error('Unexpected token in map type: ' + tokens[0])\n tokens.shift();\n field.name = tokens.shift();\n break\n\n case 'repeated':\n case 'required':\n case 'optional':\n var t = tokens.shift();\n field.required = t === 'required';\n field.repeated = t === 'repeated';\n field.type = tokens.shift();\n field.name = tokens.shift();\n break\n\n case '[':\n field.options = onfieldoptions(tokens);\n break\n\n case ';':\n if (field.name === null) throw new Error('Missing field name')\n if (field.type === null) throw new Error('Missing type in message field: ' + field.name)\n if (field.tag === -1) throw new Error('Missing tag number in message field: ' + field.name)\n tokens.shift();\n return field\n\n default:\n throw new Error('Unexpected token in message field: ' + tokens[0])\n }\n }\n\n throw new Error('No ; found for message field')\n };\n\n var onmessagebody = function (tokens) {\n var body = {\n enums: [],\n options: {},\n messages: [],\n fields: [],\n extends: [],\n extensions: null\n };\n\n while (tokens.length) {\n switch (tokens[0]) {\n case 'map':\n case 'repeated':\n case 'optional':\n case 'required':\n body.fields.push(onfield(tokens));\n break\n\n case 'enum':\n body.enums.push(onenum(tokens));\n break\n\n case 'message':\n body.messages.push(onmessage(tokens));\n break\n\n case 'extensions':\n body.extensions = onextensions(tokens);\n break\n\n case 'oneof':\n tokens.shift();\n var name = tokens.shift();\n if (tokens[0] !== '{') throw new Error('Unexpected token in oneof: ' + tokens[0])\n tokens.shift();\n while (tokens[0] !== '}') {\n tokens.unshift('optional');\n var field = onfield(tokens);\n field.oneof = name;\n body.fields.push(field);\n }\n tokens.shift();\n break\n\n case 'extend':\n body.extends.push(onextend(tokens));\n break\n\n case ';':\n tokens.shift();\n break\n\n case 'reserved':\n tokens.shift();\n while (tokens[0] !== ';') {\n tokens.shift();\n }\n break\n\n case 'option':\n var opt = onoption(tokens);\n if (body.options[opt.name] !== undefined) throw new Error('Duplicate option ' + opt.name)\n body.options[opt.name] = opt.value;\n break\n\n default:\n // proto3 does not require the use of optional/required, assumed as optional\n // \"singular: a well-formed message can have zero or one of this field (but not more than one).\"\n // https://developers.google.com/protocol-buffers/docs/proto3#specifying-field-rules\n tokens.unshift('optional');\n body.fields.push(onfield(tokens));\n }\n }\n\n return body\n };\n\n var onextend = function (tokens) {\n var out = {\n name: tokens[1],\n message: onmessage(tokens)\n };\n return out\n };\n\n var onextensions = function (tokens) {\n tokens.shift();\n var from = Number(tokens.shift());\n if (isNaN(from)) throw new Error('Invalid from in extensions definition')\n if (tokens.shift() !== 'to') throw new Error(\"Expected keyword 'to' in extensions definition\")\n var to = tokens.shift();\n if (to === 'max') to = MAX_RANGE;\n to = Number(to);\n if (isNaN(to)) throw new Error('Invalid to in extensions definition')\n if (tokens.shift() !== ';') throw new Error('Missing ; in extensions definition')\n return { from: from, to: to }\n };\n var onmessage = function (tokens) {\n tokens.shift();\n\n var lvl = 1;\n var body = [];\n var msg = {\n name: tokens.shift(),\n options: {},\n enums: [],\n extends: [],\n messages: [],\n fields: []\n };\n\n if (tokens[0] !== '{') throw new Error('Expected { but found ' + tokens[0])\n tokens.shift();\n\n while (tokens.length) {\n if (tokens[0] === '{') lvl++;\n else if (tokens[0] === '}') lvl--;\n\n if (!lvl) {\n tokens.shift();\n body = onmessagebody(body);\n msg.enums = body.enums;\n msg.messages = body.messages;\n msg.fields = body.fields;\n msg.extends = body.extends;\n msg.extensions = body.extensions;\n msg.options = body.options;\n return msg\n }\n\n body.push(tokens.shift());\n }\n\n if (lvl) throw new Error('No closing tag for message')\n };\n\n var onpackagename = function (tokens) {\n tokens.shift();\n var name = tokens.shift();\n if (tokens[0] !== ';') throw new Error('Expected ; but found ' + tokens[0])\n tokens.shift();\n return name\n };\n\n var onsyntaxversion = function (tokens) {\n tokens.shift();\n\n if (tokens[0] !== '=') throw new Error('Expected = but found ' + tokens[0])\n tokens.shift();\n\n var version = tokens.shift();\n switch (version) {\n case '\"proto2\"':\n version = 2;\n break\n\n case '\"proto3\"':\n version = 3;\n break\n\n default:\n throw new Error('Expected protobuf syntax version but found ' + version)\n }\n\n if (tokens[0] !== ';') throw new Error('Expected ; but found ' + tokens[0])\n tokens.shift();\n\n return version\n };\n\n var onenumvalue = function (tokens) {\n if (tokens.length < 4) throw new Error('Invalid enum value: ' + tokens.slice(0, 3).join(' '))\n if (tokens[1] !== '=') throw new Error('Expected = but found ' + tokens[1])\n if (tokens[3] !== ';' && tokens[3] !== '[') throw new Error('Expected ; or [ but found ' + tokens[1])\n\n var name = tokens.shift();\n tokens.shift();\n var val = {\n value: null,\n options: {}\n };\n val.value = Number(tokens.shift());\n if (tokens[0] === '[') {\n val.options = onfieldoptions(tokens);\n }\n tokens.shift(); // expecting the semicolon here\n\n return {\n name: name,\n val: val\n }\n };\n\n var onenum = function (tokens) {\n tokens.shift();\n var options = {};\n var e = {\n name: tokens.shift(),\n values: {},\n options: {}\n };\n\n if (tokens[0] !== '{') throw new Error('Expected { but found ' + tokens[0])\n tokens.shift();\n\n while (tokens.length) {\n if (tokens[0] === '}') {\n tokens.shift();\n // there goes optional semicolon after the enclosing \"}\"\n if (tokens[0] === ';') tokens.shift();\n return e\n }\n if (tokens[0] === 'option') {\n options = onoption(tokens);\n e.options[options.name] = options.value;\n continue\n }\n var val = onenumvalue(tokens);\n e.values[val.name] = val.val;\n }\n\n throw new Error('No closing tag for enum')\n };\n\n var onoption = function (tokens) {\n var name = null;\n var value = null;\n\n var parse = function (value) {\n if (value === 'true') return true\n if (value === 'false') return false\n return value.replace(/^\"+|\"+$/gm, '')\n };\n\n while (tokens.length) {\n if (tokens[0] === ';') {\n tokens.shift();\n return { name: name, value: value }\n }\n switch (tokens[0]) {\n case 'option':\n tokens.shift();\n\n var hasBracket = tokens[0] === '(';\n if (hasBracket) tokens.shift();\n\n name = tokens.shift();\n\n if (hasBracket) {\n if (tokens[0] !== ')') throw new Error('Expected ) but found ' + tokens[0])\n tokens.shift();\n }\n\n if (tokens[0][0] === '.') {\n name += tokens.shift();\n }\n\n break\n\n case '=':\n tokens.shift();\n if (name === null) throw new Error('Expected key for option with value: ' + tokens[0])\n value = parse(tokens.shift());\n\n if (name === 'optimize_for' && !/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(value)) {\n throw new Error('Unexpected value for option optimize_for: ' + value)\n } else if (value === '{') {\n // option foo = {bar: baz}\n value = onoptionMap(tokens);\n }\n break\n\n default:\n throw new Error('Unexpected token in option: ' + tokens[0])\n }\n }\n };\n\n var onoptionMap = function (tokens) {\n var parse = function (value) {\n if (value === 'true') return true\n if (value === 'false') return false\n return value.replace(/^\"+|\"+$/gm, '')\n };\n\n var map = {};\n\n while (tokens.length) {\n if (tokens[0] === '}') {\n tokens.shift();\n return map\n }\n\n var hasBracket = tokens[0] === '(';\n if (hasBracket) tokens.shift();\n\n var key = tokens.shift();\n if (hasBracket) {\n if (tokens[0] !== ')') throw new Error('Expected ) but found ' + tokens[0])\n tokens.shift();\n }\n\n var value = null;\n\n switch (tokens[0]) {\n case ':':\n if (map[key] !== undefined) throw new Error('Duplicate option map key ' + key)\n\n tokens.shift();\n\n value = parse(tokens.shift());\n\n if (value === '{') {\n // option foo = {bar: baz}\n value = onoptionMap(tokens);\n }\n\n map[key] = value;\n\n if (tokens[0] === ';') {\n tokens.shift();\n }\n break\n\n case '{':\n tokens.shift();\n value = onoptionMap(tokens);\n\n if (map[key] === undefined) map[key] = [];\n if (!Array.isArray(map[key])) throw new Error('Duplicate option map key ' + key)\n\n map[key].push(value);\n break\n\n default:\n throw new Error('Unexpected token in option map: ' + tokens[0])\n }\n }\n\n throw new Error('No closing tag for option map')\n };\n\n var onimport = function (tokens) {\n tokens.shift();\n var file = tokens.shift().replace(/^\"+|\"+$/gm, '');\n\n if (tokens[0] !== ';') throw new Error('Unexpected token: ' + tokens[0] + '. Expected \";\"')\n\n tokens.shift();\n return file\n };\n\n var onservice = function (tokens) {\n tokens.shift();\n\n var service = {\n name: tokens.shift(),\n methods: [],\n options: {}\n };\n\n if (tokens[0] !== '{') throw new Error('Expected { but found ' + tokens[0])\n tokens.shift();\n\n while (tokens.length) {\n if (tokens[0] === '}') {\n tokens.shift();\n // there goes optional semicolon after the enclosing \"}\"\n if (tokens[0] === ';') tokens.shift();\n return service\n }\n\n switch (tokens[0]) {\n case 'option':\n var opt = onoption(tokens);\n if (service.options[opt.name] !== undefined) throw new Error('Duplicate option ' + opt.name)\n service.options[opt.name] = opt.value;\n break\n case 'rpc':\n service.methods.push(onrpc(tokens));\n break\n default:\n throw new Error('Unexpected token in service: ' + tokens[0])\n }\n }\n\n throw new Error('No closing tag for service')\n };\n\n var onrpc = function (tokens) {\n tokens.shift();\n\n var rpc = {\n name: tokens.shift(),\n input_type: null,\n output_type: null,\n client_streaming: false,\n server_streaming: false,\n options: {}\n };\n\n if (tokens[0] !== '(') throw new Error('Expected ( but found ' + tokens[0])\n tokens.shift();\n\n if (tokens[0] === 'stream') {\n tokens.shift();\n rpc.client_streaming = true;\n }\n\n rpc.input_type = tokens.shift();\n\n if (tokens[0] !== ')') throw new Error('Expected ) but found ' + tokens[0])\n tokens.shift();\n\n if (tokens[0] !== 'returns') throw new Error('Expected returns but found ' + tokens[0])\n tokens.shift();\n\n if (tokens[0] !== '(') throw new Error('Expected ( but found ' + tokens[0])\n tokens.shift();\n\n if (tokens[0] === 'stream') {\n tokens.shift();\n rpc.server_streaming = true;\n }\n\n rpc.output_type = tokens.shift();\n\n if (tokens[0] !== ')') throw new Error('Expected ) but found ' + tokens[0])\n tokens.shift();\n\n if (tokens[0] === ';') {\n tokens.shift();\n return rpc\n }\n\n if (tokens[0] !== '{') throw new Error('Expected { but found ' + tokens[0])\n tokens.shift();\n\n while (tokens.length) {\n if (tokens[0] === '}') {\n tokens.shift();\n // there goes optional semicolon after the enclosing \"}\"\n if (tokens[0] === ';') tokens.shift();\n return rpc\n }\n\n if (tokens[0] === 'option') {\n var opt = onoption(tokens);\n if (rpc.options[opt.name] !== undefined) throw new Error('Duplicate option ' + opt.name)\n rpc.options[opt.name] = opt.value;\n } else {\n throw new Error('Unexpected token in rpc options: ' + tokens[0])\n }\n }\n\n throw new Error('No closing tag for rpc')\n };\n\n var parse = function (buf) {\n var tokens = tokenize(buf.toString());\n // check for isolated strings in tokens by looking for opening quote\n for (var i = 0; i < tokens.length; i++) {\n if (/^(\"|')([^'\"]*)$/.test(tokens[i])) {\n var j;\n if (tokens[i].length === 1) {\n j = i + 1;\n } else {\n j = i;\n }\n // look ahead for the closing quote and collapse all\n // in-between tokens into a single token\n for (j; j < tokens.length; j++) {\n if (/^[^'\"\\\\]*(?:\\\\.[^'\"\\\\]*)*(\"|')$/.test(tokens[j])) {\n tokens = tokens.slice(0, i).concat(tokens.slice(i, j + 1).join('')).concat(tokens.slice(j + 1));\n break\n }\n }\n }\n }\n var schema = {\n syntax: 3,\n package: null,\n imports: [],\n enums: [],\n messages: [],\n options: {},\n extends: []\n };\n\n var firstline = true;\n\n while (tokens.length) {\n switch (tokens[0]) {\n case 'package':\n schema.package = onpackagename(tokens);\n break\n\n case 'syntax':\n if (!firstline) throw new Error('Protobuf syntax version should be first thing in file')\n schema.syntax = onsyntaxversion(tokens);\n break\n\n case 'message':\n schema.messages.push(onmessage(tokens));\n break\n\n case 'enum':\n schema.enums.push(onenum(tokens));\n break\n\n case 'option':\n var opt = onoption(tokens);\n if (schema.options[opt.name]) throw new Error('Duplicate option ' + opt.name)\n schema.options[opt.name] = opt.value;\n break\n\n case 'import':\n schema.imports.push(onimport(tokens));\n break\n\n case 'extend':\n schema.extends.push(onextend(tokens));\n break\n\n case 'service':\n if (!schema.services) schema.services = [];\n schema.services.push(onservice(tokens));\n break\n\n default:\n throw new Error('Unexpected token: ' + tokens[0])\n }\n firstline = false;\n }\n\n // now iterate over messages and propagate extends\n schema.extends.forEach(function (ext) {\n schema.messages.forEach(function (msg) {\n if (msg.name === ext.name) {\n ext.message.fields.forEach(function (field) {\n if (!msg.extensions || field.tag < msg.extensions.from || field.tag > msg.extensions.to) {\n throw new Error(msg.name + ' does not declare ' + field.tag + ' as an extension number')\n }\n msg.fields.push(field);\n });\n }\n });\n });\n\n schema.messages.forEach(function (msg) {\n msg.fields.forEach(function (field) {\n var fieldSplit;\n var messageName;\n var nestedEnumName;\n var message;\n\n function enumNameIsFieldType (en) {\n return en.name === field.type\n }\n\n function enumNameIsNestedEnumName (en) {\n return en.name === nestedEnumName\n }\n\n if (field.options && field.options.packed === 'true') {\n if (PACKABLE_TYPES.indexOf(field.type) === -1) {\n // let's see if it's an enum\n if (field.type.indexOf('.') === -1) {\n if (msg.enums && msg.enums.some(enumNameIsFieldType)) {\n return\n }\n } else {\n fieldSplit = field.type.split('.');\n if (fieldSplit.length > 2) {\n throw new Error('what is this?')\n }\n\n messageName = fieldSplit[0];\n nestedEnumName = fieldSplit[1];\n\n schema.messages.some(function (msg) {\n if (msg.name === messageName) {\n message = msg;\n return msg\n }\n });\n\n if (message && message.enums && message.enums.some(enumNameIsNestedEnumName)) {\n return\n }\n }\n\n throw new Error(\n 'Fields of type ' + field.type + ' cannot be declared [packed=true]. ' +\n 'Only repeated fields of primitive numeric types (types which use ' +\n 'the varint, 32-bit, or 64-bit wire types) can be declared \"packed\". ' +\n 'See https://developers.google.com/protocol-buffers/docs/encoding#optional'\n )\n }\n }\n });\n });\n\n return schema\n };\n\n var parse_1 = parse;\n\n var onfield$1 = function (f, result) {\n var prefix = f.repeated ? 'repeated' : f.required ? 'required' : 'optional';\n if (f.type === 'map') prefix = 'map<' + f.map.from + ',' + f.map.to + '>';\n if (f.oneof) prefix = '';\n\n var opts = Object.keys(f.options || {}).map(function (key) {\n return key + ' = ' + f.options[key]\n }).join(',');\n\n if (opts) opts = ' [' + opts + ']';\n\n result.push((prefix ? prefix + ' ' : '') + (f.map === 'map' ? '' : f.type + ' ') + f.name + ' = ' + f.tag + opts + ';');\n return result\n };\n\n var onmessage$1 = function (m, result) {\n result.push('message ' + m.name + ' {');\n\n if (!m.options) m.options = {};\n onoption$1(m.options, result);\n\n if (!m.enums) m.enums = [];\n m.enums.forEach(function (e) {\n result.push(onenum$1(e, []));\n });\n\n if (!m.messages) m.messages = [];\n m.messages.forEach(function (m) {\n result.push(onmessage$1(m, []));\n });\n\n var oneofs = {};\n\n if (!m.fields) m.fields = [];\n m.fields.forEach(function (f) {\n if (f.oneof) {\n if (!oneofs[f.oneof]) oneofs[f.oneof] = [];\n oneofs[f.oneof].push(onfield$1(f, []));\n } else {\n result.push(onfield$1(f, []));\n }\n });\n\n Object.keys(oneofs).forEach(function (n) {\n oneofs[n].unshift('oneof ' + n + ' {');\n oneofs[n].push('}');\n result.push(oneofs[n]);\n });\n\n result.push('}', '');\n return result\n };\n\n var onenum$1 = function (e, result) {\n result.push('enum ' + e.name + ' {');\n if (!e.options) e.options = {};\n var options = onoption$1(e.options, []);\n if (options.length > 1) {\n result.push(options.slice(0, -1));\n }\n Object.keys(e.values).map(function (v) {\n var val = onenumvalue$1(e.values[v]);\n result.push([v + ' = ' + val + ';']);\n });\n result.push('}', '');\n return result\n };\n\n var onenumvalue$1 = function (v, result) {\n var opts = Object.keys(v.options || {}).map(function (key) {\n return key + ' = ' + v.options[key]\n }).join(',');\n\n if (opts) opts = ' [' + opts + ']';\n var val = v.value + opts;\n return val\n };\n\n var onoption$1 = function (o, result) {\n var keys = Object.keys(o);\n keys.forEach(function (option) {\n var v = o[option];\n if (~option.indexOf('.')) option = '(' + option + ')';\n\n var type = typeof v;\n\n if (type === 'object') {\n v = onoptionMap$1(v, []);\n if (v.length) result.push('option ' + option + ' = {', v, '};');\n } else {\n if (type === 'string' && option !== 'optimize_for') v = '\"' + v + '\"';\n result.push('option ' + option + ' = ' + v + ';');\n }\n });\n if (keys.length > 0) {\n result.push('');\n }\n\n return result\n };\n\n var onoptionMap$1 = function (o, result) {\n var keys = Object.keys(o);\n keys.forEach(function (k) {\n var v = o[k];\n\n var type = typeof v;\n\n if (type === 'object') {\n if (Array.isArray(v)) {\n v.forEach(function (v) {\n v = onoptionMap$1(v, []);\n if (v.length) result.push(k + ' {', v, '}');\n });\n } else {\n v = onoptionMap$1(v, []);\n if (v.length) result.push(k + ' {', v, '}');\n }\n } else {\n if (type === 'string') v = '\"' + v + '\"';\n result.push(k + ': ' + v);\n }\n });\n\n return result\n };\n\n var onservices = function (s, result) {\n result.push('service ' + s.name + ' {');\n\n if (!s.options) s.options = {};\n onoption$1(s.options, result);\n if (!s.methods) s.methods = [];\n s.methods.forEach(function (m) {\n result.push(onrpc$1(m, []));\n });\n\n result.push('}', '');\n return result\n };\n\n var onrpc$1 = function (rpc, result) {\n var def = 'rpc ' + rpc.name + '(';\n if (rpc.client_streaming) def += 'stream ';\n def += rpc.input_type + ') returns (';\n if (rpc.server_streaming) def += 'stream ';\n def += rpc.output_type + ')';\n\n if (!rpc.options) rpc.options = {};\n\n var options = onoption$1(rpc.options, []);\n if (options.length > 1) {\n result.push(def + ' {', options.slice(0, -1), '}');\n } else {\n result.push(def + ';');\n }\n\n return result\n };\n\n var indent = function (lvl) {\n return function (line) {\n if (Array.isArray(line)) return line.map(indent(lvl + ' ')).join('\\n')\n return lvl + line\n }\n };\n\n var stringify = function (schema) {\n var result = [];\n\n result.push('syntax = \"proto' + schema.syntax + '\";', '');\n\n if (schema.package) result.push('package ' + schema.package + ';', '');\n\n if (!schema.options) schema.options = {};\n\n onoption$1(schema.options, result);\n\n if (!schema.enums) schema.enums = [];\n schema.enums.forEach(function (e) {\n onenum$1(e, result);\n });\n\n if (!schema.messages) schema.messages = [];\n schema.messages.forEach(function (m) {\n onmessage$1(m, result);\n });\n\n if (schema.services) {\n schema.services.forEach(function (s) {\n onservices(s, result);\n });\n }\n return result.map(indent('')).join('\\n')\n };\n\n var protocolBuffersSchema = parse_1;\n var parse_1$1 = parse_1;\n var stringify_1 = stringify;\n protocolBuffersSchema.parse = parse_1$1;\n protocolBuffersSchema.stringify = stringify_1;\n\n function encoder (type, encode, decode, encodingLength) {\n encode.bytes = decode.bytes = 0;\n\n return {\n type: type,\n encode: encode,\n decode: decode,\n encodingLength: encodingLength\n }\n }\n\n var encoder_1 = encoder;\n\n var encode_1$2 = encode$5;\n\n var MSB$4 = 0x80\n , REST$4 = 0x7F\n , MSBALL$2 = ~REST$4\n , INT$2 = Math.pow(2, 31);\n\n function encode$5(num, out, offset) {\n out = out || [];\n offset = offset || 0;\n var oldOffset = offset;\n\n while(num >= INT$2) {\n out[offset++] = (num & 0xFF) | MSB$4;\n num /= 128;\n }\n while(num & MSBALL$2) {\n out[offset++] = (num & 0xFF) | MSB$4;\n num >>>= 7;\n }\n out[offset] = num | 0;\n \n encode$5.bytes = offset - oldOffset + 1;\n \n return out\n }\n\n var decode$5 = read$3;\n\n var MSB$5 = 0x80\n , REST$5 = 0x7F;\n\n function read$3(buf, offset) {\n var res = 0\n , offset = offset || 0\n , shift = 0\n , counter = offset\n , b\n , l = buf.length;\n\n do {\n if (counter >= l) {\n read$3.bytes = 0;\n throw new RangeError('Could not decode varint')\n }\n b = buf[counter++];\n res += shift < 28\n ? (b & REST$5) << shift\n : (b & REST$5) * Math.pow(2, shift);\n shift += 7;\n } while (b >= MSB$5)\n\n read$3.bytes = counter - offset;\n\n return res\n }\n\n var N1$2 = Math.pow(2, 7);\n var N2$2 = Math.pow(2, 14);\n var N3$2 = Math.pow(2, 21);\n var N4$2 = Math.pow(2, 28);\n var N5$2 = Math.pow(2, 35);\n var N6$2 = Math.pow(2, 42);\n var N7$2 = Math.pow(2, 49);\n var N8$2 = Math.pow(2, 56);\n var N9$2 = Math.pow(2, 63);\n\n var length$2 = function (value) {\n return (\n value < N1$2 ? 1\n : value < N2$2 ? 2\n : value < N3$2 ? 3\n : value < N4$2 ? 4\n : value < N5$2 ? 5\n : value < N6$2 ? 6\n : value < N7$2 ? 7\n : value < N8$2 ? 8\n : value < N9$2 ? 9\n : 10\n )\n };\n\n var varint$2 = {\n encode: encode_1$2\n , decode: decode$5\n , encodingLength: length$2\n };\n\n function bytesBufferLength (val) {\n return val.byteLength\n }\n\n function bytesEncodingLength (val) {\n const len = bytesBufferLength(val);\n return varint$2.encodingLength(len) + len\n }\n\n function bytesEncode (val, buffer, dataView, offset) {\n const oldOffset = offset;\n const len = bytesBufferLength(val);\n\n varint$2.encode(len, buffer, offset);\n offset += varint$2.encode.bytes;\n\n buffer.set(val, offset);\n offset += len;\n\n bytesEncode.bytes = offset - oldOffset;\n }\n\n function bytesDecode (buffer, dataView, offset) {\n const oldOffset = offset;\n\n const len = varint$2.decode(buffer, offset);\n offset += varint$2.decode.bytes;\n\n const val = buffer.slice(offset, offset + len);\n offset += val.length;\n\n bytesDecode.bytes = offset - oldOffset;\n\n return val\n }\n\n var bytes = encoder_1(2, bytesEncode, bytesDecode, bytesEncodingLength);\n\n function stringEncodingLength (val) {\n const len = fromString_1$1(val).byteLength;\n return varint$2.encodingLength(len) + len\n }\n\n function stringEncode (val, buffer, dataView, offset) {\n const oldOffset = offset;\n const len = fromString_1$1(val).byteLength;\n\n varint$2.encode(len, buffer, offset, 'utf-8');\n offset += varint$2.encode.bytes;\n\n const arr = fromString_1$1(val);\n buffer.set(arr, offset);\n offset += arr.length;\n\n stringEncode.bytes = offset - oldOffset;\n }\n\n function stringDecode (buffer, dataView, offset) {\n const oldOffset = offset;\n\n const len = varint$2.decode(buffer, offset);\n offset += varint$2.decode.bytes;\n\n const val = toString_1$1(buffer.subarray(offset, offset + len));\n offset += len;\n\n stringDecode.bytes = offset - oldOffset;\n\n return val\n }\n\n var string = encoder_1(2, stringEncode, stringDecode, stringEncodingLength);\n\n function boolEncodingLength () {\n return 1\n }\n\n function boolEncode (value, buffer, dataView, offset) {\n buffer[offset] = value ? 1 : 0;\n boolEncode.bytes = 1;\n }\n\n function boolDecode (buffer, dataView, offset) {\n const bool = buffer[offset] > 0;\n boolDecode.bytes = 1;\n\n return bool\n }\n\n var bool = encoder_1(0, boolEncode, boolDecode, boolEncodingLength);\n\n function in32Encode (val, buffer, dataView, offset) {\n varint$2.encode(val < 0 ? val + 4294967296 : val, buffer, offset);\n in32Encode.bytes = varint$2.encode.bytes;\n }\n\n function int32Decode (buffer, dataView, offset) {\n const val = varint$2.decode(buffer, offset);\n int32Decode.bytes = varint$2.decode.bytes;\n\n return val > 2147483647 ? val - 4294967296 : val\n }\n\n function int32EncodingLength (val) {\n return varint$2.encodingLength(val < 0 ? val + 4294967296 : val)\n }\n\n var int32 = encoder_1(0, in32Encode, int32Decode, int32EncodingLength);\n\n function int64Encode (val, buffer, dataView, offset) {\n if (val < 0) {\n const last = offset + 9;\n varint$2.encode(val * -1, buffer, offset);\n\n offset += varint$2.encode.bytes - 1;\n buffer[offset] = buffer[offset] | 0x80;\n\n while (offset < last - 1) {\n offset++;\n buffer[offset] = 0xff;\n }\n buffer[last] = 0x01;\n\n int64Encode.bytes = 10;\n } else {\n varint$2.encode(val, buffer, offset);\n int64Encode.bytes = varint$2.encode.bytes;\n }\n }\n\n function int64Decode (buffer, dataView, offset) {\n let val = varint$2.decode(buffer, offset);\n\n if (val >= Math.pow(2, 63)) {\n let limit = 9;\n while (buffer[offset + limit - 1] === 0xff) limit--;\n limit = limit || 9;\n const subset = buffer.subarray(offset, offset + limit);\n subset[limit - 1] = subset[limit - 1] & 0x7f;\n val = -1 * varint$2.decode(subset, 0);\n int64Decode.bytes = 10;\n } else {\n int64Decode.bytes = varint$2.decode.bytes;\n }\n\n return val\n }\n\n function int64EncodingLength (val) {\n return val < 0 ? 10 : varint$2.encodingLength(val)\n }\n\n var int64 = encoder_1(0, int64Encode, int64Decode, int64EncodingLength);\n\n var encode$6 = function encode (v, b, o) {\n v = v >= 0 ? v*2 : v*-2 - 1;\n var r = varint$2.encode(v, b, o);\n encode.bytes = varint$2.encode.bytes;\n return r\n };\n var decode$6 = function decode (b, o) {\n var v = varint$2.decode(b, o);\n decode.bytes = varint$2.decode.bytes;\n return v & 1 ? (v+1) / -2 : v / 2\n };\n\n var encodingLength = function (v) {\n return varint$2.encodingLength(v >= 0 ? v*2 : v*-2 - 1)\n };\n\n var signedVarint = {\n \tencode: encode$6,\n \tdecode: decode$6,\n \tencodingLength: encodingLength\n };\n\n function svarintEncode (val, buffer, dataView, offset) {\n signedVarint.encode(val, buffer, offset);\n\n svarintEncode.bytes = signedVarint.encode.bytes;\n }\n\n function svarintDecode (buffer, dataView, offset) {\n const val = signedVarint.decode(buffer, offset);\n svarintDecode.bytes = signedVarint.decode.bytes;\n\n return val\n }\n\n var sint64 = encoder_1(0, svarintEncode, svarintDecode, signedVarint.encodingLength);\n\n function varintEncode$2 (val, buffer, dataView, offset) {\n varint$2.encode(val, buffer, offset);\n\n varintEncode$2.bytes = varint$2.encode.bytes;\n }\n\n function varintDecode (buffer, dataView, offset) {\n const val = varint$2.decode(buffer, offset);\n varintDecode.bytes = varint$2.decode.bytes;\n\n return val\n }\n\n var varint_1 = encoder_1(0, varintEncode$2, varintDecode, varint$2.encodingLength);\n\n function fixed64EncodingLength () {\n return 8\n }\n\n function fixed64Encode (val, buffer, dataView, offset) {\n for (const byte of val) {\n buffer[offset] = byte;\n offset++;\n }\n\n fixed64Encode.bytes = 8;\n }\n\n function fixed64Decode (buffer, dataView, offset) {\n const val = buffer.slice(offset, offset + 8);\n fixed64Decode.bytes = 8;\n\n return val\n }\n\n var fixed64 = encoder_1(1, fixed64Encode, fixed64Decode, fixed64EncodingLength);\n\n function doubleEncodingLength () {\n return 8\n }\n\n function doubleEncode (val, buffer, dataView, offset) {\n dataView.setFloat64(offset, val, true);\n doubleEncode.bytes = 8;\n }\n\n function doubleDecode (buffer, dataView, offset) {\n const val = dataView.getFloat64(offset, true);\n doubleDecode.bytes = 8;\n\n return val\n }\n\n var double = encoder_1(1, doubleEncode, doubleDecode, doubleEncodingLength);\n\n function fixed32EncodingLength (val) {\n return 4\n }\n\n function fixed32Encode (val, buffer, dataView, offset) {\n dataView.setUint32(offset, val, true);\n fixed32Encode.bytes = 4;\n }\n\n function fixed32Decode (buffer, dataView, offset) {\n const val = dataView.getUint32(offset, true);\n fixed32Decode.bytes = 4;\n\n return val\n }\n\n var fixed32 = encoder_1(5, fixed32Encode, fixed32Decode, fixed32EncodingLength);\n\n function sfixed32EncodingLength (val) {\n return 4\n }\n\n function sfixed32Encode (val, buffer, dataView, offset) {\n dataView.setInt32(offset, val, true);\n sfixed32Encode.bytes = 4;\n }\n\n function sfixed32Decode (buffer, dataView, offset) {\n const val = dataView.getInt32(offset, true);\n sfixed32Decode.bytes = 4;\n\n return val\n }\n\n var sfixed32 = encoder_1(5, sfixed32Encode, sfixed32Decode, sfixed32EncodingLength);\n\n function floatEncodingLength () {\n return 4\n }\n\n function floatEncode (val, buffer, dataView, offset) {\n dataView.setFloat32(offset, val, true);\n floatEncode.bytes = 4;\n }\n\n function floatDecode (buffer, dataView, offset) {\n const val = dataView.getFloat32(offset, true);\n floatDecode.bytes = 4;\n\n return val\n }\n\n var float = encoder_1(5, floatEncode, floatDecode, floatEncodingLength);\n\n var encodings = createCommonjsModule(function (module, exports) {\n\n exports.make = encoder_1;\n exports.bytes = bytes;\n exports.string = string;\n exports.bool = bool;\n exports.int32 = int32;\n exports.int64 = int64;\n exports.sint32 =\n exports.sint64 = sint64;\n exports.uint32 =\n exports.uint64 =\n exports.enum =\n exports.varint = varint_1;\n\n // we cannot represent these in javascript so we just use buffers\n exports.fixed64 =\n exports.sfixed64 = fixed64;\n exports.double = double;\n exports.fixed32 = fixed32;\n exports.sfixed32 = sfixed32;\n exports.float = float;\n });\n\n var defined = function (val) {\n return val !== null && val !== undefined && (typeof val !== 'number' || !isNaN(val))\n };\n\n var utils$2 = {\n \tdefined: defined\n };\n\n /* eslint max-depth: 1 */\n\n\n const defined$1 = utils$2.defined;\n\n function toSentenceCase (string) {\n return `${string.substring(0, 1).toUpperCase()}${string.substring(1)}`\n }\n\n function addPropertyAccessors (obj, name, value, defaultValue) {\n if (Object.prototype.hasOwnProperty.call(obj, name)) {\n // have already added this property\n return\n }\n\n const sentenceCaseName = toSentenceCase(name);\n\n Object.defineProperties(obj, {\n [name]: {\n enumerable: true,\n configurable: true,\n set: (val) => {\n value = val;\n },\n get: () => {\n if (value === undefined) {\n return defaultValue\n }\n\n return value\n }\n },\n [`has${sentenceCaseName}`]: {\n configurable: true,\n value: () => {\n return value !== undefined\n }\n },\n [`set${sentenceCaseName}`]: {\n configurable: true,\n value: (val) => {\n value = val;\n }\n },\n [`get${sentenceCaseName}`]: {\n configurable: true,\n value: () => {\n return value\n }\n },\n [`clear${sentenceCaseName}`]: {\n configurable: true,\n value: () => {\n value = undefined;\n obj[name] = undefined;\n }\n }\n });\n }\n\n function compileDecode (m, resolve, enc) {\n const requiredFields = [];\n const fields = {};\n const oneofFields = [];\n const vals = [];\n\n for (var i = 0; i < enc.length; i++) {\n const field = m.fields[i];\n\n fields[field.tag] = i;\n\n const def = field.options && field.options.default;\n const resolved = resolve(field.type, m.id, false);\n vals[i] = [def, resolved && resolved.values];\n\n m.fields[i].packed = field.repeated && field.options && field.options.packed && field.options.packed !== 'false';\n\n if (field.required) {\n requiredFields.push(field.name);\n }\n\n if (field.oneof) {\n oneofFields.push(field.name);\n }\n }\n\n function decodeField (e, field, obj, buf, dataView, offset, i) {\n const name = field.name;\n\n if (field.oneof) {\n // clear already defined oneof fields\n const props = Object.keys(obj);\n for (var j = 0; j < props.length; j++) {\n if (oneofFields.indexOf(props[j]) > -1) {\n const sentenceCase = toSentenceCase(props[j]);\n delete obj[`has${sentenceCase}`];\n delete obj[`get${sentenceCase}`];\n delete obj[`set${sentenceCase}`];\n delete obj[`clear${sentenceCase}`];\n delete obj[props[j]];\n }\n }\n }\n\n let value;\n\n if (e.message) {\n const len = varint$2.decode(buf, offset);\n offset += varint$2.decode.bytes;\n\n const decoded = e.decode(buf, dataView, offset, offset + len);\n\n if (field.map) {\n value = obj[name] || {};\n value[decoded.key] = decoded.value;\n } else if (field.repeated) {\n value = obj[name] || [];\n value.push(decoded);\n } else {\n value = decoded;\n }\n } else {\n if (field.repeated) {\n value = obj[name] || [];\n value.push(e.decode(buf, dataView, offset));\n } else {\n value = e.decode(buf, dataView, offset);\n }\n }\n\n addPropertyAccessors(obj, name, value);\n\n offset += e.decode.bytes;\n\n return offset\n }\n\n return function decode (buf, view, offset, end) {\n if (offset == null) {\n offset = 0;\n }\n\n if (end == null) {\n end = buf.length;\n }\n\n if (!(end <= buf.length && offset <= buf.length)) {\n throw new Error('Decoded message is not valid')\n }\n\n if (!view) {\n view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n }\n\n var oldOffset = offset;\n var obj = {};\n var field;\n\n while (true) {\n if (end <= offset) {\n // finished\n\n // check required methods\n var name = '';\n var j = 0;\n for (j = 0; j < requiredFields.length; j++) {\n name = requiredFields[j];\n if (!defined$1(obj[name])) {\n throw new Error('Decoded message is not valid, missing required field: ' + name)\n }\n }\n\n // fill out missing defaults\n var val;\n var def;\n for (j = 0; j < enc.length; j++) {\n field = m.fields[j];\n def = vals[j][0];\n val = vals[j][1];\n name = field.name;\n let defaultVal;\n\n if (Object.prototype.hasOwnProperty.call(obj, name)) {\n continue\n }\n\n var done = false;\n\n if (field.oneof) {\n var props = Object.keys(obj);\n\n for (var k = 0; k < props.length; k++) {\n if (oneofFields.indexOf(props[k]) > -1) {\n done = true;\n break\n }\n }\n }\n\n if (done) {\n continue\n }\n\n if (val) { // is enum\n if (field.repeated) {\n def = [];\n } else {\n def = (def && val[def]) ? val[def].value : val[Object.keys(val)[0]].value;\n def = parseInt(def || 0, 10);\n }\n } else {\n defaultVal = defaultValue(field);\n def = coerceValue(field, def);\n }\n\n addPropertyAccessors(obj, name, def, defaultVal);\n }\n\n decode.bytes = offset - oldOffset;\n return obj\n }\n\n var prefix = varint$2.decode(buf, offset);\n offset += varint$2.decode.bytes;\n var tag = prefix >> 3;\n\n var i = fields[tag];\n\n if (i == null) {\n offset = skip(prefix & 7, buf, view, offset);\n continue\n }\n\n var e = enc[i];\n field = m.fields[i];\n\n if (field.packed) {\n var packedEnd = varint$2.decode(buf, offset);\n offset += varint$2.decode.bytes;\n packedEnd += offset;\n\n while (offset < packedEnd) {\n offset = decodeField(e, field, obj, buf, view, offset);\n }\n } else {\n offset = decodeField(e, field, obj, buf, view, offset);\n }\n }\n }\n }\n\n var skip = function (type, buffer, view, offset) {\n switch (type) {\n case 0:\n varint$2.decode(buffer, offset);\n return offset + varint$2.decode.bytes\n\n case 1:\n return offset + 8\n\n case 2:\n var len = varint$2.decode(buffer, offset);\n return offset + varint$2.decode.bytes + len\n\n case 3:\n case 4:\n throw new Error('Groups are not supported')\n\n case 5:\n return offset + 4\n default:\n throw new Error('Unknown wire type: ' + type)\n }\n };\n\n var defaultValue = function (f) {\n if (f.map) return {}\n if (f.repeated) return []\n\n switch (f.type) {\n case 'string':\n return ''\n case 'bool':\n return false\n case 'float':\n case 'double':\n case 'sfixed32':\n case 'fixed32':\n case 'varint':\n case 'enum':\n case 'uint64':\n case 'uint32':\n case 'int64':\n case 'int32':\n case 'sint64':\n case 'sint32':\n return 0\n default:\n return null\n }\n };\n\n var coerceValue = function (f, def) {\n if (def === undefined) {\n return def\n }\n\n switch (f.type) {\n case 'bool':\n return def === 'true'\n case 'float':\n case 'double':\n case 'sfixed32':\n case 'fixed32':\n case 'varint':\n case 'enum':\n case 'uint64':\n case 'uint32':\n case 'int64':\n case 'int32':\n case 'sint64':\n case 'sint32':\n return parseInt(def, 10)\n default:\n return def\n }\n };\n\n var decode$7 = compileDecode;\n\n var defined$2 = utils$2.defined;\n\n\n function compileEncode (m, resolve, enc, oneofs, encodingLength) {\n const oneofsKeys = Object.keys(oneofs);\n const encLength = enc.length;\n const ints = {};\n for (let i = 0; i < encLength; i++) {\n ints[i] = {\n p: varint$2.encode(m.fields[i].tag << 3 | 2),\n h: varint$2.encode(m.fields[i].tag << 3 | enc[i].type)\n };\n\n const field = m.fields[i];\n m.fields[i].packed = field.repeated && field.options && field.options.packed && field.options.packed !== 'false';\n }\n\n function encodeField (buf, view, offset, h, e, packed, innerVal) {\n let j = 0;\n if (!packed) {\n for (j = 0; j < h.length; j++) {\n buf[offset++] = h[j];\n }\n }\n\n if (e.message) {\n varint$2.encode(e.encodingLength(innerVal), buf, offset);\n offset += varint$2.encode.bytes;\n }\n\n e.encode(innerVal, buf, view, offset);\n\n return offset + e.encode.bytes\n }\n\n return function encode (obj, buf, view, offset = 0) {\n if (buf == null) {\n buf = new Uint8Array(encodingLength(obj));\n }\n\n if (view == null) {\n view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n }\n\n const oldOffset = offset;\n const objKeys = Object.keys(obj);\n let i = 0;\n\n // oneof checks\n\n let match = false;\n for (i = 0; i < oneofsKeys.length; i++) {\n const name = oneofsKeys[i];\n const prop = oneofs[i];\n if (objKeys.indexOf(prop) > -1) {\n if (match) {\n throw new Error('only one of the properties defined in oneof ' + name + ' can be set')\n }\n\n match = true;\n }\n }\n\n for (i = 0; i < encLength; i++) {\n const e = enc[i];\n const field = m.fields[i]; // was f\n let val = obj[field.name];\n let j = 0;\n\n if (!defined$2(val)) {\n if (field.required) {\n throw new Error(field.name + ' is required')\n }\n continue\n }\n const p = ints[i].p;\n const h = ints[i].h;\n\n const packed = field.packed;\n\n if (field.map) {\n const tmp = Object.keys(val);\n for (j = 0; j < tmp.length; j++) {\n tmp[j] = {\n key: tmp[j],\n value: val[tmp[j]]\n };\n }\n val = tmp;\n }\n\n if (packed) {\n let packedLen = 0;\n for (j = 0; j < val.length; j++) {\n if (!Object.prototype.hasOwnProperty.call(val, j)) {\n continue\n }\n\n packedLen += e.encodingLength(val[j]);\n }\n\n if (packedLen) {\n for (j = 0; j < h.length; j++) {\n buf[offset++] = p[j];\n }\n varint$2.encode(packedLen, buf, offset);\n offset += varint$2.encode.bytes;\n }\n }\n\n if (field.repeated) {\n let innerVal;\n for (j = 0; j < val.length; j++) {\n innerVal = val[j];\n if (!defined$2(innerVal)) {\n continue\n }\n\n offset = encodeField(buf, view, offset, h, e, packed, innerVal);\n }\n } else {\n offset = encodeField(buf, view, offset, h, e, packed, val);\n }\n }\n\n encode.bytes = offset - oldOffset;\n return buf\n }\n }\n\n var encode$7 = compileEncode;\n\n var defined$3 = utils$2.defined;\n\n\n function compileEncodingLength (m, enc, oneofs) {\n const oneofsKeys = Object.keys(oneofs);\n const encLength = enc.length;\n\n const hls = new Array(encLength);\n\n for (let i = 0; i < m.fields.length; i++) {\n hls[i] = varint$2.encodingLength(m.fields[i].tag << 3 | enc[i].type);\n\n const field = m.fields[i];\n m.fields[i].packed = field.repeated && field.options && field.options.packed && field.options.packed !== 'false';\n }\n\n return function encodingLength (obj) {\n let length = 0;\n let i = 0;\n let j = 0;\n\n for (i = 0; i < oneofsKeys.length; i++) {\n const name = oneofsKeys[i];\n const props = oneofs[name];\n\n let match = false;\n for (j = 0; j < props.length; j++) {\n if (defined$3(obj[props[j]])) {\n if (match) {\n throw new Error('only one of the properties defined in oneof ' + name + ' can be set')\n }\n match = true;\n }\n }\n }\n\n for (i = 0; i < encLength; i++) {\n const e = enc[i];\n const field = m.fields[i];\n let val = obj[field.name];\n const hl = hls[i];\n let len;\n\n if (!defined$3(val)) {\n if (field.required) {\n throw new Error(field.name + ' is required')\n }\n\n continue\n }\n\n if (field.map) {\n const tmp = Object.keys(val);\n for (j = 0; j < tmp.length; j++) {\n tmp[j] = {\n key: tmp[j],\n value: val[tmp[j]]\n };\n }\n\n val = tmp;\n }\n\n if (field.packed) {\n let packedLen = 0;\n for (j = 0; j < val.length; j++) {\n if (!defined$3(val[j])) {\n continue\n }\n len = e.encodingLength(val[j]);\n packedLen += len;\n\n if (e.message) {\n packedLen += varint$2.encodingLength(len);\n }\n }\n\n if (packedLen) {\n length += hl + packedLen + varint$2.encodingLength(packedLen);\n }\n } else if (field.repeated) {\n for (j = 0; j < val.length; j++) {\n if (!defined$3(val[j])) {\n continue\n }\n\n len = e.encodingLength(val[j]);\n length += hl + len + (e.message ? varint$2.encodingLength(len) : 0);\n }\n } else {\n len = e.encodingLength(val);\n length += hl + len + (e.message ? varint$2.encodingLength(len) : 0);\n }\n }\n\n return length\n }\n }\n\n var encodingLength$1 = compileEncodingLength;\n\n const flatten = function (values) {\n if (!values) return null\n const result = {};\n Object.keys(values).forEach(function (k) {\n result[k] = values[k].value;\n });\n return result\n };\n\n var compile = function (schema, extraEncodings) {\n const messages = {};\n const enums = {};\n const cache = {};\n\n const visit = function (schema, prefix) {\n if (schema.enums) {\n schema.enums.forEach(function (e) {\n e.id = prefix + (prefix ? '.' : '') + e.name;\n enums[e.id] = e;\n visit(e, e.id);\n });\n }\n if (schema.messages) {\n schema.messages.forEach(function (m) {\n m.id = prefix + (prefix ? '.' : '') + m.name;\n messages[m.id] = m;\n m.fields.forEach(function (f) {\n if (!f.map) return\n\n const name = 'Map_' + f.map.from + '_' + f.map.to;\n const map = {\n name: name,\n enums: [],\n messages: [],\n fields: [{\n name: 'key',\n type: f.map.from,\n tag: 1,\n repeated: false,\n required: true\n }, {\n name: 'value',\n type: f.map.to,\n tag: 2,\n repeated: false,\n required: false\n }],\n extensions: null,\n id: prefix + (prefix ? '.' : '') + name\n };\n\n if (!messages[map.id]) {\n messages[map.id] = map;\n schema.messages.push(map);\n }\n f.type = name;\n f.repeated = true;\n });\n visit(m, m.id);\n });\n }\n };\n\n visit(schema, '');\n\n const compileEnum = function (e) {\n const values = Object.keys(e.values || []).map(function (k) {\n return parseInt(e.values[k].value, 10)\n });\n\n const encode = function enumEncode (val, buf, view, offset) {\n if (!values.length || values.indexOf(val) === -1) {\n throw new Error('Invalid enum value: ' + val)\n }\n varint$2.encode(val, buf, offset);\n enumEncode.bytes = varint$2.encode.bytes;\n return buf\n };\n\n const decode = function enumDecode (buf, view, offset) {\n var val = varint$2.decode(buf, offset);\n if (!values.length || values.indexOf(val) === -1) {\n throw new Error('Invalid enum value: ' + val)\n }\n enumDecode.bytes = varint$2.decode.bytes;\n return val\n };\n\n return encodings.make(0, encode, decode, varint$2.encodingLength)\n };\n\n const compileMessage = function (m, exports) {\n m.messages.forEach(function (nested) {\n exports[nested.name] = resolve(nested.name, m.id);\n });\n\n m.enums.forEach(function (val) {\n exports[val.name] = flatten(val.values);\n });\n\n exports.type = 2;\n exports.message = true;\n exports.name = m.name;\n\n const oneofs = {};\n\n m.fields.forEach(function (f) {\n if (!f.oneof) return\n if (!oneofs[f.oneof]) oneofs[f.oneof] = [];\n oneofs[f.oneof].push(f.name);\n });\n\n const enc = m.fields.map(function (f) {\n return resolve(f.type, m.id)\n });\n\n const encodingLength = encodingLength$1(m, enc, oneofs);\n const encode = encode$7(m, resolve, enc, oneofs, encodingLength);\n const decode = decode$7(m, resolve, enc);\n\n // end of compilation - return all the things\n\n encode.bytes = decode.bytes = 0;\n\n exports.buffer = true;\n exports.encode = encode;\n exports.decode = decode;\n exports.encodingLength = encodingLength;\n\n return exports\n };\n\n const resolve = function (name, from, compile) {\n if (extraEncodings && extraEncodings[name]) return extraEncodings[name]\n if (encodings[name]) return encodings[name]\n\n const m = (from ? from + '.' + name : name).split('.')\n .map(function (part, i, list) {\n return list.slice(0, i).concat(name).join('.')\n })\n .reverse()\n .reduce(function (result, id) {\n return result || messages[id] || enums[id]\n }, null);\n\n if (compile === false) return m\n if (!m) throw new Error('Could not resolve ' + name)\n\n if (m.values) return compileEnum(m)\n const res = cache[m.id] || compileMessage(m, cache[m.id] = {});\n return res\n };\n\n return (schema.enums || []).concat((schema.messages || []).map(function (message) {\n return resolve(message.id)\n }))\n };\n\n var flatten$1 = function (values) {\n if (!values) return null\n var result = {};\n Object.keys(values).forEach(function (k) {\n result[k] = values[k].value;\n });\n return result\n };\n\n var src$7 = function (proto, opts) {\n if (!opts) opts = {};\n if (!proto) throw new Error('Pass in a .proto string or a protobuf-schema parsed object')\n\n var sch = (typeof proto === 'object' && !(proto instanceof Uint8Array)) ? proto : protocolBuffersSchema.parse(proto);\n\n // to not make toString,toJSON enumarable we make a fire-and-forget prototype\n var Messages = function () {\n var self = this;\n\n compile(sch, opts.encodings || {}).forEach(function (m) {\n self[m.name] = flatten$1(m.values) || m;\n });\n };\n\n Messages.prototype.toString = function () {\n return protocolBuffersSchema.stringify(sch)\n };\n\n Messages.prototype.toJSON = function () {\n return sch\n };\n\n return new Messages()\n };\n\n var dag_proto = `// An IPFS MerkleDAG Link\nmessage PBLink {\n\n // multihash of the target object\n optional bytes Hash = 1;\n\n // utf string name. should be unique per object\n optional string Name = 2;\n\n // cumulative size of target object\n optional uint64 Tsize = 3;\n}\n\n// An IPFS MerkleDAG Node\nmessage PBNode {\n\n // refs to other objects\n repeated PBLink Links = 2;\n\n // opaque user data\n optional bytes Data = 1;\n}`;\n\n var serialize = createCommonjsModule(function (module, exports) {\n\n\n const proto = src$7(dag_proto);\n\n\n exports = module.exports;\n\n const toProtoBuf = (node) => {\n const pbn = {};\n\n if (node.Data && node.Data.byteLength > 0) {\n pbn.Data = node.Data;\n } else {\n // NOTE: this has to be null in order to match go-ipfs serialization\n // `null !== new Uint8Array(0)`\n pbn.Data = null;\n }\n\n if (node.Links && node.Links.length > 0) {\n pbn.Links = node.Links\n .map((link) => ({\n Hash: link.Hash.bytes,\n Name: link.Name,\n Tsize: link.Tsize\n }));\n } else {\n pbn.Links = null;\n }\n\n return pbn\n };\n\n /**\n * Serialize internal representation into a binary PB block.\n *\n * @param {Object} node - Internal representation of a PB block\n * @returns {Uint8Array} - The encoded binary representation\n */\n const serializeDAGNode = (node) => {\n const data = node.Data;\n const links = node.Links || [];\n\n const serialized = proto.PBNode.encode(toProtoBuf({\n Data: data,\n Links: links\n }));\n\n return serialized\n };\n\n // Serialize an object where the `Links` might not be a `DAGLink` instance yet\n const serializeDAGNodeLike = (data, links = []) => {\n const node = { Data: data };\n node.Links = links.map((link) => {\n return dagLink.isDAGLink(link)\n ? link\n : dagLink.util.createDagLinkFromB58EncodedHash(link)\n });\n return serializeDAGNode(node)\n };\n\n exports.serializeDAGNode = serializeDAGNode;\n exports.serializeDAGNodeLike = serializeDAGNodeLike;\n });\n\n function assign(obj, props) {\n for (const key in props) {\n Object.defineProperty(obj, key, {\n value: props[key],\n enumerable: true,\n configurable: true,\n });\n }\n\n return obj;\n }\n\n function createError$1(err, code, props) {\n if (!err || typeof err === 'string') {\n throw new TypeError('Please pass an Error to err-code');\n }\n\n if (!props) {\n props = {};\n }\n\n if (typeof code === 'object') {\n props = code;\n code = undefined;\n }\n\n if (code != null) {\n props.code = code;\n }\n\n try {\n return assign(err, props);\n } catch (_) {\n props.message = err.message;\n props.stack = err.stack;\n\n const ErrClass = function () {};\n\n ErrClass.prototype = Object.create(Object.getPrototypeOf(err));\n\n return assign(new ErrClass(), props);\n }\n }\n\n var errCode = createError$1;\n\n var sha3 = createCommonjsModule(function (module) {\n /*jslint bitwise: true */\n (function () {\n\n var INPUT_ERROR = 'input is invalid type';\n var FINALIZE_ERROR = 'finalize already called';\n var WINDOW = typeof window === 'object';\n var root = WINDOW ? window : {};\n if (root.JS_SHA3_NO_WINDOW) {\n WINDOW = false;\n }\n var WEB_WORKER = !WINDOW && typeof self === 'object';\n var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node;\n if (NODE_JS) {\n root = commonjsGlobal;\n } else if (WEB_WORKER) {\n root = self;\n }\n var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports;\n var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';\n var HEX_CHARS = '0123456789abcdef'.split('');\n var SHAKE_PADDING = [31, 7936, 2031616, 520093696];\n var CSHAKE_PADDING = [4, 1024, 262144, 67108864];\n var KECCAK_PADDING = [1, 256, 65536, 16777216];\n var PADDING = [6, 1536, 393216, 100663296];\n var SHIFT = [0, 8, 16, 24];\n var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,\n 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,\n 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,\n 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,\n 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];\n var BITS = [224, 256, 384, 512];\n var SHAKE_BITS = [128, 256];\n var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];\n var CSHAKE_BYTEPAD = {\n '128': 168,\n '256': 136\n };\n\n if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) {\n Array.isArray = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n };\n }\n\n if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {\n ArrayBuffer.isView = function (obj) {\n return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;\n };\n }\n\n var createOutputMethod = function (bits, padding, outputType) {\n return function (message) {\n return new Keccak(bits, padding, bits).update(message)[outputType]();\n };\n };\n\n var createShakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits) {\n return new Keccak(bits, padding, outputBits).update(message)[outputType]();\n };\n };\n\n var createCshakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits, n, s) {\n return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();\n };\n };\n\n var createKmacOutputMethod = function (bits, padding, outputType) {\n return function (key, message, outputBits, s) {\n return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();\n };\n };\n\n var createOutputMethods = function (method, createMethod, bits, padding) {\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\n var type = OUTPUT_TYPES[i];\n method[type] = createMethod(bits, padding, type);\n }\n return method;\n };\n\n var createMethod = function (bits, padding) {\n var method = createOutputMethod(bits, padding, 'hex');\n method.create = function () {\n return new Keccak(bits, padding, bits);\n };\n method.update = function (message) {\n return method.create().update(message);\n };\n return createOutputMethods(method, createOutputMethod, bits, padding);\n };\n\n var createShakeMethod = function (bits, padding) {\n var method = createShakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits) {\n return new Keccak(bits, padding, outputBits);\n };\n method.update = function (message, outputBits) {\n return method.create(outputBits).update(message);\n };\n return createOutputMethods(method, createShakeOutputMethod, bits, padding);\n };\n\n var createCshakeMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createCshakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits, n, s) {\n if (!n && !s) {\n return methods['shake' + bits].create(outputBits);\n } else {\n return new Keccak(bits, padding, outputBits).bytepad([n, s], w);\n }\n };\n method.update = function (message, outputBits, n, s) {\n return method.create(outputBits, n, s).update(message);\n };\n return createOutputMethods(method, createCshakeOutputMethod, bits, padding);\n };\n\n var createKmacMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createKmacOutputMethod(bits, padding, 'hex');\n method.create = function (key, outputBits, s) {\n return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);\n };\n method.update = function (key, message, outputBits, s) {\n return method.create(key, outputBits, s).update(message);\n };\n return createOutputMethods(method, createKmacOutputMethod, bits, padding);\n };\n\n var algorithms = [\n { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },\n { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },\n { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },\n { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },\n { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }\n ];\n\n var methods = {}, methodNames = [];\n\n for (var i = 0; i < algorithms.length; ++i) {\n var algorithm = algorithms[i];\n var bits = algorithm.bits;\n for (var j = 0; j < bits.length; ++j) {\n var methodName = algorithm.name + '_' + bits[j];\n methodNames.push(methodName);\n methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);\n if (algorithm.name !== 'sha3') {\n var newMethodName = algorithm.name + bits[j];\n methodNames.push(newMethodName);\n methods[newMethodName] = methods[methodName];\n }\n }\n }\n\n function Keccak(bits, padding, outputBits) {\n this.blocks = [];\n this.s = [];\n this.padding = padding;\n this.outputBits = outputBits;\n this.reset = true;\n this.finalized = false;\n this.block = 0;\n this.start = 0;\n this.blockCount = (1600 - (bits << 1)) >> 5;\n this.byteCount = this.blockCount << 2;\n this.outputBlocks = outputBits >> 5;\n this.extraBytes = (outputBits & 31) >> 3;\n\n for (var i = 0; i < 50; ++i) {\n this.s[i] = 0;\n }\n }\n\n Keccak.prototype.update = function (message) {\n if (this.finalized) {\n throw new Error(FINALIZE_ERROR);\n }\n var notString, type = typeof message;\n if (type !== 'string') {\n if (type === 'object') {\n if (message === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {\n message = new Uint8Array(message);\n } else if (!Array.isArray(message)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var blocks = this.blocks, byteCount = this.byteCount, length = message.length,\n blockCount = this.blockCount, index = 0, s = this.s, i, code;\n\n while (index < length) {\n if (this.reset) {\n this.reset = false;\n blocks[0] = this.block;\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n if (notString) {\n for (i = this.start; index < length && i < byteCount; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = this.start; index < length && i < byteCount; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n }\n }\n }\n this.lastByteIndex = i;\n if (i >= byteCount) {\n this.start = i - byteCount;\n this.block = blocks[blockCount];\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n this.reset = true;\n } else {\n this.start = i;\n }\n }\n return this;\n };\n\n Keccak.prototype.encode = function (x, right) {\n var o = x & 255, n = 1;\n var bytes = [o];\n x = x >> 8;\n o = x & 255;\n while (o > 0) {\n bytes.unshift(o);\n x = x >> 8;\n o = x & 255;\n ++n;\n }\n if (right) {\n bytes.push(n);\n } else {\n bytes.unshift(n);\n }\n this.update(bytes);\n return bytes.length;\n };\n\n Keccak.prototype.encodeString = function (str) {\n var notString, type = typeof str;\n if (type !== 'string') {\n if (type === 'object') {\n if (str === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) {\n str = new Uint8Array(str);\n } else if (!Array.isArray(str)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var bytes = 0, length = str.length;\n if (notString) {\n bytes = length;\n } else {\n for (var i = 0; i < str.length; ++i) {\n var code = str.charCodeAt(i);\n if (code < 0x80) {\n bytes += 1;\n } else if (code < 0x800) {\n bytes += 2;\n } else if (code < 0xd800 || code >= 0xe000) {\n bytes += 3;\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));\n bytes += 4;\n }\n }\n }\n bytes += this.encode(bytes * 8);\n this.update(str);\n return bytes;\n };\n\n Keccak.prototype.bytepad = function (strs, w) {\n var bytes = this.encode(w);\n for (var i = 0; i < strs.length; ++i) {\n bytes += this.encodeString(strs[i]);\n }\n var paddingBytes = w - bytes % w;\n var zeros = [];\n zeros.length = paddingBytes;\n this.update(zeros);\n return this;\n };\n\n Keccak.prototype.finalize = function () {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;\n blocks[i >> 2] |= this.padding[i & 3];\n if (this.lastByteIndex === this.byteCount) {\n blocks[0] = blocks[blockCount];\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n blocks[blockCount - 1] |= 0x80000000;\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n };\n\n Keccak.prototype.toString = Keccak.prototype.hex = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var hex = '', block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +\n HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +\n HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +\n HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];\n }\n if (j % blockCount === 0) {\n f(s);\n i = 0;\n }\n }\n if (extraBytes) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];\n if (extraBytes > 1) {\n hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];\n }\n if (extraBytes > 2) {\n hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];\n }\n }\n return hex;\n };\n\n Keccak.prototype.arrayBuffer = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var bytes = this.outputBits >> 3;\n var buffer;\n if (extraBytes) {\n buffer = new ArrayBuffer((outputBlocks + 1) << 2);\n } else {\n buffer = new ArrayBuffer(bytes);\n }\n var array = new Uint32Array(buffer);\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n array[j] = s[i];\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n array[i] = s[i];\n buffer = buffer.slice(0, bytes);\n }\n return buffer;\n };\n\n Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;\n\n Keccak.prototype.digest = Keccak.prototype.array = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var array = [], offset, block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n array[offset + 1] = (block >> 8) & 0xFF;\n array[offset + 2] = (block >> 16) & 0xFF;\n array[offset + 3] = (block >> 24) & 0xFF;\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n if (extraBytes > 1) {\n array[offset + 1] = (block >> 8) & 0xFF;\n }\n if (extraBytes > 2) {\n array[offset + 2] = (block >> 16) & 0xFF;\n }\n }\n return array;\n };\n\n function Kmac(bits, padding, outputBits) {\n Keccak.call(this, bits, padding, outputBits);\n }\n\n Kmac.prototype = new Keccak();\n\n Kmac.prototype.finalize = function () {\n this.encode(this.outputBits, true);\n return Keccak.prototype.finalize.call(this);\n };\n\n var f = function (s) {\n var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,\n b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,\n b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,\n b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;\n for (n = 0; n < 48; n += 2) {\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\n\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\n s[0] ^= h;\n s[1] ^= l;\n s[10] ^= h;\n s[11] ^= l;\n s[20] ^= h;\n s[21] ^= l;\n s[30] ^= h;\n s[31] ^= l;\n s[40] ^= h;\n s[41] ^= l;\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\n s[2] ^= h;\n s[3] ^= l;\n s[12] ^= h;\n s[13] ^= l;\n s[22] ^= h;\n s[23] ^= l;\n s[32] ^= h;\n s[33] ^= l;\n s[42] ^= h;\n s[43] ^= l;\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\n s[4] ^= h;\n s[5] ^= l;\n s[14] ^= h;\n s[15] ^= l;\n s[24] ^= h;\n s[25] ^= l;\n s[34] ^= h;\n s[35] ^= l;\n s[44] ^= h;\n s[45] ^= l;\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\n s[6] ^= h;\n s[7] ^= l;\n s[16] ^= h;\n s[17] ^= l;\n s[26] ^= h;\n s[27] ^= l;\n s[36] ^= h;\n s[37] ^= l;\n s[46] ^= h;\n s[47] ^= l;\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\n s[8] ^= h;\n s[9] ^= l;\n s[18] ^= h;\n s[19] ^= l;\n s[28] ^= h;\n s[29] ^= l;\n s[38] ^= h;\n s[39] ^= l;\n s[48] ^= h;\n s[49] ^= l;\n\n b0 = s[0];\n b1 = s[1];\n b32 = (s[11] << 4) | (s[10] >>> 28);\n b33 = (s[10] << 4) | (s[11] >>> 28);\n b14 = (s[20] << 3) | (s[21] >>> 29);\n b15 = (s[21] << 3) | (s[20] >>> 29);\n b46 = (s[31] << 9) | (s[30] >>> 23);\n b47 = (s[30] << 9) | (s[31] >>> 23);\n b28 = (s[40] << 18) | (s[41] >>> 14);\n b29 = (s[41] << 18) | (s[40] >>> 14);\n b20 = (s[2] << 1) | (s[3] >>> 31);\n b21 = (s[3] << 1) | (s[2] >>> 31);\n b2 = (s[13] << 12) | (s[12] >>> 20);\n b3 = (s[12] << 12) | (s[13] >>> 20);\n b34 = (s[22] << 10) | (s[23] >>> 22);\n b35 = (s[23] << 10) | (s[22] >>> 22);\n b16 = (s[33] << 13) | (s[32] >>> 19);\n b17 = (s[32] << 13) | (s[33] >>> 19);\n b48 = (s[42] << 2) | (s[43] >>> 30);\n b49 = (s[43] << 2) | (s[42] >>> 30);\n b40 = (s[5] << 30) | (s[4] >>> 2);\n b41 = (s[4] << 30) | (s[5] >>> 2);\n b22 = (s[14] << 6) | (s[15] >>> 26);\n b23 = (s[15] << 6) | (s[14] >>> 26);\n b4 = (s[25] << 11) | (s[24] >>> 21);\n b5 = (s[24] << 11) | (s[25] >>> 21);\n b36 = (s[34] << 15) | (s[35] >>> 17);\n b37 = (s[35] << 15) | (s[34] >>> 17);\n b18 = (s[45] << 29) | (s[44] >>> 3);\n b19 = (s[44] << 29) | (s[45] >>> 3);\n b10 = (s[6] << 28) | (s[7] >>> 4);\n b11 = (s[7] << 28) | (s[6] >>> 4);\n b42 = (s[17] << 23) | (s[16] >>> 9);\n b43 = (s[16] << 23) | (s[17] >>> 9);\n b24 = (s[26] << 25) | (s[27] >>> 7);\n b25 = (s[27] << 25) | (s[26] >>> 7);\n b6 = (s[36] << 21) | (s[37] >>> 11);\n b7 = (s[37] << 21) | (s[36] >>> 11);\n b38 = (s[47] << 24) | (s[46] >>> 8);\n b39 = (s[46] << 24) | (s[47] >>> 8);\n b30 = (s[8] << 27) | (s[9] >>> 5);\n b31 = (s[9] << 27) | (s[8] >>> 5);\n b12 = (s[18] << 20) | (s[19] >>> 12);\n b13 = (s[19] << 20) | (s[18] >>> 12);\n b44 = (s[29] << 7) | (s[28] >>> 25);\n b45 = (s[28] << 7) | (s[29] >>> 25);\n b26 = (s[38] << 8) | (s[39] >>> 24);\n b27 = (s[39] << 8) | (s[38] >>> 24);\n b8 = (s[48] << 14) | (s[49] >>> 18);\n b9 = (s[49] << 14) | (s[48] >>> 18);\n\n s[0] = b0 ^ (~b2 & b4);\n s[1] = b1 ^ (~b3 & b5);\n s[10] = b10 ^ (~b12 & b14);\n s[11] = b11 ^ (~b13 & b15);\n s[20] = b20 ^ (~b22 & b24);\n s[21] = b21 ^ (~b23 & b25);\n s[30] = b30 ^ (~b32 & b34);\n s[31] = b31 ^ (~b33 & b35);\n s[40] = b40 ^ (~b42 & b44);\n s[41] = b41 ^ (~b43 & b45);\n s[2] = b2 ^ (~b4 & b6);\n s[3] = b3 ^ (~b5 & b7);\n s[12] = b12 ^ (~b14 & b16);\n s[13] = b13 ^ (~b15 & b17);\n s[22] = b22 ^ (~b24 & b26);\n s[23] = b23 ^ (~b25 & b27);\n s[32] = b32 ^ (~b34 & b36);\n s[33] = b33 ^ (~b35 & b37);\n s[42] = b42 ^ (~b44 & b46);\n s[43] = b43 ^ (~b45 & b47);\n s[4] = b4 ^ (~b6 & b8);\n s[5] = b5 ^ (~b7 & b9);\n s[14] = b14 ^ (~b16 & b18);\n s[15] = b15 ^ (~b17 & b19);\n s[24] = b24 ^ (~b26 & b28);\n s[25] = b25 ^ (~b27 & b29);\n s[34] = b34 ^ (~b36 & b38);\n s[35] = b35 ^ (~b37 & b39);\n s[44] = b44 ^ (~b46 & b48);\n s[45] = b45 ^ (~b47 & b49);\n s[6] = b6 ^ (~b8 & b0);\n s[7] = b7 ^ (~b9 & b1);\n s[16] = b16 ^ (~b18 & b10);\n s[17] = b17 ^ (~b19 & b11);\n s[26] = b26 ^ (~b28 & b20);\n s[27] = b27 ^ (~b29 & b21);\n s[36] = b36 ^ (~b38 & b30);\n s[37] = b37 ^ (~b39 & b31);\n s[46] = b46 ^ (~b48 & b40);\n s[47] = b47 ^ (~b49 & b41);\n s[8] = b8 ^ (~b0 & b2);\n s[9] = b9 ^ (~b1 & b3);\n s[18] = b18 ^ (~b10 & b12);\n s[19] = b19 ^ (~b11 & b13);\n s[28] = b28 ^ (~b20 & b22);\n s[29] = b29 ^ (~b21 & b23);\n s[38] = b38 ^ (~b30 & b32);\n s[39] = b39 ^ (~b31 & b33);\n s[48] = b48 ^ (~b40 & b42);\n s[49] = b49 ^ (~b41 & b43);\n\n s[0] ^= RC[n];\n s[1] ^= RC[n + 1];\n }\n };\n\n if (COMMON_JS) {\n module.exports = methods;\n } else {\n for (i = 0; i < methodNames.length; ++i) {\n root[methodNames[i]] = methods[methodNames[i]];\n }\n }\n })();\n });\n\n /* jshint -W086: true */\n\n var murmurHash3js = createCommonjsModule(function (module, exports) {\n (function (root, undefined$1) {\n\n // Create a local object that'll be exported or referenced globally.\n var library = {\n 'version': '3.0.0',\n 'x86': {},\n 'x64': {},\n 'inputValidation': true\n };\n\n // PRIVATE FUNCTIONS\n // -----------------\n\n function _validBytes(bytes) {\n // check the input is an array or a typed array\n if (!Array.isArray(bytes) && !ArrayBuffer.isView(bytes)) {\n return false;\n }\n\n // check all bytes are actually bytes\n for (var i = 0; i < bytes.length; i++) {\n if (!Number.isInteger(bytes[i]) || bytes[i] < 0 || bytes[i] > 255) {\n return false;\n }\n }\n return true;\n }\n\n function _x86Multiply(m, n) {\n //\n // Given two 32bit ints, returns the two multiplied together as a\n // 32bit int.\n //\n\n return ((m & 0xffff) * n) + ((((m >>> 16) * n) & 0xffff) << 16);\n }\n\n function _x86Rotl(m, n) {\n //\n // Given a 32bit int and an int representing a number of bit positions,\n // returns the 32bit int rotated left by that number of positions.\n //\n\n return (m << n) | (m >>> (32 - n));\n }\n\n function _x86Fmix(h) {\n //\n // Given a block, returns murmurHash3's final x86 mix of that block.\n //\n\n h ^= h >>> 16;\n h = _x86Multiply(h, 0x85ebca6b);\n h ^= h >>> 13;\n h = _x86Multiply(h, 0xc2b2ae35);\n h ^= h >>> 16;\n\n return h;\n }\n\n function _x64Add(m, n) {\n //\n // Given two 64bit ints (as an array of two 32bit ints) returns the two\n // added together as a 64bit int (as an array of two 32bit ints).\n //\n\n m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff];\n n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff];\n var o = [0, 0, 0, 0];\n\n o[3] += m[3] + n[3];\n o[2] += o[3] >>> 16;\n o[3] &= 0xffff;\n\n o[2] += m[2] + n[2];\n o[1] += o[2] >>> 16;\n o[2] &= 0xffff;\n\n o[1] += m[1] + n[1];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n\n o[0] += m[0] + n[0];\n o[0] &= 0xffff;\n\n return [(o[0] << 16) | o[1], (o[2] << 16) | o[3]];\n }\n\n function _x64Multiply(m, n) {\n //\n // Given two 64bit ints (as an array of two 32bit ints) returns the two\n // multiplied together as a 64bit int (as an array of two 32bit ints).\n //\n\n m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff];\n n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff];\n var o = [0, 0, 0, 0];\n\n o[3] += m[3] * n[3];\n o[2] += o[3] >>> 16;\n o[3] &= 0xffff;\n\n o[2] += m[2] * n[3];\n o[1] += o[2] >>> 16;\n o[2] &= 0xffff;\n\n o[2] += m[3] * n[2];\n o[1] += o[2] >>> 16;\n o[2] &= 0xffff;\n\n o[1] += m[1] * n[3];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n\n o[1] += m[2] * n[2];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n\n o[1] += m[3] * n[1];\n o[0] += o[1] >>> 16;\n o[1] &= 0xffff;\n\n o[0] += (m[0] * n[3]) + (m[1] * n[2]) + (m[2] * n[1]) + (m[3] * n[0]);\n o[0] &= 0xffff;\n\n return [(o[0] << 16) | o[1], (o[2] << 16) | o[3]];\n }\n\n function _x64Rotl(m, n) {\n //\n // Given a 64bit int (as an array of two 32bit ints) and an int\n // representing a number of bit positions, returns the 64bit int (as an\n // array of two 32bit ints) rotated left by that number of positions.\n //\n\n n %= 64;\n\n if (n === 32) {\n return [m[1], m[0]];\n } else if (n < 32) {\n return [(m[0] << n) | (m[1] >>> (32 - n)), (m[1] << n) | (m[0] >>> (32 - n))];\n } else {\n n -= 32;\n return [(m[1] << n) | (m[0] >>> (32 - n)), (m[0] << n) | (m[1] >>> (32 - n))];\n }\n }\n\n function _x64LeftShift(m, n) {\n //\n // Given a 64bit int (as an array of two 32bit ints) and an int\n // representing a number of bit positions, returns the 64bit int (as an\n // array of two 32bit ints) shifted left by that number of positions.\n //\n\n n %= 64;\n\n if (n === 0) {\n return m;\n } else if (n < 32) {\n return [(m[0] << n) | (m[1] >>> (32 - n)), m[1] << n];\n } else {\n return [m[1] << (n - 32), 0];\n }\n }\n\n function _x64Xor(m, n) {\n //\n // Given two 64bit ints (as an array of two 32bit ints) returns the two\n // xored together as a 64bit int (as an array of two 32bit ints).\n //\n\n return [m[0] ^ n[0], m[1] ^ n[1]];\n }\n\n function _x64Fmix(h) {\n //\n // Given a block, returns murmurHash3's final x64 mix of that block.\n // (`[0, h[0] >>> 1]` is a 33 bit unsigned right shift. This is the\n // only place where we need to right shift 64bit ints.)\n //\n\n h = _x64Xor(h, [0, h[0] >>> 1]);\n h = _x64Multiply(h, [0xff51afd7, 0xed558ccd]);\n h = _x64Xor(h, [0, h[0] >>> 1]);\n h = _x64Multiply(h, [0xc4ceb9fe, 0x1a85ec53]);\n h = _x64Xor(h, [0, h[0] >>> 1]);\n\n return h;\n }\n\n // PUBLIC FUNCTIONS\n // ----------------\n\n library.x86.hash32 = function (bytes, seed) {\n //\n // Given a string and an optional seed as an int, returns a 32 bit hash\n // using the x86 flavor of MurmurHash3, as an unsigned int.\n //\n if (library.inputValidation && !_validBytes(bytes)) {\n return undefined$1;\n }\n seed = seed || 0;\n\n var remainder = bytes.length % 4;\n var blocks = bytes.length - remainder;\n\n var h1 = seed;\n\n var k1 = 0;\n\n var c1 = 0xcc9e2d51;\n var c2 = 0x1b873593;\n\n for (var i = 0; i < blocks; i = i + 4) {\n k1 = (bytes[i]) | (bytes[i + 1] << 8) | (bytes[i + 2] << 16) | (bytes[i + 3] << 24);\n\n k1 = _x86Multiply(k1, c1);\n k1 = _x86Rotl(k1, 15);\n k1 = _x86Multiply(k1, c2);\n\n h1 ^= k1;\n h1 = _x86Rotl(h1, 13);\n h1 = _x86Multiply(h1, 5) + 0xe6546b64;\n }\n\n k1 = 0;\n\n switch (remainder) {\n case 3:\n k1 ^= bytes[i + 2] << 16;\n\n case 2:\n k1 ^= bytes[i + 1] << 8;\n\n case 1:\n k1 ^= bytes[i];\n k1 = _x86Multiply(k1, c1);\n k1 = _x86Rotl(k1, 15);\n k1 = _x86Multiply(k1, c2);\n h1 ^= k1;\n }\n\n h1 ^= bytes.length;\n h1 = _x86Fmix(h1);\n\n return h1 >>> 0;\n };\n\n library.x86.hash128 = function (bytes, seed) {\n //\n // Given a string and an optional seed as an int, returns a 128 bit\n // hash using the x86 flavor of MurmurHash3, as an unsigned hex.\n //\n if (library.inputValidation && !_validBytes(bytes)) {\n return undefined$1;\n }\n\n seed = seed || 0;\n var remainder = bytes.length % 16;\n var blocks = bytes.length - remainder;\n\n var h1 = seed;\n var h2 = seed;\n var h3 = seed;\n var h4 = seed;\n\n var k1 = 0;\n var k2 = 0;\n var k3 = 0;\n var k4 = 0;\n\n var c1 = 0x239b961b;\n var c2 = 0xab0e9789;\n var c3 = 0x38b34ae5;\n var c4 = 0xa1e38b93;\n\n for (var i = 0; i < blocks; i = i + 16) {\n k1 = (bytes[i]) | (bytes[i + 1] << 8) | (bytes[i + 2] << 16) | (bytes[i + 3] << 24);\n k2 = (bytes[i + 4]) | (bytes[i + 5] << 8) | (bytes[i + 6] << 16) | (bytes[i + 7] << 24);\n k3 = (bytes[i + 8]) | (bytes[i + 9] << 8) | (bytes[i + 10] << 16) | (bytes[i + 11] << 24);\n k4 = (bytes[i + 12]) | (bytes[i + 13] << 8) | (bytes[i + 14] << 16) | (bytes[i + 15] << 24);\n\n k1 = _x86Multiply(k1, c1);\n k1 = _x86Rotl(k1, 15);\n k1 = _x86Multiply(k1, c2);\n h1 ^= k1;\n\n h1 = _x86Rotl(h1, 19);\n h1 += h2;\n h1 = _x86Multiply(h1, 5) + 0x561ccd1b;\n\n k2 = _x86Multiply(k2, c2);\n k2 = _x86Rotl(k2, 16);\n k2 = _x86Multiply(k2, c3);\n h2 ^= k2;\n\n h2 = _x86Rotl(h2, 17);\n h2 += h3;\n h2 = _x86Multiply(h2, 5) + 0x0bcaa747;\n\n k3 = _x86Multiply(k3, c3);\n k3 = _x86Rotl(k3, 17);\n k3 = _x86Multiply(k3, c4);\n h3 ^= k3;\n\n h3 = _x86Rotl(h3, 15);\n h3 += h4;\n h3 = _x86Multiply(h3, 5) + 0x96cd1c35;\n\n k4 = _x86Multiply(k4, c4);\n k4 = _x86Rotl(k4, 18);\n k4 = _x86Multiply(k4, c1);\n h4 ^= k4;\n\n h4 = _x86Rotl(h4, 13);\n h4 += h1;\n h4 = _x86Multiply(h4, 5) + 0x32ac3b17;\n }\n\n k1 = 0;\n k2 = 0;\n k3 = 0;\n k4 = 0;\n\n switch (remainder) {\n case 15:\n k4 ^= bytes[i + 14] << 16;\n\n case 14:\n k4 ^= bytes[i + 13] << 8;\n\n case 13:\n k4 ^= bytes[i + 12];\n k4 = _x86Multiply(k4, c4);\n k4 = _x86Rotl(k4, 18);\n k4 = _x86Multiply(k4, c1);\n h4 ^= k4;\n\n case 12:\n k3 ^= bytes[i + 11] << 24;\n\n case 11:\n k3 ^= bytes[i + 10] << 16;\n\n case 10:\n k3 ^= bytes[i + 9] << 8;\n\n case 9:\n k3 ^= bytes[i + 8];\n k3 = _x86Multiply(k3, c3);\n k3 = _x86Rotl(k3, 17);\n k3 = _x86Multiply(k3, c4);\n h3 ^= k3;\n\n case 8:\n k2 ^= bytes[i + 7] << 24;\n\n case 7:\n k2 ^= bytes[i + 6] << 16;\n\n case 6:\n k2 ^= bytes[i + 5] << 8;\n\n case 5:\n k2 ^= bytes[i + 4];\n k2 = _x86Multiply(k2, c2);\n k2 = _x86Rotl(k2, 16);\n k2 = _x86Multiply(k2, c3);\n h2 ^= k2;\n\n case 4:\n k1 ^= bytes[i + 3] << 24;\n\n case 3:\n k1 ^= bytes[i + 2] << 16;\n\n case 2:\n k1 ^= bytes[i + 1] << 8;\n\n case 1:\n k1 ^= bytes[i];\n k1 = _x86Multiply(k1, c1);\n k1 = _x86Rotl(k1, 15);\n k1 = _x86Multiply(k1, c2);\n h1 ^= k1;\n }\n\n h1 ^= bytes.length;\n h2 ^= bytes.length;\n h3 ^= bytes.length;\n h4 ^= bytes.length;\n\n h1 += h2;\n h1 += h3;\n h1 += h4;\n h2 += h1;\n h3 += h1;\n h4 += h1;\n\n h1 = _x86Fmix(h1);\n h2 = _x86Fmix(h2);\n h3 = _x86Fmix(h3);\n h4 = _x86Fmix(h4);\n\n h1 += h2;\n h1 += h3;\n h1 += h4;\n h2 += h1;\n h3 += h1;\n h4 += h1;\n\n return (\"00000000\" + (h1 >>> 0).toString(16)).slice(-8) + (\"00000000\" + (h2 >>> 0).toString(16)).slice(-8) + (\"00000000\" + (h3 >>> 0).toString(16)).slice(-8) + (\"00000000\" + (h4 >>> 0).toString(16)).slice(-8);\n };\n\n library.x64.hash128 = function (bytes, seed) {\n //\n // Given a string and an optional seed as an int, returns a 128 bit\n // hash using the x64 flavor of MurmurHash3, as an unsigned hex.\n //\n if (library.inputValidation && !_validBytes(bytes)) {\n return undefined$1;\n }\n seed = seed || 0;\n\n var remainder = bytes.length % 16;\n var blocks = bytes.length - remainder;\n\n var h1 = [0, seed];\n var h2 = [0, seed];\n\n var k1 = [0, 0];\n var k2 = [0, 0];\n\n var c1 = [0x87c37b91, 0x114253d5];\n var c2 = [0x4cf5ad43, 0x2745937f];\n\n for (var i = 0; i < blocks; i = i + 16) {\n k1 = [(bytes[i + 4]) | (bytes[i + 5] << 8) | (bytes[i + 6] << 16) | (bytes[i + 7] << 24), (bytes[i]) |\n (bytes[i + 1] << 8) | (bytes[i + 2] << 16) | (bytes[i + 3] << 24)];\n k2 = [(bytes[i + 12]) | (bytes[i + 13] << 8) | (bytes[i + 14] << 16) | (bytes[i + 15] << 24), (bytes[i + 8]) |\n (bytes[i + 9] << 8) | (bytes[i + 10] << 16) | (bytes[i + 11] << 24)];\n\n k1 = _x64Multiply(k1, c1);\n k1 = _x64Rotl(k1, 31);\n k1 = _x64Multiply(k1, c2);\n h1 = _x64Xor(h1, k1);\n\n h1 = _x64Rotl(h1, 27);\n h1 = _x64Add(h1, h2);\n h1 = _x64Add(_x64Multiply(h1, [0, 5]), [0, 0x52dce729]);\n\n k2 = _x64Multiply(k2, c2);\n k2 = _x64Rotl(k2, 33);\n k2 = _x64Multiply(k2, c1);\n h2 = _x64Xor(h2, k2);\n\n h2 = _x64Rotl(h2, 31);\n h2 = _x64Add(h2, h1);\n h2 = _x64Add(_x64Multiply(h2, [0, 5]), [0, 0x38495ab5]);\n }\n\n k1 = [0, 0];\n k2 = [0, 0];\n\n switch (remainder) {\n case 15:\n k2 = _x64Xor(k2, _x64LeftShift([0, bytes[i + 14]], 48));\n\n case 14:\n k2 = _x64Xor(k2, _x64LeftShift([0, bytes[i + 13]], 40));\n\n case 13:\n k2 = _x64Xor(k2, _x64LeftShift([0, bytes[i + 12]], 32));\n\n case 12:\n k2 = _x64Xor(k2, _x64LeftShift([0, bytes[i + 11]], 24));\n\n case 11:\n k2 = _x64Xor(k2, _x64LeftShift([0, bytes[i + 10]], 16));\n\n case 10:\n k2 = _x64Xor(k2, _x64LeftShift([0, bytes[i + 9]], 8));\n\n case 9:\n k2 = _x64Xor(k2, [0, bytes[i + 8]]);\n k2 = _x64Multiply(k2, c2);\n k2 = _x64Rotl(k2, 33);\n k2 = _x64Multiply(k2, c1);\n h2 = _x64Xor(h2, k2);\n\n case 8:\n k1 = _x64Xor(k1, _x64LeftShift([0, bytes[i + 7]], 56));\n\n case 7:\n k1 = _x64Xor(k1, _x64LeftShift([0, bytes[i + 6]], 48));\n\n case 6:\n k1 = _x64Xor(k1, _x64LeftShift([0, bytes[i + 5]], 40));\n\n case 5:\n k1 = _x64Xor(k1, _x64LeftShift([0, bytes[i + 4]], 32));\n\n case 4:\n k1 = _x64Xor(k1, _x64LeftShift([0, bytes[i + 3]], 24));\n\n case 3:\n k1 = _x64Xor(k1, _x64LeftShift([0, bytes[i + 2]], 16));\n\n case 2:\n k1 = _x64Xor(k1, _x64LeftShift([0, bytes[i + 1]], 8));\n\n case 1:\n k1 = _x64Xor(k1, [0, bytes[i]]);\n k1 = _x64Multiply(k1, c1);\n k1 = _x64Rotl(k1, 31);\n k1 = _x64Multiply(k1, c2);\n h1 = _x64Xor(h1, k1);\n }\n\n h1 = _x64Xor(h1, [0, bytes.length]);\n h2 = _x64Xor(h2, [0, bytes.length]);\n\n h1 = _x64Add(h1, h2);\n h2 = _x64Add(h2, h1);\n\n h1 = _x64Fmix(h1);\n h2 = _x64Fmix(h2);\n\n h1 = _x64Add(h1, h2);\n h2 = _x64Add(h2, h1);\n\n return (\"00000000\" + (h1[0] >>> 0).toString(16)).slice(-8) + (\"00000000\" + (h1[1] >>> 0).toString(16)).slice(-8) + (\"00000000\" + (h2[0] >>> 0).toString(16)).slice(-8) + (\"00000000\" + (h2[1] >>> 0).toString(16)).slice(-8);\n };\n\n // INITIALIZATION\n // --------------\n\n // Export murmurHash3 for CommonJS, either as an AMD module or just as part\n // of the global object.\n {\n\n if ( module.exports) {\n exports = module.exports = library;\n }\n\n exports.murmurHash3 = library;\n\n }\n })();\n });\n\n var murmurhash3jsRevisited = murmurHash3js;\n\n /* eslint-disable require-await */\n\n\n\n const crypto$1 = self.crypto || self.msCrypto;\n\n const digest = async (data, alg) => {\n if (typeof self === 'undefined' || (!self.crypto && !self.msCrypto)) {\n throw new Error(\n 'Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context'\n )\n }\n switch (alg) {\n case 'sha1':\n return new Uint8Array(await crypto$1.subtle.digest({ name: 'SHA-1' }, data))\n case 'sha2-256':\n return new Uint8Array(await crypto$1.subtle.digest({ name: 'SHA-256' }, data))\n case 'sha2-512':\n return new Uint8Array(await crypto$1.subtle.digest({ name: 'SHA-512' }, data))\n case 'dbl-sha2-256': {\n const d = await crypto$1.subtle.digest({ name: 'SHA-256' }, data);\n return new Uint8Array(await crypto$1.subtle.digest({ name: 'SHA-256' }, d))\n }\n default:\n throw new Error(`${alg} is not a supported algorithm`)\n }\n };\n\n var sha_browser = {\n factory: (alg) => async (data) => {\n return digest(data, alg)\n },\n digest,\n multihashing: async (buf, alg, length) => {\n const h = await digest(buf, alg);\n return src$2.encode(h, alg, length)\n }\n };\n\n const fromNumberTo32BitBuf = (number) => {\n const bytes = new Uint8Array(4);\n\n for (let i = 0; i < 4; i++) {\n bytes[i] = number & 0xff;\n number = number >> 8;\n }\n\n return bytes\n };\n\n var utils$3 = {\n fromNumberTo32BitBuf\n };\n\n var ERROR_MSG_INPUT = 'Input must be an string, Buffer or Uint8Array';\n\n // For convenience, let people hash a string, not just a Uint8Array\n function normalizeInput (input) {\n var ret;\n if (input instanceof Uint8Array) {\n ret = input;\n } else if (input instanceof buffer.Buffer) {\n ret = new Uint8Array(input);\n } else if (typeof (input) === 'string') {\n ret = new Uint8Array(buffer.Buffer.from(input, 'utf8'));\n } else {\n throw new Error(ERROR_MSG_INPUT)\n }\n return ret\n }\n\n // Converts a Uint8Array to a hexadecimal string\n // For example, toHex([255, 0, 255]) returns \"ff00ff\"\n function toHex (bytes) {\n return Array.prototype.map.call(bytes, function (n) {\n return (n < 16 ? '0' : '') + n.toString(16)\n }).join('')\n }\n\n // Converts any value in [0...2^32-1] to an 8-character hex string\n function uint32ToHex (val) {\n return (0x100000000 + val).toString(16).substring(1)\n }\n\n // For debugging: prints out hash state in the same format as the RFC\n // sample computation exactly, so that you can diff\n function debugPrint (label, arr, size) {\n var msg = '\\n' + label + ' = ';\n for (var i = 0; i < arr.length; i += 2) {\n if (size === 32) {\n msg += uint32ToHex(arr[i]).toUpperCase();\n msg += ' ';\n msg += uint32ToHex(arr[i + 1]).toUpperCase();\n } else if (size === 64) {\n msg += uint32ToHex(arr[i + 1]).toUpperCase();\n msg += uint32ToHex(arr[i]).toUpperCase();\n } else throw new Error('Invalid size ' + size)\n if (i % 6 === 4) {\n msg += '\\n' + new Array(label.length + 4).join(' ');\n } else if (i < arr.length - 2) {\n msg += ' ';\n }\n }\n console.log(msg);\n }\n\n // For performance testing: generates N bytes of input, hashes M times\n // Measures and prints MB/second hash performance each time\n function testSpeed (hashFn, N, M) {\n var startMs = new Date().getTime();\n\n var input = new Uint8Array(N);\n for (var i = 0; i < N; i++) {\n input[i] = i % 256;\n }\n var genMs = new Date().getTime();\n console.log('Generated random input in ' + (genMs - startMs) + 'ms');\n startMs = genMs;\n\n for (i = 0; i < M; i++) {\n var hashHex = hashFn(input);\n var hashMs = new Date().getTime();\n var ms = hashMs - startMs;\n startMs = hashMs;\n console.log('Hashed in ' + ms + 'ms: ' + hashHex.substring(0, 20) + '...');\n console.log(Math.round(N / (1 << 20) / (ms / 1000) * 100) / 100 + ' MB PER SECOND');\n }\n }\n\n var util$4 = {\n normalizeInput: normalizeInput,\n toHex: toHex,\n debugPrint: debugPrint,\n testSpeed: testSpeed\n };\n\n // Blake2B in pure Javascript\n // Adapted from the reference implementation in RFC7693\n // Ported to Javascript by DC - https://github.com/dcposch\n\n\n\n // 64-bit unsigned addition\n // Sets v[a,a+1] += v[b,b+1]\n // v should be a Uint32Array\n function ADD64AA (v, a, b) {\n var o0 = v[a] + v[b];\n var o1 = v[a + 1] + v[b + 1];\n if (o0 >= 0x100000000) {\n o1++;\n }\n v[a] = o0;\n v[a + 1] = o1;\n }\n\n // 64-bit unsigned addition\n // Sets v[a,a+1] += b\n // b0 is the low 32 bits of b, b1 represents the high 32 bits\n function ADD64AC (v, a, b0, b1) {\n var o0 = v[a] + b0;\n if (b0 < 0) {\n o0 += 0x100000000;\n }\n var o1 = v[a + 1] + b1;\n if (o0 >= 0x100000000) {\n o1++;\n }\n v[a] = o0;\n v[a + 1] = o1;\n }\n\n // Little-endian byte access\n function B2B_GET32 (arr, i) {\n return (arr[i] ^\n (arr[i + 1] << 8) ^\n (arr[i + 2] << 16) ^\n (arr[i + 3] << 24))\n }\n\n // G Mixing function\n // The ROTRs are inlined for speed\n function B2B_G (a, b, c, d, ix, iy) {\n var x0 = m[ix];\n var x1 = m[ix + 1];\n var y0 = m[iy];\n var y1 = m[iy + 1];\n\n ADD64AA(v, a, b); // v[a,a+1] += v[b,b+1] ... in JS we must store a uint64 as two uint32s\n ADD64AC(v, a, x0, x1); // v[a, a+1] += x ... x0 is the low 32 bits of x, x1 is the high 32 bits\n\n // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated to the right by 32 bits\n var xor0 = v[d] ^ v[a];\n var xor1 = v[d + 1] ^ v[a + 1];\n v[d] = xor1;\n v[d + 1] = xor0;\n\n ADD64AA(v, c, d);\n\n // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 24 bits\n xor0 = v[b] ^ v[c];\n xor1 = v[b + 1] ^ v[c + 1];\n v[b] = (xor0 >>> 24) ^ (xor1 << 8);\n v[b + 1] = (xor1 >>> 24) ^ (xor0 << 8);\n\n ADD64AA(v, a, b);\n ADD64AC(v, a, y0, y1);\n\n // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated right by 16 bits\n xor0 = v[d] ^ v[a];\n xor1 = v[d + 1] ^ v[a + 1];\n v[d] = (xor0 >>> 16) ^ (xor1 << 16);\n v[d + 1] = (xor1 >>> 16) ^ (xor0 << 16);\n\n ADD64AA(v, c, d);\n\n // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 63 bits\n xor0 = v[b] ^ v[c];\n xor1 = v[b + 1] ^ v[c + 1];\n v[b] = (xor1 >>> 31) ^ (xor0 << 1);\n v[b + 1] = (xor0 >>> 31) ^ (xor1 << 1);\n }\n\n // Initialization Vector\n var BLAKE2B_IV32 = new Uint32Array([\n 0xF3BCC908, 0x6A09E667, 0x84CAA73B, 0xBB67AE85,\n 0xFE94F82B, 0x3C6EF372, 0x5F1D36F1, 0xA54FF53A,\n 0xADE682D1, 0x510E527F, 0x2B3E6C1F, 0x9B05688C,\n 0xFB41BD6B, 0x1F83D9AB, 0x137E2179, 0x5BE0CD19\n ]);\n\n var SIGMA8 = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,\n 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,\n 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,\n 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,\n 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,\n 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11,\n 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10,\n 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5,\n 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0,\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3\n ];\n\n // These are offsets into a uint64 buffer.\n // Multiply them all by 2 to make them offsets into a uint32 buffer,\n // because this is Javascript and we don't have uint64s\n var SIGMA82 = new Uint8Array(SIGMA8.map(function (x) { return x * 2 }));\n\n // Compression function. 'last' flag indicates last block.\n // Note we're representing 16 uint64s as 32 uint32s\n var v = new Uint32Array(32);\n var m = new Uint32Array(32);\n function blake2bCompress (ctx, last) {\n var i = 0;\n\n // init work variables\n for (i = 0; i < 16; i++) {\n v[i] = ctx.h[i];\n v[i + 16] = BLAKE2B_IV32[i];\n }\n\n // low 64 bits of offset\n v[24] = v[24] ^ ctx.t;\n v[25] = v[25] ^ (ctx.t / 0x100000000);\n // high 64 bits not supported, offset may not be higher than 2**53-1\n\n // last block flag set ?\n if (last) {\n v[28] = ~v[28];\n v[29] = ~v[29];\n }\n\n // get little-endian words\n for (i = 0; i < 32; i++) {\n m[i] = B2B_GET32(ctx.b, 4 * i);\n }\n\n // twelve rounds of mixing\n // uncomment the DebugPrint calls to log the computation\n // and match the RFC sample documentation\n // util.debugPrint(' m[16]', m, 64)\n for (i = 0; i < 12; i++) {\n // util.debugPrint(' (i=' + (i < 10 ? ' ' : '') + i + ') v[16]', v, 64)\n B2B_G(0, 8, 16, 24, SIGMA82[i * 16 + 0], SIGMA82[i * 16 + 1]);\n B2B_G(2, 10, 18, 26, SIGMA82[i * 16 + 2], SIGMA82[i * 16 + 3]);\n B2B_G(4, 12, 20, 28, SIGMA82[i * 16 + 4], SIGMA82[i * 16 + 5]);\n B2B_G(6, 14, 22, 30, SIGMA82[i * 16 + 6], SIGMA82[i * 16 + 7]);\n B2B_G(0, 10, 20, 30, SIGMA82[i * 16 + 8], SIGMA82[i * 16 + 9]);\n B2B_G(2, 12, 22, 24, SIGMA82[i * 16 + 10], SIGMA82[i * 16 + 11]);\n B2B_G(4, 14, 16, 26, SIGMA82[i * 16 + 12], SIGMA82[i * 16 + 13]);\n B2B_G(6, 8, 18, 28, SIGMA82[i * 16 + 14], SIGMA82[i * 16 + 15]);\n }\n // util.debugPrint(' (i=12) v[16]', v, 64)\n\n for (i = 0; i < 16; i++) {\n ctx.h[i] = ctx.h[i] ^ v[i] ^ v[i + 16];\n }\n // util.debugPrint('h[8]', ctx.h, 64)\n }\n\n // Creates a BLAKE2b hashing context\n // Requires an output length between 1 and 64 bytes\n // Takes an optional Uint8Array key\n function blake2bInit (outlen, key) {\n if (outlen === 0 || outlen > 64) {\n throw new Error('Illegal output length, expected 0 < length <= 64')\n }\n if (key && key.length > 64) {\n throw new Error('Illegal key, expected Uint8Array with 0 < length <= 64')\n }\n\n // state, 'param block'\n var ctx = {\n b: new Uint8Array(128),\n h: new Uint32Array(16),\n t: 0, // input count\n c: 0, // pointer within buffer\n outlen: outlen // output length in bytes\n };\n\n // initialize hash state\n for (var i = 0; i < 16; i++) {\n ctx.h[i] = BLAKE2B_IV32[i];\n }\n var keylen = key ? key.length : 0;\n ctx.h[0] ^= 0x01010000 ^ (keylen << 8) ^ outlen;\n\n // key the hash, if applicable\n if (key) {\n blake2bUpdate(ctx, key);\n // at the end\n ctx.c = 128;\n }\n\n return ctx\n }\n\n // Updates a BLAKE2b streaming hash\n // Requires hash context and Uint8Array (byte array)\n function blake2bUpdate (ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 128) { // buffer full ?\n ctx.t += ctx.c; // add counters\n blake2bCompress(ctx, false); // compress (not last)\n ctx.c = 0; // counter to zero\n }\n ctx.b[ctx.c++] = input[i];\n }\n }\n\n // Completes a BLAKE2b streaming hash\n // Returns a Uint8Array containing the message digest\n function blake2bFinal (ctx) {\n ctx.t += ctx.c; // mark last block offset\n\n while (ctx.c < 128) { // fill up with zeros\n ctx.b[ctx.c++] = 0;\n }\n blake2bCompress(ctx, true); // final block flag = 1\n\n // little endian convert and store\n var out = new Uint8Array(ctx.outlen);\n for (var i = 0; i < ctx.outlen; i++) {\n out[i] = ctx.h[i >> 2] >> (8 * (i & 3));\n }\n return out\n }\n\n // Computes the BLAKE2B hash of a string or byte array, and returns a Uint8Array\n //\n // Returns a n-byte Uint8Array\n //\n // Parameters:\n // - input - the input bytes, as a string, Buffer or Uint8Array\n // - key - optional key Uint8Array, up to 64 bytes\n // - outlen - optional output length in bytes, default 64\n function blake2b (input, key, outlen) {\n // preprocess inputs\n outlen = outlen || 64;\n input = util$4.normalizeInput(input);\n\n // do the math\n var ctx = blake2bInit(outlen, key);\n blake2bUpdate(ctx, input);\n return blake2bFinal(ctx)\n }\n\n // Computes the BLAKE2B hash of a string or byte array\n //\n // Returns an n-byte hash in hex, all lowercase\n //\n // Parameters:\n // - input - the input bytes, as a string, Buffer, or Uint8Array\n // - key - optional key Uint8Array, up to 64 bytes\n // - outlen - optional output length in bytes, default 64\n function blake2bHex (input, key, outlen) {\n var output = blake2b(input, key, outlen);\n return util$4.toHex(output)\n }\n\n var blake2b_1 = {\n blake2b: blake2b,\n blake2bHex: blake2bHex,\n blake2bInit: blake2bInit,\n blake2bUpdate: blake2bUpdate,\n blake2bFinal: blake2bFinal\n };\n\n // BLAKE2s hash function in pure Javascript\n // Adapted from the reference implementation in RFC7693\n // Ported to Javascript by DC - https://github.com/dcposch\n\n\n\n // Little-endian byte access.\n // Expects a Uint8Array and an index\n // Returns the little-endian uint32 at v[i..i+3]\n function B2S_GET32 (v, i) {\n return v[i] ^ (v[i + 1] << 8) ^ (v[i + 2] << 16) ^ (v[i + 3] << 24)\n }\n\n // Mixing function G.\n function B2S_G (a, b, c, d, x, y) {\n v$1[a] = v$1[a] + v$1[b] + x;\n v$1[d] = ROTR32(v$1[d] ^ v$1[a], 16);\n v$1[c] = v$1[c] + v$1[d];\n v$1[b] = ROTR32(v$1[b] ^ v$1[c], 12);\n v$1[a] = v$1[a] + v$1[b] + y;\n v$1[d] = ROTR32(v$1[d] ^ v$1[a], 8);\n v$1[c] = v$1[c] + v$1[d];\n v$1[b] = ROTR32(v$1[b] ^ v$1[c], 7);\n }\n\n // 32-bit right rotation\n // x should be a uint32\n // y must be between 1 and 31, inclusive\n function ROTR32 (x, y) {\n return (x >>> y) ^ (x << (32 - y))\n }\n\n // Initialization Vector.\n var BLAKE2S_IV = new Uint32Array([\n 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,\n 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19]);\n\n var SIGMA = new Uint8Array([\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,\n 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,\n 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,\n 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,\n 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,\n 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11,\n 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10,\n 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5,\n 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0]);\n\n // Compression function. \"last\" flag indicates last block\n var v$1 = new Uint32Array(16);\n var m$1 = new Uint32Array(16);\n function blake2sCompress (ctx, last) {\n var i = 0;\n for (i = 0; i < 8; i++) { // init work variables\n v$1[i] = ctx.h[i];\n v$1[i + 8] = BLAKE2S_IV[i];\n }\n\n v$1[12] ^= ctx.t; // low 32 bits of offset\n v$1[13] ^= (ctx.t / 0x100000000); // high 32 bits\n if (last) { // last block flag set ?\n v$1[14] = ~v$1[14];\n }\n\n for (i = 0; i < 16; i++) { // get little-endian words\n m$1[i] = B2S_GET32(ctx.b, 4 * i);\n }\n\n // ten rounds of mixing\n // uncomment the DebugPrint calls to log the computation\n // and match the RFC sample documentation\n // util.debugPrint(' m[16]', m, 32)\n for (i = 0; i < 10; i++) {\n // util.debugPrint(' (i=' + i + ') v[16]', v, 32)\n B2S_G(0, 4, 8, 12, m$1[SIGMA[i * 16 + 0]], m$1[SIGMA[i * 16 + 1]]);\n B2S_G(1, 5, 9, 13, m$1[SIGMA[i * 16 + 2]], m$1[SIGMA[i * 16 + 3]]);\n B2S_G(2, 6, 10, 14, m$1[SIGMA[i * 16 + 4]], m$1[SIGMA[i * 16 + 5]]);\n B2S_G(3, 7, 11, 15, m$1[SIGMA[i * 16 + 6]], m$1[SIGMA[i * 16 + 7]]);\n B2S_G(0, 5, 10, 15, m$1[SIGMA[i * 16 + 8]], m$1[SIGMA[i * 16 + 9]]);\n B2S_G(1, 6, 11, 12, m$1[SIGMA[i * 16 + 10]], m$1[SIGMA[i * 16 + 11]]);\n B2S_G(2, 7, 8, 13, m$1[SIGMA[i * 16 + 12]], m$1[SIGMA[i * 16 + 13]]);\n B2S_G(3, 4, 9, 14, m$1[SIGMA[i * 16 + 14]], m$1[SIGMA[i * 16 + 15]]);\n }\n // util.debugPrint(' (i=10) v[16]', v, 32)\n\n for (i = 0; i < 8; i++) {\n ctx.h[i] ^= v$1[i] ^ v$1[i + 8];\n }\n // util.debugPrint('h[8]', ctx.h, 32)\n }\n\n // Creates a BLAKE2s hashing context\n // Requires an output length between 1 and 32 bytes\n // Takes an optional Uint8Array key\n function blake2sInit (outlen, key) {\n if (!(outlen > 0 && outlen <= 32)) {\n throw new Error('Incorrect output length, should be in [1, 32]')\n }\n var keylen = key ? key.length : 0;\n if (key && !(keylen > 0 && keylen <= 32)) {\n throw new Error('Incorrect key length, should be in [1, 32]')\n }\n\n var ctx = {\n h: new Uint32Array(BLAKE2S_IV), // hash state\n b: new Uint32Array(64), // input block\n c: 0, // pointer within block\n t: 0, // input count\n outlen: outlen // output length in bytes\n };\n ctx.h[0] ^= 0x01010000 ^ (keylen << 8) ^ outlen;\n\n if (keylen > 0) {\n blake2sUpdate(ctx, key);\n ctx.c = 64; // at the end\n }\n\n return ctx\n }\n\n // Updates a BLAKE2s streaming hash\n // Requires hash context and Uint8Array (byte array)\n function blake2sUpdate (ctx, input) {\n for (var i = 0; i < input.length; i++) {\n if (ctx.c === 64) { // buffer full ?\n ctx.t += ctx.c; // add counters\n blake2sCompress(ctx, false); // compress (not last)\n ctx.c = 0; // counter to zero\n }\n ctx.b[ctx.c++] = input[i];\n }\n }\n\n // Completes a BLAKE2s streaming hash\n // Returns a Uint8Array containing the message digest\n function blake2sFinal (ctx) {\n ctx.t += ctx.c; // mark last block offset\n while (ctx.c < 64) { // fill up with zeros\n ctx.b[ctx.c++] = 0;\n }\n blake2sCompress(ctx, true); // final block flag = 1\n\n // little endian convert and store\n var out = new Uint8Array(ctx.outlen);\n for (var i = 0; i < ctx.outlen; i++) {\n out[i] = (ctx.h[i >> 2] >> (8 * (i & 3))) & 0xFF;\n }\n return out\n }\n\n // Computes the BLAKE2S hash of a string or byte array, and returns a Uint8Array\n //\n // Returns a n-byte Uint8Array\n //\n // Parameters:\n // - input - the input bytes, as a string, Buffer, or Uint8Array\n // - key - optional key Uint8Array, up to 32 bytes\n // - outlen - optional output length in bytes, default 64\n function blake2s (input, key, outlen) {\n // preprocess inputs\n outlen = outlen || 32;\n input = util$4.normalizeInput(input);\n\n // do the math\n var ctx = blake2sInit(outlen, key);\n blake2sUpdate(ctx, input);\n return blake2sFinal(ctx)\n }\n\n // Computes the BLAKE2S hash of a string or byte array\n //\n // Returns an n-byte hash in hex, all lowercase\n //\n // Parameters:\n // - input - the input bytes, as a string, Buffer, or Uint8Array\n // - key - optional key Uint8Array, up to 32 bytes\n // - outlen - optional output length in bytes, default 64\n function blake2sHex (input, key, outlen) {\n var output = blake2s(input, key, outlen);\n return util$4.toHex(output)\n }\n\n var blake2s_1 = {\n blake2s: blake2s,\n blake2sHex: blake2sHex,\n blake2sInit: blake2sInit,\n blake2sUpdate: blake2sUpdate,\n blake2sFinal: blake2sFinal\n };\n\n var blakejs = {\n blake2b: blake2b_1.blake2b,\n blake2bHex: blake2b_1.blake2bHex,\n blake2bInit: blake2b_1.blake2bInit,\n blake2bUpdate: blake2b_1.blake2bUpdate,\n blake2bFinal: blake2b_1.blake2bFinal,\n blake2s: blake2s_1.blake2s,\n blake2sHex: blake2s_1.blake2sHex,\n blake2sInit: blake2s_1.blake2sInit,\n blake2sUpdate: blake2s_1.blake2sUpdate,\n blake2sFinal: blake2s_1.blake2sFinal\n };\n\n const minB = 0xb201;\n const minS = 0xb241;\n\n const blake2b$1 = {\n init: blakejs.blake2bInit,\n update: blakejs.blake2bUpdate,\n digest: blakejs.blake2bFinal\n };\n\n const blake2s$1 = {\n init: blakejs.blake2sInit,\n update: blakejs.blake2sUpdate,\n digest: blakejs.blake2sFinal\n };\n\n // Note that although this function doesn't do any asynchronous work, we mark\n // the function as async because it must return a Promise to match the API\n // for other functions that do perform asynchronous work (see sha.browser.js)\n // eslint-disable-next-line\n const makeB2Hash = (size, hf) => async (data) => {\n const ctx = hf.init(size, null);\n hf.update(ctx, data);\n return hf.digest(ctx)\n };\n\n var blake_1 = (table) => {\n for (let i = 0; i < 64; i++) {\n table[minB + i] = makeB2Hash(i + 1, blake2b$1);\n }\n for (let i = 0; i < 32; i++) {\n table[minS + i] = makeB2Hash(i + 1, blake2s$1);\n }\n };\n\n const { factory: sha } = sha_browser;\n const { fromNumberTo32BitBuf: fromNumberTo32BitBuf$1 } = utils$3;\n\n\n // Note that although this function doesn't do any asynchronous work, we mark\n // the function as async because it must return a Promise to match the API\n // for other functions that do perform asynchronous work (see sha.browser.js)\n // eslint-disable-next-line\n const hash$1 = (algorithm) => async (data) => {\n switch (algorithm) {\n case 'sha3-224':\n return new Uint8Array(sha3.sha3_224.arrayBuffer(data))\n case 'sha3-256':\n return new Uint8Array(sha3.sha3_256.arrayBuffer(data))\n case 'sha3-384':\n return new Uint8Array(sha3.sha3_384.arrayBuffer(data))\n case 'sha3-512':\n return new Uint8Array(sha3.sha3_512.arrayBuffer(data))\n case 'shake-128':\n return new Uint8Array(sha3.shake128.create(128).update(data).arrayBuffer())\n case 'shake-256':\n return new Uint8Array(sha3.shake256.create(256).update(data).arrayBuffer())\n case 'keccak-224':\n return new Uint8Array(sha3.keccak224.arrayBuffer(data))\n case 'keccak-256':\n return new Uint8Array(sha3.keccak256.arrayBuffer(data))\n case 'keccak-384':\n return new Uint8Array(sha3.keccak384.arrayBuffer(data))\n case 'keccak-512':\n return new Uint8Array(sha3.keccak512.arrayBuffer(data))\n case 'murmur3-128':\n return fromString_1$1(murmurhash3jsRevisited.x64.hash128(data), 'base16')\n case 'murmur3-32':\n return fromNumberTo32BitBuf$1(murmurhash3jsRevisited.x86.hash32(data))\n\n default:\n throw new TypeError(`${algorithm} is not a supported algorithm`)\n }\n };\n\n const identity$2 = data => data;\n\n var crypto$2 = {\n identity: identity$2,\n sha1: sha('sha1'),\n sha2256: sha('sha2-256'),\n sha2512: sha('sha2-512'),\n dblSha2256: sha('dbl-sha2-256'),\n sha3224: hash$1('sha3-224'),\n sha3256: hash$1('sha3-256'),\n sha3384: hash$1('sha3-384'),\n sha3512: hash$1('sha3-512'),\n shake128: hash$1('shake-128'),\n shake256: hash$1('shake-256'),\n keccak224: hash$1('keccak-224'),\n keccak256: hash$1('keccak-256'),\n keccak384: hash$1('keccak-384'),\n keccak512: hash$1('keccak-512'),\n murmur3128: hash$1('murmur3-128'),\n murmur332: hash$1('murmur3-32'),\n addBlake: blake_1\n };\n\n /**\n * Returns true if the two passed Uint8Arrays have the same content\n *\n * @param {Uint8Array} a\n * @param {Uint8Array} b\n * @returns {boolean}\n */\n function equals$1 (a, b) {\n if (a === b) {\n return true\n }\n\n if (a.byteLength !== b.byteLength) {\n return false\n }\n\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false\n }\n }\n\n return true\n }\n\n var equals_1$1 = equals$1;\n\n /**\n * Hash the given `buf` using the algorithm specified by `alg`.\n * @param {Uint8Array} buf - The value to hash.\n * @param {number|string} alg - The algorithm to use eg 'sha1'\n * @param {number} [length] - Optionally trim the result to this length.\n * @returns {Promise<Uint8Array>}\n */\n async function Multihashing (buf, alg, length) {\n const digest = await Multihashing.digest(buf, alg, length);\n return src$2.encode(digest, alg, length)\n }\n\n /**\n * Expose multihash itself, to avoid silly double requires.\n */\n Multihashing.multihash = src$2;\n\n /**\n * @param {Uint8Array} buf - The value to hash.\n * @param {number|string} alg - The algorithm to use eg 'sha1'\n * @param {number} [length] - Optionally trim the result to this length.\n * @returns {Promise<Uint8Array>}\n */\n Multihashing.digest = async (buf, alg, length) => {\n const hash = Multihashing.createHash(alg);\n const digest = await hash(buf);\n return length ? digest.slice(0, length) : digest\n };\n\n /**\n * Creates a function that hashes with the given algorithm\n *\n * @param {string|number} alg - The algorithm to use eg 'sha1'\n *\n * @returns {function} - The hash function corresponding to `alg`\n */\n Multihashing.createHash = function (alg) {\n if (!alg) {\n throw errCode(new Error('hash algorithm must be specified'), 'ERR_HASH_ALGORITHM_NOT_SPECIFIED')\n }\n\n alg = src$2.coerceCode(alg);\n if (!Multihashing.functions[alg]) {\n throw errCode(new Error(`multihash function '${alg}' not yet supported`), 'ERR_HASH_ALGORITHM_NOT_SUPPORTED')\n }\n\n return Multihashing.functions[alg]\n };\n\n /**\n * Mapping of multihash codes to their hashing functions.\n * @type {Object}\n */\n Multihashing.functions = {\n // identity\n 0x00: crypto$2.identity,\n // sha1\n 0x11: crypto$2.sha1,\n // sha2-256\n 0x12: crypto$2.sha2256,\n // sha2-512\n 0x13: crypto$2.sha2512,\n // sha3-512\n 0x14: crypto$2.sha3512,\n // sha3-384\n 0x15: crypto$2.sha3384,\n // sha3-256\n 0x16: crypto$2.sha3256,\n // sha3-224\n 0x17: crypto$2.sha3224,\n // shake-128\n 0x18: crypto$2.shake128,\n // shake-256\n 0x19: crypto$2.shake256,\n // keccak-224\n 0x1A: crypto$2.keccak224,\n // keccak-256\n 0x1B: crypto$2.keccak256,\n // keccak-384\n 0x1C: crypto$2.keccak384,\n // keccak-512\n 0x1D: crypto$2.keccak512,\n // murmur3-128\n 0x22: crypto$2.murmur3128,\n // murmur3-32\n 0x23: crypto$2.murmur332,\n // dbl-sha2-256\n 0x56: crypto$2.dblSha2256\n };\n\n // add blake functions\n crypto$2.addBlake(Multihashing.functions);\n\n Multihashing.validate = async (buf, hash) => {\n const newHash = await Multihashing(buf, src$2.decode(hash).name);\n\n return equals_1$1(hash, newHash)\n };\n\n var src$8 = Multihashing;\n\n var genCid = createCommonjsModule(function (module, exports) {\n\n\n\n\n\n exports = module.exports;\n\n exports.codec = src$3.DAG_PB;\n exports.defaultHashAlg = src$3.SHA2_256;\n\n /**\n * Calculate the CID of the binary blob.\n *\n * @param {Object} binaryBlob - Encoded IPLD Node\n * @param {Object} [userOptions] - Options to create the CID\n * @param {number} [userOptions.cidVersion=1] - CID version number\n * @param {string} [UserOptions.hashAlg] - Defaults to the defaultHashAlg of the format\n * @returns {Promise.<CID>}\n */\n const cid = async (binaryBlob, userOptions) => {\n const defaultOptions = { cidVersion: 1, hashAlg: exports.defaultHashAlg };\n const options = Object.assign(defaultOptions, userOptions);\n\n const multihash = await src$8(binaryBlob, options.hashAlg);\n const codecName = src$3.print[exports.codec];\n const cid = new src$4(options.cidVersion, codecName, multihash);\n\n return cid\n };\n\n exports.cid = cid;\n });\n\n /*\n * toDAGLink converts a DAGNode to a DAGLink\n */\n const toDAGLink = async (node, options = {}) => {\n const nodeCid = await genCid.cid(node.serialize(), options);\n return new dagLink(options.name || '', node.size, nodeCid)\n };\n\n var toDagLink = toDAGLink;\n\n var util$5 = createCommonjsModule(function (module, exports) {\n\n\n\n function createDagLinkFromB58EncodedHash (link) {\n return new dagLink(\n link.Name || link.name || '',\n link.Tsize || link.Size || link.size || 0,\n link.Hash || link.hash || link.multihash || link.cid\n )\n }\n\n exports = module.exports;\n exports.createDagLinkFromB58EncodedHash = createDagLinkFromB58EncodedHash;\n });\n\n var dagLink$1 = createCommonjsModule(function (module, exports) {\n\n exports = module.exports = dagLink;\n exports.util = util$5;\n });\n\n const asDAGLink = (link) => {\n if (dagLink$1.isDAGLink(link)) {\n // It's a DAGLink instance\n // no need to do anything\n return link\n }\n\n // DAGNode.isDagNode() would be more appropriate here, but it can't be used\n // as it would lead to circular dependencies as `addLink` is called from\n // within the DAGNode object.\n if (!('cid' in link ||\n 'hash' in link ||\n 'Hash' in link ||\n 'multihash' in link)) {\n throw new Error('Link must be a DAGLink or DAGLink-like. Convert the DAGNode into a DAGLink via `node.toDAGLink()`.')\n }\n\n // It's a Object with name, multihash/hash/cid and size\n return new dagLink$1(link.Name || link.name, link.Tsize || link.size, link.Hash || link.multihash || link.hash || link.cid)\n };\n\n const addLink = (node, link) => {\n const dagLink = asDAGLink(link);\n node.Links.push(dagLink);\n sortLinks_1(node.Links);\n };\n\n var addLink_1 = addLink;\n\n const rmLink = (dagNode, nameOrCid) => {\n let predicate = null;\n\n // It's a name\n if (typeof nameOrCid === 'string') {\n predicate = (link) => link.Name === nameOrCid;\n } else if (nameOrCid instanceof Uint8Array || src$4.isCID(nameOrCid)) {\n predicate = (link) => equals_1$1(link.Hash, nameOrCid);\n }\n\n if (predicate) {\n const links = dagNode.Links;\n let index = 0;\n while (index < links.length) {\n const link = links[index];\n if (predicate(link)) {\n links.splice(index, 1);\n } else {\n index++;\n }\n }\n } else {\n throw new Error('second arg needs to be a name or CID')\n }\n };\n\n var rmLink_1 = rmLink;\n\n var dagNode = createCommonjsModule(function (module, exports) {\n\n\n\n\n const { serializeDAGNode } = serialize;\n\n\n\n\n\n\n class DAGNode {\n constructor (data, links = [], serializedSize = null) {\n if (!data) {\n data = new Uint8Array(0);\n }\n if (typeof data === 'string') {\n data = fromString_1$1(data);\n }\n\n if (!(data instanceof Uint8Array)) {\n throw new Error('Passed \\'data\\' is not a Uint8Array or a String!')\n }\n\n if (serializedSize !== null && typeof serializedSize !== 'number') {\n throw new Error('Passed \\'serializedSize\\' must be a number!')\n }\n\n links = links.map((link) => {\n return dagLink.isDAGLink(link)\n ? link\n : dagLink.util.createDagLinkFromB58EncodedHash(link)\n });\n sortLinks_1(links);\n\n Object.defineProperties(this, {\n Data: { value: data, writable: false, enumerable: true },\n Links: { value: links, writable: false, enumerable: true },\n _serializedSize: { value: serializedSize, writable: true, enumerable: false },\n _size: { value: null, writable: true, enumerable: false }\n });\n }\n\n toJSON () {\n if (!this._json) {\n this._json = Object.freeze({\n data: this.Data,\n links: this.Links.map((l) => l.toJSON()),\n size: this.size\n });\n }\n\n return Object.assign({}, this._json)\n }\n\n toString () {\n return `DAGNode <data: \"${toString_1$1(this.Data, 'base64urlpad')}\", links: ${this.Links.length}, size: ${this.size}>`\n }\n\n _invalidateCached () {\n this._serializedSize = null;\n this._size = null;\n }\n\n addLink (link) {\n this._invalidateCached();\n return addLink_1(this, link)\n }\n\n rmLink (link) {\n this._invalidateCached();\n return rmLink_1(this, link)\n }\n\n // @returns {Promise.<DAGLink>}\n toDAGLink (options) {\n return toDagLink(this, options)\n }\n\n serialize () {\n return serializeDAGNode(this)\n }\n\n get size () {\n if (this._size === null) {\n if (this._serializedSize === null) {\n this._serializedSize = this.serialize().length;\n }\n this._size = this.Links.reduce((sum, l) => sum + l.Tsize, this._serializedSize);\n }\n\n return this._size\n }\n\n set size (size) {\n throw new Error(\"Can't set property: 'size' is immutable\")\n }\n }\n\n module.exports = classIs(DAGNode, { className: 'DAGNode', symbolName: '@ipld/js-ipld-dag-pb/dagnode' });\n });\n\n var dagNode$1 = createCommonjsModule(function (module, exports) {\n\n module.exports = dagNode;\n });\n\n var util$6 = createCommonjsModule(function (module, exports) {\n\n\n const proto = src$7(dag_proto);\n\n\n const { serializeDAGNodeLike } = serialize;\n\n\n exports = module.exports;\n\n exports.codec = genCid.codec;\n exports.defaultHashAlg = genCid.defaultHashAlg;\n\n /**\n * Calculate the CID of the binary blob.\n *\n * @param {Object} binaryBlob - Encoded IPLD Node\n * @param {Object} [userOptions] - Options to create the CID\n * @param {number} [userOptions.cidVersion=1] - CID version number\n * @param {string} [UserOptions.hashAlg] - Defaults to the defaultHashAlg of the format\n * @returns {Promise.<CID>}\n */\n const cid = (binaryBlob, userOptions) => {\n return genCid.cid(binaryBlob, userOptions)\n };\n\n /**\n * Serialize internal representation into a binary PB block.\n *\n * @param {Object} node - Internal representation of a CBOR block\n * @returns {Uint8Array} - The encoded binary representation\n */\n const serialize$1 = (node) => {\n if (dagNode.isDAGNode(node)) {\n return node.serialize()\n } else {\n return serializeDAGNodeLike(node.Data, node.Links)\n }\n };\n\n /**\n * Deserialize PB block into the internal representation.\n *\n * @param {Uint8Array} buffer - Binary representation of a PB block\n * @returns {Object} - An object that conforms to the IPLD Data Model\n */\n const deserialize = (buffer) => {\n const pbn = proto.PBNode.decode(buffer);\n\n const links = pbn.Links.map((link) => {\n return new dagLink(link.Name, link.Tsize, link.Hash)\n });\n\n const data = pbn.Data == null ? new Uint8Array(0) : pbn.Data;\n\n return new dagNode(data, links, buffer.byteLength)\n };\n\n exports.serialize = serialize$1;\n exports.deserialize = deserialize;\n exports.cid = cid;\n });\n\n /**\n * Resolves a path within a PB block.\n *\n * Returns the value or a link and the partial mising path. This way the\n * IPLD Resolver can fetch the link and continue to resolve.\n *\n * @param {Uint8Array} binaryBlob - Binary representation of a PB block\n * @param {string} [path='/'] - Path that should be resolved\n * @returns {Object} result - Result of the path it it was resolved successfully\n * @returns {*} result.value - Value the path resolves to\n * @returns {string} result.remainderPath - If the path resolves half-way to a\n * link, then the `remainderPath` is the part after the link that can be used\n * for further resolving\n */\n var resolve = (binaryBlob, path) => {\n let node = util$6.deserialize(binaryBlob);\n\n const parts = path.split('/').filter(Boolean);\n while (parts.length) {\n const key = parts.shift();\n if (node[key] === undefined) {\n // There might be a matching named link\n for (const link of node.Links) {\n if (link.Name === key) {\n return {\n value: link.Hash,\n remainderPath: parts.join('/')\n }\n }\n }\n\n // There wasn't even a matching named link\n throw new Error(`Object has no property '${key}'`)\n }\n\n node = node[key];\n if (src$4.isCID(node)) {\n return {\n value: node,\n remainderPath: parts.join('/')\n }\n }\n }\n\n return {\n value: node,\n remainderPath: ''\n }\n };\n\n /**\n * Return all available paths of a block.\n *\n * @generator\n * @param {Uint8Array} binaryBlob - Binary representation of a PB block\n * @yields {string} - A single path\n */\n var tree = function * (binaryBlob) {\n const node = util$6.deserialize(binaryBlob);\n\n // There is always a `Data` and `Links` property\n yield 'Data';\n yield 'Links';\n for (let ii = 0; ii < node.Links.length; ii++) {\n yield `Links/${ii}`;\n yield `Links/${ii}/Name`;\n yield `Links/${ii}/Tsize`;\n yield `Links/${ii}/Hash`;\n }\n };\n\n var resolver = {\n \tresolve: resolve,\n \ttree: tree\n };\n\n var src$9 = createCommonjsModule(function (module, exports) {\n\n exports.DAGNode = dagNode$1;\n exports.DAGLink = dagLink$1;\n\n /*\n * Functions to fulfil IPLD Format interface\n * https://github.com/ipld/interface-ipld-format\n */\n exports.resolver = resolver;\n exports.util = util$6;\n exports.codec = exports.util.codec;\n exports.defaultHashAlg = exports.util.defaultHashAlg;\n });\n\n var rawToDAGLink = function (raw) {\n return new src$9.DAGLink(raw.Name, raw.Tsize, raw.Hash);\n };\n var rawToDAGNode = function (raw) {\n var _a, _b, _c;\n var data = (_a = raw === null || raw === void 0 ? void 0 : raw.value) === null || _a === void 0 ? void 0 : _a.Data;\n var links = (_c = (_b = raw === null || raw === void 0 ? void 0 : raw.value) === null || _b === void 0 ? void 0 : _b.Links) === null || _c === void 0 ? void 0 : _c.map(rawToDAGLink);\n return new src$9.DAGNode(data, links);\n };\n var util$7 = {\n rawToDAGLink: rawToDAGLink,\n rawToDAGNode: rawToDAGNode\n };\n\n // These bytes in the \"data\" field of an IPFS node indicate that the node is an IPLD DAG Node\n var DAG_NODE_DATA = buffer.Buffer.from([8, 1]);\n\n var add = function (content) { return __awaiter(void 0, void 0, void 0, function () {\n var ipfs, result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, get$2()];\n case 1:\n ipfs = _a.sent();\n return [4 /*yield*/, ipfs.add(content, { cidVersion: 1, pin: true })];\n case 2:\n result = _a.sent();\n return [2 /*return*/, {\n cid: result.cid.toString(),\n size: result.size,\n isFile: true\n }];\n }\n });\n }); };\n var catRaw = function (cid) { return __awaiter(void 0, void 0, void 0, function () {\n var ipfs, chunks, _a, _b, chunk, e_1_1;\n var e_1, _c;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0: return [4 /*yield*/, get$2()];\n case 1:\n ipfs = _d.sent();\n chunks = [];\n return [4 /*yield*/, attemptPin(cid)];\n case 2:\n _d.sent();\n _d.label = 3;\n case 3:\n _d.trys.push([3, 8, 9, 14]);\n _a = __asyncValues(ipfs.cat(cid));\n _d.label = 4;\n case 4: return [4 /*yield*/, _a.next()];\n case 5:\n if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 7];\n chunk = _b.value;\n chunks.push(chunk);\n _d.label = 6;\n case 6: return [3 /*break*/, 4];\n case 7: return [3 /*break*/, 14];\n case 8:\n e_1_1 = _d.sent();\n e_1 = { error: e_1_1 };\n return [3 /*break*/, 14];\n case 9:\n _d.trys.push([9, , 12, 13]);\n if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 11];\n return [4 /*yield*/, _c.call(_a)];\n case 10:\n _d.sent();\n _d.label = 11;\n case 11: return [3 /*break*/, 13];\n case 12:\n if (e_1) throw e_1.error;\n return [7 /*endfinally*/];\n case 13: return [7 /*endfinally*/];\n case 14: return [2 /*return*/, chunks];\n }\n });\n }); };\n var catBuf = function (cid) { return __awaiter(void 0, void 0, void 0, function () {\n var raw;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, catRaw(cid)];\n case 1:\n raw = _a.sent();\n return [2 /*return*/, buffer.Buffer.concat(raw)];\n }\n });\n }); };\n var cat = function (cid) { return __awaiter(void 0, void 0, void 0, function () {\n var buf;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, catBuf(cid)];\n case 1:\n buf = _a.sent();\n return [2 /*return*/, buf.toString()];\n }\n });\n }); };\n var ls = function (cid) { return __awaiter(void 0, void 0, void 0, function () {\n var ipfs, links, _a, _b, link, e_2_1;\n var e_2, _c;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0: return [4 /*yield*/, get$2()];\n case 1:\n ipfs = _d.sent();\n links = [];\n _d.label = 2;\n case 2:\n _d.trys.push([2, 7, 8, 13]);\n _a = __asyncValues(ipfs.ls(cid));\n _d.label = 3;\n case 3: return [4 /*yield*/, _a.next()];\n case 4:\n if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 6];\n link = _b.value;\n links.push(link);\n _d.label = 5;\n case 5: return [3 /*break*/, 3];\n case 6: return [3 /*break*/, 13];\n case 7:\n e_2_1 = _d.sent();\n e_2 = { error: e_2_1 };\n return [3 /*break*/, 13];\n case 8:\n _d.trys.push([8, , 11, 12]);\n if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 10];\n return [4 /*yield*/, _c.call(_a)];\n case 9:\n _d.sent();\n _d.label = 10;\n case 10: return [3 /*break*/, 12];\n case 11:\n if (e_2) throw e_2.error;\n return [7 /*endfinally*/];\n case 12: return [7 /*endfinally*/];\n case 13: return [2 /*return*/, links];\n }\n });\n }); };\n var dagGet = function (cid) { return __awaiter(void 0, void 0, void 0, function () {\n var ipfs, raw, node;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, get$2()];\n case 1:\n ipfs = _a.sent();\n return [4 /*yield*/, attemptPin(cid)];\n case 2:\n _a.sent();\n return [4 /*yield*/, ipfs.dag.get(new src$4(cid))];\n case 3:\n raw = _a.sent();\n node = util$7.rawToDAGNode(raw);\n return [2 /*return*/, node];\n }\n });\n }); };\n var dagPut = function (node) { return __awaiter(void 0, void 0, void 0, function () {\n var ipfs, cidObj, cid, nodeSize;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, get$2()\n // using this format because Gateway doesn't like `dag-cbor` nodes.\n // I think this is because UnixFS requires `dag-pb` & the gateway requires UnixFS for directory traversal\n ];\n case 1:\n ipfs = _a.sent();\n return [4 /*yield*/, ipfs.dag.put(node, { format: 'dag-pb', hashAlg: 'sha2-256' })];\n case 2:\n cidObj = _a.sent();\n cid = cidObj.toV1().toString();\n return [4 /*yield*/, attemptPin(cid)];\n case 3:\n _a.sent();\n return [4 /*yield*/, size(cid)];\n case 4:\n nodeSize = _a.sent();\n return [2 /*return*/, {\n cid: cid,\n size: nodeSize,\n isFile: false\n }];\n }\n });\n }); };\n var dagPutLinks = function (links) { return __awaiter(void 0, void 0, void 0, function () {\n var node;\n return __generator(this, function (_a) {\n node = new src$9.DAGNode(DAG_NODE_DATA, links);\n return [2 /*return*/, dagPut(node)];\n });\n }); };\n var size = function (cid) { return __awaiter(void 0, void 0, void 0, function () {\n var ipfs, stat;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, get$2()];\n case 1:\n ipfs = _a.sent();\n return [4 /*yield*/, ipfs.files.stat(\"/ipfs/\" + cid)];\n case 2:\n stat = _a.sent();\n return [2 /*return*/, stat.cumulativeSize];\n }\n });\n }); };\n var attemptPin = function (cid) { return __awaiter(void 0, void 0, void 0, function () {\n var ipfs, err_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, get$2()];\n case 1:\n ipfs = _a.sent();\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, ipfs.pin.add(cid, { recursive: false })];\n case 3:\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n err_1 = _a.sent();\n if (!err_1.message || !err_1.message.includes(\"already pinned recursively\")) {\n throw new Error(err_1);\n }\n return [3 /*break*/, 5];\n case 5: return [2 /*return*/];\n }\n });\n }); };\n\n /*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n\n var buffer$2 = createCommonjsModule(function (module, exports) {\n\n\n\n var customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null;\n\n exports.Buffer = Buffer;\n exports.SlowBuffer = SlowBuffer;\n exports.INSPECT_MAX_BYTES = 50;\n\n var K_MAX_LENGTH = 0x7fffffff;\n exports.kMaxLength = K_MAX_LENGTH;\n\n /**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\n Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();\n\n if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n );\n }\n\n function typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n var arr = new Uint8Array(1);\n var proto = { foo: function () { return 42 } };\n Object.setPrototypeOf(proto, Uint8Array.prototype);\n Object.setPrototypeOf(arr, proto);\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n }\n\n Object.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n });\n\n Object.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n });\n\n function createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n var buf = new Uint8Array(length);\n Object.setPrototypeOf(buf, Buffer.prototype);\n return buf\n }\n\n /**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\n function Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n }\n\n Buffer.poolSize = 8192; // not used by this implementation\n\n function from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n var valueOf = value.valueOf && value.valueOf();\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n var b = fromObject(value);\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(\n value[Symbol.toPrimitive]('string'), encodingOrOffset, length\n )\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n /**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\n Buffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n };\n\n // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n // https://github.com/feross/buffer/pull/148\n Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);\n Object.setPrototypeOf(Buffer, Uint8Array);\n\n function assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n }\n\n function alloc (size, fill, encoding) {\n assertSize(size);\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n }\n\n /**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\n Buffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n };\n\n function allocUnsafe (size) {\n assertSize(size);\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n }\n\n /**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\n Buffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n };\n /**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\n Buffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n };\n\n function fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8';\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n var length = byteLength(string, encoding) | 0;\n var buf = createBuffer(length);\n\n var actual = buf.write(string, encoding);\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual);\n }\n\n return buf\n }\n\n function fromArrayLike (array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0;\n var buf = createBuffer(length);\n for (var i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255;\n }\n return buf\n }\n\n function fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n var copy = new Uint8Array(arrayView);\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n }\n\n function fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n var buf;\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array);\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset);\n } else {\n buf = new Uint8Array(array, byteOffset, length);\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype);\n\n return buf\n }\n\n function fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0;\n var buf = createBuffer(len);\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len);\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n }\n\n function checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n }\n\n function SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0;\n }\n return Buffer.alloc(+length)\n }\n\n Buffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n };\n\n Buffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n var x = a.length;\n var y = b.length;\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n };\n\n Buffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n };\n\n Buffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i;\n if (length === undefined) {\n length = 0;\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n\n var buffer = Buffer.allocUnsafe(length);\n var pos = 0;\n for (i = 0; i < list.length; ++i) {\n var buf = list[i];\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n Buffer.from(buf).copy(buffer, pos);\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n );\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos);\n }\n pos += buf.length;\n }\n return buffer\n };\n\n function byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n var len = string.length;\n var mustMatch = (arguments.length > 2 && arguments[2] === true);\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false;\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n }\n Buffer.byteLength = byteLength;\n\n function slowToString (encoding, start, end) {\n var loweredCase = false;\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0;\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length;\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0;\n start >>>= 0;\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8';\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase();\n loweredCase = true;\n }\n }\n }\n\n // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n // to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n // reliably in a browserify context because there could be multiple different\n // copies of the 'buffer' package in use. This method works even for Buffer\n // instances that were created from another copy of the `buffer` package.\n // See: https://github.com/feross/buffer/issues/154\n Buffer.prototype._isBuffer = true;\n\n function swap (b, n, m) {\n var i = b[n];\n b[n] = b[m];\n b[m] = i;\n }\n\n Buffer.prototype.swap16 = function swap16 () {\n var len = this.length;\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n return this\n };\n\n Buffer.prototype.swap32 = function swap32 () {\n var len = this.length;\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this\n };\n\n Buffer.prototype.swap64 = function swap64 () {\n var len = this.length;\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this\n };\n\n Buffer.prototype.toString = function toString () {\n var length = this.length;\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n };\n\n Buffer.prototype.toLocaleString = Buffer.prototype.toString;\n\n Buffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n };\n\n Buffer.prototype.inspect = function inspect () {\n var str = '';\n var max = exports.INSPECT_MAX_BYTES;\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();\n if (this.length > max) str += ' ... ';\n return '<Buffer ' + str + '>'\n };\n if (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;\n }\n\n Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength);\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0;\n }\n if (end === undefined) {\n end = target ? target.length : 0;\n }\n if (thisStart === undefined) {\n thisStart = 0;\n }\n if (thisEnd === undefined) {\n thisEnd = this.length;\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart;\n var y = end - start;\n var len = Math.min(x, y);\n\n var thisCopy = this.slice(thisStart, thisEnd);\n var targetCopy = target.slice(start, end);\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n };\n\n // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n // OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n //\n // Arguments:\n // - buffer - a Buffer to search\n // - val - a string, Buffer, or number\n // - byteOffset - an index into `buffer`; will be clamped to an int32\n // - encoding - an optional encoding, relevant is val is a string\n // - dir - true for indexOf, false for lastIndexOf\n function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff;\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000;\n }\n byteOffset = +byteOffset; // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1);\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset;\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0;\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding);\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF; // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n }\n\n function arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1;\n var arrLength = arr.length;\n var valLength = val.length;\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase();\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i;\n if (dir) {\n var foundIndex = -1;\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i;\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n for (i = byteOffset; i >= 0; i--) {\n var found = true;\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false;\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n }\n\n Buffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n };\n\n Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n };\n\n Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n };\n\n function hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0;\n var remaining = buf.length - offset;\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n if (length > remaining) {\n length = remaining;\n }\n }\n\n var strLen = string.length;\n\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16);\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed;\n }\n return i\n }\n\n function utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n }\n\n function asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n }\n\n function base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n }\n\n function ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n }\n\n Buffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8';\n length = this.length;\n offset = 0;\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset;\n length = this.length;\n offset = 0;\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0;\n if (isFinite(length)) {\n length = length >>> 0;\n if (encoding === undefined) encoding = 'utf8';\n } else {\n encoding = length;\n length = undefined;\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset;\n if (length === undefined || length > remaining) length = remaining;\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8';\n\n var loweredCase = false;\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n };\n\n Buffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n };\n\n function base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64Js.fromByteArray(buf)\n } else {\n return base64Js.fromByteArray(buf.slice(start, end))\n }\n }\n\n function utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end);\n var res = [];\n\n var i = start;\n while (i < end) {\n var firstByte = buf[i];\n var codePoint = null;\n var bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1;\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint;\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte;\n }\n break\n case 2:\n secondByte = buf[i + 1];\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint;\n }\n }\n break\n case 3:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint;\n }\n }\n break\n case 4:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n fourthByte = buf[i + 3];\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint;\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD;\n bytesPerSequence = 1;\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000;\n res.push(codePoint >>> 10 & 0x3FF | 0xD800);\n codePoint = 0xDC00 | codePoint & 0x3FF;\n }\n\n res.push(codePoint);\n i += bytesPerSequence;\n }\n\n return decodeCodePointsArray(res)\n }\n\n // Based on http://stackoverflow.com/a/22747272/680742, the browser with\n // the lowest limit is Chrome, with 0x10000 args.\n // We go 1 magnitude less, for safety\n var MAX_ARGUMENTS_LENGTH = 0x1000;\n\n function decodeCodePointsArray (codePoints) {\n var len = codePoints.length;\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = '';\n var i = 0;\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n );\n }\n return res\n }\n\n function asciiSlice (buf, start, end) {\n var ret = '';\n end = Math.min(buf.length, end);\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F);\n }\n return ret\n }\n\n function latin1Slice (buf, start, end) {\n var ret = '';\n end = Math.min(buf.length, end);\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i]);\n }\n return ret\n }\n\n function hexSlice (buf, start, end) {\n var len = buf.length;\n\n if (!start || start < 0) start = 0;\n if (!end || end < 0 || end > len) end = len;\n\n var out = '';\n for (var i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]];\n }\n return out\n }\n\n function utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end);\n var res = '';\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (var i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256));\n }\n return res\n }\n\n Buffer.prototype.slice = function slice (start, end) {\n var len = this.length;\n start = ~~start;\n end = end === undefined ? len : ~~end;\n\n if (start < 0) {\n start += len;\n if (start < 0) start = 0;\n } else if (start > len) {\n start = len;\n }\n\n if (end < 0) {\n end += len;\n if (end < 0) end = 0;\n } else if (end > len) {\n end = len;\n }\n\n if (end < start) end = start;\n\n var newBuf = this.subarray(start, end);\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype);\n\n return newBuf\n };\n\n /*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\n function checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n }\n\n Buffer.prototype.readUintLE =\n Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n var val = this[offset];\n var mul = 1;\n var i = 0;\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n\n return val\n };\n\n Buffer.prototype.readUintBE =\n Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length);\n }\n\n var val = this[offset + --byteLength];\n var mul = 1;\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul;\n }\n\n return val\n };\n\n Buffer.prototype.readUint8 =\n Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n return this[offset]\n };\n\n Buffer.prototype.readUint16LE =\n Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] | (this[offset + 1] << 8)\n };\n\n Buffer.prototype.readUint16BE =\n Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n return (this[offset] << 8) | this[offset + 1]\n };\n\n Buffer.prototype.readUint32LE =\n Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n };\n\n Buffer.prototype.readUint32BE =\n Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n };\n\n Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n var val = this[offset];\n var mul = 1;\n var i = 0;\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n mul *= 0x80;\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n return val\n };\n\n Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n var i = byteLength;\n var mul = 1;\n var val = this[offset + --i];\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul;\n }\n mul *= 0x80;\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n return val\n };\n\n Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 1, this.length);\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n };\n\n Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n var val = this[offset] | (this[offset + 1] << 8);\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n };\n\n Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 2, this.length);\n var val = this[offset + 1] | (this[offset] << 8);\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n };\n\n Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n };\n\n Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n };\n\n Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, true, 23, 4)\n };\n\n Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, false, 23, 4)\n };\n\n Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, true, 52, 8)\n };\n\n Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0;\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, false, 52, 8)\n };\n\n function checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n }\n\n Buffer.prototype.writeUintLE =\n Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n var mul = 1;\n var i = 0;\n this[offset] = value & 0xFF;\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeUintBE =\n Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n byteLength = byteLength >>> 0;\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n var i = byteLength - 1;\n var mul = 1;\n this[offset + i] = value & 0xFF;\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeUint8 =\n Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);\n this[offset] = (value & 0xff);\n return offset + 1\n };\n\n Buffer.prototype.writeUint16LE =\n Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n return offset + 2\n };\n\n Buffer.prototype.writeUint16BE =\n Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n this[offset] = (value >>> 8);\n this[offset + 1] = (value & 0xff);\n return offset + 2\n };\n\n Buffer.prototype.writeUint32LE =\n Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n this[offset + 3] = (value >>> 24);\n this[offset + 2] = (value >>> 16);\n this[offset + 1] = (value >>> 8);\n this[offset] = (value & 0xff);\n return offset + 4\n };\n\n Buffer.prototype.writeUint32BE =\n Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n this[offset] = (value >>> 24);\n this[offset + 1] = (value >>> 16);\n this[offset + 2] = (value >>> 8);\n this[offset + 3] = (value & 0xff);\n return offset + 4\n };\n\n Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n var limit = Math.pow(2, (8 * byteLength) - 1);\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n var i = 0;\n var mul = 1;\n var sub = 0;\n this[offset] = value & 0xFF;\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n var limit = Math.pow(2, (8 * byteLength) - 1);\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n var i = byteLength - 1;\n var mul = 1;\n var sub = 0;\n this[offset + i] = value & 0xFF;\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength\n };\n\n Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);\n if (value < 0) value = 0xff + value + 1;\n this[offset] = (value & 0xff);\n return offset + 1\n };\n\n Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n return offset + 2\n };\n\n Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n this[offset] = (value >>> 8);\n this[offset + 1] = (value & 0xff);\n return offset + 2\n };\n\n Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n this[offset + 2] = (value >>> 16);\n this[offset + 3] = (value >>> 24);\n return offset + 4\n };\n\n Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n if (value < 0) value = 0xffffffff + value + 1;\n this[offset] = (value >>> 24);\n this[offset + 1] = (value >>> 16);\n this[offset + 2] = (value >>> 8);\n this[offset + 3] = (value & 0xff);\n return offset + 4\n };\n\n function checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n }\n\n function writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4);\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4);\n return offset + 4\n }\n\n Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n };\n\n Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n };\n\n function writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value;\n offset = offset >>> 0;\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8);\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8);\n return offset + 8\n }\n\n Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n };\n\n Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n };\n\n // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\n Buffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0;\n if (!end && end !== 0) end = this.length;\n if (targetStart >= target.length) targetStart = target.length;\n if (!targetStart) targetStart = 0;\n if (end > 0 && end < start) end = start;\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length;\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n\n var len = end - start;\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end);\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n );\n }\n\n return len\n };\n\n // Usage:\n // buffer.fill(number[, offset[, end]])\n // buffer.fill(buffer[, offset[, end]])\n // buffer.fill(string[, offset[, end]][, encoding])\n Buffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === 'string') {\n encoding = end;\n end = this.length;\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0);\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code;\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255;\n } else if (typeof val === 'boolean') {\n val = Number(val);\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0;\n end = end === undefined ? this.length : end >>> 0;\n\n if (!val) val = 0;\n\n var i;\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding);\n var len = bytes.length;\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n\n return this\n };\n\n // HELPER FUNCTIONS\n // ================\n\n var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\n\n function base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0];\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '');\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '=';\n }\n return str\n }\n\n function utf8ToBytes (string, units) {\n units = units || Infinity;\n var codePoint;\n var length = string.length;\n var leadSurrogate = null;\n var bytes = [];\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i);\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint;\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n leadSurrogate = codePoint;\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n }\n\n leadSurrogate = null;\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint);\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n );\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n );\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n );\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n }\n\n function asciiToBytes (str) {\n var byteArray = [];\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF);\n }\n return byteArray\n }\n\n function utf16leToBytes (str, units) {\n var c, hi, lo;\n var byteArray = [];\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n\n return byteArray\n }\n\n function base64ToBytes (str) {\n return base64Js.toByteArray(base64clean(str))\n }\n\n function blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i];\n }\n return i\n }\n\n // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n // the `instanceof` check but they should be treated as of that type.\n // See: https://github.com/feross/buffer/issues/166\n function isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n }\n function numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n }\n\n // Create lookup table for `toString('hex')`\n // See: https://github.com/feross/buffer/issues/219\n var hexSliceLookupTable = (function () {\n var alphabet = '0123456789abcdef';\n var table = new Array(256);\n for (var i = 0; i < 16; ++i) {\n var i16 = i * 16;\n for (var j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j];\n }\n }\n return table\n })();\n });\n\n var bignumber = createCommonjsModule(function (module) {\n (function (globalObject) {\n\n /*\n * bignumber.js v9.0.1\n * A JavaScript library for arbitrary-precision arithmetic.\n * https://github.com/MikeMcl/bignumber.js\n * Copyright (c) 2020 Michael Mclaughlin <M8ch88l@gmail.com>\n * MIT Licensed.\n *\n * BigNumber.prototype methods | BigNumber methods\n * |\n * absoluteValue abs | clone\n * comparedTo | config set\n * decimalPlaces dp | DECIMAL_PLACES\n * dividedBy div | ROUNDING_MODE\n * dividedToIntegerBy idiv | EXPONENTIAL_AT\n * exponentiatedBy pow | RANGE\n * integerValue | CRYPTO\n * isEqualTo eq | MODULO_MODE\n * isFinite | POW_PRECISION\n * isGreaterThan gt | FORMAT\n * isGreaterThanOrEqualTo gte | ALPHABET\n * isInteger | isBigNumber\n * isLessThan lt | maximum max\n * isLessThanOrEqualTo lte | minimum min\n * isNaN | random\n * isNegative | sum\n * isPositive |\n * isZero |\n * minus |\n * modulo mod |\n * multipliedBy times |\n * negated |\n * plus |\n * precision sd |\n * shiftedBy |\n * squareRoot sqrt |\n * toExponential |\n * toFixed |\n * toFormat |\n * toFraction |\n * toJSON |\n * toNumber |\n * toPrecision |\n * toString |\n * valueOf |\n *\n */\n\n\n var BigNumber,\n isNumeric = /^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i,\n mathceil = Math.ceil,\n mathfloor = Math.floor,\n\n bignumberError = '[BigNumber Error] ',\n tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ',\n\n BASE = 1e14,\n LOG_BASE = 14,\n MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1\n // MAX_INT32 = 0x7fffffff, // 2^31 - 1\n POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13],\n SQRT_BASE = 1e7,\n\n // EDITABLE\n // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and\n // the arguments to toExponential, toFixed, toFormat, and toPrecision.\n MAX = 1E9; // 0 to MAX_INT32\n\n\n /*\n * Create and return a BigNumber constructor.\n */\n function clone(configObject) {\n var div, convertBase, parseNumeric,\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\n ONE = new BigNumber(1),\n\n\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\n\n\n // The default values below must be integers within the inclusive ranges stated.\n // The values can also be changed at run-time using BigNumber.set.\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n // The rounding mode used when rounding to the above decimal places, and when using\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\n // UP 0 Away from zero.\n // DOWN 1 Towards zero.\n // CEIL 2 Towards +Infinity.\n // FLOOR 3 Towards -Infinity.\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n // The modulo mode used when calculating the modulus: a mod n.\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n // The remainder (r) is calculated as: r = a - n * q.\n //\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\n // DOWN 1 The remainder has the same sign as the dividend.\n // This modulo mode is commonly known as 'truncated division' and is\n // equivalent to (a % n) in JavaScript.\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n // The remainder is always positive.\n //\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\n // modes are commonly used for the modulus operation.\n // Although the other rounding modes can also be used, they may not give useful results.\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 0, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n prefix: '',\n groupSize: 3,\n secondaryGroupSize: 0,\n groupSeparator: ',',\n decimalSeparator: '.',\n fractionGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n suffix: ''\n },\n\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\n // '-', '.', whitespace, or repeated character.\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\n\n\n //------------------------------------------------------------------------------------------\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * v {number|string|BigNumber} A numeric value.\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\n */\n function BigNumber(v, b) {\n var alphabet, c, caseChanged, e, i, isNum, len, str,\n x = this;\n\n // Enable constructor call without `new`.\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\n\n if (b == null) {\n\n if (v && v._isBigNumber === true) {\n x.s = v.s;\n\n if (!v.c || v.e > MAX_EXP) {\n x.c = x.e = null;\n } else if (v.e < MIN_EXP) {\n x.c = [x.e = 0];\n } else {\n x.e = v.e;\n x.c = v.c.slice();\n }\n\n return;\n }\n\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\n\n // Use `1 / n` to handle minus zero also.\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\n\n // Fast path for integers, where n < 2147483648 (2**31).\n if (v === ~~v) {\n for (e = 0, i = v; i >= 10; i /= 10, e++);\n\n if (e > MAX_EXP) {\n x.c = x.e = null;\n } else {\n x.e = e;\n x.c = [v];\n }\n\n return;\n }\n\n str = String(v);\n } else {\n\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\n\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\n }\n\n // Decimal point?\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\n\n // Exponential form?\n if ((i = str.search(/e/i)) > 0) {\n\n // Determine exponent.\n if (e < 0) e = i;\n e += +str.slice(i + 1);\n str = str.substring(0, i);\n } else if (e < 0) {\n\n // Integer.\n e = str.length;\n }\n\n } else {\n\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\n intCheck(b, 2, ALPHABET.length, 'Base');\n\n // Allow exponential notation to be used with base 10 argument, while\n // also rounding to DECIMAL_PLACES as with other bases.\n if (b == 10) {\n x = new BigNumber(v);\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\n }\n\n str = String(v);\n\n if (isNum = typeof v == 'number') {\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\n\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\n\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\n throw Error\n (tooManyDigits + v);\n }\n } else {\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\n }\n\n alphabet = ALPHABET.slice(0, b);\n e = i = 0;\n\n // Check that str is a valid base b number.\n // Don't use RegExp, so alphabet can contain special characters.\n for (len = str.length; i < len; i++) {\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\n if (c == '.') {\n\n // If '.' is not the first character and it has not be found before.\n if (i > e) {\n e = len;\n continue;\n }\n } else if (!caseChanged) {\n\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\n str == str.toLowerCase() && (str = str.toUpperCase())) {\n caseChanged = true;\n i = -1;\n e = 0;\n continue;\n }\n }\n\n return parseNumeric(x, String(v), isNum, b);\n }\n }\n\n // Prevent later check for length on converted number.\n isNum = false;\n str = convertBase(str, b, 10, x.s);\n\n // Decimal point?\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\n else e = str.length;\n }\n\n // Determine leading zeros.\n for (i = 0; str.charCodeAt(i) === 48; i++);\n\n // Determine trailing zeros.\n for (len = str.length; str.charCodeAt(--len) === 48;);\n\n if (str = str.slice(i, ++len)) {\n len -= i;\n\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\n if (isNum && BigNumber.DEBUG &&\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\n throw Error\n (tooManyDigits + (x.s * v));\n }\n\n // Overflow?\n if ((e = e - i - 1) > MAX_EXP) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if (e < MIN_EXP) {\n\n // Zero.\n x.c = [x.e = 0];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = (e + 1) % LOG_BASE;\n if (e < 0) i += LOG_BASE; // i < 1\n\n if (i < len) {\n if (i) x.c.push(+str.slice(0, i));\n\n for (len -= LOG_BASE; i < len;) {\n x.c.push(+str.slice(i, i += LOG_BASE));\n }\n\n i = LOG_BASE - (str = str.slice(i)).length;\n } else {\n i -= len;\n }\n\n for (; i--; str += '0');\n x.c.push(+str);\n }\n } else {\n\n // Zero.\n x.c = [x.e = 0];\n }\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.clone = clone;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object with the following optional properties (if the value of a property is\n * a number, it must be an integer within the inclusive range stated):\n *\n * DECIMAL_PLACES {number} 0 to MAX\n * ROUNDING_MODE {number} 0 to 8\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\n * CRYPTO {boolean} true or false\n * MODULO_MODE {number} 0 to 9\n * POW_PRECISION {number} 0 to MAX\n * ALPHABET {string} A string of two or more unique characters which does\n * not contain '.'.\n * FORMAT {object} An object with some of the following properties:\n * prefix {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * groupSeparator {string}\n * decimalSeparator {string}\n * fractionGroupSize {number}\n * fractionGroupSeparator {string}\n * suffix {string}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\n *\n * Return an object with the properties current values.\n */\n BigNumber.config = BigNumber.set = function (obj) {\n var p, v;\n\n if (obj != null) {\n\n if (typeof obj == 'object') {\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\n v = obj[p];\n intCheck(v, 0, MAX, p);\n DECIMAL_PLACES = v;\n }\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\n v = obj[p];\n intCheck(v, 0, 8, p);\n ROUNDING_MODE = v;\n }\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\n v = obj[p];\n if (v && v.pop) {\n intCheck(v[0], -MAX, 0, p);\n intCheck(v[1], 0, MAX, p);\n TO_EXP_NEG = v[0];\n TO_EXP_POS = v[1];\n } else {\n intCheck(v, -MAX, MAX, p);\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\n }\n }\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\n if (obj.hasOwnProperty(p = 'RANGE')) {\n v = obj[p];\n if (v && v.pop) {\n intCheck(v[0], -MAX, -1, p);\n intCheck(v[1], 1, MAX, p);\n MIN_EXP = v[0];\n MAX_EXP = v[1];\n } else {\n intCheck(v, -MAX, MAX, p);\n if (v) {\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\n } else {\n throw Error\n (bignumberError + p + ' cannot be zero: ' + v);\n }\n }\n }\n\n // CRYPTO {boolean} true or false.\n // '[BigNumber Error] CRYPTO not true or false: {v}'\n // '[BigNumber Error] crypto unavailable'\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\n v = obj[p];\n if (v === !!v) {\n if (v) {\n if (typeof crypto != 'undefined' && crypto &&\n (crypto.getRandomValues || crypto.randomBytes)) {\n CRYPTO = v;\n } else {\n CRYPTO = !v;\n throw Error\n (bignumberError + 'crypto unavailable');\n }\n } else {\n CRYPTO = v;\n }\n } else {\n throw Error\n (bignumberError + p + ' not true or false: ' + v);\n }\n }\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\n v = obj[p];\n intCheck(v, 0, 9, p);\n MODULO_MODE = v;\n }\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\n v = obj[p];\n intCheck(v, 0, MAX, p);\n POW_PRECISION = v;\n }\n\n // FORMAT {object}\n // '[BigNumber Error] FORMAT not an object: {v}'\n if (obj.hasOwnProperty(p = 'FORMAT')) {\n v = obj[p];\n if (typeof v == 'object') FORMAT = v;\n else throw Error\n (bignumberError + p + ' not an object: ' + v);\n }\n\n // ALPHABET {string}\n // '[BigNumber Error] ALPHABET invalid: {v}'\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\n v = obj[p];\n\n // Disallow if less than two characters,\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\n if (typeof v == 'string' && !/^.?$|[+\\-.\\s]|(.).*\\1/.test(v)) {\n ALPHABET = v;\n } else {\n throw Error\n (bignumberError + p + ' invalid: ' + v);\n }\n }\n\n } else {\n\n // '[BigNumber Error] Object expected: {v}'\n throw Error\n (bignumberError + 'Object expected: ' + obj);\n }\n }\n\n return {\n DECIMAL_PLACES: DECIMAL_PLACES,\n ROUNDING_MODE: ROUNDING_MODE,\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\n RANGE: [MIN_EXP, MAX_EXP],\n CRYPTO: CRYPTO,\n MODULO_MODE: MODULO_MODE,\n POW_PRECISION: POW_PRECISION,\n FORMAT: FORMAT,\n ALPHABET: ALPHABET\n };\n };\n\n\n /*\n * Return true if v is a BigNumber instance, otherwise return false.\n *\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\n *\n * v {any}\n *\n * '[BigNumber Error] Invalid BigNumber: {v}'\n */\n BigNumber.isBigNumber = function (v) {\n if (!v || v._isBigNumber !== true) return false;\n if (!BigNumber.DEBUG) return true;\n\n var i, n,\n c = v.c,\n e = v.e,\n s = v.s;\n\n out: if ({}.toString.call(c) == '[object Array]') {\n\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\n\n // If the first element is zero, the BigNumber value must be zero.\n if (c[0] === 0) {\n if (e === 0 && c.length === 1) return true;\n break out;\n }\n\n // Calculate number of digits that c[0] should have, based on the exponent.\n i = (e + 1) % LOG_BASE;\n if (i < 1) i += LOG_BASE;\n\n // Calculate number of digits of c[0].\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\n if (String(c[0]).length == i) {\n\n for (i = 0; i < c.length; i++) {\n n = c[i];\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\n }\n\n // Last element cannot be zero, unless it is the only element.\n if (n !== 0) return true;\n }\n }\n\n // Infinity/NaN\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\n return true;\n }\n\n throw Error\n (bignumberError + 'Invalid BigNumber: ' + v);\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.maximum = BigNumber.max = function () {\n return maxOrMin(arguments, P.lt);\n };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.minimum = BigNumber.min = function () {\n return maxOrMin(arguments, P.gt);\n };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\n * '[BigNumber Error] crypto unavailable'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor(Math.random() * pow2_53); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n if (dp == null) dp = DECIMAL_PLACES;\n else intCheck(dp, 0, MAX);\n\n k = mathceil(dp / LOG_BASE);\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if (crypto.getRandomValues) {\n\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\n\n for (; i < k;) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if (v >= 9e15) {\n b = crypto.getRandomValues(new Uint32Array(2));\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if (crypto.randomBytes) {\n\n // buffer\n a = crypto.randomBytes(k *= 7);\n\n for (; i < k;) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\n\n if (v >= 9e15) {\n crypto.randomBytes(7).copy(a, i);\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 7;\n }\n }\n i = k / 7;\n } else {\n CRYPTO = false;\n throw Error\n (bignumberError + 'crypto unavailable');\n }\n }\n\n // Use Math.random.\n if (!CRYPTO) {\n\n for (; i < k;) {\n v = random53bitInt();\n if (v < 9e15) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if (k && dp) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor(k / v) * v;\n }\n\n // Remove trailing elements which are zero.\n for (; c[i] === 0; c.pop(), i--);\n\n // Zero?\n if (i < 0) {\n c = [e = 0];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if (i < LOG_BASE) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n /*\n * Return a BigNumber whose value is the sum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.sum = function () {\n var i = 1,\n args = arguments,\n sum = new BigNumber(args[0]);\n for (; i < args.length;) sum = sum.plus(args[i++]);\n return sum;\n };\n\n\n // PRIVATE FUNCTIONS\n\n\n // Called by BigNumber and BigNumber.prototype.toString.\n convertBase = (function () {\n var decimal = '0123456789';\n\n /*\n * Convert string of baseIn to an array of numbers of baseOut.\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\n */\n function toBaseOut(str, baseIn, baseOut, alphabet) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n len = str.length;\n\n for (; i < len;) {\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\n\n arr[0] += alphabet.indexOf(str.charAt(i++));\n\n for (j = 0; j < arr.length; j++) {\n\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] == null) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n }\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n // If the caller is toString, we are converting from base 10 to baseOut.\n // If the caller is BigNumber, we are converting from baseIn to base 10.\n return function (str, baseIn, baseOut, sign, callerIsToString) {\n var alphabet, d, e, k, r, x, xc, y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n // Non-integer.\n if (i >= 0) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\n 10, baseOut, decimal);\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\n ? (alphabet = ALPHABET, decimal)\n : (alphabet = decimal, ALPHABET));\n\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\n e = k = xc.length;\n\n // Remove trailing zeros.\n for (; xc[--k] == 0; xc.pop());\n\n // Zero?\n if (!xc[0]) return alphabet.charAt(0);\n\n // Does str represent an integer? If so, no need for the division.\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // The sign is needed for correct rounding.\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n // xc now represents str converted to baseOut.\n\n // THe index of the rounding digit.\n d = e + dp + 1;\n\n // The rounding digit: the digit to the right of the digit that may be rounded up.\n i = xc[d];\n\n // Look at the rounding digits and mode to determine whether to round up.\n\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == (x.s < 0 ? 8 : 7));\n\n // If the index of the rounding digit is not greater than zero, or xc represents\n // zero, then the result of the base conversion is zero or, if rounding up, a value\n // such as 0.00001.\n if (d < 1 || !xc[0]) {\n\n // 1^-dp or 0\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\n } else {\n\n // Truncate xc to the required number of decimal places.\n xc.length = d;\n\n // Round up?\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for (k = xc.length; !xc[--k];);\n\n // E.g. [4, 11, 15] becomes 4bf.\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\n\n // Add leading zeros, decimal point and trailing zeros as required.\n str = toFixedPoint(str, e, alphabet.charAt(0));\n }\n\n // The caller will add the sign.\n return str;\n };\n })();\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply(x, k, base) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for (x = x.slice(); i--;) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x = [carry].concat(x);\n\n return x;\n }\n\n function compare(a, b, aL, bL) {\n var i, cmp;\n\n if (aL != bL) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for (i = cmp = 0; i < aL; i++) {\n\n if (a[i] != b[i]) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n\n return cmp;\n }\n\n function subtract(a, b, aL, base) {\n var i = 0;\n\n // Subtract b from a.\n for (; aL--;) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for (; !a[0] && a.length > 1; a.splice(0, 1));\n }\n\n // x: dividend, y: divisor.\n return function (x, y, dp, rm, base) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if (!xc || !xc[0] || !yc || !yc[0]) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if (!base) {\n base = BASE;\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for (i = 0; yc[i] == (xc[i] || 0); i++);\n\n if (yc[i] > (xc[i] || 0)) e--;\n\n if (s < 0) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor(base / (yc[0] + 1));\n\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\n if (n > 1) {\n yc = multiply(yc, n, base);\n xc = multiply(xc, n, base);\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice(0, yL);\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for (; remL < yL; rem[remL++] = 0);\n yz = yc.slice();\n yz = [0].concat(yz);\n yc0 = yc[0];\n if (yc[1] >= base / 2) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare(yc, rem, yL, remL);\n\n // If divisor < remainder.\n if (cmp < 0) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor(rem0 / yc0);\n\n // Algorithm:\n // product = divisor multiplied by trial digit (n).\n // Compare product and remainder.\n // If product is greater than remainder:\n // Subtract divisor from product, decrement trial digit.\n // Subtract product from remainder.\n // If product was less than remainder at the last compare:\n // Compare new remainder and divisor.\n // If remainder is greater than divisor:\n // Subtract divisor from remainder, increment trial digit.\n\n if (n > 1) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply(yc, n, base);\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder then trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while (compare(prod, rem, prodL, remL) == 1) {\n n--;\n\n // Subtract divisor from product.\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if (n == 0) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if (prodL < remL) prod = [0].concat(prod);\n\n // Subtract product from remainder.\n subtract(rem, prod, remL, base);\n remL = rem.length;\n\n // If product was < remainder.\n if (cmp == -1) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while (compare(yc, rem, yL, remL) < 1) {\n n++;\n\n // Subtract divisor from remainder.\n subtract(rem, yL < remL ? yz : yc, remL, base);\n remL = rem.length;\n }\n }\n } else if (cmp === 0) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if (rem[0]) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [xc[xi]];\n remL = 1;\n }\n } while ((xi++ < xL || rem[0] != null) && s--);\n\n more = rem[0] != null;\n\n // Leading zero?\n if (!qc[0]) qc.splice(0, 1);\n }\n\n if (base == BASE) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\n\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n: a BigNumber.\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\n * rm: the rounding mode.\n * id: 1 (toExponential) or 2 (toPrecision).\n */\n function format(n, i, rm, id) {\n var c0, e, ne, len, str;\n\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n\n if (!n.c) return n.toString();\n\n c0 = n.c[0];\n ne = n.e;\n\n if (i == null) {\n str = coeffToString(n.c);\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\n ? toExponential(str, ne)\n : toFixedPoint(str, ne, '0');\n } else {\n n = round(new BigNumber(n), i, rm);\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString(n.c);\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\n\n // Append zeros?\n for (; len < i; str += '0', len++);\n str = toExponential(str, e);\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint(str, e, '0');\n\n // Append zeros?\n if (e + 1 > len) {\n if (--i > 0) for (str += '.'; i--; str += '0');\n } else {\n i += e - len;\n if (i > 0) {\n if (e + 1 == len) str += '.';\n for (; i--; str += '0');\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin(args, method) {\n var n,\n i = 1,\n m = new BigNumber(args[0]);\n\n for (; i < args.length; i++) {\n n = new BigNumber(args[i]);\n\n // If any number is NaN, return NaN.\n if (!n.s) {\n m = n;\n break;\n } else if (method.call(m, n)) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise(n, c, e) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for (; !c[--j]; c.pop());\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for (j = c[0]; j >= 10; j /= 10, i++);\n\n // Overflow?\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if (e < MIN_EXP) {\n\n // Zero.\n n.c = [n.e = 0];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n\n return function (x, str, isNum, b) {\n var base,\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\n\n // No exception on ±Infinity or NaN.\n if (isInfinityOrNaN.test(s)) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if (!isNum) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace(basePrefix, function (m, p1, p2) {\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\n }\n\n if (str != s) return new BigNumber(s, base);\n }\n\n // '[BigNumber Error] Not a number: {n}'\n // '[BigNumber Error] Not a base {b} number: {n}'\n if (BigNumber.DEBUG) {\n throw Error\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\n }\n\n // NaN\n x.s = null;\n }\n\n x.c = x.e = null;\n }\n })();\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round(x, sd, rm, r) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if (i < 0) {\n i += LOG_BASE;\n j = sd;\n n = xc[ni = 0];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[d - j - 1] % 10 | 0;\n } else {\n ni = mathceil((i + 1) / LOG_BASE);\n\n if (ni >= xc.length) {\n\n if (r) {\n\n // Needed by sqrt.\n for (; xc.length <= ni; xc.push(0));\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for (d = 1; k >= 10; k /= 10, d++);\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\n\n r = rm < 4\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\n rm == (x.s < 0 ? 8 : 7));\n\n if (sd < 1 || !xc[0]) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if (i == 0) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[LOG_BASE - i];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for (; ;) {\n\n // If the digit to be rounded up is in the first element of xc...\n if (ni == 0) {\n\n // i will be the length of xc[0] before k is added.\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\n j = xc[0] += k;\n for (k = 1; j >= 10; j /= 10, k++);\n\n // if i != k the length has increased.\n if (i != k) {\n x.e++;\n if (xc[0] == BASE) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if (xc[ni] != BASE) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for (i = xc.length; xc[--i] === 0; xc.pop());\n }\n\n // Overflow? Infinity.\n if (x.e > MAX_EXP) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if (x.e < MIN_EXP) {\n x.c = [x.e = 0];\n }\n }\n\n return x;\n }\n\n\n function valueOf(n) {\n var str,\n e = n.e;\n\n if (e === null) return n.toString();\n\n str = coeffToString(n.c);\n\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential(str, e)\n : toFixedPoint(str, e, '0');\n\n return n.s < 0 ? '-' + str : str;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if (x.s < 0) x.s = 1;\n return x;\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = function (y, b) {\n return compare(this, new BigNumber(y, b));\n };\n\n\n /*\n * If dp is undefined or null or true or false, return the number of decimal places of the\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\n *\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\n * ROUNDING_MODE if rm is omitted.\n *\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n P.decimalPlaces = P.dp = function (dp, rm) {\n var c, n, v,\n x = this;\n\n if (dp != null) {\n intCheck(dp, 0, MAX);\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n\n return round(new BigNumber(x), dp + x.e + 1, rm);\n }\n\n if (!(c = x.c)) return null;\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\n if (n < 0) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function (y, b) {\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.idiv = function (y, b) {\n return div(this, new BigNumber(y, b), 0, 1);\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\n *\n * If m is present, return the result modulo m.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\n *\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\n *\n * n {number|string|BigNumber} The exponent. An integer.\n * [m] {number|string|BigNumber} The modulus.\n *\n * '[BigNumber Error] Exponent not an integer: {n}'\n */\n P.exponentiatedBy = P.pow = function (n, m) {\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\n x = this;\n\n n = new BigNumber(n);\n\n // Allow NaN and ±Infinity, but not other non-integers.\n if (n.c && !n.isInteger()) {\n throw Error\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\n }\n\n if (m != null) m = new BigNumber(m);\n\n // Exponent of MAX_SAFE_INTEGER is 15.\n nIsBig = n.e > 14;\n\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\n\n // The sign of the result of pow when x is negative depends on the evenness of n.\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\n return m ? y.mod(m) : y;\n }\n\n nIsNeg = n.s < 0;\n\n if (m) {\n\n // x % m returns NaN if abs(m) is zero, or m is NaN.\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\n\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\n\n if (isModExp) x = x.mod(m);\n\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\n // [1, 240000000]\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\n // [80000000000000] [99999750000000]\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\n\n // If x is negative and n is odd, k = -0, else k = 0.\n k = x.s < 0 && isOdd(n) ? -0 : 0;\n\n // If x >= 1, k = ±Infinity.\n if (x.e > -1) k = 1 / k;\n\n // If n is negative return ±0, else return ±Infinity.\n return new BigNumber(nIsNeg ? 1 / k : k);\n\n } else if (POW_PRECISION) {\n\n // Truncating each coefficient array to a length of k after each multiplication\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\n // i.e. there will be a minimum of 28 guard digits retained.\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\n }\n\n if (nIsBig) {\n half = new BigNumber(0.5);\n if (nIsNeg) n.s = 1;\n nIsOdd = isOdd(n);\n } else {\n i = Math.abs(+valueOf(n));\n nIsOdd = i % 2;\n }\n\n y = new BigNumber(ONE);\n\n // Performs 54 loop iterations for n of 9007199254740991.\n for (; ;) {\n\n if (nIsOdd) {\n y = y.times(x);\n if (!y.c) break;\n\n if (k) {\n if (y.c.length > k) y.c.length = k;\n } else if (isModExp) {\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\n }\n }\n\n if (i) {\n i = mathfloor(i / 2);\n if (i === 0) break;\n nIsOdd = i % 2;\n } else {\n n = n.times(half);\n round(n, n.e + 1, 1);\n\n if (n.e > 14) {\n nIsOdd = isOdd(n);\n } else {\n i = +valueOf(n);\n if (i === 0) break;\n nIsOdd = i % 2;\n }\n }\n\n x = x.times(x);\n\n if (k) {\n if (x.c && x.c.length > k) x.c.length = k;\n } else if (isModExp) {\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\n }\n }\n\n if (isModExp) return y;\n if (nIsNeg) y = ONE.div(y);\n\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\n */\n P.integerValue = function (rm) {\n var n = new BigNumber(this);\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n return round(n, n.e + 1, rm);\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise return false.\n */\n P.isEqualTo = P.eq = function (y, b) {\n return compare(this, new BigNumber(y, b)) === 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise return false.\n */\n P.isGreaterThan = P.gt = function (y, b) {\n return compare(this, new BigNumber(y, b)) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise return false.\n */\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = function () {\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise return false.\n */\n P.isLessThan = P.lt = function (y, b) {\n return compare(this, new BigNumber(y, b)) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise return false.\n */\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise return false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise return false.\n */\n P.isNegative = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is positive, otherwise return false.\n */\n P.isPositive = function () {\n return this.s > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = function (y, b) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n y = new BigNumber(y, b);\n b = y.s;\n\n // Either NaN?\n if (!a || !b) return new BigNumber(NaN);\n\n // Signs differ?\n if (a != b) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n\n // Either Infinity?\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\n\n // Either zero?\n if (!xc[0] || !yc[0]) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0);\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if (a = xe - ye) {\n\n if (xLTy = a < 0) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for (b = a; b--; t.push(0));\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\n\n for (a = b = 0; b < j; b++) {\n\n if (xc[b] != yc[b]) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = (j = yc.length) - (i = xc.length);\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if (b > 0) for (; b--; xc[i++] = 0);\n b = BASE - 1;\n\n // Subtract yc from xc.\n for (; j > a;) {\n\n if (xc[--j] < yc[j]) {\n for (i = j; i && !xc[--i]; xc[i] = b);\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\n\n // Zero?\n if (!xc[0]) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [y.e = 0];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise(y, xc, ye);\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function (y, b) {\n var q, s,\n x = this;\n\n y = new BigNumber(y, b);\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if (!x.c || !y.s || y.c && !y.c[0]) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if (!y.c || x.c && !x.c[0]) {\n return new BigNumber(x);\n }\n\n if (MODULO_MODE == 9) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div(x, y, 0, 3);\n y.s = s;\n q.s *= s;\n } else {\n q = div(x, y, 0, MODULO_MODE);\n }\n\n y = x.minus(q.times(y));\n\n // To match JavaScript %, ensure sign of zero is sign of dividend.\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\n\n return y;\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\n * of BigNumber(y, b).\n */\n P.multipliedBy = P.times = function (y, b) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = (y = new BigNumber(y, b)).c;\n\n // Either NaN, ±Infinity or ±0?\n if (!xc || !yc || !xc[0] || !yc[0]) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if (!xc || !yc) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for (i = ycL; --i >= 0;) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for (k = xcL, j = i + k; j > i;) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.splice(0, 1);\n }\n\n return normalise(y, zc, e);\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = function (y, b) {\n var t,\n x = this,\n a = x.s;\n\n y = new BigNumber(y, b);\n b = y.s;\n\n // Either NaN?\n if (!a || !b) return new BigNumber(NaN);\n\n // Signs differ?\n if (a != b) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n\n // Return ±Infinity if either ±Infinity.\n if (!xc || !yc) return new BigNumber(a / 0);\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if (a = xe - ye) {\n if (a > 0) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for (; a--; t.push(0));\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for (a = 0; b;) {\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\n }\n\n if (a) {\n xc = [a].concat(xc);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise(y, xc, ye);\n };\n\n\n /*\n * If sd is undefined or null or true or false, return the number of significant digits of\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\n * If sd is true include integer-part trailing zeros in the count.\n *\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\n * ROUNDING_MODE if rm is omitted.\n *\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\n * boolean: whether to count integer-part trailing zeros: true or false.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\n */\n P.precision = P.sd = function (sd, rm) {\n var c, n, v,\n x = this;\n\n if (sd != null && sd !== !!sd) {\n intCheck(sd, 1, MAX);\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n\n return round(new BigNumber(x), sd, rm);\n }\n\n if (!(c = x.c)) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if (v = c[v]) {\n\n // Subtract the number of trailing zeros of the last element.\n for (; v % 10 == 0; v /= 10, n--);\n\n // Add the number of digits of the first element.\n for (v = c[0]; v >= 10; v /= 10, n++);\n }\n\n if (sd && x.e + 1 > n) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\n */\n P.shiftedBy = function (k) {\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\n return this.times('1e' + k);\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt(N) = N\n * sqrt(-I) = N\n * sqrt(I) = I\n * sqrt(0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if (s !== 1 || !c || !c[0]) {\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\n }\n\n // Initial estimate.\n s = Math.sqrt(+valueOf(x));\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if (s == 0 || s == 1 / 0) {\n n = coeffToString(c);\n if ((n.length + e) % 2 == 0) n += '0';\n s = Math.sqrt(+n);\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\n\n if (s == 1 / 0) {\n n = '5e' + e;\n } else {\n n = s.toExponential();\n n = n.slice(0, n.indexOf('e') + 1) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber(s + '');\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if (r.c[0]) {\n e = r.e;\n s = e + dp;\n if (s < 3) s = 0;\n\n // Newton-Raphson iteration.\n for (; ;) {\n t = r;\n r = half.times(t.plus(div(x, t, dp, 1)));\n\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if (r.e < e) --s;\n n = n.slice(s - 3, s + 1);\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if (n == '9999' || !rep && n == '4999') {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if (!rep) {\n round(t, t.e + DECIMAL_PLACES + 2, 0);\n\n if (t.times(t).eq(x)) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\n\n // Truncate to the first rounding digit.\n round(r, r.e + DECIMAL_PLACES + 2, 1);\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n P.toExponential = function (dp, rm) {\n if (dp != null) {\n intCheck(dp, 0, MAX);\n dp++;\n }\n return format(this, dp, rm, 1);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n P.toFixed = function (dp, rm) {\n if (dp != null) {\n intCheck(dp, 0, MAX);\n dp = dp + this.e + 1;\n }\n return format(this, dp, rm);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the format or FORMAT object (see BigNumber.set).\n *\n * The formatting object may contain some or all of the properties shown below.\n *\n * FORMAT = {\n * prefix: '',\n * groupSize: 3,\n * secondaryGroupSize: 0,\n * groupSeparator: ',',\n * decimalSeparator: '.',\n * fractionGroupSize: 0,\n * fractionGroupSeparator: '\\xA0', // non-breaking space\n * suffix: ''\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n * [format] {object} Formatting options. See FORMAT pbject above.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n * '[BigNumber Error] Argument not an object: {format}'\n */\n P.toFormat = function (dp, rm, format) {\n var str,\n x = this;\n\n if (format == null) {\n if (dp != null && rm && typeof rm == 'object') {\n format = rm;\n rm = null;\n } else if (dp && typeof dp == 'object') {\n format = dp;\n dp = rm = null;\n } else {\n format = FORMAT;\n }\n } else if (typeof format != 'object') {\n throw Error\n (bignumberError + 'Argument not an object: ' + format);\n }\n\n str = x.toFixed(dp, rm);\n\n if (x.c) {\n var i,\n arr = str.split('.'),\n g1 = +format.groupSize,\n g2 = +format.secondaryGroupSize,\n groupSeparator = format.groupSeparator || '',\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = x.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if (g1 > 0 && len > 0) {\n i = len % g1 || g1;\n intPart = intDigits.substr(0, i);\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\n '$&' + (format.fractionGroupSeparator || ''))\n : fractionPart)\n : intPart;\n }\n\n return (format.prefix || '') + str + (format.suffix || '');\n };\n\n\n /*\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\n * fraction with an integer numerator and an integer denominator.\n * The denominator will be a positive non-zero value less than or equal to the specified\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\n * the lowest value necessary to represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\n *\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\n */\n P.toFraction = function (md) {\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\n x = this,\n xc = x.c;\n\n if (md != null) {\n n = new BigNumber(md);\n\n // Throw if md is less than one or is not an integer, unless it is Infinity.\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\n throw Error\n (bignumberError + 'Argument ' +\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\n }\n }\n\n if (!xc) return new BigNumber(x);\n\n d = new BigNumber(ONE);\n n1 = d0 = new BigNumber(ONE);\n d1 = n0 = new BigNumber(ONE);\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for (; ;) {\n q = div(n, d, 0, 1);\n d2 = d0.plus(q.times(d1));\n if (d2.comparedTo(md) == 1) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus(q.times(d2 = n1));\n n0 = d2;\n d = n.minus(q.times(d2 = d));\n n = d2;\n }\n\n d2 = div(md.minus(d0), d1, 0, 1);\n n0 = n0.plus(d2.times(n1));\n d0 = d0.plus(d2.times(d1));\n n0.s = n1.s = x.s;\n e = e * 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\n\n MAX_EXP = exp;\n\n return r;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n return +valueOf(this);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\n */\n P.toPrecision = function (sd, rm) {\n if (sd != null) intCheck(sd, 1, MAX);\n return format(this, sd, rm, 2);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\n *\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if (e === null) {\n if (s) {\n str = 'Infinity';\n if (s < 0) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n if (b == null) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential(coeffToString(n.c), e)\n : toFixedPoint(coeffToString(n.c), e, '0');\n } else if (b === 10) {\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\n } else {\n intCheck(b, 2, ALPHABET.length, 'Base');\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\n }\n\n if (s < 0 && n.c[0]) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return as toString, but do not accept a base argument, and include the minus sign for\n * negative zero.\n */\n P.valueOf = P.toJSON = function () {\n return valueOf(this);\n };\n\n\n P._isBigNumber = true;\n\n if (configObject != null) BigNumber.set(configObject);\n\n return BigNumber;\n }\n\n\n // PRIVATE HELPER FUNCTIONS\n\n // These functions don't need access to variables,\n // e.g. DECIMAL_PLACES, in the scope of the `clone` function above.\n\n\n function bitFloor(n) {\n var i = n | 0;\n return n > 0 || n === i ? i : i - 1;\n }\n\n\n // Return a coefficient array as a string of base 10 digits.\n function coeffToString(a) {\n var s, z,\n i = 1,\n j = a.length,\n r = a[0] + '';\n\n for (; i < j;) {\n s = a[i++] + '';\n z = LOG_BASE - s.length;\n for (; z--; s = '0' + s);\n r += s;\n }\n\n // Determine trailing zeros.\n for (j = r.length; r.charCodeAt(--j) === 48;);\n\n return r.slice(0, j + 1 || 1);\n }\n\n\n // Compare the value of BigNumbers x and y.\n function compare(x, y) {\n var a, b,\n xc = x.c,\n yc = y.c,\n i = x.s,\n j = y.s,\n k = x.e,\n l = y.e;\n\n // Either NaN?\n if (!i || !j) return null;\n\n a = xc && !xc[0];\n b = yc && !yc[0];\n\n // Either zero?\n if (a || b) return a ? b ? 0 : -j : i;\n\n // Signs differ?\n if (i != j) return i;\n\n a = i < 0;\n b = k == l;\n\n // Either Infinity?\n if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1;\n\n // Compare exponents.\n if (!b) return k > l ^ a ? 1 : -1;\n\n j = (k = xc.length) < (l = yc.length) ? k : l;\n\n // Compare digit by digit.\n for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;\n\n // Compare lengths.\n return k == l ? 0 : k > l ^ a ? 1 : -1;\n }\n\n\n /*\n * Check that n is a primitive number, an integer, and in range, otherwise throw.\n */\n function intCheck(n, min, max, name) {\n if (n < min || n > max || n !== mathfloor(n)) {\n throw Error\n (bignumberError + (name || 'Argument') + (typeof n == 'number'\n ? n < min || n > max ? ' out of range: ' : ' not an integer: '\n : ' not a primitive number: ') + String(n));\n }\n }\n\n\n // Assumes finite n.\n function isOdd(n) {\n var k = n.c.length - 1;\n return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;\n }\n\n\n function toExponential(str, e) {\n return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) +\n (e < 0 ? 'e' : 'e+') + e;\n }\n\n\n function toFixedPoint(str, e, z) {\n var len, zs;\n\n // Negative exponent?\n if (e < 0) {\n\n // Prepend zeros.\n for (zs = z + '.'; ++e; zs += z);\n str = zs + str;\n\n // Positive exponent\n } else {\n len = str.length;\n\n // Append zeros.\n if (++e > len) {\n for (zs = z, e -= len; --e; zs += z);\n str += zs;\n } else if (e < len) {\n str = str.slice(0, e) + '.' + str.slice(e);\n }\n }\n\n return str;\n }\n\n\n // EXPORT\n\n\n BigNumber = clone();\n BigNumber['default'] = BigNumber.BigNumber = BigNumber;\n\n // AMD.\n if ( module.exports) {\n module.exports = BigNumber;\n\n // Browser.\n } else {\n if (!globalObject) {\n globalObject = typeof self != 'undefined' && self ? self : window;\n }\n\n globalObject.BigNumber = BigNumber;\n }\n })(commonjsGlobal);\n });\n\n /* eslint-disable */\n var decoder_asm = function decodeAsm (stdlib, foreign, buffer) {\n 'use asm';\n\n // -- Imports\n\n var heap = new stdlib.Uint8Array(buffer);\n // var log = foreign.log\n var pushInt = foreign.pushInt;\n var pushInt32 = foreign.pushInt32;\n var pushInt32Neg = foreign.pushInt32Neg;\n var pushInt64 = foreign.pushInt64;\n var pushInt64Neg = foreign.pushInt64Neg;\n var pushFloat = foreign.pushFloat;\n var pushFloatSingle = foreign.pushFloatSingle;\n var pushFloatDouble = foreign.pushFloatDouble;\n var pushTrue = foreign.pushTrue;\n var pushFalse = foreign.pushFalse;\n var pushUndefined = foreign.pushUndefined;\n var pushNull = foreign.pushNull;\n var pushInfinity = foreign.pushInfinity;\n var pushInfinityNeg = foreign.pushInfinityNeg;\n var pushNaN = foreign.pushNaN;\n var pushNaNNeg = foreign.pushNaNNeg;\n\n var pushArrayStart = foreign.pushArrayStart;\n var pushArrayStartFixed = foreign.pushArrayStartFixed;\n var pushArrayStartFixed32 = foreign.pushArrayStartFixed32;\n var pushArrayStartFixed64 = foreign.pushArrayStartFixed64;\n var pushObjectStart = foreign.pushObjectStart;\n var pushObjectStartFixed = foreign.pushObjectStartFixed;\n var pushObjectStartFixed32 = foreign.pushObjectStartFixed32;\n var pushObjectStartFixed64 = foreign.pushObjectStartFixed64;\n\n var pushByteString = foreign.pushByteString;\n var pushByteStringStart = foreign.pushByteStringStart;\n var pushUtf8String = foreign.pushUtf8String;\n var pushUtf8StringStart = foreign.pushUtf8StringStart;\n\n var pushSimpleUnassigned = foreign.pushSimpleUnassigned;\n\n var pushTagStart = foreign.pushTagStart;\n var pushTagStart4 = foreign.pushTagStart4;\n var pushTagStart8 = foreign.pushTagStart8;\n var pushTagUnassigned = foreign.pushTagUnassigned;\n\n var pushBreak = foreign.pushBreak;\n\n var pow = stdlib.Math.pow;\n\n // -- Constants\n\n\n // -- Mutable Variables\n\n var offset = 0;\n var inputLength = 0;\n var code = 0;\n\n // Decode a cbor string represented as Uint8Array\n // which is allocated on the heap from 0 to inputLength\n //\n // input - Int\n //\n // Returns Code - Int,\n // Success = 0\n // Error > 0\n function parse (input) {\n input = input | 0;\n\n offset = 0;\n inputLength = input;\n\n while ((offset | 0) < (inputLength | 0)) {\n code = jumpTable[heap[offset] & 255](heap[offset] | 0) | 0;\n\n if ((code | 0) > 0) {\n break\n }\n }\n\n return code | 0\n }\n\n // -- Helper Function\n\n function checkOffset (n) {\n n = n | 0;\n\n if ((((offset | 0) + (n | 0)) | 0) < (inputLength | 0)) {\n return 0\n }\n\n return 1\n }\n\n function readUInt16 (n) {\n n = n | 0;\n\n return (\n (heap[n | 0] << 8) | heap[(n + 1) | 0]\n ) | 0\n }\n\n function readUInt32 (n) {\n n = n | 0;\n\n return (\n (heap[n | 0] << 24) | (heap[(n + 1) | 0] << 16) | (heap[(n + 2) | 0] << 8) | heap[(n + 3) | 0]\n ) | 0\n }\n\n // -- Initial Byte Handlers\n\n function INT_P (octet) {\n octet = octet | 0;\n\n pushInt(octet | 0);\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function UINT_P_8 (octet) {\n octet = octet | 0;\n\n if (checkOffset(1) | 0) {\n return 1\n }\n\n pushInt(heap[(offset + 1) | 0] | 0);\n\n offset = (offset + 2) | 0;\n\n return 0\n }\n\n function UINT_P_16 (octet) {\n octet = octet | 0;\n\n if (checkOffset(2) | 0) {\n return 1\n }\n\n pushInt(\n readUInt16((offset + 1) | 0) | 0\n );\n\n offset = (offset + 3) | 0;\n\n return 0\n }\n\n function UINT_P_32 (octet) {\n octet = octet | 0;\n\n if (checkOffset(4) | 0) {\n return 1\n }\n\n pushInt32(\n readUInt16((offset + 1) | 0) | 0,\n readUInt16((offset + 3) | 0) | 0\n );\n\n offset = (offset + 5) | 0;\n\n return 0\n }\n\n function UINT_P_64 (octet) {\n octet = octet | 0;\n\n if (checkOffset(8) | 0) {\n return 1\n }\n\n pushInt64(\n readUInt16((offset + 1) | 0) | 0,\n readUInt16((offset + 3) | 0) | 0,\n readUInt16((offset + 5) | 0) | 0,\n readUInt16((offset + 7) | 0) | 0\n );\n\n offset = (offset + 9) | 0;\n\n return 0\n }\n\n function INT_N (octet) {\n octet = octet | 0;\n\n pushInt((-1 - ((octet - 32) | 0)) | 0);\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function UINT_N_8 (octet) {\n octet = octet | 0;\n\n if (checkOffset(1) | 0) {\n return 1\n }\n\n pushInt(\n (-1 - (heap[(offset + 1) | 0] | 0)) | 0\n );\n\n offset = (offset + 2) | 0;\n\n return 0\n }\n\n function UINT_N_16 (octet) {\n octet = octet | 0;\n\n var val = 0;\n\n if (checkOffset(2) | 0) {\n return 1\n }\n\n val = readUInt16((offset + 1) | 0) | 0;\n pushInt((-1 - (val | 0)) | 0);\n\n offset = (offset + 3) | 0;\n\n return 0\n }\n\n function UINT_N_32 (octet) {\n octet = octet | 0;\n\n if (checkOffset(4) | 0) {\n return 1\n }\n\n pushInt32Neg(\n readUInt16((offset + 1) | 0) | 0,\n readUInt16((offset + 3) | 0) | 0\n );\n\n offset = (offset + 5) | 0;\n\n return 0\n }\n\n function UINT_N_64 (octet) {\n octet = octet | 0;\n\n if (checkOffset(8) | 0) {\n return 1\n }\n\n pushInt64Neg(\n readUInt16((offset + 1) | 0) | 0,\n readUInt16((offset + 3) | 0) | 0,\n readUInt16((offset + 5) | 0) | 0,\n readUInt16((offset + 7) | 0) | 0\n );\n\n offset = (offset + 9) | 0;\n\n return 0\n }\n\n function BYTE_STRING (octet) {\n octet = octet | 0;\n\n var start = 0;\n var end = 0;\n var step = 0;\n\n step = (octet - 64) | 0;\n if (checkOffset(step | 0) | 0) {\n return 1\n }\n\n start = (offset + 1) | 0;\n end = (((offset + 1) | 0) + (step | 0)) | 0;\n\n pushByteString(start | 0, end | 0);\n\n offset = end | 0;\n\n return 0\n }\n\n function BYTE_STRING_8 (octet) {\n octet = octet | 0;\n\n var start = 0;\n var end = 0;\n var length = 0;\n\n if (checkOffset(1) | 0) {\n return 1\n }\n\n length = heap[(offset + 1) | 0] | 0;\n start = (offset + 2) | 0;\n end = (((offset + 2) | 0) + (length | 0)) | 0;\n\n if (checkOffset((length + 1) | 0) | 0) {\n return 1\n }\n\n pushByteString(start | 0, end | 0);\n\n offset = end | 0;\n\n return 0\n }\n\n function BYTE_STRING_16 (octet) {\n octet = octet | 0;\n\n var start = 0;\n var end = 0;\n var length = 0;\n\n if (checkOffset(2) | 0) {\n return 1\n }\n\n length = readUInt16((offset + 1) | 0) | 0;\n start = (offset + 3) | 0;\n end = (((offset + 3) | 0) + (length | 0)) | 0;\n\n\n if (checkOffset((length + 2) | 0) | 0) {\n return 1\n }\n\n pushByteString(start | 0, end | 0);\n\n offset = end | 0;\n\n return 0\n }\n\n function BYTE_STRING_32 (octet) {\n octet = octet | 0;\n\n var start = 0;\n var end = 0;\n var length = 0;\n\n if (checkOffset(4) | 0) {\n return 1\n }\n\n length = readUInt32((offset + 1) | 0) | 0;\n start = (offset + 5) | 0;\n end = (((offset + 5) | 0) + (length | 0)) | 0;\n\n\n if (checkOffset((length + 4) | 0) | 0) {\n return 1\n }\n\n pushByteString(start | 0, end | 0);\n\n offset = end | 0;\n\n return 0\n }\n\n function BYTE_STRING_64 (octet) {\n // NOT IMPLEMENTED\n octet = octet | 0;\n\n return 1\n }\n\n function BYTE_STRING_BREAK (octet) {\n octet = octet | 0;\n\n pushByteStringStart();\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function UTF8_STRING (octet) {\n octet = octet | 0;\n\n var start = 0;\n var end = 0;\n var step = 0;\n\n step = (octet - 96) | 0;\n\n if (checkOffset(step | 0) | 0) {\n return 1\n }\n\n start = (offset + 1) | 0;\n end = (((offset + 1) | 0) + (step | 0)) | 0;\n\n pushUtf8String(start | 0, end | 0);\n\n offset = end | 0;\n\n return 0\n }\n\n function UTF8_STRING_8 (octet) {\n octet = octet | 0;\n\n var start = 0;\n var end = 0;\n var length = 0;\n\n if (checkOffset(1) | 0) {\n return 1\n }\n\n length = heap[(offset + 1) | 0] | 0;\n start = (offset + 2) | 0;\n end = (((offset + 2) | 0) + (length | 0)) | 0;\n\n if (checkOffset((length + 1) | 0) | 0) {\n return 1\n }\n\n pushUtf8String(start | 0, end | 0);\n\n offset = end | 0;\n\n return 0\n }\n\n function UTF8_STRING_16 (octet) {\n octet = octet | 0;\n\n var start = 0;\n var end = 0;\n var length = 0;\n\n if (checkOffset(2) | 0) {\n return 1\n }\n\n length = readUInt16((offset + 1) | 0) | 0;\n start = (offset + 3) | 0;\n end = (((offset + 3) | 0) + (length | 0)) | 0;\n\n if (checkOffset((length + 2) | 0) | 0) {\n return 1\n }\n\n pushUtf8String(start | 0, end | 0);\n\n offset = end | 0;\n\n return 0\n }\n\n function UTF8_STRING_32 (octet) {\n octet = octet | 0;\n\n var start = 0;\n var end = 0;\n var length = 0;\n\n if (checkOffset(4) | 0) {\n return 1\n }\n\n length = readUInt32((offset + 1) | 0) | 0;\n start = (offset + 5) | 0;\n end = (((offset + 5) | 0) + (length | 0)) | 0;\n\n if (checkOffset((length + 4) | 0) | 0) {\n return 1\n }\n\n pushUtf8String(start | 0, end | 0);\n\n offset = end | 0;\n\n return 0\n }\n\n function UTF8_STRING_64 (octet) {\n // NOT IMPLEMENTED\n octet = octet | 0;\n\n return 1\n }\n\n function UTF8_STRING_BREAK (octet) {\n octet = octet | 0;\n\n pushUtf8StringStart();\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function ARRAY (octet) {\n octet = octet | 0;\n\n pushArrayStartFixed((octet - 128) | 0);\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function ARRAY_8 (octet) {\n octet = octet | 0;\n\n if (checkOffset(1) | 0) {\n return 1\n }\n\n pushArrayStartFixed(heap[(offset + 1) | 0] | 0);\n\n offset = (offset + 2) | 0;\n\n return 0\n }\n\n function ARRAY_16 (octet) {\n octet = octet | 0;\n\n if (checkOffset(2) | 0) {\n return 1\n }\n\n pushArrayStartFixed(\n readUInt16((offset + 1) | 0) | 0\n );\n\n offset = (offset + 3) | 0;\n\n return 0\n }\n\n function ARRAY_32 (octet) {\n octet = octet | 0;\n\n if (checkOffset(4) | 0) {\n return 1\n }\n\n pushArrayStartFixed32(\n readUInt16((offset + 1) | 0) | 0,\n readUInt16((offset + 3) | 0) | 0\n );\n\n offset = (offset + 5) | 0;\n\n return 0\n }\n\n function ARRAY_64 (octet) {\n octet = octet | 0;\n\n if (checkOffset(8) | 0) {\n return 1\n }\n\n pushArrayStartFixed64(\n readUInt16((offset + 1) | 0) | 0,\n readUInt16((offset + 3) | 0) | 0,\n readUInt16((offset + 5) | 0) | 0,\n readUInt16((offset + 7) | 0) | 0\n );\n\n offset = (offset + 9) | 0;\n\n return 0\n }\n\n function ARRAY_BREAK (octet) {\n octet = octet | 0;\n\n pushArrayStart();\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function MAP (octet) {\n octet = octet | 0;\n\n var step = 0;\n\n step = (octet - 160) | 0;\n\n if (checkOffset(step | 0) | 0) {\n return 1\n }\n\n pushObjectStartFixed(step | 0);\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function MAP_8 (octet) {\n octet = octet | 0;\n\n if (checkOffset(1) | 0) {\n return 1\n }\n\n pushObjectStartFixed(heap[(offset + 1) | 0] | 0);\n\n offset = (offset + 2) | 0;\n\n return 0\n }\n\n function MAP_16 (octet) {\n octet = octet | 0;\n\n if (checkOffset(2) | 0) {\n return 1\n }\n\n pushObjectStartFixed(\n readUInt16((offset + 1) | 0) | 0\n );\n\n offset = (offset + 3) | 0;\n\n return 0\n }\n\n function MAP_32 (octet) {\n octet = octet | 0;\n\n if (checkOffset(4) | 0) {\n return 1\n }\n\n pushObjectStartFixed32(\n readUInt16((offset + 1) | 0) | 0,\n readUInt16((offset + 3) | 0) | 0\n );\n\n offset = (offset + 5) | 0;\n\n return 0\n }\n\n function MAP_64 (octet) {\n octet = octet | 0;\n\n if (checkOffset(8) | 0) {\n return 1\n }\n\n pushObjectStartFixed64(\n readUInt16((offset + 1) | 0) | 0,\n readUInt16((offset + 3) | 0) | 0,\n readUInt16((offset + 5) | 0) | 0,\n readUInt16((offset + 7) | 0) | 0\n );\n\n offset = (offset + 9) | 0;\n\n return 0\n }\n\n function MAP_BREAK (octet) {\n octet = octet | 0;\n\n pushObjectStart();\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function TAG_KNOWN (octet) {\n octet = octet | 0;\n\n pushTagStart((octet - 192| 0) | 0);\n\n offset = (offset + 1 | 0);\n\n return 0\n }\n\n function TAG_BIGNUM_POS (octet) {\n octet = octet | 0;\n\n pushTagStart(octet | 0);\n\n offset = (offset + 1 | 0);\n\n return 0\n }\n\n function TAG_BIGNUM_NEG (octet) {\n octet = octet | 0;\n\n pushTagStart(octet | 0);\n\n offset = (offset + 1 | 0);\n\n return 0\n }\n\n function TAG_FRAC (octet) {\n octet = octet | 0;\n\n pushTagStart(octet | 0);\n\n offset = (offset + 1 | 0);\n\n return 0\n }\n\n function TAG_BIGNUM_FLOAT (octet) {\n octet = octet | 0;\n\n pushTagStart(octet | 0);\n\n offset = (offset + 1 | 0);\n\n return 0\n }\n\n function TAG_UNASSIGNED (octet) {\n octet = octet | 0;\n\n pushTagStart((octet - 192| 0) | 0);\n\n offset = (offset + 1 | 0);\n\n return 0\n }\n\n function TAG_BASE64_URL (octet) {\n octet = octet | 0;\n\n pushTagStart(octet | 0);\n\n offset = (offset + 1 | 0);\n\n return 0\n }\n\n function TAG_BASE64 (octet) {\n octet = octet | 0;\n\n pushTagStart(octet | 0);\n\n offset = (offset + 1 | 0);\n\n return 0\n }\n\n function TAG_BASE16 (octet) {\n octet = octet | 0;\n\n pushTagStart(octet | 0);\n\n offset = (offset + 1 | 0);\n\n return 0\n }\n\n function TAG_MORE_1 (octet) {\n octet = octet | 0;\n\n if (checkOffset(1) | 0) {\n return 1\n }\n\n pushTagStart(heap[(offset + 1) | 0] | 0);\n\n offset = (offset + 2 | 0);\n\n return 0\n }\n\n function TAG_MORE_2 (octet) {\n octet = octet | 0;\n\n if (checkOffset(2) | 0) {\n return 1\n }\n\n pushTagStart(\n readUInt16((offset + 1) | 0) | 0\n );\n\n offset = (offset + 3 | 0);\n\n return 0\n }\n\n function TAG_MORE_4 (octet) {\n octet = octet | 0;\n\n if (checkOffset(4) | 0) {\n return 1\n }\n\n pushTagStart4(\n readUInt16((offset + 1) | 0) | 0,\n readUInt16((offset + 3) | 0) | 0\n );\n\n offset = (offset + 5 | 0);\n\n return 0\n }\n\n function TAG_MORE_8 (octet) {\n octet = octet | 0;\n\n if (checkOffset(8) | 0) {\n return 1\n }\n\n pushTagStart8(\n readUInt16((offset + 1) | 0) | 0,\n readUInt16((offset + 3) | 0) | 0,\n readUInt16((offset + 5) | 0) | 0,\n readUInt16((offset + 7) | 0) | 0\n );\n\n offset = (offset + 9 | 0);\n\n return 0\n }\n\n function SIMPLE_UNASSIGNED (octet) {\n octet = octet | 0;\n\n pushSimpleUnassigned(((octet | 0) - 224) | 0);\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function SIMPLE_FALSE (octet) {\n octet = octet | 0;\n\n pushFalse();\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function SIMPLE_TRUE (octet) {\n octet = octet | 0;\n\n pushTrue();\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function SIMPLE_NULL (octet) {\n octet = octet | 0;\n\n pushNull();\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function SIMPLE_UNDEFINED (octet) {\n octet = octet | 0;\n\n pushUndefined();\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n function SIMPLE_BYTE (octet) {\n octet = octet | 0;\n\n if (checkOffset(1) | 0) {\n return 1\n }\n\n pushSimpleUnassigned(heap[(offset + 1) | 0] | 0);\n\n offset = (offset + 2) | 0;\n\n return 0\n }\n\n function SIMPLE_FLOAT_HALF (octet) {\n octet = octet | 0;\n\n var f = 0;\n var g = 0;\n var sign = 1.0;\n var exp = 0.0;\n var mant = 0.0;\n var r = 0.0;\n if (checkOffset(2) | 0) {\n return 1\n }\n\n f = heap[(offset + 1) | 0] | 0;\n g = heap[(offset + 2) | 0] | 0;\n\n if ((f | 0) & 0x80) {\n sign = -1.0;\n }\n\n exp = +(((f | 0) & 0x7C) >> 2);\n mant = +((((f | 0) & 0x03) << 8) | g);\n\n if (+exp == 0.0) {\n pushFloat(+(\n (+sign) * +5.9604644775390625e-8 * (+mant)\n ));\n } else if (+exp == 31.0) {\n if (+sign == 1.0) {\n if (+mant > 0.0) {\n pushNaN();\n } else {\n pushInfinity();\n }\n } else {\n if (+mant > 0.0) {\n pushNaNNeg();\n } else {\n pushInfinityNeg();\n }\n }\n } else {\n pushFloat(+(\n +sign * pow(+2, +(+exp - 25.0)) * +(1024.0 + mant)\n ));\n }\n\n offset = (offset + 3) | 0;\n\n return 0\n }\n\n function SIMPLE_FLOAT_SINGLE (octet) {\n octet = octet | 0;\n\n if (checkOffset(4) | 0) {\n return 1\n }\n\n pushFloatSingle(\n heap[(offset + 1) | 0] | 0,\n heap[(offset + 2) | 0] | 0,\n heap[(offset + 3) | 0] | 0,\n heap[(offset + 4) | 0] | 0\n );\n\n offset = (offset + 5) | 0;\n\n return 0\n }\n\n function SIMPLE_FLOAT_DOUBLE (octet) {\n octet = octet | 0;\n\n if (checkOffset(8) | 0) {\n return 1\n }\n\n pushFloatDouble(\n heap[(offset + 1) | 0] | 0,\n heap[(offset + 2) | 0] | 0,\n heap[(offset + 3) | 0] | 0,\n heap[(offset + 4) | 0] | 0,\n heap[(offset + 5) | 0] | 0,\n heap[(offset + 6) | 0] | 0,\n heap[(offset + 7) | 0] | 0,\n heap[(offset + 8) | 0] | 0\n );\n\n offset = (offset + 9) | 0;\n\n return 0\n }\n\n function ERROR (octet) {\n octet = octet | 0;\n\n return 1\n }\n\n function BREAK (octet) {\n octet = octet | 0;\n\n pushBreak();\n\n offset = (offset + 1) | 0;\n\n return 0\n }\n\n // -- Jump Table\n\n var jumpTable = [\n // Integer 0x00..0x17 (0..23)\n INT_P, // 0x00\n INT_P, // 0x01\n INT_P, // 0x02\n INT_P, // 0x03\n INT_P, // 0x04\n INT_P, // 0x05\n INT_P, // 0x06\n INT_P, // 0x07\n INT_P, // 0x08\n INT_P, // 0x09\n INT_P, // 0x0A\n INT_P, // 0x0B\n INT_P, // 0x0C\n INT_P, // 0x0D\n INT_P, // 0x0E\n INT_P, // 0x0F\n INT_P, // 0x10\n INT_P, // 0x11\n INT_P, // 0x12\n INT_P, // 0x13\n INT_P, // 0x14\n INT_P, // 0x15\n INT_P, // 0x16\n INT_P, // 0x17\n // Unsigned integer (one-byte uint8_t follows)\n UINT_P_8, // 0x18\n // Unsigned integer (two-byte uint16_t follows)\n UINT_P_16, // 0x19\n // Unsigned integer (four-byte uint32_t follows)\n UINT_P_32, // 0x1a\n // Unsigned integer (eight-byte uint64_t follows)\n UINT_P_64, // 0x1b\n ERROR, // 0x1c\n ERROR, // 0x1d\n ERROR, // 0x1e\n ERROR, // 0x1f\n // Negative integer -1-0x00..-1-0x17 (-1..-24)\n INT_N, // 0x20\n INT_N, // 0x21\n INT_N, // 0x22\n INT_N, // 0x23\n INT_N, // 0x24\n INT_N, // 0x25\n INT_N, // 0x26\n INT_N, // 0x27\n INT_N, // 0x28\n INT_N, // 0x29\n INT_N, // 0x2A\n INT_N, // 0x2B\n INT_N, // 0x2C\n INT_N, // 0x2D\n INT_N, // 0x2E\n INT_N, // 0x2F\n INT_N, // 0x30\n INT_N, // 0x31\n INT_N, // 0x32\n INT_N, // 0x33\n INT_N, // 0x34\n INT_N, // 0x35\n INT_N, // 0x36\n INT_N, // 0x37\n // Negative integer -1-n (one-byte uint8_t for n follows)\n UINT_N_8, // 0x38\n // Negative integer -1-n (two-byte uint16_t for n follows)\n UINT_N_16, // 0x39\n // Negative integer -1-n (four-byte uint32_t for nfollows)\n UINT_N_32, // 0x3a\n // Negative integer -1-n (eight-byte uint64_t for n follows)\n UINT_N_64, // 0x3b\n ERROR, // 0x3c\n ERROR, // 0x3d\n ERROR, // 0x3e\n ERROR, // 0x3f\n // byte string (0x00..0x17 bytes follow)\n BYTE_STRING, // 0x40\n BYTE_STRING, // 0x41\n BYTE_STRING, // 0x42\n BYTE_STRING, // 0x43\n BYTE_STRING, // 0x44\n BYTE_STRING, // 0x45\n BYTE_STRING, // 0x46\n BYTE_STRING, // 0x47\n BYTE_STRING, // 0x48\n BYTE_STRING, // 0x49\n BYTE_STRING, // 0x4A\n BYTE_STRING, // 0x4B\n BYTE_STRING, // 0x4C\n BYTE_STRING, // 0x4D\n BYTE_STRING, // 0x4E\n BYTE_STRING, // 0x4F\n BYTE_STRING, // 0x50\n BYTE_STRING, // 0x51\n BYTE_STRING, // 0x52\n BYTE_STRING, // 0x53\n BYTE_STRING, // 0x54\n BYTE_STRING, // 0x55\n BYTE_STRING, // 0x56\n BYTE_STRING, // 0x57\n // byte string (one-byte uint8_t for n, and then n bytes follow)\n BYTE_STRING_8, // 0x58\n // byte string (two-byte uint16_t for n, and then n bytes follow)\n BYTE_STRING_16, // 0x59\n // byte string (four-byte uint32_t for n, and then n bytes follow)\n BYTE_STRING_32, // 0x5a\n // byte string (eight-byte uint64_t for n, and then n bytes follow)\n BYTE_STRING_64, // 0x5b\n ERROR, // 0x5c\n ERROR, // 0x5d\n ERROR, // 0x5e\n // byte string, byte strings follow, terminated by \"break\"\n BYTE_STRING_BREAK, // 0x5f\n // UTF-8 string (0x00..0x17 bytes follow)\n UTF8_STRING, // 0x60\n UTF8_STRING, // 0x61\n UTF8_STRING, // 0x62\n UTF8_STRING, // 0x63\n UTF8_STRING, // 0x64\n UTF8_STRING, // 0x65\n UTF8_STRING, // 0x66\n UTF8_STRING, // 0x67\n UTF8_STRING, // 0x68\n UTF8_STRING, // 0x69\n UTF8_STRING, // 0x6A\n UTF8_STRING, // 0x6B\n UTF8_STRING, // 0x6C\n UTF8_STRING, // 0x6D\n UTF8_STRING, // 0x6E\n UTF8_STRING, // 0x6F\n UTF8_STRING, // 0x70\n UTF8_STRING, // 0x71\n UTF8_STRING, // 0x72\n UTF8_STRING, // 0x73\n UTF8_STRING, // 0x74\n UTF8_STRING, // 0x75\n UTF8_STRING, // 0x76\n UTF8_STRING, // 0x77\n // UTF-8 string (one-byte uint8_t for n, and then n bytes follow)\n UTF8_STRING_8, // 0x78\n // UTF-8 string (two-byte uint16_t for n, and then n bytes follow)\n UTF8_STRING_16, // 0x79\n // UTF-8 string (four-byte uint32_t for n, and then n bytes follow)\n UTF8_STRING_32, // 0x7a\n // UTF-8 string (eight-byte uint64_t for n, and then n bytes follow)\n UTF8_STRING_64, // 0x7b\n // UTF-8 string, UTF-8 strings follow, terminated by \"break\"\n ERROR, // 0x7c\n ERROR, // 0x7d\n ERROR, // 0x7e\n UTF8_STRING_BREAK, // 0x7f\n // array (0x00..0x17 data items follow)\n ARRAY, // 0x80\n ARRAY, // 0x81\n ARRAY, // 0x82\n ARRAY, // 0x83\n ARRAY, // 0x84\n ARRAY, // 0x85\n ARRAY, // 0x86\n ARRAY, // 0x87\n ARRAY, // 0x88\n ARRAY, // 0x89\n ARRAY, // 0x8A\n ARRAY, // 0x8B\n ARRAY, // 0x8C\n ARRAY, // 0x8D\n ARRAY, // 0x8E\n ARRAY, // 0x8F\n ARRAY, // 0x90\n ARRAY, // 0x91\n ARRAY, // 0x92\n ARRAY, // 0x93\n ARRAY, // 0x94\n ARRAY, // 0x95\n ARRAY, // 0x96\n ARRAY, // 0x97\n // array (one-byte uint8_t fo, and then n data items follow)\n ARRAY_8, // 0x98\n // array (two-byte uint16_t for n, and then n data items follow)\n ARRAY_16, // 0x99\n // array (four-byte uint32_t for n, and then n data items follow)\n ARRAY_32, // 0x9a\n // array (eight-byte uint64_t for n, and then n data items follow)\n ARRAY_64, // 0x9b\n // array, data items follow, terminated by \"break\"\n ERROR, // 0x9c\n ERROR, // 0x9d\n ERROR, // 0x9e\n ARRAY_BREAK, // 0x9f\n // map (0x00..0x17 pairs of data items follow)\n MAP, // 0xa0\n MAP, // 0xa1\n MAP, // 0xa2\n MAP, // 0xa3\n MAP, // 0xa4\n MAP, // 0xa5\n MAP, // 0xa6\n MAP, // 0xa7\n MAP, // 0xa8\n MAP, // 0xa9\n MAP, // 0xaA\n MAP, // 0xaB\n MAP, // 0xaC\n MAP, // 0xaD\n MAP, // 0xaE\n MAP, // 0xaF\n MAP, // 0xb0\n MAP, // 0xb1\n MAP, // 0xb2\n MAP, // 0xb3\n MAP, // 0xb4\n MAP, // 0xb5\n MAP, // 0xb6\n MAP, // 0xb7\n // map (one-byte uint8_t for n, and then n pairs of data items follow)\n MAP_8, // 0xb8\n // map (two-byte uint16_t for n, and then n pairs of data items follow)\n MAP_16, // 0xb9\n // map (four-byte uint32_t for n, and then n pairs of data items follow)\n MAP_32, // 0xba\n // map (eight-byte uint64_t for n, and then n pairs of data items follow)\n MAP_64, // 0xbb\n ERROR, // 0xbc\n ERROR, // 0xbd\n ERROR, // 0xbe\n // map, pairs of data items follow, terminated by \"break\"\n MAP_BREAK, // 0xbf\n // Text-based date/time (data item follows; see Section 2.4.1)\n TAG_KNOWN, // 0xc0\n // Epoch-based date/time (data item follows; see Section 2.4.1)\n TAG_KNOWN, // 0xc1\n // Positive bignum (data item \"byte string\" follows)\n TAG_KNOWN, // 0xc2\n // Negative bignum (data item \"byte string\" follows)\n TAG_KNOWN, // 0xc3\n // Decimal Fraction (data item \"array\" follows; see Section 2.4.3)\n TAG_KNOWN, // 0xc4\n // Bigfloat (data item \"array\" follows; see Section 2.4.3)\n TAG_KNOWN, // 0xc5\n // (tagged item)\n TAG_UNASSIGNED, // 0xc6\n TAG_UNASSIGNED, // 0xc7\n TAG_UNASSIGNED, // 0xc8\n TAG_UNASSIGNED, // 0xc9\n TAG_UNASSIGNED, // 0xca\n TAG_UNASSIGNED, // 0xcb\n TAG_UNASSIGNED, // 0xcc\n TAG_UNASSIGNED, // 0xcd\n TAG_UNASSIGNED, // 0xce\n TAG_UNASSIGNED, // 0xcf\n TAG_UNASSIGNED, // 0xd0\n TAG_UNASSIGNED, // 0xd1\n TAG_UNASSIGNED, // 0xd2\n TAG_UNASSIGNED, // 0xd3\n TAG_UNASSIGNED, // 0xd4\n // Expected Conversion (data item follows; see Section 2.4.4.2)\n TAG_UNASSIGNED, // 0xd5\n TAG_UNASSIGNED, // 0xd6\n TAG_UNASSIGNED, // 0xd7\n // (more tagged items, 1/2/4/8 bytes and then a data item follow)\n TAG_MORE_1, // 0xd8\n TAG_MORE_2, // 0xd9\n TAG_MORE_4, // 0xda\n TAG_MORE_8, // 0xdb\n ERROR, // 0xdc\n ERROR, // 0xdd\n ERROR, // 0xde\n ERROR, // 0xdf\n // (simple value)\n SIMPLE_UNASSIGNED, // 0xe0\n SIMPLE_UNASSIGNED, // 0xe1\n SIMPLE_UNASSIGNED, // 0xe2\n SIMPLE_UNASSIGNED, // 0xe3\n SIMPLE_UNASSIGNED, // 0xe4\n SIMPLE_UNASSIGNED, // 0xe5\n SIMPLE_UNASSIGNED, // 0xe6\n SIMPLE_UNASSIGNED, // 0xe7\n SIMPLE_UNASSIGNED, // 0xe8\n SIMPLE_UNASSIGNED, // 0xe9\n SIMPLE_UNASSIGNED, // 0xea\n SIMPLE_UNASSIGNED, // 0xeb\n SIMPLE_UNASSIGNED, // 0xec\n SIMPLE_UNASSIGNED, // 0xed\n SIMPLE_UNASSIGNED, // 0xee\n SIMPLE_UNASSIGNED, // 0xef\n SIMPLE_UNASSIGNED, // 0xf0\n SIMPLE_UNASSIGNED, // 0xf1\n SIMPLE_UNASSIGNED, // 0xf2\n SIMPLE_UNASSIGNED, // 0xf3\n // False\n SIMPLE_FALSE, // 0xf4\n // True\n SIMPLE_TRUE, // 0xf5\n // Null\n SIMPLE_NULL, // 0xf6\n // Undefined\n SIMPLE_UNDEFINED, // 0xf7\n // (simple value, one byte follows)\n SIMPLE_BYTE, // 0xf8\n // Half-Precision Float (two-byte IEEE 754)\n SIMPLE_FLOAT_HALF, // 0xf9\n // Single-Precision Float (four-byte IEEE 754)\n SIMPLE_FLOAT_SINGLE, // 0xfa\n // Double-Precision Float (eight-byte IEEE 754)\n SIMPLE_FLOAT_DOUBLE, // 0xfb\n ERROR, // 0xfc\n ERROR, // 0xfd\n ERROR, // 0xfe\n // \"break\" stop code\n BREAK // 0xff\n ];\n\n // --\n\n return {\n parse: parse\n }\n };\n\n const Bignumber = bignumber.BigNumber;\n\n var MT = {\n POS_INT: 0,\n NEG_INT: 1,\n BYTE_STRING: 2,\n UTF8_STRING: 3,\n ARRAY: 4,\n MAP: 5,\n TAG: 6,\n SIMPLE_FLOAT: 7\n };\n\n var TAG = {\n DATE_STRING: 0,\n DATE_EPOCH: 1,\n POS_BIGINT: 2,\n NEG_BIGINT: 3,\n DECIMAL_FRAC: 4,\n BIGFLOAT: 5,\n BASE64URL_EXPECTED: 21,\n BASE64_EXPECTED: 22,\n BASE16_EXPECTED: 23,\n CBOR: 24,\n URI: 32,\n BASE64URL: 33,\n BASE64: 34,\n REGEXP: 35,\n MIME: 36\n };\n\n var NUMBYTES = {\n ZERO: 0,\n ONE: 24,\n TWO: 25,\n FOUR: 26,\n EIGHT: 27,\n INDEFINITE: 31\n };\n\n var SIMPLE = {\n FALSE: 20,\n TRUE: 21,\n NULL: 22,\n UNDEFINED: 23\n };\n\n var SYMS = {\n NULL: Symbol('null'),\n UNDEFINED: Symbol('undef'),\n PARENT: Symbol('parent'),\n BREAK: Symbol('break'),\n STREAM: Symbol('stream')\n };\n\n var SHIFT32 = Math.pow(2, 32);\n var SHIFT16 = Math.pow(2, 16);\n\n var MAX_SAFE_HIGH = 0x1fffff;\n var NEG_ONE = new Bignumber(-1);\n var TEN = new Bignumber(10);\n var TWO = new Bignumber(2);\n\n var PARENT = {\n ARRAY: 0,\n OBJECT: 1,\n MAP: 2,\n TAG: 3,\n BYTE_STRING: 4,\n UTF8_STRING: 5\n };\n\n var constants$4 = {\n \tMT: MT,\n \tTAG: TAG,\n \tNUMBYTES: NUMBYTES,\n \tSIMPLE: SIMPLE,\n \tSYMS: SYMS,\n \tSHIFT32: SHIFT32,\n \tSHIFT16: SHIFT16,\n \tMAX_SAFE_HIGH: MAX_SAFE_HIGH,\n \tNEG_ONE: NEG_ONE,\n \tTEN: TEN,\n \tTWO: TWO,\n \tPARENT: PARENT\n };\n\n var utils$4 = createCommonjsModule(function (module, exports) {\n\n const { Buffer } = buffer$2;\n const Bignumber = bignumber.BigNumber;\n\n\n const SHIFT32 = constants$4.SHIFT32;\n const SHIFT16 = constants$4.SHIFT16;\n const MAX_SAFE_HIGH = 0x1fffff;\n\n exports.parseHalf = function parseHalf (buf) {\n var exp, mant, sign;\n sign = buf[0] & 0x80 ? -1 : 1;\n exp = (buf[0] & 0x7C) >> 2;\n mant = ((buf[0] & 0x03) << 8) | buf[1];\n if (!exp) {\n return sign * 5.9604644775390625e-8 * mant\n } else if (exp === 0x1f) {\n return sign * (mant ? 0 / 0 : 2e308)\n } else {\n return sign * Math.pow(2, exp - 25) * (1024 + mant)\n }\n };\n\n function toHex (n) {\n if (n < 16) {\n return '0' + n.toString(16)\n }\n\n return n.toString(16)\n }\n\n exports.arrayBufferToBignumber = function (buf) {\n const len = buf.byteLength;\n let res = '';\n for (let i = 0; i < len; i++) {\n res += toHex(buf[i]);\n }\n\n return new Bignumber(res, 16)\n };\n\n // convert an Object into a Map\n exports.buildMap = (obj) => {\n const res = new Map();\n const keys = Object.keys(obj);\n const length = keys.length;\n for (let i = 0; i < length; i++) {\n res.set(keys[i], obj[keys[i]]);\n }\n return res\n };\n\n exports.buildInt32 = (f, g) => {\n return f * SHIFT16 + g\n };\n\n exports.buildInt64 = (f1, f2, g1, g2) => {\n const f = exports.buildInt32(f1, f2);\n const g = exports.buildInt32(g1, g2);\n\n if (f > MAX_SAFE_HIGH) {\n return new Bignumber(f).times(SHIFT32).plus(g)\n } else {\n return (f * SHIFT32) + g\n }\n };\n\n exports.writeHalf = function writeHalf (buf, half) {\n // assume 0, -0, NaN, Infinity, and -Infinity have already been caught\n\n // HACK: everyone settle in. This isn't going to be pretty.\n // Translate cn-cbor's C code (from Carsten Borman):\n\n // uint32_t be32;\n // uint16_t be16, u16;\n // union {\n // float f;\n // uint32_t u;\n // } u32;\n // u32.f = float_val;\n\n const u32 = Buffer.allocUnsafe(4);\n u32.writeFloatBE(half, 0);\n const u = u32.readUInt32BE(0);\n\n // if ((u32.u & 0x1FFF) == 0) { /* worth trying half */\n\n // hildjj: If the lower 13 bits are 0, we won't lose anything in the conversion\n if ((u & 0x1FFF) !== 0) {\n return false\n }\n\n // int s16 = (u32.u >> 16) & 0x8000;\n // int exp = (u32.u >> 23) & 0xff;\n // int mant = u32.u & 0x7fffff;\n\n var s16 = (u >> 16) & 0x8000; // top bit is sign\n const exp = (u >> 23) & 0xff; // then 5 bits of exponent\n const mant = u & 0x7fffff;\n\n // if (exp == 0 && mant == 0)\n // ; /* 0.0, -0.0 */\n\n // hildjj: zeros already handled. Assert if you don't believe me.\n\n // else if (exp >= 113 && exp <= 142) /* normalized */\n // s16 += ((exp - 112) << 10) + (mant >> 13);\n if ((exp >= 113) && (exp <= 142)) {\n s16 += ((exp - 112) << 10) + (mant >> 13);\n\n // else if (exp >= 103 && exp < 113) { /* denorm, exp16 = 0 */\n // if (mant & ((1 << (126 - exp)) - 1))\n // goto float32; /* loss of precision */\n // s16 += ((mant + 0x800000) >> (126 - exp));\n } else if ((exp >= 103) && (exp < 113)) {\n if (mant & ((1 << (126 - exp)) - 1)) {\n return false\n }\n s16 += ((mant + 0x800000) >> (126 - exp));\n\n // } else if (exp == 255 && mant == 0) { /* Inf */\n // s16 += 0x7c00;\n\n // hildjj: Infinity already handled\n\n // } else\n // goto float32; /* loss of range */\n } else {\n return false\n }\n\n // ensure_writable(3);\n // u16 = s16;\n // be16 = hton16p((const uint8_t*)&u16);\n buf.writeUInt16BE(s16, 0);\n return true\n };\n\n exports.keySorter = function (a, b) {\n var lenA = a[0].byteLength;\n var lenB = b[0].byteLength;\n\n if (lenA > lenB) {\n return 1\n }\n\n if (lenB > lenA) {\n return -1\n }\n\n return a[0].compare(b[0])\n };\n\n // Adapted from http://www.2ality.com/2012/03/signedzero.html\n exports.isNegativeZero = (x) => {\n return x === 0 && (1 / x < 0)\n };\n\n exports.nextPowerOf2 = (n) => {\n let count = 0;\n // First n in the below condition is for\n // the case where n is 0\n if (n && !(n & (n - 1))) {\n return n\n }\n\n while (n !== 0) {\n n >>= 1;\n count += 1;\n }\n\n return 1 << count\n };\n });\n\n const MT$1 = constants$4.MT;\n const SIMPLE$1 = constants$4.SIMPLE;\n const SYMS$1 = constants$4.SYMS;\n\n /**\n * A CBOR Simple Value that does not map onto a known constant.\n */\n class Simple {\n /**\n * Creates an instance of Simple.\n *\n * @param {integer} value - the simple value's integer value\n */\n constructor (value) {\n if (typeof value !== 'number') {\n throw new Error('Invalid Simple type: ' + (typeof value))\n }\n if ((value < 0) || (value > 255) || ((value | 0) !== value)) {\n throw new Error('value must be a small positive integer: ' + value)\n }\n this.value = value;\n }\n\n /**\n * Debug string for simple value\n *\n * @returns {string} simple(value)\n */\n toString () {\n return 'simple(' + this.value + ')'\n }\n\n /**\n * Debug string for simple value\n *\n * @returns {string} simple(value)\n */\n inspect () {\n return 'simple(' + this.value + ')'\n }\n\n /**\n * Push the simple value onto the CBOR stream\n *\n * @param {cbor.Encoder} gen The generator to push onto\n * @returns {number}\n */\n encodeCBOR (gen) {\n return gen._pushInt(this.value, MT$1.SIMPLE_FLOAT)\n }\n\n /**\n * Is the given object a Simple?\n *\n * @param {any} obj - object to test\n * @returns {bool} - is it Simple?\n */\n static isSimple (obj) {\n return obj instanceof Simple\n }\n\n /**\n * Decode from the CBOR additional information into a JavaScript value.\n * If the CBOR item has no parent, return a \"safe\" symbol instead of\n * `null` or `undefined`, so that the value can be passed through a\n * stream in object mode.\n *\n * @param {Number} val - the CBOR additional info to convert\n * @param {bool} hasParent - Does the CBOR item have a parent?\n * @returns {(null|undefined|Boolean|Symbol)} - the decoded value\n */\n static decode (val, hasParent) {\n if (hasParent == null) {\n hasParent = true;\n }\n switch (val) {\n case SIMPLE$1.FALSE:\n return false\n case SIMPLE$1.TRUE:\n return true\n case SIMPLE$1.NULL:\n if (hasParent) {\n return null\n } else {\n return SYMS$1.NULL\n }\n case SIMPLE$1.UNDEFINED:\n if (hasParent) {\n return undefined\n } else {\n return SYMS$1.UNDEFINED\n }\n case -1:\n if (!hasParent) {\n throw new Error('Invalid BREAK')\n }\n return SYMS$1.BREAK\n default:\n return new Simple(val)\n }\n }\n }\n\n var simple = Simple;\n\n /**\n * A CBOR tagged item, where the tag does not have semantics specified at the\n * moment, or those semantics threw an error during parsing. Typically this will\n * be an extension point you're not yet expecting.\n */\n class Tagged {\n /**\n * Creates an instance of Tagged.\n *\n * @param {Number} tag - the number of the tag\n * @param {any} value - the value inside the tag\n * @param {Error} err - the error that was thrown parsing the tag, or null\n */\n constructor (tag, value, err) {\n this.tag = tag;\n this.value = value;\n this.err = err;\n if (typeof this.tag !== 'number') {\n throw new Error('Invalid tag type (' + (typeof this.tag) + ')')\n }\n if ((this.tag < 0) || ((this.tag | 0) !== this.tag)) {\n throw new Error('Tag must be a positive integer: ' + this.tag)\n }\n }\n\n /**\n * Convert to a String\n *\n * @returns {String} string of the form '1(2)'\n */\n toString () {\n return `${this.tag}(${JSON.stringify(this.value)})`\n }\n\n /**\n * Push the simple value onto the CBOR stream\n *\n * @param {cbor.Encoder} gen The generator to push onto\n * @returns {number}\n */\n encodeCBOR (gen) {\n gen._pushTag(this.tag);\n return gen.pushAny(this.value)\n }\n\n /**\n * If we have a converter for this type, do the conversion. Some converters\n * are built-in. Additional ones can be passed in. If you want to remove\n * a built-in converter, pass a converter in whose value is 'null' instead\n * of a function.\n *\n * @param {Object} converters - keys in the object are a tag number, the value\n * is a function that takes the decoded CBOR and returns a JavaScript value\n * of the appropriate type. Throw an exception in the function on errors.\n * @returns {any} - the converted item\n */\n convert (converters) {\n var er, f;\n f = converters != null ? converters[this.tag] : undefined;\n if (typeof f !== 'function') {\n f = Tagged['_tag' + this.tag];\n if (typeof f !== 'function') {\n return this\n }\n }\n try {\n return f.call(Tagged, this.value)\n } catch (error) {\n er = error;\n this.err = er;\n return this\n }\n }\n }\n\n var tagged = Tagged;\n\n const defaultBase = self.location ?\n self.location.protocol + '//' + self.location.host :\n '';\n const URL$1 = self.URL;\n\n class URLWithLegacySupport {\n constructor(url = '', base = defaultBase) {\n this.super = new URL$1(url, base);\n this.path = this.pathname + this.search;\n this.auth =\n this.username && this.password ?\n this.username + ':' + this.password :\n null;\n\n this.query =\n this.search && this.search.startsWith('?') ?\n this.search.slice(1) :\n null;\n }\n\n get hash() {\n return this.super.hash;\n }\n get host() {\n return this.super.host;\n }\n get hostname() {\n return this.super.hostname;\n }\n get href() {\n return this.super.href;\n }\n get origin() {\n return this.super.origin;\n }\n get password() {\n return this.super.password;\n }\n get pathname() {\n return this.super.pathname;\n }\n get port() {\n return this.super.port;\n }\n get protocol() {\n return this.super.protocol;\n }\n get search() {\n return this.super.search;\n }\n get searchParams() {\n return this.super.searchParams;\n }\n get username() {\n return this.super.username;\n }\n\n set hash(hash) {\n this.super.hash = hash;\n }\n set host(host) {\n this.super.host = host;\n }\n set hostname(hostname) {\n this.super.hostname = hostname;\n }\n set href(href) {\n this.super.href = href;\n }\n set origin(origin) {\n this.super.origin = origin;\n }\n set password(password) {\n this.super.password = password;\n }\n set pathname(pathname) {\n this.super.pathname = pathname;\n }\n set port(port) {\n this.super.port = port;\n }\n set protocol(protocol) {\n this.super.protocol = protocol;\n }\n set search(search) {\n this.super.search = search;\n }\n set searchParams(searchParams) {\n this.super.searchParams = searchParams;\n }\n set username(username) {\n this.super.username = username;\n }\n\n createObjectURL(o) {\n return this.super.createObjectURL(o);\n }\n revokeObjectURL(o) {\n this.super.revokeObjectURL(o);\n }\n toJSON() {\n return this.super.toJSON();\n }\n toString() {\n return this.super.toString();\n }\n format() {\n return this.toString();\n }\n }\n\n function format$1(obj) {\n if (typeof obj === 'string') {\n const url = new URL$1(obj);\n\n return url.toString();\n }\n\n if (!(obj instanceof URL$1)) {\n const userPass =\n obj.username && obj.password ?\n `${obj.username}:${obj.password}@` :\n '';\n const auth = obj.auth ? obj.auth + '@' : '';\n const port = obj.port ? ':' + obj.port : '';\n const protocol = obj.protocol ? obj.protocol + '//' : '';\n const host = obj.host || '';\n const hostname = obj.hostname || '';\n const search = obj.search || (obj.query ? '?' + obj.query : '');\n const hash = obj.hash || '';\n const pathname = obj.pathname || '';\n const path = obj.path || pathname + search;\n\n return `${protocol}${userPass || auth}${host ||\n hostname + port}${path}${hash}`;\n }\n }\n\n var urlBrowser = {\n URLWithLegacySupport,\n URLSearchParams: self.URLSearchParams,\n defaultBase,\n format: format$1\n };\n\n const { URLWithLegacySupport: URLWithLegacySupport$1, format: format$2 } = urlBrowser;\n\n var relative = (url, location = {}, protocolMap = {}, defaultProtocol) => {\n let protocol = location.protocol ?\n location.protocol.replace(':', '') :\n 'http';\n\n // Check protocol map\n protocol = (protocolMap[protocol] || defaultProtocol || protocol) + ':';\n let urlParsed;\n\n try {\n urlParsed = new URLWithLegacySupport$1(url);\n } catch (err) {\n urlParsed = {};\n }\n\n const base = Object.assign({}, location, {\n protocol: protocol || urlParsed.protocol,\n host: location.host || urlParsed.host\n });\n\n return new URLWithLegacySupport$1(url, format$2(base)).toString();\n };\n\n const {\n URLWithLegacySupport: URLWithLegacySupport$2,\n format: format$3,\n URLSearchParams,\n defaultBase: defaultBase$1\n } = urlBrowser;\n\n\n var isoUrl = {\n URL: URLWithLegacySupport$2,\n URLSearchParams,\n format: format$3,\n relative,\n defaultBase: defaultBase$1\n };\n\n const { Buffer } = buffer$2;\n\n const Bignumber$1 = bignumber.BigNumber;\n\n\n\n\n\n\n const { URL: URL$2 } = isoUrl;\n\n /**\n * Transform binary cbor data into JavaScript objects.\n */\n class Decoder {\n /**\n * @param {Object} [opts={}]\n * @param {number} [opts.size=65536] - Size of the allocated heap.\n */\n constructor (opts) {\n opts = opts || {};\n\n if (!opts.size || opts.size < 0x10000) {\n opts.size = 0x10000;\n } else {\n // Ensure the size is a power of 2\n opts.size = utils$4.nextPowerOf2(opts.size);\n }\n\n // Heap use to share the input with the parser\n this._heap = new ArrayBuffer(opts.size);\n this._heap8 = new Uint8Array(this._heap);\n this._buffer = Buffer.from(this._heap);\n\n this._reset();\n\n // Known tags\n this._knownTags = Object.assign({\n 0: (val) => new Date(val),\n 1: (val) => new Date(val * 1000),\n 2: (val) => utils$4.arrayBufferToBignumber(val),\n 3: (val) => constants$4.NEG_ONE.minus(utils$4.arrayBufferToBignumber(val)),\n 4: (v) => {\n // const v = new Uint8Array(val)\n return constants$4.TEN.pow(v[0]).times(v[1])\n },\n 5: (v) => {\n // const v = new Uint8Array(val)\n return constants$4.TWO.pow(v[0]).times(v[1])\n },\n 32: (val) => new URL$2(val),\n 35: (val) => new RegExp(val)\n }, opts.tags);\n\n // Initialize asm based parser\n this.parser = decoder_asm(commonjsGlobal, {\n // eslint-disable-next-line no-console\n log: console.log.bind(console),\n pushInt: this.pushInt.bind(this),\n pushInt32: this.pushInt32.bind(this),\n pushInt32Neg: this.pushInt32Neg.bind(this),\n pushInt64: this.pushInt64.bind(this),\n pushInt64Neg: this.pushInt64Neg.bind(this),\n pushFloat: this.pushFloat.bind(this),\n pushFloatSingle: this.pushFloatSingle.bind(this),\n pushFloatDouble: this.pushFloatDouble.bind(this),\n pushTrue: this.pushTrue.bind(this),\n pushFalse: this.pushFalse.bind(this),\n pushUndefined: this.pushUndefined.bind(this),\n pushNull: this.pushNull.bind(this),\n pushInfinity: this.pushInfinity.bind(this),\n pushInfinityNeg: this.pushInfinityNeg.bind(this),\n pushNaN: this.pushNaN.bind(this),\n pushNaNNeg: this.pushNaNNeg.bind(this),\n pushArrayStart: this.pushArrayStart.bind(this),\n pushArrayStartFixed: this.pushArrayStartFixed.bind(this),\n pushArrayStartFixed32: this.pushArrayStartFixed32.bind(this),\n pushArrayStartFixed64: this.pushArrayStartFixed64.bind(this),\n pushObjectStart: this.pushObjectStart.bind(this),\n pushObjectStartFixed: this.pushObjectStartFixed.bind(this),\n pushObjectStartFixed32: this.pushObjectStartFixed32.bind(this),\n pushObjectStartFixed64: this.pushObjectStartFixed64.bind(this),\n pushByteString: this.pushByteString.bind(this),\n pushByteStringStart: this.pushByteStringStart.bind(this),\n pushUtf8String: this.pushUtf8String.bind(this),\n pushUtf8StringStart: this.pushUtf8StringStart.bind(this),\n pushSimpleUnassigned: this.pushSimpleUnassigned.bind(this),\n pushTagUnassigned: this.pushTagUnassigned.bind(this),\n pushTagStart: this.pushTagStart.bind(this),\n pushTagStart4: this.pushTagStart4.bind(this),\n pushTagStart8: this.pushTagStart8.bind(this),\n pushBreak: this.pushBreak.bind(this)\n }, this._heap);\n }\n\n get _depth () {\n return this._parents.length\n }\n\n get _currentParent () {\n return this._parents[this._depth - 1]\n }\n\n get _ref () {\n return this._currentParent.ref\n }\n\n // Finish the current parent\n _closeParent () {\n var p = this._parents.pop();\n\n if (p.length > 0) {\n throw new Error(`Missing ${p.length} elements`)\n }\n\n switch (p.type) {\n case constants$4.PARENT.TAG:\n this._push(\n this.createTag(p.ref[0], p.ref[1])\n );\n break\n case constants$4.PARENT.BYTE_STRING:\n this._push(this.createByteString(p.ref, p.length));\n break\n case constants$4.PARENT.UTF8_STRING:\n this._push(this.createUtf8String(p.ref, p.length));\n break\n case constants$4.PARENT.MAP:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createMap(p.ref, p.length));\n break\n case constants$4.PARENT.OBJECT:\n if (p.values % 2 > 0) {\n throw new Error('Odd number of elements in the map')\n }\n this._push(this.createObject(p.ref, p.length));\n break\n case constants$4.PARENT.ARRAY:\n this._push(this.createArray(p.ref, p.length));\n break\n }\n\n if (this._currentParent && this._currentParent.type === constants$4.PARENT.TAG) {\n this._dec();\n }\n }\n\n // Reduce the expected length of the current parent by one\n _dec () {\n const p = this._currentParent;\n // The current parent does not know the epxected child length\n\n if (p.length < 0) {\n return\n }\n\n p.length--;\n\n // All children were seen, we can close the current parent\n if (p.length === 0) {\n this._closeParent();\n }\n }\n\n // Push any value to the current parent\n _push (val, hasChildren) {\n const p = this._currentParent;\n p.values++;\n\n switch (p.type) {\n case constants$4.PARENT.ARRAY:\n case constants$4.PARENT.BYTE_STRING:\n case constants$4.PARENT.UTF8_STRING:\n if (p.length > -1) {\n this._ref[this._ref.length - p.length] = val;\n } else {\n this._ref.push(val);\n }\n this._dec();\n break\n case constants$4.PARENT.OBJECT:\n if (p.tmpKey != null) {\n this._ref[p.tmpKey] = val;\n p.tmpKey = null;\n this._dec();\n } else {\n p.tmpKey = val;\n\n if (typeof p.tmpKey !== 'string') {\n // too bad, convert to a Map\n p.type = constants$4.PARENT.MAP;\n p.ref = utils$4.buildMap(p.ref);\n }\n }\n break\n case constants$4.PARENT.MAP:\n if (p.tmpKey != null) {\n this._ref.set(p.tmpKey, val);\n p.tmpKey = null;\n this._dec();\n } else {\n p.tmpKey = val;\n }\n break\n case constants$4.PARENT.TAG:\n this._ref.push(val);\n if (!hasChildren) {\n this._dec();\n }\n break\n default:\n throw new Error('Unknown parent type')\n }\n }\n\n // Create a new parent in the parents list\n _createParent (obj, type, len) {\n this._parents[this._depth] = {\n type: type,\n length: len,\n ref: obj,\n values: 0,\n tmpKey: null\n };\n }\n\n // Reset all state back to the beginning, also used for initiatlization\n _reset () {\n this._res = [];\n this._parents = [{\n type: constants$4.PARENT.ARRAY,\n length: -1,\n ref: this._res,\n values: 0,\n tmpKey: null\n }];\n }\n\n // -- Interface to customize deoding behaviour\n createTag (tagNumber, value) {\n const typ = this._knownTags[tagNumber];\n\n if (!typ) {\n return new tagged(tagNumber, value)\n }\n\n return typ(value)\n }\n\n createMap (obj, len) {\n return obj\n }\n\n createObject (obj, len) {\n return obj\n }\n\n createArray (arr, len) {\n return arr\n }\n\n createByteString (raw, len) {\n return Buffer.concat(raw)\n }\n\n createByteStringFromHeap (start, end) {\n if (start === end) {\n return Buffer.alloc(0)\n }\n\n return Buffer.from(this._heap.slice(start, end))\n }\n\n createInt (val) {\n return val\n }\n\n createInt32 (f, g) {\n return utils$4.buildInt32(f, g)\n }\n\n createInt64 (f1, f2, g1, g2) {\n return utils$4.buildInt64(f1, f2, g1, g2)\n }\n\n createFloat (val) {\n return val\n }\n\n createFloatSingle (a, b, c, d) {\n return ieee754.read([a, b, c, d], 0, false, 23, 4)\n }\n\n createFloatDouble (a, b, c, d, e, f, g, h) {\n return ieee754.read([a, b, c, d, e, f, g, h], 0, false, 52, 8)\n }\n\n createInt32Neg (f, g) {\n return -1 - utils$4.buildInt32(f, g)\n }\n\n createInt64Neg (f1, f2, g1, g2) {\n const f = utils$4.buildInt32(f1, f2);\n const g = utils$4.buildInt32(g1, g2);\n\n if (f > constants$4.MAX_SAFE_HIGH) {\n return constants$4.NEG_ONE.minus(new Bignumber$1(f).times(constants$4.SHIFT32).plus(g))\n }\n\n return -1 - ((f * constants$4.SHIFT32) + g)\n }\n\n createTrue () {\n return true\n }\n\n createFalse () {\n return false\n }\n\n createNull () {\n return null\n }\n\n createUndefined () {\n return undefined\n }\n\n createInfinity () {\n return Infinity\n }\n\n createInfinityNeg () {\n return -Infinity\n }\n\n createNaN () {\n return NaN\n }\n\n createNaNNeg () {\n return -NaN\n }\n\n createUtf8String (raw, len) {\n return raw.join('')\n }\n\n createUtf8StringFromHeap (start, end) {\n if (start === end) {\n return ''\n }\n\n return this._buffer.toString('utf8', start, end)\n }\n\n createSimpleUnassigned (val) {\n return new simple(val)\n }\n\n // -- Interface for decoder.asm.js\n\n pushInt (val) {\n this._push(this.createInt(val));\n }\n\n pushInt32 (f, g) {\n this._push(this.createInt32(f, g));\n }\n\n pushInt64 (f1, f2, g1, g2) {\n this._push(this.createInt64(f1, f2, g1, g2));\n }\n\n pushFloat (val) {\n this._push(this.createFloat(val));\n }\n\n pushFloatSingle (a, b, c, d) {\n this._push(this.createFloatSingle(a, b, c, d));\n }\n\n pushFloatDouble (a, b, c, d, e, f, g, h) {\n this._push(this.createFloatDouble(a, b, c, d, e, f, g, h));\n }\n\n pushInt32Neg (f, g) {\n this._push(this.createInt32Neg(f, g));\n }\n\n pushInt64Neg (f1, f2, g1, g2) {\n this._push(this.createInt64Neg(f1, f2, g1, g2));\n }\n\n pushTrue () {\n this._push(this.createTrue());\n }\n\n pushFalse () {\n this._push(this.createFalse());\n }\n\n pushNull () {\n this._push(this.createNull());\n }\n\n pushUndefined () {\n this._push(this.createUndefined());\n }\n\n pushInfinity () {\n this._push(this.createInfinity());\n }\n\n pushInfinityNeg () {\n this._push(this.createInfinityNeg());\n }\n\n pushNaN () {\n this._push(this.createNaN());\n }\n\n pushNaNNeg () {\n this._push(this.createNaNNeg());\n }\n\n pushArrayStart () {\n this._createParent([], constants$4.PARENT.ARRAY, -1);\n }\n\n pushArrayStartFixed (len) {\n this._createArrayStartFixed(len);\n }\n\n pushArrayStartFixed32 (len1, len2) {\n const len = utils$4.buildInt32(len1, len2);\n this._createArrayStartFixed(len);\n }\n\n pushArrayStartFixed64 (len1, len2, len3, len4) {\n const len = utils$4.buildInt64(len1, len2, len3, len4);\n this._createArrayStartFixed(len);\n }\n\n pushObjectStart () {\n this._createObjectStartFixed(-1);\n }\n\n pushObjectStartFixed (len) {\n this._createObjectStartFixed(len);\n }\n\n pushObjectStartFixed32 (len1, len2) {\n const len = utils$4.buildInt32(len1, len2);\n this._createObjectStartFixed(len);\n }\n\n pushObjectStartFixed64 (len1, len2, len3, len4) {\n const len = utils$4.buildInt64(len1, len2, len3, len4);\n this._createObjectStartFixed(len);\n }\n\n pushByteStringStart () {\n this._parents[this._depth] = {\n type: constants$4.PARENT.BYTE_STRING,\n length: -1,\n ref: [],\n values: 0,\n tmpKey: null\n };\n }\n\n pushByteString (start, end) {\n this._push(this.createByteStringFromHeap(start, end));\n }\n\n pushUtf8StringStart () {\n this._parents[this._depth] = {\n type: constants$4.PARENT.UTF8_STRING,\n length: -1,\n ref: [],\n values: 0,\n tmpKey: null\n };\n }\n\n pushUtf8String (start, end) {\n this._push(this.createUtf8StringFromHeap(start, end));\n }\n\n pushSimpleUnassigned (val) {\n this._push(this.createSimpleUnassigned(val));\n }\n\n pushTagStart (tag) {\n this._parents[this._depth] = {\n type: constants$4.PARENT.TAG,\n length: 1,\n ref: [tag]\n };\n }\n\n pushTagStart4 (f, g) {\n this.pushTagStart(utils$4.buildInt32(f, g));\n }\n\n pushTagStart8 (f1, f2, g1, g2) {\n this.pushTagStart(utils$4.buildInt64(f1, f2, g1, g2));\n }\n\n pushTagUnassigned (tagNumber) {\n this._push(this.createTag(tagNumber));\n }\n\n pushBreak () {\n if (this._currentParent.length > -1) {\n throw new Error('Unexpected break')\n }\n\n this._closeParent();\n }\n\n _createObjectStartFixed (len) {\n if (len === 0) {\n this._push(this.createObject({}));\n return\n }\n\n this._createParent({}, constants$4.PARENT.OBJECT, len);\n }\n\n _createArrayStartFixed (len) {\n if (len === 0) {\n this._push(this.createArray([]));\n return\n }\n\n this._createParent(new Array(len), constants$4.PARENT.ARRAY, len);\n }\n\n _decode (input) {\n if (input.byteLength === 0) {\n throw new Error('Input too short')\n }\n\n this._reset();\n this._heap8.set(input);\n const code = this.parser.parse(input.byteLength);\n\n if (this._depth > 1) {\n while (this._currentParent.length === 0) {\n this._closeParent();\n }\n if (this._depth > 1) {\n throw new Error('Undeterminated nesting')\n }\n }\n\n if (code > 0) {\n throw new Error('Failed to parse')\n }\n\n if (this._res.length === 0) {\n throw new Error('No valid result')\n }\n }\n\n // -- Public Interface\n\n decodeFirst (input) {\n this._decode(input);\n\n return this._res[0]\n }\n\n decodeAll (input) {\n this._decode(input);\n\n return this._res\n }\n\n /**\n * Decode the first cbor object.\n *\n * @param {Buffer|string} input\n * @param {string} [enc='hex'] - Encoding used if a string is passed.\n * @returns {*}\n */\n static decode (input, enc) {\n if (typeof input === 'string') {\n input = Buffer.from(input, enc || 'hex');\n }\n\n const dec = new Decoder({ size: input.length });\n return dec.decodeFirst(input)\n }\n\n /**\n * Decode all cbor objects.\n *\n * @param {Buffer|string} input\n * @param {string} [enc='hex'] - Encoding used if a string is passed.\n * @returns {Array<*>}\n */\n static decodeAll (input, enc) {\n if (typeof input === 'string') {\n input = Buffer.from(input, enc || 'hex');\n }\n\n const dec = new Decoder({ size: input.length });\n return dec.decodeAll(input)\n }\n }\n\n Decoder.decodeFirst = Decoder.decode;\n\n var decoder = Decoder;\n\n const { Buffer: Buffer$1 } = buffer$2;\n\n\n\n /**\n * Output the diagnostic format from a stream of CBOR bytes.\n *\n */\n class Diagnose extends decoder {\n createTag (tagNumber, value) {\n return `${tagNumber}(${value})`\n }\n\n createInt (val) {\n return super.createInt(val).toString()\n }\n\n createInt32 (f, g) {\n return super.createInt32(f, g).toString()\n }\n\n createInt64 (f1, f2, g1, g2) {\n return super.createInt64(f1, f2, g1, g2).toString()\n }\n\n createInt32Neg (f, g) {\n return super.createInt32Neg(f, g).toString()\n }\n\n createInt64Neg (f1, f2, g1, g2) {\n return super.createInt64Neg(f1, f2, g1, g2).toString()\n }\n\n createTrue () {\n return 'true'\n }\n\n createFalse () {\n return 'false'\n }\n\n createFloat (val) {\n const fl = super.createFloat(val);\n if (utils$4.isNegativeZero(val)) {\n return '-0_1'\n }\n\n return `${fl}_1`\n }\n\n createFloatSingle (a, b, c, d) {\n const fl = super.createFloatSingle(a, b, c, d);\n return `${fl}_2`\n }\n\n createFloatDouble (a, b, c, d, e, f, g, h) {\n const fl = super.createFloatDouble(a, b, c, d, e, f, g, h);\n return `${fl}_3`\n }\n\n createByteString (raw, len) {\n const val = raw.join(', ');\n\n if (len === -1) {\n return `(_ ${val})`\n }\n return `h'${val}`\n }\n\n createByteStringFromHeap (start, end) {\n const val = (Buffer$1.from(\n super.createByteStringFromHeap(start, end)\n )).toString('hex');\n\n return `h'${val}'`\n }\n\n createInfinity () {\n return 'Infinity_1'\n }\n\n createInfinityNeg () {\n return '-Infinity_1'\n }\n\n createNaN () {\n return 'NaN_1'\n }\n\n createNaNNeg () {\n return '-NaN_1'\n }\n\n createNull () {\n return 'null'\n }\n\n createUndefined () {\n return 'undefined'\n }\n\n createSimpleUnassigned (val) {\n return `simple(${val})`\n }\n\n createArray (arr, len) {\n const val = super.createArray(arr, len);\n\n if (len === -1) {\n // indefinite\n return `[_ ${val.join(', ')}]`\n }\n\n return `[${val.join(', ')}]`\n }\n\n createMap (map, len) {\n const val = super.createMap(map);\n const list = Array.from(val.keys())\n .reduce(collectObject(val), '');\n\n if (len === -1) {\n return `{_ ${list}}`\n }\n\n return `{${list}}`\n }\n\n createObject (obj, len) {\n const val = super.createObject(obj);\n const map = Object.keys(val)\n .reduce(collectObject(val), '');\n\n if (len === -1) {\n return `{_ ${map}}`\n }\n\n return `{${map}}`\n }\n\n createUtf8String (raw, len) {\n const val = raw.join(', ');\n\n if (len === -1) {\n return `(_ ${val})`\n }\n\n return `\"${val}\"`\n }\n\n createUtf8StringFromHeap (start, end) {\n const val = (Buffer$1.from(\n super.createUtf8StringFromHeap(start, end)\n )).toString('utf8');\n\n return `\"${val}\"`\n }\n\n static diagnose (input, enc) {\n if (typeof input === 'string') {\n input = Buffer$1.from(input, enc || 'hex');\n }\n\n const dec = new Diagnose();\n return dec.decodeFirst(input)\n }\n }\n\n var diagnose = Diagnose;\n\n function collectObject (val) {\n return (acc, key) => {\n if (acc) {\n return `${acc}, ${key}: ${val[key]}`\n }\n return `${key}: ${val[key]}`\n }\n }\n\n const { Buffer: Buffer$2 } = buffer$2;\n const { URL: URL$3 } = isoUrl;\n const Bignumber$2 = bignumber.BigNumber;\n\n\n\n const MT$2 = constants$4.MT;\n const NUMBYTES$1 = constants$4.NUMBYTES;\n const SHIFT32$1 = constants$4.SHIFT32;\n const SYMS$2 = constants$4.SYMS;\n const TAG$1 = constants$4.TAG;\n const HALF = (constants$4.MT.SIMPLE_FLOAT << 5) | constants$4.NUMBYTES.TWO;\n const FLOAT = (constants$4.MT.SIMPLE_FLOAT << 5) | constants$4.NUMBYTES.FOUR;\n const DOUBLE = (constants$4.MT.SIMPLE_FLOAT << 5) | constants$4.NUMBYTES.EIGHT;\n const TRUE = (constants$4.MT.SIMPLE_FLOAT << 5) | constants$4.SIMPLE.TRUE;\n const FALSE = (constants$4.MT.SIMPLE_FLOAT << 5) | constants$4.SIMPLE.FALSE;\n const UNDEFINED = (constants$4.MT.SIMPLE_FLOAT << 5) | constants$4.SIMPLE.UNDEFINED;\n const NULL = (constants$4.MT.SIMPLE_FLOAT << 5) | constants$4.SIMPLE.NULL;\n\n const MAXINT_BN = new Bignumber$2('0x20000000000000');\n const BUF_NAN = Buffer$2.from('f97e00', 'hex');\n const BUF_INF_NEG = Buffer$2.from('f9fc00', 'hex');\n const BUF_INF_POS = Buffer$2.from('f97c00', 'hex');\n\n function toType (obj) {\n // [object Type]\n // --------8---1\n return ({}).toString.call(obj).slice(8, -1)\n }\n\n /**\n * Transform JavaScript values into CBOR bytes\n *\n */\n class Encoder {\n /**\n * @param {Object} [options={}]\n * @param {function(Buffer)} options.stream\n */\n constructor (options) {\n options = options || {};\n\n this.streaming = typeof options.stream === 'function';\n this.onData = options.stream;\n\n this.semanticTypes = [\n [URL$3, this._pushUrl],\n [Bignumber$2, this._pushBigNumber]\n ];\n\n const addTypes = options.genTypes || [];\n const len = addTypes.length;\n for (let i = 0; i < len; i++) {\n this.addSemanticType(\n addTypes[i][0],\n addTypes[i][1]\n );\n }\n\n this._reset();\n }\n\n addSemanticType (type, fun) {\n const len = this.semanticTypes.length;\n for (let i = 0; i < len; i++) {\n const typ = this.semanticTypes[i][0];\n if (typ === type) {\n const old = this.semanticTypes[i][1];\n this.semanticTypes[i][1] = fun;\n return old\n }\n }\n this.semanticTypes.push([type, fun]);\n return null\n }\n\n push (val) {\n if (!val) {\n return true\n }\n\n this.result[this.offset] = val;\n this.resultMethod[this.offset] = 0;\n this.resultLength[this.offset] = val.length;\n this.offset++;\n\n if (this.streaming) {\n this.onData(this.finalize());\n }\n\n return true\n }\n\n pushWrite (val, method, len) {\n this.result[this.offset] = val;\n this.resultMethod[this.offset] = method;\n this.resultLength[this.offset] = len;\n this.offset++;\n\n if (this.streaming) {\n this.onData(this.finalize());\n }\n\n return true\n }\n\n _pushUInt8 (val) {\n return this.pushWrite(val, 1, 1)\n }\n\n _pushUInt16BE (val) {\n return this.pushWrite(val, 2, 2)\n }\n\n _pushUInt32BE (val) {\n return this.pushWrite(val, 3, 4)\n }\n\n _pushDoubleBE (val) {\n return this.pushWrite(val, 4, 8)\n }\n\n _pushNaN () {\n return this.push(BUF_NAN)\n }\n\n _pushInfinity (obj) {\n const half = (obj < 0) ? BUF_INF_NEG : BUF_INF_POS;\n return this.push(half)\n }\n\n _pushFloat (obj) {\n const b2 = Buffer$2.allocUnsafe(2);\n\n if (utils$4.writeHalf(b2, obj)) {\n if (utils$4.parseHalf(b2) === obj) {\n return this._pushUInt8(HALF) && this.push(b2)\n }\n }\n\n const b4 = Buffer$2.allocUnsafe(4);\n b4.writeFloatBE(obj, 0);\n if (b4.readFloatBE(0) === obj) {\n return this._pushUInt8(FLOAT) && this.push(b4)\n }\n\n return this._pushUInt8(DOUBLE) && this._pushDoubleBE(obj)\n }\n\n _pushInt (obj, mt, orig) {\n const m = mt << 5;\n if (obj < 24) {\n return this._pushUInt8(m | obj)\n }\n\n if (obj <= 0xff) {\n return this._pushUInt8(m | NUMBYTES$1.ONE) && this._pushUInt8(obj)\n }\n\n if (obj <= 0xffff) {\n return this._pushUInt8(m | NUMBYTES$1.TWO) && this._pushUInt16BE(obj)\n }\n\n if (obj <= 0xffffffff) {\n return this._pushUInt8(m | NUMBYTES$1.FOUR) && this._pushUInt32BE(obj)\n }\n\n if (obj <= Number.MAX_SAFE_INTEGER) {\n return this._pushUInt8(m | NUMBYTES$1.EIGHT) &&\n this._pushUInt32BE(Math.floor(obj / SHIFT32$1)) &&\n this._pushUInt32BE(obj % SHIFT32$1)\n }\n\n if (mt === MT$2.NEG_INT) {\n return this._pushFloat(orig)\n }\n\n return this._pushFloat(obj)\n }\n\n _pushIntNum (obj) {\n if (obj < 0) {\n return this._pushInt(-obj - 1, MT$2.NEG_INT, obj)\n } else {\n return this._pushInt(obj, MT$2.POS_INT)\n }\n }\n\n _pushNumber (obj) {\n switch (false) {\n case (obj === obj): // eslint-disable-line\n return this._pushNaN(obj)\n case isFinite(obj):\n return this._pushInfinity(obj)\n case ((obj % 1) !== 0):\n return this._pushIntNum(obj)\n default:\n return this._pushFloat(obj)\n }\n }\n\n _pushString (obj) {\n const len = Buffer$2.byteLength(obj, 'utf8');\n return this._pushInt(len, MT$2.UTF8_STRING) && this.pushWrite(obj, 5, len)\n }\n\n _pushBoolean (obj) {\n return this._pushUInt8(obj ? TRUE : FALSE)\n }\n\n _pushUndefined (obj) {\n return this._pushUInt8(UNDEFINED)\n }\n\n _pushArray (gen, obj) {\n const len = obj.length;\n if (!gen._pushInt(len, MT$2.ARRAY)) {\n return false\n }\n for (let j = 0; j < len; j++) {\n if (!gen.pushAny(obj[j])) {\n return false\n }\n }\n return true\n }\n\n _pushTag (tag) {\n return this._pushInt(tag, MT$2.TAG)\n }\n\n _pushDate (gen, obj) {\n // Round date, to get seconds since 1970-01-01 00:00:00 as defined in\n // Sec. 2.4.1 and get a possibly more compact encoding. Note that it is\n // still allowed to encode fractions of seconds which can be achieved by\n // changing overwriting the encode function for Date objects.\n return gen._pushTag(TAG$1.DATE_EPOCH) && gen.pushAny(Math.round(obj / 1000))\n }\n\n _pushBuffer (gen, obj) {\n return gen._pushInt(obj.length, MT$2.BYTE_STRING) && gen.push(obj)\n }\n\n _pushNoFilter (gen, obj) {\n return gen._pushBuffer(gen, obj.slice())\n }\n\n _pushRegexp (gen, obj) {\n return gen._pushTag(TAG$1.REGEXP) && gen.pushAny(obj.source)\n }\n\n _pushSet (gen, obj) {\n if (!gen._pushInt(obj.size, MT$2.ARRAY)) {\n return false\n }\n for (const x of obj) {\n if (!gen.pushAny(x)) {\n return false\n }\n }\n return true\n }\n\n _pushUrl (gen, obj) {\n return gen._pushTag(TAG$1.URI) && gen.pushAny(obj.format())\n }\n\n _pushBigint (obj) {\n let tag = TAG$1.POS_BIGINT;\n if (obj.isNegative()) {\n obj = obj.negated().minus(1);\n tag = TAG$1.NEG_BIGINT;\n }\n let str = obj.toString(16);\n if (str.length % 2) {\n str = '0' + str;\n }\n const buf = Buffer$2.from(str, 'hex');\n return this._pushTag(tag) && this._pushBuffer(this, buf)\n }\n\n _pushBigNumber (gen, obj) {\n if (obj.isNaN()) {\n return gen._pushNaN()\n }\n if (!obj.isFinite()) {\n return gen._pushInfinity(obj.isNegative() ? -Infinity : Infinity)\n }\n if (obj.isInteger()) {\n return gen._pushBigint(obj)\n }\n if (!(gen._pushTag(TAG$1.DECIMAL_FRAC) &&\n gen._pushInt(2, MT$2.ARRAY))) {\n return false\n }\n\n const dec = obj.decimalPlaces();\n const slide = obj.multipliedBy(new Bignumber$2(10).pow(dec));\n if (!gen._pushIntNum(-dec)) {\n return false\n }\n if (slide.abs().isLessThan(MAXINT_BN)) {\n return gen._pushIntNum(slide.toNumber())\n } else {\n return gen._pushBigint(slide)\n }\n }\n\n _pushMap (gen, obj) {\n if (!gen._pushInt(obj.size, MT$2.MAP)) {\n return false\n }\n\n return this._pushRawMap(\n obj.size,\n Array.from(obj)\n )\n }\n\n _pushObject (obj) {\n if (!obj) {\n return this._pushUInt8(NULL)\n }\n\n var len = this.semanticTypes.length;\n for (var i = 0; i < len; i++) {\n if (obj instanceof this.semanticTypes[i][0]) {\n return this.semanticTypes[i][1].call(obj, this, obj)\n }\n }\n\n var f = obj.encodeCBOR;\n if (typeof f === 'function') {\n return f.call(obj, this)\n }\n\n var keys = Object.keys(obj);\n var keyLength = keys.length;\n if (!this._pushInt(keyLength, MT$2.MAP)) {\n return false\n }\n\n return this._pushRawMap(\n keyLength,\n keys.map((k) => [k, obj[k]])\n )\n }\n\n _pushRawMap (len, map) {\n // Sort keys for canoncialization\n // 1. encode key\n // 2. shorter key comes before longer key\n // 3. same length keys are sorted with lower\n // byte value before higher\n\n map = map.map(function (a) {\n a[0] = Encoder.encode(a[0]);\n return a\n }).sort(utils$4.keySorter);\n\n for (var j = 0; j < len; j++) {\n if (!this.push(map[j][0])) {\n return false\n }\n\n if (!this.pushAny(map[j][1])) {\n return false\n }\n }\n\n return true\n }\n\n /**\n * Alias for `.pushAny`\n *\n * @param {*} obj\n * @returns {boolean} true on success\n */\n write (obj) {\n return this.pushAny(obj)\n }\n\n /**\n * Push any supported type onto the encoded stream\n *\n * @param {any} obj\n * @returns {boolean} true on success\n */\n pushAny (obj) {\n var typ = toType(obj);\n\n switch (typ) {\n case 'Number':\n return this._pushNumber(obj)\n case 'String':\n return this._pushString(obj)\n case 'Boolean':\n return this._pushBoolean(obj)\n case 'Object':\n return this._pushObject(obj)\n case 'Array':\n return this._pushArray(this, obj)\n case 'Uint8Array':\n return this._pushBuffer(this, Buffer$2.isBuffer(obj) ? obj : Buffer$2.from(obj))\n case 'Null':\n return this._pushUInt8(NULL)\n case 'Undefined':\n return this._pushUndefined(obj)\n case 'Map':\n return this._pushMap(this, obj)\n case 'Set':\n return this._pushSet(this, obj)\n case 'URL':\n return this._pushUrl(this, obj)\n case 'BigNumber':\n return this._pushBigNumber(this, obj)\n case 'Date':\n return this._pushDate(this, obj)\n case 'RegExp':\n return this._pushRegexp(this, obj)\n case 'Symbol':\n switch (obj) {\n case SYMS$2.NULL:\n return this._pushObject(null)\n case SYMS$2.UNDEFINED:\n return this._pushUndefined(undefined)\n // TODO: Add pluggable support for other symbols\n default:\n throw new Error('Unknown symbol: ' + obj.toString())\n }\n default:\n throw new Error('Unknown type: ' + typeof obj + ', ' + (obj ? obj.toString() : ''))\n }\n }\n\n finalize () {\n if (this.offset === 0) {\n return null\n }\n\n var result = this.result;\n var resultLength = this.resultLength;\n var resultMethod = this.resultMethod;\n var offset = this.offset;\n\n // Determine the size of the buffer\n var size = 0;\n var i = 0;\n\n for (; i < offset; i++) {\n size += resultLength[i];\n }\n\n var res = Buffer$2.allocUnsafe(size);\n var index = 0;\n var length = 0;\n\n // Write the content into the result buffer\n for (i = 0; i < offset; i++) {\n length = resultLength[i];\n\n switch (resultMethod[i]) {\n case 0:\n result[i].copy(res, index);\n break\n case 1:\n res.writeUInt8(result[i], index, true);\n break\n case 2:\n res.writeUInt16BE(result[i], index, true);\n break\n case 3:\n res.writeUInt32BE(result[i], index, true);\n break\n case 4:\n res.writeDoubleBE(result[i], index, true);\n break\n case 5:\n res.write(result[i], index, length, 'utf8');\n break\n default:\n throw new Error('unkown method')\n }\n\n index += length;\n }\n\n var tmp = res;\n\n this._reset();\n\n return tmp\n }\n\n _reset () {\n this.result = [];\n this.resultMethod = [];\n this.resultLength = [];\n this.offset = 0;\n }\n\n /**\n * Encode the given value\n * @param {*} o\n * @returns {Buffer}\n */\n static encode (o) {\n const enc = new Encoder();\n const ret = enc.pushAny(o);\n if (!ret) {\n throw new Error('Failed to encode input')\n }\n\n return enc.finalize()\n }\n }\n\n var encoder$1 = Encoder;\n\n var src$a = createCommonjsModule(function (module, exports) {\n\n // exports.Commented = require('./commented')\n exports.Diagnose = diagnose;\n exports.Decoder = decoder;\n exports.Encoder = encoder$1;\n exports.Simple = simple;\n exports.Tagged = tagged;\n\n // exports.comment = exports.Commented.comment\n exports.decodeAll = exports.Decoder.decodeAll;\n exports.decodeFirst = exports.Decoder.decodeFirst;\n exports.diagnose = exports.Diagnose.diagnose;\n exports.encode = exports.Encoder.encode;\n exports.decode = exports.Decoder.decode;\n\n exports.leveldb = {\n decode: exports.Decoder.decodeAll,\n encode: exports.Encoder.encode,\n buffer: true,\n name: 'cbor'\n };\n });\n\n var add$1 = function (content, key) { return __awaiter(void 0, void 0, void 0, function () {\n var normalized, _a, encoded, toAdd, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n if (!isBlob(content)) return [3 /*break*/, 2];\n return [4 /*yield*/, toBuffer(content)];\n case 1:\n _a = _c.sent();\n return [3 /*break*/, 3];\n case 2:\n _a = content;\n _c.label = 3;\n case 3:\n normalized = _a;\n encoded = src$a.encode(normalized);\n if (!isJust(key)) return [3 /*break*/, 5];\n return [4 /*yield*/, aes$2.encrypt(encoded, key)];\n case 4:\n _b = _c.sent();\n return [3 /*break*/, 6];\n case 5:\n _b = encoded;\n _c.label = 6;\n case 6:\n toAdd = _b;\n return [2 /*return*/, add(toAdd)];\n }\n });\n }); };\n var catAndDecode = function (cid, key) { return __awaiter(void 0, void 0, void 0, function () {\n var buf, toDecode, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, catBuf(cid)];\n case 1:\n buf = _b.sent();\n if (!isJust(key)) return [3 /*break*/, 3];\n return [4 /*yield*/, aes$2.decrypt(buf, key)];\n case 2:\n _a = _b.sent();\n return [3 /*break*/, 4];\n case 3:\n _a = buf;\n _b.label = 4;\n case 4:\n toDecode = _a;\n return [2 /*return*/, src$a.decode(toDecode)];\n }\n });\n }); };\n //# sourceMappingURL=encoded.js.map\n\n var encoded = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$1,\n catAndDecode: catAndDecode\n });\n\n var index$3 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n encoded: encoded,\n set: set$1,\n get: get$2,\n iframe: iframe,\n add: add,\n catRaw: catRaw,\n catBuf: catBuf,\n cat: cat,\n ls: ls,\n dagGet: dagGet,\n dagPut: dagPut,\n dagPutLinks: dagPutLinks,\n size: size,\n attemptPin: attemptPin,\n DAG_NODE_DATA: DAG_NODE_DATA\n });\n\n /**\n * Path for `AppInfo`.\n */\n function appDataPath(app) {\n return directory(Branch.Private, \"Apps\", app.creator, app.name);\n }\n /**\n * Lists the filesystems paths for a set of `Permissions`.\n * This'll return a list of `DistinctivePath`s.\n */\n function paths(permissions) {\n var _a, _b, _c, _d;\n var list = [];\n if (permissions.app)\n list.push(appDataPath(permissions.app));\n if ((_a = permissions.fs) === null || _a === void 0 ? void 0 : _a.private)\n list = list.concat((_b = permissions.fs) === null || _b === void 0 ? void 0 : _b.private.map(function (p) { return combine(directory(Branch.Private), p); }));\n if ((_c = permissions.fs) === null || _c === void 0 ? void 0 : _c.public)\n list = list.concat((_d = permissions.fs) === null || _d === void 0 ? void 0 : _d.public.map(function (p) { return combine(directory(Branch.Public), p); }));\n return list;\n }\n\n /**\n * Base-N/Base-X encoding/decoding functions.\n *\n * Original implementation from base-x:\n * https://github.com/cryptocoinjs/base-x\n *\n * Which is MIT licensed:\n *\n * The MIT License (MIT)\n *\n * Copyright base-x contributors (c) 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n // baseN alphabet indexes\n const _reverseAlphabets = {};\n\n /**\n * BaseN-encodes a Uint8Array using the given alphabet.\n *\n * @param {Uint8Array} input the bytes to encode in a Uint8Array.\n * @param {number} maxline the maximum number of encoded characters per line to\n * use, defaults to none.\n *\n * @return {string} the baseN-encoded output string.\n */\n function encode$8(input, alphabet, maxline) {\n if(!(input instanceof Uint8Array)) {\n throw new TypeError('\"input\" must be a Uint8Array.');\n }\n if(typeof alphabet !== 'string') {\n throw new TypeError('\"alphabet\" must be a string.');\n }\n if(maxline !== undefined && typeof maxline !== 'number') {\n throw new TypeError('\"maxline\" must be a number.');\n }\n if(input.length === 0) {\n return '';\n }\n\n let output = '';\n\n let i = 0;\n const base = alphabet.length;\n const first = alphabet.charAt(0);\n const digits = [0];\n for(i = 0; i < input.length; ++i) {\n let carry = input[i];\n for(let j = 0; j < digits.length; ++j) {\n carry += digits[j] << 8;\n digits[j] = carry % base;\n carry = (carry / base) | 0;\n }\n\n while(carry > 0) {\n digits.push(carry % base);\n carry = (carry / base) | 0;\n }\n }\n\n // deal with leading zeros\n for(i = 0; input[i] === 0 && i < input.length - 1; ++i) {\n output += first;\n }\n // convert digits to a string\n for(i = digits.length - 1; i >= 0; --i) {\n output += alphabet[digits[i]];\n }\n\n if(maxline) {\n const regex = new RegExp('.{1,' + maxline + '}', 'g');\n output = output.match(regex).join('\\r\\n');\n }\n\n return output;\n }\n\n /**\n * Decodes a baseN-encoded (using the given alphabet) string to a\n * Uint8Array.\n *\n * @param {string} input the baseN-encoded input string.\n *\n * @return {Uint8Array} the decoded bytes in a Uint8Array.\n */\n function decode$8(input, alphabet) {\n if(typeof input !== 'string') {\n throw new TypeError('\"input\" must be a string.');\n }\n if(typeof alphabet !== 'string') {\n throw new TypeError('\"alphabet\" must be a string.');\n }\n if(input.length === 0) {\n return new Uint8Array();\n }\n\n let table = _reverseAlphabets[alphabet];\n if(!table) {\n // compute reverse alphabet\n table = _reverseAlphabets[alphabet] = [];\n for(let i = 0; i < alphabet.length; ++i) {\n table[alphabet.charCodeAt(i)] = i;\n }\n }\n\n // remove whitespace characters\n input = input.replace(/\\s/g, '');\n\n const base = alphabet.length;\n const first = alphabet.charAt(0);\n const bytes = [0];\n for(let i = 0; i < input.length; i++) {\n const value = table[input.charCodeAt(i)];\n if(value === undefined) {\n return;\n }\n\n let carry = value;\n for(let j = 0; j < bytes.length; ++j) {\n carry += bytes[j] * base;\n bytes[j] = carry & 0xff;\n carry >>= 8;\n }\n\n while(carry > 0) {\n bytes.push(carry & 0xff);\n carry >>= 8;\n }\n }\n\n // deal with leading zeros\n for(let k = 0; input[k] === first && k < input.length - 1; ++k) {\n bytes.push(0);\n }\n\n return new Uint8Array(bytes.reverse());\n }\n\n /*!\n * Copyright (c) 2019-2020 Digital Bazaar, Inc. All rights reserved.\n */\n\n // base58 characters (Bitcoin alphabet)\n const alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\n\n function encode$9(input, maxline) {\n return encode$8(input, alphabet, maxline);\n }\n\n function decode$9(input) {\n return decode$8(input, alphabet);\n }\n\n var EDWARDS_DID_PREFIX = new Uint8Array([0xed, 0x01]);\n var BLS_DID_PREFIX = new Uint8Array([0xea, 0x01]);\n var RSA_DID_PREFIX = new Uint8Array([0x00, 0xf5, 0x02]);\n var BASE58_DID_PREFIX = 'did:key:z';\n var KeyType;\n (function (KeyType) {\n KeyType[\"RSA\"] = \"rsa\";\n KeyType[\"Edwards\"] = \"ed25519\";\n KeyType[\"BLS\"] = \"bls12-381\";\n })(KeyType || (KeyType = {}));\n // KINDS\n /**\n * Create a DID based on the exchange key-pair.\n */\n function exchange() {\n return __awaiter(this, void 0, void 0, function () {\n var pubKeyB64, ksAlg;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, keystore$2.publicReadKey()];\n case 1:\n pubKeyB64 = _a.sent();\n return [4 /*yield*/, keystore$2.getAlg()];\n case 2:\n ksAlg = _a.sent();\n return [2 /*return*/, publicKeyToDid(pubKeyB64, toKeyType(ksAlg))];\n }\n });\n });\n }\n /**\n * Get the root write-key DID for a user.\n * Stored at `_did.${username}.${endpoints.user}`\n */\n function root$1(username) {\n return __awaiter(this, void 0, void 0, function () {\n var domain, maybeDid;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n domain = setup.endpoints.user;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, lookupTxtRecord(\"_did.\" + username + \".\" + domain)];\n case 2:\n maybeDid = _a.sent();\n if (maybeDid !== null)\n return [2 /*return*/, maybeDid];\n return [3 /*break*/, 4];\n case 3:\n _a.sent();\n return [3 /*break*/, 4];\n case 4: throw new Error(\"Could not locate user DID in DNS.\");\n }\n });\n });\n }\n /**\n * Create a DID based on the write key-pair.\n */\n function write$1() {\n return __awaiter(this, void 0, void 0, function () {\n var pubKeyB64, ksAlg;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, keystore$2.publicWriteKey()];\n case 1:\n pubKeyB64 = _a.sent();\n return [4 /*yield*/, keystore$2.getAlg()];\n case 2:\n ksAlg = _a.sent();\n return [2 /*return*/, publicKeyToDid(pubKeyB64, toKeyType(ksAlg))];\n }\n });\n });\n }\n // TRANSFORMERS\n /**\n * Convert a base64 public key to a DID (did:key).\n */\n function publicKeyToDid(publicKey, type) {\n var pubKeyBuf = utils.base64ToArrBuf(publicKey);\n // Prefix public-write key\n var prefix = magicBytes(type);\n if (prefix === null) {\n throw new Error(\"Key type '\" + type + \"' not supported\");\n }\n var prefixedBuf = utils.joinBufs(prefix, pubKeyBuf);\n // Encode prefixed\n return BASE58_DID_PREFIX + encode$9(new Uint8Array(prefixedBuf));\n }\n /**\n * Convert a DID (did:key) to a base64 public key.\n */\n function didToPublicKey(did) {\n if (!did.startsWith(BASE58_DID_PREFIX)) {\n throw new Error(\"Please use a base58-encoded DID formatted `did:key:z...`\");\n }\n var didWithoutPrefix = did.substr(BASE58_DID_PREFIX.length);\n var magicalBuf = decode$9(didWithoutPrefix);\n var _a = parseMagicBytes(magicalBuf), keyBuffer = _a.keyBuffer, type = _a.type;\n return {\n publicKey: utils.arrBufToBase64(keyBuffer),\n type: type\n };\n }\n // VALIDATION\n /**\n * Verify the signature of some data (string, ArrayBuffer or Uint8Array), given a DID.\n */\n function verifySignedData(_a) {\n var _b = _a.charSize, charSize = _b === void 0 ? 16 : _b, data = _a.data, did = _a.did, signature = _a.signature;\n return __awaiter(this, void 0, void 0, function () {\n var _c, type, publicKey, sigBytes, dataBytes, keyBytes, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n _e.trys.push([0, 7, , 8]);\n _c = didToPublicKey(did), type = _c.type, publicKey = _c.publicKey;\n sigBytes = new Uint8Array(utils.base64ToArrBuf(signature));\n dataBytes = new Uint8Array(utils.normalizeUnicodeToBuf(data, charSize));\n keyBytes = new Uint8Array(utils.base64ToArrBuf(publicKey));\n _d = type;\n switch (_d) {\n case KeyType.Edwards: return [3 /*break*/, 1];\n case KeyType.RSA: return [3 /*break*/, 3];\n }\n return [3 /*break*/, 5];\n case 1: return [4 /*yield*/, ed25519.verify(dataBytes, sigBytes, keyBytes)];\n case 2: return [2 /*return*/, _e.sent()];\n case 3: return [4 /*yield*/, rsa$1.verify(dataBytes, sigBytes, keyBytes)];\n case 4: return [2 /*return*/, _e.sent()];\n case 5: return [2 /*return*/, false];\n case 6: return [3 /*break*/, 8];\n case 7:\n _e.sent();\n return [2 /*return*/, false];\n case 8: return [2 /*return*/];\n }\n });\n });\n }\n // ㊙️\n /**\n * Magic bytes.\n */\n function magicBytes(keyType) {\n switch (keyType) {\n case KeyType.Edwards: return EDWARDS_DID_PREFIX;\n case KeyType.RSA: return RSA_DID_PREFIX;\n case KeyType.BLS: return BLS_DID_PREFIX;\n default: return null;\n }\n }\n /**\n * Parse magic bytes on prefixed key-buffer\n * to determine cryptosystem & the unprefixed key-buffer.\n */\n var parseMagicBytes = function (prefixedKey) {\n // RSA\n if (hasPrefix(prefixedKey, RSA_DID_PREFIX)) {\n return {\n keyBuffer: prefixedKey.slice(RSA_DID_PREFIX.byteLength),\n type: KeyType.RSA\n };\n // EDWARDS\n }\n else if (hasPrefix(prefixedKey, EDWARDS_DID_PREFIX)) {\n return {\n keyBuffer: prefixedKey.slice(EDWARDS_DID_PREFIX.byteLength),\n type: KeyType.Edwards\n };\n // BLS\n }\n else if (hasPrefix(prefixedKey, BLS_DID_PREFIX)) {\n return {\n keyBuffer: prefixedKey.slice(BLS_DID_PREFIX.byteLength),\n type: KeyType.BLS\n };\n }\n throw new Error(\"Unsupported key algorithm. Try using RSA.\");\n };\n /**\n * Determines if an ArrayBuffer has a given indeterminate length-prefix.\n */\n var hasPrefix = function (prefixedKey, prefix) {\n return equal(prefix, prefixedKey.slice(0, prefix.byteLength));\n };\n var toKeyType = function (str) {\n switch (str) {\n case 'rsa': return KeyType.RSA;\n case 'ed25519': return KeyType.Edwards;\n case 'bls12-381': return KeyType.BLS;\n }\n throw new Error(\"Key Type \" + str + \" not supported\");\n };\n //# sourceMappingURL=did.js.map\n\n var did$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n get KeyType () { return KeyType; },\n exchange: exchange,\n root: root$1,\n ucan: write$1,\n write: write$1,\n publicKeyToDid: publicKeyToDid,\n didToPublicKey: didToPublicKey,\n verifySignedData: verifySignedData\n });\n\n // CONSTANTS\n // TODO: Waiting on API change.\n // Should be `dnslink`\n var WNFS_PREFIX = \"wnfs\";\n // FUNCTIONS\n /**\n * Create a UCAN, User Controlled Authorization Networks, JWT.\n * This JWT can be used for authorization.\n *\n * ### Header\n *\n * `alg`, Algorithm, the type of signature.\n * `typ`, Type, the type of this data structure, JWT.\n * `uav`, UCAN version.\n *\n * ### Payload\n *\n * `aud`, Audience, the ID of who it's intended for.\n * `exp`, Expiry, unix timestamp of when the jwt is no longer valid.\n * `iss`, Issuer, the ID of who sent this.\n * `nbf`, Not Before, unix timestamp of when the jwt becomes valid.\n * `prf`, Proof, an optional nested token with equal or greater privileges.\n * `ptc`, Potency, which rights come with the token.\n * `rsc`, Resource, the involved resource.\n *\n */\n function build(_a) {\n var _b = _a.addSignature, addSignature = _b === void 0 ? true : _b, audience = _a.audience, _c = _a.facts, facts = _c === void 0 ? [] : _c, issuer = _a.issuer, _d = _a.lifetimeInSeconds, lifetimeInSeconds = _d === void 0 ? 30 : _d, _e = _a.potency, potency = _e === void 0 ? 'APPEND' : _e, proof = _a.proof, resource = _a.resource;\n return __awaiter(this, void 0, void 0, function () {\n var currentTimeInSeconds, decodedProof, ksAlg, header, exp, nbf, prf, payload, _f, signature, _g;\n var _h;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n currentTimeInSeconds = Math.floor(Date.now() / 1000);\n decodedProof = proof && decode$a(proof);\n return [4 /*yield*/, keystore$2.getAlg()\n // Header\n ];\n case 1:\n ksAlg = _j.sent();\n header = {\n alg: jwtAlgorithm(ksAlg) || 'UnknownAlgorithm',\n typ: 'JWT',\n uav: '1.0.0' // actually 0.3.1 but server isn't updated yet\n };\n exp = currentTimeInSeconds + lifetimeInSeconds;\n nbf = currentTimeInSeconds - 60;\n if (decodedProof) {\n prf = decodedProof.payload;\n exp = Math.min(prf.exp, exp);\n nbf = Math.max(prf.nbf, nbf);\n }\n _h = {\n aud: audience,\n exp: exp,\n fct: facts\n };\n _f = issuer;\n if (_f) return [3 /*break*/, 3];\n return [4 /*yield*/, write$1()];\n case 2:\n _f = (_j.sent());\n _j.label = 3;\n case 3:\n payload = (_h.iss = _f,\n _h.nbf = nbf,\n _h.prf = proof || null,\n _h.ptc = potency,\n _h.rsc = resource ? resource : (decodedProof ? decodedProof.payload.rsc : '*'),\n _h);\n if (!addSignature) return [3 /*break*/, 5];\n return [4 /*yield*/, sign$1(header, payload)];\n case 4:\n _g = _j.sent();\n return [3 /*break*/, 6];\n case 5:\n _g = null;\n _j.label = 6;\n case 6:\n signature = _g;\n return [2 /*return*/, {\n header: header,\n payload: payload,\n signature: signature\n }];\n }\n });\n });\n }\n /**\n * Given a list of UCANs, generate a dictionary.\n * The key will be in the form of `${resourceKey}:${resourceValue}`\n */\n function compileDictionary(ucans) {\n return ucans.reduce(function (acc, ucanString) {\n var _a, _b;\n var ucan = decode$a(ucanString);\n var rsc = ucan.payload.rsc;\n if (isExpired(ucan))\n return acc;\n if (typeof rsc !== \"object\") {\n return __assign(__assign({}, acc), (_a = {}, _a[rsc] = ucanString, _a));\n }\n var resource = Array.from(Object.entries(rsc))[0];\n var key = resource[0] + \":\" + (resource[0] === WNFS_PREFIX\n ? resource[1].replace(/^\\/+/, \"\")\n : resource[1]);\n return __assign(__assign({}, acc), (_b = {}, _b[key] = ucanString, _b));\n }, {});\n }\n /**\n * Try to decode a UCAN.\n * Will throw if it fails.\n *\n * @param ucan The encoded UCAN to decode\n */\n function decode$a(ucan) {\n var split = ucan.split(\".\");\n var header = JSON.parse(urlDecode(split[0]));\n var payload = JSON.parse(urlDecode(split[1]));\n return {\n header: header,\n payload: payload,\n signature: split[2] || null\n };\n }\n /**\n * Encode a UCAN.\n *\n * @param ucan The UCAN to encode\n */\n function encode$a(ucan) {\n var encodedHeader = encodeHeader(ucan.header);\n var encodedPayload = encodePayload(ucan.payload);\n return encodedHeader + '.' +\n encodedPayload + '.' +\n ucan.signature;\n }\n /**\n * Encode the header of a UCAN.\n *\n * @param header The UcanHeader to encode\n */\n function encodeHeader(header) {\n return urlEncode(JSON.stringify(header));\n }\n /**\n * Encode the payload of a UCAN.\n *\n * @param payload The UcanPayload to encode\n */\n function encodePayload(payload) {\n return urlEncode(JSON.stringify(__assign({}, payload)));\n }\n /**\n * Check if a UCAN is expired.\n *\n * @param ucan The UCAN to validate\n */\n function isExpired(ucan) {\n return ucan.payload.exp <= Math.floor(Date.now() / 1000);\n }\n /**\n * Check if a UCAN is valid.\n *\n * @param ucan The decoded UCAN\n * @param did The DID associated with the signature of the UCAN\n */\n function isValid(ucan) {\n return __awaiter(this, void 0, void 0, function () {\n var encodedHeader, encodedPayload, a, prf, b;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n encodedHeader = encodeHeader(ucan.header);\n encodedPayload = encodePayload(ucan.payload);\n return [4 /*yield*/, verifySignedData({\n charSize: 8,\n data: encodedHeader + \".\" + encodedPayload,\n did: ucan.payload.iss,\n signature: makeUrlUnsafe(ucan.signature || \"\")\n })];\n case 1:\n a = _a.sent();\n if (!a)\n return [2 /*return*/, a];\n if (!ucan.payload.prf)\n return [2 /*return*/, true\n // Verify proofs\n ];\n prf = decode$a(ucan.payload.prf);\n b = prf.payload.aud === ucan.payload.iss;\n if (!b)\n return [2 /*return*/, b];\n return [4 /*yield*/, isValid(prf)];\n case 2: return [2 /*return*/, _a.sent()];\n }\n });\n });\n }\n /**\n * Given a UCAN, lookup the root issuer.\n *\n * Throws when given an improperly formatted UCAN.\n * This could be a nested UCAN (ie. proof).\n *\n * @param ucan A UCAN.\n * @returns The root issuer.\n */\n function rootIssuer(ucan, level) {\n if (level === void 0) { level = 0; }\n var p = extractPayload(ucan, level);\n if (p.prf)\n return rootIssuer(p.prf, level + 1);\n return p.iss;\n }\n /**\n * Generate UCAN signature.\n */\n function sign$1(header, payload) {\n return __awaiter(this, void 0, void 0, function () {\n var encodedHeader, encodedPayload, _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n encodedHeader = encodeHeader(header);\n encodedPayload = encodePayload(payload);\n _b = (_a = base64).makeUrlSafe;\n return [4 /*yield*/, keystore$2.sign(encodedHeader + \".\" + encodedPayload, 8)];\n case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];\n }\n });\n });\n }\n // ㊙️\n /**\n * JWT algorithm to be used in a JWT header.\n */\n function jwtAlgorithm(cryptoSystem) {\n switch (cryptoSystem) {\n case \"ed25519\": return 'EdDSA';\n case \"rsa\": return 'RS256';\n default: return null;\n }\n }\n /**\n * Extract the payload of a UCAN.\n *\n * Throws when given an improperly formatted UCAN.\n */\n function extractPayload(ucan, level) {\n try {\n return JSON.parse(urlDecode(ucan.split(\".\")[1]));\n }\n catch (_) {\n throw new Error(\"Invalid UCAN (\" + level + \" level\" + (level === 1 ? \"\" : \"s\") + \" deep): `\" + ucan + \"`\");\n }\n }\n\n var ucan = /*#__PURE__*/Object.freeze({\n __proto__: null,\n WNFS_PREFIX: WNFS_PREFIX,\n build: build,\n compileDictionary: compileDictionary,\n decode: decode$a,\n encode: encode$a,\n encodeHeader: encodeHeader,\n encodePayload: encodePayload,\n isExpired: isExpired,\n isValid: isValid,\n rootIssuer: rootIssuer,\n sign: sign$1\n });\n\n var dictionary = {};\n // FUNCTIONS\n /**\n * You didn't see anything 👀\n */\n function clearStorage() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n dictionary = {};\n return [4 /*yield*/, removeItem$1(UCANS_STORAGE_KEY)];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n }\n /**\n * Lookup the prefix for a filesystem key in the dictionary.\n */\n function dictionaryFilesystemPrefix(username) {\n // const host = `${username}.${setup.endpoints.user}`\n // TODO: Waiting on API change.\n // Should be `${WNFS_PREFIX}:${host}/`\n return WNFS_PREFIX + \":\";\n }\n /**\n * Look up a UCAN for a platform app.\n */\n function lookupAppUcan(domain) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, dictionary[\"*\"] || dictionary[\"app:*\"] || dictionary[\"app:\" + domain]];\n });\n });\n }\n /**\n * Look up a UCAN with a file system path.\n */\n function lookupFilesystemUcan(path) {\n return __awaiter(this, void 0, void 0, function () {\n var all, isDirectory$1, pathParts, username, prefix;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (dictionary[\"*\"]) {\n return [2 /*return*/, dictionary[\"*\"]];\n }\n all = path === \"*\";\n isDirectory$1 = all ? false : isDirectory(path);\n pathParts = all ? [\"*\"] : unwrap(path);\n return [4 /*yield*/, authenticatedUsername()];\n case 1:\n username = _a.sent();\n prefix = username ? dictionaryFilesystemPrefix() : \"\";\n return [2 /*return*/, pathParts.reduce(function (acc, part, idx) {\n if (acc)\n return acc;\n var isLastPart = idx === 0;\n var partsSlice = pathParts.slice(0, pathParts.length - idx);\n var partialPath = toPosix(isLastPart && !isDirectory$1\n ? file.apply(pathing, partsSlice) : directory.apply(pathing, partsSlice));\n return dictionary[\"\" + prefix + partialPath] || null;\n }, null)];\n }\n });\n });\n }\n /**\n * Store UCANs and update the in-memory dictionary.\n */\n function store(ucans) {\n return __awaiter(this, void 0, void 0, function () {\n var existing, newList, filteredList;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getItem$1(UCANS_STORAGE_KEY)];\n case 1:\n existing = _a.sent();\n newList = (existing || []).concat(ucans);\n dictionary = compileDictionary(newList);\n filteredList = listFromDictionary();\n return [4 /*yield*/, setItem$1(UCANS_STORAGE_KEY, filteredList)];\n case 2:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n }\n /**\n * See if the stored UCANs in the in-memory dictionary\n * conform to the given `Permissions`.\n */\n function validatePermissions(_a, username) {\n var app = _a.app, fs = _a.fs;\n var prefix = dictionaryFilesystemPrefix();\n // Root access\n var rootUcan = dictionary[\"*\"];\n if (rootUcan && !isExpired(decode$a(rootUcan)))\n return true;\n // Check permissions\n if (app) {\n var k = prefix + toPosix(appDataPath(app));\n var u = dictionary[k];\n if (!u || isExpired(decode$a(u)))\n return false;\n }\n if (fs === null || fs === void 0 ? void 0 : fs.private) {\n var priv = fs.private.every(function (path) {\n var pathWithPrefix = prefix + \"private/\" + toPosix(path);\n var u = dictionary[pathWithPrefix];\n return u && !isExpired(decode$a(u));\n });\n if (!priv)\n return false;\n }\n if (fs === null || fs === void 0 ? void 0 : fs.public) {\n var publ = fs.public.every(function (path) {\n var pathWithPrefix = prefix + \"public/\" + toPosix(path);\n var u = dictionary[pathWithPrefix];\n return u && !isExpired(decode$a(u));\n });\n if (!publ)\n return false;\n }\n return true;\n }\n // ㊙️\n function listFromDictionary() {\n return Object.values(dictionary);\n }\n\n var index_umd$1 = createCommonjsModule(function (module, exports) {\n (function (global, factory) {\n \t factory(exports) ;\n }(commonjsGlobal, (function (exports) {\n \t/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n \t/**\n \t * Throttle execution of a function. Especially useful for rate limiting\n \t * execution of handlers on events like resize and scroll.\n \t *\n \t * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n \t * @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the\n \t * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time\n \t * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,\n \t * the internal counter is reset).\n \t * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n \t * to `callback` when the throttled-function is executed.\n \t * @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),\n \t * schedule `callback` to execute after `delay` ms.\n \t *\n \t * @returns {Function} A new, throttled, function.\n \t */\n \tfunction throttle (delay, noTrailing, callback, debounceMode) {\n \t /*\n \t * After wrapper has stopped being called, this timeout ensures that\n \t * `callback` is executed at the proper times in `throttle` and `end`\n \t * debounce modes.\n \t */\n \t var timeoutID;\n \t var cancelled = false; // Keep track of the last time `callback` was executed.\n\n \t var lastExec = 0; // Function to clear existing timeout\n\n \t function clearExistingTimeout() {\n \t if (timeoutID) {\n \t clearTimeout(timeoutID);\n \t }\n \t } // Function to cancel next exec\n\n\n \t function cancel() {\n \t clearExistingTimeout();\n \t cancelled = true;\n \t } // `noTrailing` defaults to falsy.\n\n\n \t if (typeof noTrailing !== 'boolean') {\n \t debounceMode = callback;\n \t callback = noTrailing;\n \t noTrailing = undefined;\n \t }\n \t /*\n \t * The `wrapper` function encapsulates all of the throttling / debouncing\n \t * functionality and when executed will limit the rate at which `callback`\n \t * is executed.\n \t */\n\n\n \t function wrapper() {\n \t for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n \t arguments_[_key] = arguments[_key];\n \t }\n\n \t var self = this;\n \t var elapsed = Date.now() - lastExec;\n\n \t if (cancelled) {\n \t return;\n \t } // Execute `callback` and update the `lastExec` timestamp.\n\n\n \t function exec() {\n \t lastExec = Date.now();\n \t callback.apply(self, arguments_);\n \t }\n \t /*\n \t * If `debounceMode` is true (at begin) this is used to clear the flag\n \t * to allow future `callback` executions.\n \t */\n\n\n \t function clear() {\n \t timeoutID = undefined;\n \t }\n\n \t if (debounceMode && !timeoutID) {\n \t /*\n \t * Since `wrapper` is being called for the first time and\n \t * `debounceMode` is true (at begin), execute `callback`.\n \t */\n \t exec();\n \t }\n\n \t clearExistingTimeout();\n\n \t if (debounceMode === undefined && elapsed > delay) {\n \t /*\n \t * In throttle mode, if `delay` time has been exceeded, execute\n \t * `callback`.\n \t */\n \t exec();\n \t } else if (noTrailing !== true) {\n \t /*\n \t * In trailing throttle mode, since `delay` time has not been\n \t * exceeded, schedule `callback` to execute `delay` ms after most\n \t * recent execution.\n \t *\n \t * If `debounceMode` is true (at begin), schedule `clear` to execute\n \t * after `delay` ms.\n \t *\n \t * If `debounceMode` is false (at end), schedule `callback` to\n \t * execute after `delay` ms.\n \t */\n \t timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n \t }\n \t }\n\n \t wrapper.cancel = cancel; // Return the wrapper function.\n\n \t return wrapper;\n \t}\n\n \t/* eslint-disable no-undefined */\n \t/**\n \t * Debounce execution of a function. Debouncing, unlike throttling,\n \t * guarantees that a function is only executed a single time, either at the\n \t * very beginning of a series of calls, or at the very end.\n \t *\n \t * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n \t * @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n \t * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n \t * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n \t * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n \t * to `callback` when the debounced-function is executed.\n \t *\n \t * @returns {Function} A new, debounced function.\n \t */\n\n \tfunction debounce (delay, atBegin, callback) {\n \t return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);\n \t}\n\n \texports.debounce = debounce;\n \texports.throttle = throttle;\n\n \tObject.defineProperty(exports, '__esModule', { value: true });\n\n })));\n //# sourceMappingURL=index.umd.js.map\n });\n\n /*@__PURE__*/getDefaultExportFromCjs(index_umd$1);\n\n var toDAGLink$1 = function (link) {\n var name = link.name, cid = link.cid, size = link.size;\n return new src$9.DAGLink(name, size, cid);\n };\n var fromFSFile = function (fsObj) {\n var _a = fsObj.name, name = _a === void 0 ? '' : _a, cid = fsObj.cid, size = fsObj.size, mtime = fsObj.mtime, type = fsObj.type;\n return {\n name: name,\n cid: cid.toString(),\n size: size,\n mtime: mtime,\n isFile: type !== \"dir\"\n };\n };\n var fromDAGLink = function (link) {\n var name = link.Name;\n var cid = link.Hash.toString();\n var size = link.Tsize;\n return { name: name, cid: cid, size: size };\n };\n var make = function (name, cid, isFile, size) {\n return {\n name: name,\n cid: cid,\n size: size,\n isFile: isFile,\n mtime: Date.now()\n };\n };\n var arrToMap = function (arr) {\n return arr.reduce(function (acc, cur) {\n acc[cur.name] = cur;\n return acc;\n }, {});\n };\n\n var link = /*#__PURE__*/Object.freeze({\n __proto__: null,\n toDAGLink: toDAGLink$1,\n fromFSFile: fromFSFile,\n fromDAGLink: fromDAGLink,\n make: make,\n arrToMap: arrToMap\n });\n\n /** @internal */\n var getFile = function (cid) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, catBuf(cid)];\n });\n }); };\n var getEncryptedFile = function (cid, key) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, catAndDecode(cid, key)];\n });\n }); };\n var putFile = function (content) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, add(content)];\n });\n }); };\n var putEncryptedFile = function (content, key) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, add$1(content, key)];\n });\n }); };\n var getSimpleLinks = function (cid) { return __awaiter(void 0, void 0, void 0, function () {\n var dagNode;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, dagGet(cid)];\n case 1:\n dagNode = _a.sent();\n return [2 /*return*/, arrToMap(dagNode.Links.map(fromDAGLink))];\n }\n });\n }); };\n var getLinks = function (cid) { return __awaiter(void 0, void 0, void 0, function () {\n var raw, links, dagNode;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, ls(cid)];\n case 1:\n raw = _a.sent();\n links = arrToMap(raw.map(fromFSFile));\n return [4 /*yield*/, dagGet(cid)];\n case 2:\n dagNode = _a.sent();\n dagNode.Links.forEach(function (l) {\n if (links[l.Name] && links[l.Name].size === 0) {\n links[l.Name].size = l.Tsize;\n }\n });\n return [2 /*return*/, links];\n }\n });\n }); };\n var putLinks = function (links) { return __awaiter(void 0, void 0, void 0, function () {\n var dagLinks;\n return __generator(this, function (_a) {\n dagLinks = Object.values(links)\n .filter(function (l) { return l !== undefined; })\n .map(toDAGLink$1);\n return [2 /*return*/, dagPutLinks(dagLinks)];\n });\n }); };\n\n /** @internal */\n var isFile$1 = function (obj) {\n return isObject(obj) && obj.content !== undefined;\n };\n var isBaseLink = function (obj) {\n return isObject(obj)\n && isString(obj.name)\n && isNum(obj.size)\n && isBool(obj.isFile);\n };\n var isLink = function (obj) {\n return isBaseLink(obj)\n && isCID(obj.cid);\n };\n var isLinks = function (obj) {\n return isObject(obj)\n && Object.values(obj).every(isLink);\n };\n var isUnixMeta = function (obj) {\n return isObject(obj)\n && isNum(obj.mtime)\n && isNum(obj.ctime)\n && isNum(obj.mode)\n && isString(obj._type);\n };\n var isMetadata = function (obj) {\n return isObject(obj)\n && isUnixMeta(obj.unixMeta)\n && isBool(obj.isFile)\n && isSemVer(obj.version);\n };\n var isSkeleton = function (obj) {\n return isObject(obj)\n && Object.values(obj).every(function (val) { return (isObject(val)\n && isCID(val.cid)\n && isCID(val.userland)\n && isCID(val.metadata)\n && isSkeleton(val.subSkeleton)); });\n };\n var isTreeHeader = function (obj) {\n return isObject(obj)\n && isSkeleton(obj.skeleton)\n && isMetadata(obj.metadata)\n && obj.metadata.isFile === false;\n };\n var isTreeInfo = function (obj) {\n return isTreeHeader(obj)\n && isCID(obj.userland);\n };\n var isFileHeader = function (obj) {\n return isObject(obj)\n && isMetadata(obj.metadata)\n && obj.metadata.isFile === true;\n };\n var isFileInfo = function (obj) {\n return isFileHeader(obj)\n && isCID(obj.userland);\n };\n var isCID = function (obj) {\n return isString(obj);\n };\n var isSemVer = function (obj) {\n if (!isObject(obj))\n return false;\n var major = obj.major, minor = obj.minor, patch = obj.patch;\n return isNum(major) && isNum(minor) && isNum(patch);\n };\n\n /** @internal */\n var putTree = function (links, skeletonVal, metadataVal, previousCID) { return __awaiter(void 0, void 0, void 0, function () {\n var userlandInfo, userland, _a, metadata, skeleton, previous, _b, _c, _d, _e, internalLinks, _f, cid, size$1;\n return __generator(this, function (_g) {\n switch (_g.label) {\n case 0: return [4 /*yield*/, putLinks(links)];\n case 1:\n userlandInfo = _g.sent();\n userland = make('userland', userlandInfo.cid, true, userlandInfo.size);\n return [4 /*yield*/, Promise.all([\n putAndMakeLink('metadata', metadataVal),\n putAndMakeLink('skeleton', skeletonVal),\n ])];\n case 2:\n _a = _g.sent(), metadata = _a[0], skeleton = _a[1];\n if (!(previousCID != null)) return [3 /*break*/, 4];\n _d = (_c = link).make;\n _e = ['previous', previousCID, false];\n return [4 /*yield*/, size(previousCID)];\n case 3:\n _b = _d.apply(_c, _e.concat([_g.sent()]));\n return [3 /*break*/, 5];\n case 4:\n _b = undefined;\n _g.label = 5;\n case 5:\n previous = _b;\n internalLinks = { metadata: metadata, skeleton: skeleton, userland: userland, previous: previous };\n return [4 /*yield*/, putLinks(internalLinks)];\n case 6:\n _f = _g.sent(), cid = _f.cid, size$1 = _f.size;\n return [2 /*return*/, {\n cid: cid,\n userland: userland.cid,\n metadata: metadata.cid,\n size: size$1,\n isFile: false,\n skeleton: skeletonVal\n }];\n }\n });\n }); };\n var putFile$1 = function (content, metadataVal, previousCID) { return __awaiter(void 0, void 0, void 0, function () {\n var userlandInfo, userland, metadata, previous, _a, _b, _c, _d, internalLinks, _e, cid, size$1;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0: return [4 /*yield*/, putFile(content)];\n case 1:\n userlandInfo = _f.sent();\n userland = make('userland', userlandInfo.cid, true, userlandInfo.size);\n return [4 /*yield*/, putAndMakeLink('metadata', metadataVal)];\n case 2:\n metadata = _f.sent();\n if (!(previousCID != null)) return [3 /*break*/, 4];\n _c = (_b = link).make;\n _d = ['previous', previousCID, false];\n return [4 /*yield*/, size(previousCID)];\n case 3:\n _a = _c.apply(_b, _d.concat([_f.sent()]));\n return [3 /*break*/, 5];\n case 4:\n _a = undefined;\n _f.label = 5;\n case 5:\n previous = _a;\n internalLinks = { metadata: metadata, userland: userland, previous: previous };\n return [4 /*yield*/, putLinks(internalLinks)];\n case 6:\n _e = _f.sent(), cid = _e.cid, size$1 = _e.size;\n return [2 /*return*/, {\n cid: cid,\n userland: userland.cid,\n metadata: metadata.cid,\n size: size$1,\n isFile: true,\n skeleton: {}\n }];\n }\n });\n }); };\n var putAndMakeLink = function (name, val) { return __awaiter(void 0, void 0, void 0, function () {\n var _a, cid, size;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, add$1(val, null)];\n case 1:\n _a = _b.sent(), cid = _a.cid, size = _a.size;\n return [2 /*return*/, make(name, cid, true, size)];\n }\n });\n }); };\n var get$3 = function (cid) { return __awaiter(void 0, void 0, void 0, function () {\n var links, metadata, skeleton, _a, userland, previous;\n var _b, _c;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0: return [4 /*yield*/, getLinks(cid)];\n case 1:\n links = _d.sent();\n return [4 /*yield*/, getAndCheckValue(links, 'metadata', isMetadata)];\n case 2:\n metadata = _d.sent();\n if (!metadata.isFile) return [3 /*break*/, 3];\n _a = undefined;\n return [3 /*break*/, 5];\n case 3: return [4 /*yield*/, getAndCheckValue(links, 'skeleton', isSkeleton)];\n case 4:\n _a = _d.sent();\n _d.label = 5;\n case 5:\n skeleton = _a;\n userland = ((_b = links['userland']) === null || _b === void 0 ? void 0 : _b.cid) || null;\n if (!isCID(userland))\n throw new Error(\"Could not find userland\");\n previous = ((_c = links['previous']) === null || _c === void 0 ? void 0 : _c.cid) || undefined;\n return [2 /*return*/, { userland: userland, metadata: metadata, previous: previous, skeleton: skeleton }];\n }\n });\n }); };\n var getValue = function (linksOrCID, name) { return __awaiter(void 0, void 0, void 0, function () {\n var links;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!isString(linksOrCID)) return [3 /*break*/, 2];\n return [4 /*yield*/, getLinks(linksOrCID)];\n case 1:\n links = _a.sent();\n return [2 /*return*/, getValueFromLinks(links, name)];\n case 2: return [2 /*return*/, getValueFromLinks(linksOrCID, name)];\n }\n });\n }); };\n var getValueFromLinks = function (links, name) { return __awaiter(void 0, void 0, void 0, function () {\n var linkCID;\n var _a;\n return __generator(this, function (_b) {\n linkCID = (_a = links[name]) === null || _a === void 0 ? void 0 : _a.cid;\n if (!linkCID)\n return [2 /*return*/, null];\n return [2 /*return*/, catAndDecode(linkCID, null)];\n });\n }); };\n var getAndCheckValue = function (linksOrCid, name, checkFn, canBeNull) {\n if (canBeNull === void 0) { canBeNull = false; }\n return __awaiter(void 0, void 0, void 0, function () {\n var val;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getValue(linksOrCid, name)];\n case 1:\n val = _a.sent();\n return [2 /*return*/, checkValue(val, name, checkFn, canBeNull)];\n }\n });\n });\n };\n var checkValue = function (val, name, checkFn, canBeNull) {\n if (canBeNull === void 0) { canBeNull = false; }\n if (!isValue(val)) {\n if (canBeNull)\n return val;\n throw new Error(\"Could not find header value: \" + name);\n }\n if (checkFn(val)) {\n return val;\n }\n throw new Error(\"Improperly formatted header value: \" + name);\n };\n\n var isDecryptedNode = function (obj) {\n return isPrivateTreeInfo(obj) || isPrivateFileInfo(obj);\n };\n var isPrivateFileInfo = function (obj) {\n return isObject(obj)\n && isMetadata(obj.metadata)\n && obj.metadata.isFile\n && isString(obj.key)\n && isCID(obj.content);\n };\n var isPrivateTreeInfo = function (obj) {\n return isObject(obj)\n && isMetadata(obj.metadata)\n && obj.metadata.isFile === false\n && isNum(obj.revision)\n && isPrivateLinks(obj.links)\n && isPrivateSkeleton(obj.skeleton);\n };\n var isPrivateLink = function (obj) {\n return isBaseLink(obj)\n && isString(obj.key)\n && isString(obj.pointer);\n };\n var isPrivateLinks = function (obj) {\n return isObject(obj)\n && Object.values(obj).every(isPrivateLink);\n };\n var isPrivateSkeleton = function (obj) {\n return isObject(obj)\n && Object.values(obj).every(isPrivateSkeletonInfo);\n };\n var isPrivateSkeletonInfo = function (obj) {\n return isObject(obj)\n && isCID(obj.cid)\n && isString(obj.key)\n && isPrivateSkeleton(obj.subSkeleton);\n };\n\n /**\n \tC-like unsigned 32 bits integers in Javascript\n \tCopyright (C) 2013, Pierre Curto\n \tMIT license\n */\n\n var uint32 = createCommonjsModule(function (module) {\n (function (root) {\n\n \t// Local cache for typical radices\n \t({\n \t\t36: UINT32( Math.pow(36, 5) )\n \t,\t16: UINT32( Math.pow(16, 7) )\n \t,\t10: UINT32( Math.pow(10, 9) )\n \t,\t2: UINT32( Math.pow(2, 30) )\n \t});\n \t({\n \t\t36: UINT32(36)\n \t,\t16: UINT32(16)\n \t,\t10: UINT32(10)\n \t,\t2: UINT32(2)\n \t});\n\n \t/**\n \t *\tRepresents an unsigned 32 bits integer\n \t * @constructor\n \t * @param {Number|String|Number} low bits | integer as a string \t\t | integer as a number\n \t * @param {Number|Number|Undefined} high bits | radix (optional, default=10)\n \t * @return \n \t */\n \tfunction UINT32 (l, h) {\n \t\tif ( !(this instanceof UINT32) )\n \t\t\treturn new UINT32(l, h)\n\n \t\tthis._low = 0;\n \t\tthis._high = 0;\n \t\tthis.remainder = null;\n \t\tif (typeof h == 'undefined')\n \t\t\treturn fromNumber.call(this, l)\n\n \t\tif (typeof l == 'string')\n \t\t\treturn fromString.call(this, l, h)\n\n \t\tfromBits.call(this, l, h);\n \t}\n\n \t/**\n \t * Set the current _UINT32_ object with its low and high bits\n \t * @method fromBits\n \t * @param {Number} low bits\n \t * @param {Number} high bits\n \t * @return ThisExpression\n \t */\n \tfunction fromBits (l, h) {\n \t\tthis._low = l | 0;\n \t\tthis._high = h | 0;\n\n \t\treturn this\n \t}\n \tUINT32.prototype.fromBits = fromBits;\n\n \t/**\n \t * Set the current _UINT32_ object from a number\n \t * @method fromNumber\n \t * @param {Number} number\n \t * @return ThisExpression\n \t */\n \tfunction fromNumber (value) {\n \t\tthis._low = value & 0xFFFF;\n \t\tthis._high = value >>> 16;\n\n \t\treturn this\n \t}\n \tUINT32.prototype.fromNumber = fromNumber;\n\n \t/**\n \t * Set the current _UINT32_ object from a string\n \t * @method fromString\n \t * @param {String} integer as a string\n \t * @param {Number} radix (optional, default=10)\n \t * @return ThisExpression\n \t */\n \tfunction fromString (s, radix) {\n \t\tvar value = parseInt(s, radix || 10);\n\n \t\tthis._low = value & 0xFFFF;\n \t\tthis._high = value >>> 16;\n\n \t\treturn this\n \t}\n \tUINT32.prototype.fromString = fromString;\n\n \t/**\n \t * Convert this _UINT32_ to a number\n \t * @method toNumber\n \t * @return {Number} the converted UINT32\n \t */\n \tUINT32.prototype.toNumber = function () {\n \t\treturn (this._high * 65536) + this._low\n \t};\n\n \t/**\n \t * Convert this _UINT32_ to a string\n \t * @method toString\n \t * @param {Number} radix (optional, default=10)\n \t * @return {String} the converted UINT32\n \t */\n \tUINT32.prototype.toString = function (radix) {\n \t\treturn this.toNumber().toString(radix || 10)\n \t};\n\n \t/**\n \t * Add two _UINT32_. The current _UINT32_ stores the result\n \t * @method add\n \t * @param {Object} other UINT32\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.add = function (other) {\n \t\tvar a00 = this._low + other._low;\n \t\tvar a16 = a00 >>> 16;\n\n \t\ta16 += this._high + other._high;\n\n \t\tthis._low = a00 & 0xFFFF;\n \t\tthis._high = a16 & 0xFFFF;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Subtract two _UINT32_. The current _UINT32_ stores the result\n \t * @method subtract\n \t * @param {Object} other UINT32\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.subtract = function (other) {\n \t\t//TODO inline\n \t\treturn this.add( other.clone().negate() )\n \t};\n\n \t/**\n \t * Multiply two _UINT32_. The current _UINT32_ stores the result\n \t * @method multiply\n \t * @param {Object} other UINT32\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.multiply = function (other) {\n \t\t/*\n \t\t\ta = a00 + a16\n \t\t\tb = b00 + b16\n \t\t\ta*b = (a00 + a16)(b00 + b16)\n \t\t\t\t= a00b00 + a00b16 + a16b00 + a16b16\n\n \t\t\ta16b16 overflows the 32bits\n \t\t */\n \t\tvar a16 = this._high;\n \t\tvar a00 = this._low;\n \t\tvar b16 = other._high;\n \t\tvar b00 = other._low;\n\n /* Removed to increase speed under normal circumstances (i.e. not multiplying by 0 or 1)\n \t\t// this == 0 or other == 1: nothing to do\n \t\tif ((a00 == 0 && a16 == 0) || (b00 == 1 && b16 == 0)) return this\n\n \t\t// other == 0 or this == 1: this = other\n \t\tif ((b00 == 0 && b16 == 0) || (a00 == 1 && a16 == 0)) {\n \t\t\tthis._low = other._low\n \t\t\tthis._high = other._high\n \t\t\treturn this\n \t\t}\n */\n\n \t\tvar c16, c00;\n \t\tc00 = a00 * b00;\n \t\tc16 = c00 >>> 16;\n\n \t\tc16 += a16 * b00;\n \t\tc16 &= 0xFFFF;\t\t// Not required but improves performance\n \t\tc16 += a00 * b16;\n\n \t\tthis._low = c00 & 0xFFFF;\n \t\tthis._high = c16 & 0xFFFF;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Divide two _UINT32_. The current _UINT32_ stores the result.\n \t * The remainder is made available as the _remainder_ property on\n \t * the _UINT32_ object. It can be null, meaning there are no remainder.\n \t * @method div\n \t * @param {Object} other UINT32\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.div = function (other) {\n \t\tif ( (other._low == 0) && (other._high == 0) ) throw Error('division by zero')\n\n \t\t// other == 1\n \t\tif (other._high == 0 && other._low == 1) {\n \t\t\tthis.remainder = new UINT32(0);\n \t\t\treturn this\n \t\t}\n\n \t\t// other > this: 0\n \t\tif ( other.gt(this) ) {\n \t\t\tthis.remainder = this.clone();\n \t\t\tthis._low = 0;\n \t\t\tthis._high = 0;\n \t\t\treturn this\n \t\t}\n \t\t// other == this: 1\n \t\tif ( this.eq(other) ) {\n \t\t\tthis.remainder = new UINT32(0);\n \t\t\tthis._low = 1;\n \t\t\tthis._high = 0;\n \t\t\treturn this\n \t\t}\n\n \t\t// Shift the divisor left until it is higher than the dividend\n \t\tvar _other = other.clone();\n \t\tvar i = -1;\n \t\twhile ( !this.lt(_other) ) {\n \t\t\t// High bit can overflow the default 16bits\n \t\t\t// Its ok since we right shift after this loop\n \t\t\t// The overflown bit must be kept though\n \t\t\t_other.shiftLeft(1, true);\n \t\t\ti++;\n \t\t}\n\n \t\t// Set the remainder\n \t\tthis.remainder = this.clone();\n \t\t// Initialize the current result to 0\n \t\tthis._low = 0;\n \t\tthis._high = 0;\n \t\tfor (; i >= 0; i--) {\n \t\t\t_other.shiftRight(1);\n \t\t\t// If shifted divisor is smaller than the dividend\n \t\t\t// then subtract it from the dividend\n \t\t\tif ( !this.remainder.lt(_other) ) {\n \t\t\t\tthis.remainder.subtract(_other);\n \t\t\t\t// Update the current result\n \t\t\t\tif (i >= 16) {\n \t\t\t\t\tthis._high |= 1 << (i - 16);\n \t\t\t\t} else {\n \t\t\t\t\tthis._low |= 1 << i;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Negate the current _UINT32_\n \t * @method negate\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.negate = function () {\n \t\tvar v = ( ~this._low & 0xFFFF ) + 1;\n \t\tthis._low = v & 0xFFFF;\n \t\tthis._high = (~this._high + (v >>> 16)) & 0xFFFF;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Equals\n \t * @method eq\n \t * @param {Object} other UINT32\n \t * @return {Boolean}\n \t */\n \tUINT32.prototype.equals = UINT32.prototype.eq = function (other) {\n \t\treturn (this._low == other._low) && (this._high == other._high)\n \t};\n\n \t/**\n \t * Greater than (strict)\n \t * @method gt\n \t * @param {Object} other UINT32\n \t * @return {Boolean}\n \t */\n \tUINT32.prototype.greaterThan = UINT32.prototype.gt = function (other) {\n \t\tif (this._high > other._high) return true\n \t\tif (this._high < other._high) return false\n \t\treturn this._low > other._low\n \t};\n\n \t/**\n \t * Less than (strict)\n \t * @method lt\n \t * @param {Object} other UINT32\n \t * @return {Boolean}\n \t */\n \tUINT32.prototype.lessThan = UINT32.prototype.lt = function (other) {\n \t\tif (this._high < other._high) return true\n \t\tif (this._high > other._high) return false\n \t\treturn this._low < other._low\n \t};\n\n \t/**\n \t * Bitwise OR\n \t * @method or\n \t * @param {Object} other UINT32\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.or = function (other) {\n \t\tthis._low |= other._low;\n \t\tthis._high |= other._high;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise AND\n \t * @method and\n \t * @param {Object} other UINT32\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.and = function (other) {\n \t\tthis._low &= other._low;\n \t\tthis._high &= other._high;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise NOT\n \t * @method not\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.not = function() {\n \t\tthis._low = ~this._low & 0xFFFF;\n \t\tthis._high = ~this._high & 0xFFFF;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise XOR\n \t * @method xor\n \t * @param {Object} other UINT32\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.xor = function (other) {\n \t\tthis._low ^= other._low;\n \t\tthis._high ^= other._high;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise shift right\n \t * @method shiftRight\n \t * @param {Number} number of bits to shift\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.shiftRight = UINT32.prototype.shiftr = function (n) {\n \t\tif (n > 16) {\n \t\t\tthis._low = this._high >> (n - 16);\n \t\t\tthis._high = 0;\n \t\t} else if (n == 16) {\n \t\t\tthis._low = this._high;\n \t\t\tthis._high = 0;\n \t\t} else {\n \t\t\tthis._low = (this._low >> n) | ( (this._high << (16-n)) & 0xFFFF );\n \t\t\tthis._high >>= n;\n \t\t}\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise shift left\n \t * @method shiftLeft\n \t * @param {Number} number of bits to shift\n \t * @param {Boolean} allow overflow\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.shiftLeft = UINT32.prototype.shiftl = function (n, allowOverflow) {\n \t\tif (n > 16) {\n \t\t\tthis._high = this._low << (n - 16);\n \t\t\tthis._low = 0;\n \t\t\tif (!allowOverflow) {\n \t\t\t\tthis._high &= 0xFFFF;\n \t\t\t}\n \t\t} else if (n == 16) {\n \t\t\tthis._high = this._low;\n \t\t\tthis._low = 0;\n \t\t} else {\n \t\t\tthis._high = (this._high << n) | (this._low >> (16-n));\n \t\t\tthis._low = (this._low << n) & 0xFFFF;\n \t\t\tif (!allowOverflow) {\n \t\t\t\t// Overflow only allowed on the high bits...\n \t\t\t\tthis._high &= 0xFFFF;\n \t\t\t}\n \t\t}\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise rotate left\n \t * @method rotl\n \t * @param {Number} number of bits to rotate\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.rotateLeft = UINT32.prototype.rotl = function (n) {\n \t\tvar v = (this._high << 16) | this._low;\n \t\tv = (v << n) | (v >>> (32 - n));\n \t\tthis._low = v & 0xFFFF;\n \t\tthis._high = v >>> 16;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise rotate right\n \t * @method rotr\n \t * @param {Number} number of bits to rotate\n \t * @return ThisExpression\n \t */\n \tUINT32.prototype.rotateRight = UINT32.prototype.rotr = function (n) {\n \t\tvar v = (this._high << 16) | this._low;\n \t\tv = (v >>> n) | (v << (32 - n));\n \t\tthis._low = v & 0xFFFF;\n \t\tthis._high = v >>> 16;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Clone the current _UINT32_\n \t * @method clone\n \t * @return {Object} cloned UINT32\n \t */\n \tUINT32.prototype.clone = function () {\n \t\treturn new UINT32(this._low, this._high)\n \t};\n\n \tif ( module.exports) {\n \t\t// Node.js\n \t\tmodule.exports = UINT32;\n \t} else {\n \t\t// Browser\n \t\troot['UINT32'] = UINT32;\n \t}\n\n })(commonjsGlobal);\n });\n\n /**\n \tC-like unsigned 64 bits integers in Javascript\n \tCopyright (C) 2013, Pierre Curto\n \tMIT license\n */\n\n var uint64 = createCommonjsModule(function (module) {\n (function (root) {\n\n \t// Local cache for typical radices\n \tvar radixPowerCache = {\n \t\t16: UINT64( Math.pow(16, 5) )\n \t,\t10: UINT64( Math.pow(10, 5) )\n \t,\t2: UINT64( Math.pow(2, 5) )\n \t};\n \tvar radixCache = {\n \t\t16: UINT64(16)\n \t,\t10: UINT64(10)\n \t,\t2: UINT64(2)\n \t};\n\n \t/**\n \t *\tRepresents an unsigned 64 bits integer\n \t * @constructor\n \t * @param {Number} first low bits (8)\n \t * @param {Number} second low bits (8)\n \t * @param {Number} first high bits (8)\n \t * @param {Number} second high bits (8)\n \t * or\n \t * @param {Number} low bits (32)\n \t * @param {Number} high bits (32)\n \t * or\n \t * @param {String|Number} integer as a string \t\t | integer as a number\n \t * @param {Number|Undefined} radix (optional, default=10)\n \t * @return \n \t */\n \tfunction UINT64 (a00, a16, a32, a48) {\n \t\tif ( !(this instanceof UINT64) )\n \t\t\treturn new UINT64(a00, a16, a32, a48)\n\n \t\tthis.remainder = null;\n \t\tif (typeof a00 == 'string')\n \t\t\treturn fromString.call(this, a00, a16)\n\n \t\tif (typeof a16 == 'undefined')\n \t\t\treturn fromNumber.call(this, a00)\n\n \t\tfromBits.apply(this, arguments);\n \t}\n\n \t/**\n \t * Set the current _UINT64_ object with its low and high bits\n \t * @method fromBits\n \t * @param {Number} first low bits (8)\n \t * @param {Number} second low bits (8)\n \t * @param {Number} first high bits (8)\n \t * @param {Number} second high bits (8)\n \t * or\n \t * @param {Number} low bits (32)\n \t * @param {Number} high bits (32)\n \t * @return ThisExpression\n \t */\n \tfunction fromBits (a00, a16, a32, a48) {\n \t\tif (typeof a32 == 'undefined') {\n \t\t\tthis._a00 = a00 & 0xFFFF;\n \t\t\tthis._a16 = a00 >>> 16;\n \t\t\tthis._a32 = a16 & 0xFFFF;\n \t\t\tthis._a48 = a16 >>> 16;\n \t\t\treturn this\n \t\t}\n\n \t\tthis._a00 = a00 | 0;\n \t\tthis._a16 = a16 | 0;\n \t\tthis._a32 = a32 | 0;\n \t\tthis._a48 = a48 | 0;\n\n \t\treturn this\n \t}\n \tUINT64.prototype.fromBits = fromBits;\n\n \t/**\n \t * Set the current _UINT64_ object from a number\n \t * @method fromNumber\n \t * @param {Number} number\n \t * @return ThisExpression\n \t */\n \tfunction fromNumber (value) {\n \t\tthis._a00 = value & 0xFFFF;\n \t\tthis._a16 = value >>> 16;\n \t\tthis._a32 = 0;\n \t\tthis._a48 = 0;\n\n \t\treturn this\n \t}\n \tUINT64.prototype.fromNumber = fromNumber;\n\n \t/**\n \t * Set the current _UINT64_ object from a string\n \t * @method fromString\n \t * @param {String} integer as a string\n \t * @param {Number} radix (optional, default=10)\n \t * @return ThisExpression\n \t */\n \tfunction fromString (s, radix) {\n \t\tradix = radix || 10;\n\n \t\tthis._a00 = 0;\n \t\tthis._a16 = 0;\n \t\tthis._a32 = 0;\n \t\tthis._a48 = 0;\n\n \t\t/*\n \t\t\tIn Javascript, bitwise operators only operate on the first 32 bits \n \t\t\tof a number, even though parseInt() encodes numbers with a 53 bits \n \t\t\tmantissa.\n \t\t\tTherefore UINT64(<Number>) can only work on 32 bits.\n \t\t\tThe radix maximum value is 36 (as per ECMA specs) (26 letters + 10 digits)\n \t\t\tmaximum input value is m = 32bits as 1 = 2^32 - 1\n \t\t\tSo the maximum substring length n is:\n \t\t\t36^(n+1) - 1 = 2^32 - 1\n \t\t\t36^(n+1) = 2^32\n \t\t\t(n+1)ln(36) = 32ln(2)\n \t\t\tn = 32ln(2)/ln(36) - 1\n \t\t\tn = 5.189644915687692\n \t\t\tn = 5\n \t\t */\n \t\tvar radixUint = radixPowerCache[radix] || new UINT64( Math.pow(radix, 5) );\n\n \t\tfor (var i = 0, len = s.length; i < len; i += 5) {\n \t\t\tvar size = Math.min(5, len - i);\n \t\t\tvar value = parseInt( s.slice(i, i + size), radix );\n \t\t\tthis.multiply(\n \t\t\t\t\tsize < 5\n \t\t\t\t\t\t? new UINT64( Math.pow(radix, size) )\n \t\t\t\t\t\t: radixUint\n \t\t\t\t)\n \t\t\t\t.add( new UINT64(value) );\n \t\t}\n\n \t\treturn this\n \t}\n \tUINT64.prototype.fromString = fromString;\n\n \t/**\n \t * Convert this _UINT64_ to a number (last 32 bits are dropped)\n \t * @method toNumber\n \t * @return {Number} the converted UINT64\n \t */\n \tUINT64.prototype.toNumber = function () {\n \t\treturn (this._a16 * 65536) + this._a00\n \t};\n\n \t/**\n \t * Convert this _UINT64_ to a string\n \t * @method toString\n \t * @param {Number} radix (optional, default=10)\n \t * @return {String} the converted UINT64\n \t */\n \tUINT64.prototype.toString = function (radix) {\n \t\tradix = radix || 10;\n \t\tvar radixUint = radixCache[radix] || new UINT64(radix);\n\n \t\tif ( !this.gt(radixUint) ) return this.toNumber().toString(radix)\n\n \t\tvar self = this.clone();\n \t\tvar res = new Array(64);\n \t\tfor (var i = 63; i >= 0; i--) {\n \t\t\tself.div(radixUint);\n \t\t\tres[i] = self.remainder.toNumber().toString(radix);\n \t\t\tif ( !self.gt(radixUint) ) break\n \t\t}\n \t\tres[i-1] = self.toNumber().toString(radix);\n\n \t\treturn res.join('')\n \t};\n\n \t/**\n \t * Add two _UINT64_. The current _UINT64_ stores the result\n \t * @method add\n \t * @param {Object} other UINT64\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.add = function (other) {\n \t\tvar a00 = this._a00 + other._a00;\n\n \t\tvar a16 = a00 >>> 16;\n \t\ta16 += this._a16 + other._a16;\n\n \t\tvar a32 = a16 >>> 16;\n \t\ta32 += this._a32 + other._a32;\n\n \t\tvar a48 = a32 >>> 16;\n \t\ta48 += this._a48 + other._a48;\n\n \t\tthis._a00 = a00 & 0xFFFF;\n \t\tthis._a16 = a16 & 0xFFFF;\n \t\tthis._a32 = a32 & 0xFFFF;\n \t\tthis._a48 = a48 & 0xFFFF;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Subtract two _UINT64_. The current _UINT64_ stores the result\n \t * @method subtract\n \t * @param {Object} other UINT64\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.subtract = function (other) {\n \t\treturn this.add( other.clone().negate() )\n \t};\n\n \t/**\n \t * Multiply two _UINT64_. The current _UINT64_ stores the result\n \t * @method multiply\n \t * @param {Object} other UINT64\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.multiply = function (other) {\n \t\t/*\n \t\t\ta = a00 + a16 + a32 + a48\n \t\t\tb = b00 + b16 + b32 + b48\n \t\t\ta*b = (a00 + a16 + a32 + a48)(b00 + b16 + b32 + b48)\n \t\t\t\t= a00b00 + a00b16 + a00b32 + a00b48\n \t\t\t\t+ a16b00 + a16b16 + a16b32 + a16b48\n \t\t\t\t+ a32b00 + a32b16 + a32b32 + a32b48\n \t\t\t\t+ a48b00 + a48b16 + a48b32 + a48b48\n\n \t\t\ta16b48, a32b32, a48b16, a48b32 and a48b48 overflow the 64 bits\n \t\t\tso it comes down to:\n \t\t\ta*b\t= a00b00 + a00b16 + a00b32 + a00b48\n \t\t\t\t+ a16b00 + a16b16 + a16b32\n \t\t\t\t+ a32b00 + a32b16\n \t\t\t\t+ a48b00\n \t\t\t\t= a00b00\n \t\t\t\t+ a00b16 + a16b00\n \t\t\t\t+ a00b32 + a16b16 + a32b00\n \t\t\t\t+ a00b48 + a16b32 + a32b16 + a48b00\n \t\t */\n \t\tvar a00 = this._a00;\n \t\tvar a16 = this._a16;\n \t\tvar a32 = this._a32;\n \t\tvar a48 = this._a48;\n \t\tvar b00 = other._a00;\n \t\tvar b16 = other._a16;\n \t\tvar b32 = other._a32;\n \t\tvar b48 = other._a48;\n\n \t\tvar c00 = a00 * b00;\n\n \t\tvar c16 = c00 >>> 16;\n \t\tc16 += a00 * b16;\n \t\tvar c32 = c16 >>> 16;\n \t\tc16 &= 0xFFFF;\n \t\tc16 += a16 * b00;\n\n \t\tc32 += c16 >>> 16;\n \t\tc32 += a00 * b32;\n \t\tvar c48 = c32 >>> 16;\n \t\tc32 &= 0xFFFF;\n \t\tc32 += a16 * b16;\n \t\tc48 += c32 >>> 16;\n \t\tc32 &= 0xFFFF;\n \t\tc32 += a32 * b00;\n\n \t\tc48 += c32 >>> 16;\n \t\tc48 += a00 * b48;\n \t\tc48 &= 0xFFFF;\n \t\tc48 += a16 * b32;\n \t\tc48 &= 0xFFFF;\n \t\tc48 += a32 * b16;\n \t\tc48 &= 0xFFFF;\n \t\tc48 += a48 * b00;\n\n \t\tthis._a00 = c00 & 0xFFFF;\n \t\tthis._a16 = c16 & 0xFFFF;\n \t\tthis._a32 = c32 & 0xFFFF;\n \t\tthis._a48 = c48 & 0xFFFF;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Divide two _UINT64_. The current _UINT64_ stores the result.\n \t * The remainder is made available as the _remainder_ property on\n \t * the _UINT64_ object. It can be null, meaning there are no remainder.\n \t * @method div\n \t * @param {Object} other UINT64\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.div = function (other) {\n \t\tif ( (other._a16 == 0) && (other._a32 == 0) && (other._a48 == 0) ) {\n \t\t\tif (other._a00 == 0) throw Error('division by zero')\n\n \t\t\t// other == 1: this\n \t\t\tif (other._a00 == 1) {\n \t\t\t\tthis.remainder = new UINT64(0);\n \t\t\t\treturn this\n \t\t\t}\n \t\t}\n\n \t\t// other > this: 0\n \t\tif ( other.gt(this) ) {\n \t\t\tthis.remainder = this.clone();\n \t\t\tthis._a00 = 0;\n \t\t\tthis._a16 = 0;\n \t\t\tthis._a32 = 0;\n \t\t\tthis._a48 = 0;\n \t\t\treturn this\n \t\t}\n \t\t// other == this: 1\n \t\tif ( this.eq(other) ) {\n \t\t\tthis.remainder = new UINT64(0);\n \t\t\tthis._a00 = 1;\n \t\t\tthis._a16 = 0;\n \t\t\tthis._a32 = 0;\n \t\t\tthis._a48 = 0;\n \t\t\treturn this\n \t\t}\n\n \t\t// Shift the divisor left until it is higher than the dividend\n \t\tvar _other = other.clone();\n \t\tvar i = -1;\n \t\twhile ( !this.lt(_other) ) {\n \t\t\t// High bit can overflow the default 16bits\n \t\t\t// Its ok since we right shift after this loop\n \t\t\t// The overflown bit must be kept though\n \t\t\t_other.shiftLeft(1, true);\n \t\t\ti++;\n \t\t}\n\n \t\t// Set the remainder\n \t\tthis.remainder = this.clone();\n \t\t// Initialize the current result to 0\n \t\tthis._a00 = 0;\n \t\tthis._a16 = 0;\n \t\tthis._a32 = 0;\n \t\tthis._a48 = 0;\n \t\tfor (; i >= 0; i--) {\n \t\t\t_other.shiftRight(1);\n \t\t\t// If shifted divisor is smaller than the dividend\n \t\t\t// then subtract it from the dividend\n \t\t\tif ( !this.remainder.lt(_other) ) {\n \t\t\t\tthis.remainder.subtract(_other);\n \t\t\t\t// Update the current result\n \t\t\t\tif (i >= 48) {\n \t\t\t\t\tthis._a48 |= 1 << (i - 48);\n \t\t\t\t} else if (i >= 32) {\n \t\t\t\t\tthis._a32 |= 1 << (i - 32);\n \t\t\t\t} else if (i >= 16) {\n \t\t\t\t\tthis._a16 |= 1 << (i - 16);\n \t\t\t\t} else {\n \t\t\t\t\tthis._a00 |= 1 << i;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Negate the current _UINT64_\n \t * @method negate\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.negate = function () {\n \t\tvar v = ( ~this._a00 & 0xFFFF ) + 1;\n \t\tthis._a00 = v & 0xFFFF;\n \t\tv = (~this._a16 & 0xFFFF) + (v >>> 16);\n \t\tthis._a16 = v & 0xFFFF;\n \t\tv = (~this._a32 & 0xFFFF) + (v >>> 16);\n \t\tthis._a32 = v & 0xFFFF;\n \t\tthis._a48 = (~this._a48 + (v >>> 16)) & 0xFFFF;\n\n \t\treturn this\n \t};\n\n \t/**\n\n \t * @method eq\n \t * @param {Object} other UINT64\n \t * @return {Boolean}\n \t */\n \tUINT64.prototype.equals = UINT64.prototype.eq = function (other) {\n \t\treturn (this._a48 == other._a48) && (this._a00 == other._a00)\n \t\t\t && (this._a32 == other._a32) && (this._a16 == other._a16)\n \t};\n\n \t/**\n \t * Greater than (strict)\n \t * @method gt\n \t * @param {Object} other UINT64\n \t * @return {Boolean}\n \t */\n \tUINT64.prototype.greaterThan = UINT64.prototype.gt = function (other) {\n \t\tif (this._a48 > other._a48) return true\n \t\tif (this._a48 < other._a48) return false\n \t\tif (this._a32 > other._a32) return true\n \t\tif (this._a32 < other._a32) return false\n \t\tif (this._a16 > other._a16) return true\n \t\tif (this._a16 < other._a16) return false\n \t\treturn this._a00 > other._a00\n \t};\n\n \t/**\n \t * Less than (strict)\n \t * @method lt\n \t * @param {Object} other UINT64\n \t * @return {Boolean}\n \t */\n \tUINT64.prototype.lessThan = UINT64.prototype.lt = function (other) {\n \t\tif (this._a48 < other._a48) return true\n \t\tif (this._a48 > other._a48) return false\n \t\tif (this._a32 < other._a32) return true\n \t\tif (this._a32 > other._a32) return false\n \t\tif (this._a16 < other._a16) return true\n \t\tif (this._a16 > other._a16) return false\n \t\treturn this._a00 < other._a00\n \t};\n\n \t/**\n \t * Bitwise OR\n \t * @method or\n \t * @param {Object} other UINT64\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.or = function (other) {\n \t\tthis._a00 |= other._a00;\n \t\tthis._a16 |= other._a16;\n \t\tthis._a32 |= other._a32;\n \t\tthis._a48 |= other._a48;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise AND\n \t * @method and\n \t * @param {Object} other UINT64\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.and = function (other) {\n \t\tthis._a00 &= other._a00;\n \t\tthis._a16 &= other._a16;\n \t\tthis._a32 &= other._a32;\n \t\tthis._a48 &= other._a48;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise XOR\n \t * @method xor\n \t * @param {Object} other UINT64\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.xor = function (other) {\n \t\tthis._a00 ^= other._a00;\n \t\tthis._a16 ^= other._a16;\n \t\tthis._a32 ^= other._a32;\n \t\tthis._a48 ^= other._a48;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise NOT\n \t * @method not\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.not = function() {\n \t\tthis._a00 = ~this._a00 & 0xFFFF;\n \t\tthis._a16 = ~this._a16 & 0xFFFF;\n \t\tthis._a32 = ~this._a32 & 0xFFFF;\n \t\tthis._a48 = ~this._a48 & 0xFFFF;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise shift right\n \t * @method shiftRight\n \t * @param {Number} number of bits to shift\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.shiftRight = UINT64.prototype.shiftr = function (n) {\n \t\tn %= 64;\n \t\tif (n >= 48) {\n \t\t\tthis._a00 = this._a48 >> (n - 48);\n \t\t\tthis._a16 = 0;\n \t\t\tthis._a32 = 0;\n \t\t\tthis._a48 = 0;\n \t\t} else if (n >= 32) {\n \t\t\tn -= 32;\n \t\t\tthis._a00 = ( (this._a32 >> n) | (this._a48 << (16-n)) ) & 0xFFFF;\n \t\t\tthis._a16 = (this._a48 >> n) & 0xFFFF;\n \t\t\tthis._a32 = 0;\n \t\t\tthis._a48 = 0;\n \t\t} else if (n >= 16) {\n \t\t\tn -= 16;\n \t\t\tthis._a00 = ( (this._a16 >> n) | (this._a32 << (16-n)) ) & 0xFFFF;\n \t\t\tthis._a16 = ( (this._a32 >> n) | (this._a48 << (16-n)) ) & 0xFFFF;\n \t\t\tthis._a32 = (this._a48 >> n) & 0xFFFF;\n \t\t\tthis._a48 = 0;\n \t\t} else {\n \t\t\tthis._a00 = ( (this._a00 >> n) | (this._a16 << (16-n)) ) & 0xFFFF;\n \t\t\tthis._a16 = ( (this._a16 >> n) | (this._a32 << (16-n)) ) & 0xFFFF;\n \t\t\tthis._a32 = ( (this._a32 >> n) | (this._a48 << (16-n)) ) & 0xFFFF;\n \t\t\tthis._a48 = (this._a48 >> n) & 0xFFFF;\n \t\t}\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise shift left\n \t * @method shiftLeft\n \t * @param {Number} number of bits to shift\n \t * @param {Boolean} allow overflow\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.shiftLeft = UINT64.prototype.shiftl = function (n, allowOverflow) {\n \t\tn %= 64;\n \t\tif (n >= 48) {\n \t\t\tthis._a48 = this._a00 << (n - 48);\n \t\t\tthis._a32 = 0;\n \t\t\tthis._a16 = 0;\n \t\t\tthis._a00 = 0;\n \t\t} else if (n >= 32) {\n \t\t\tn -= 32;\n \t\t\tthis._a48 = (this._a16 << n) | (this._a00 >> (16-n));\n \t\t\tthis._a32 = (this._a00 << n) & 0xFFFF;\n \t\t\tthis._a16 = 0;\n \t\t\tthis._a00 = 0;\n \t\t} else if (n >= 16) {\n \t\t\tn -= 16;\n \t\t\tthis._a48 = (this._a32 << n) | (this._a16 >> (16-n));\n \t\t\tthis._a32 = ( (this._a16 << n) | (this._a00 >> (16-n)) ) & 0xFFFF;\n \t\t\tthis._a16 = (this._a00 << n) & 0xFFFF;\n \t\t\tthis._a00 = 0;\n \t\t} else {\n \t\t\tthis._a48 = (this._a48 << n) | (this._a32 >> (16-n));\n \t\t\tthis._a32 = ( (this._a32 << n) | (this._a16 >> (16-n)) ) & 0xFFFF;\n \t\t\tthis._a16 = ( (this._a16 << n) | (this._a00 >> (16-n)) ) & 0xFFFF;\n \t\t\tthis._a00 = (this._a00 << n) & 0xFFFF;\n \t\t}\n \t\tif (!allowOverflow) {\n \t\t\tthis._a48 &= 0xFFFF;\n \t\t}\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise rotate left\n \t * @method rotl\n \t * @param {Number} number of bits to rotate\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.rotateLeft = UINT64.prototype.rotl = function (n) {\n \t\tn %= 64;\n \t\tif (n == 0) return this\n \t\tif (n >= 32) {\n \t\t\t// A.B.C.D\n \t\t\t// B.C.D.A rotl(16)\n \t\t\t// C.D.A.B rotl(32)\n \t\t\tvar v = this._a00;\n \t\t\tthis._a00 = this._a32;\n \t\t\tthis._a32 = v;\n \t\t\tv = this._a48;\n \t\t\tthis._a48 = this._a16;\n \t\t\tthis._a16 = v;\n \t\t\tif (n == 32) return this\n \t\t\tn -= 32;\n \t\t}\n\n \t\tvar high = (this._a48 << 16) | this._a32;\n \t\tvar low = (this._a16 << 16) | this._a00;\n\n \t\tvar _high = (high << n) | (low >>> (32 - n));\n \t\tvar _low = (low << n) | (high >>> (32 - n));\n\n \t\tthis._a00 = _low & 0xFFFF;\n \t\tthis._a16 = _low >>> 16;\n \t\tthis._a32 = _high & 0xFFFF;\n \t\tthis._a48 = _high >>> 16;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Bitwise rotate right\n \t * @method rotr\n \t * @param {Number} number of bits to rotate\n \t * @return ThisExpression\n \t */\n \tUINT64.prototype.rotateRight = UINT64.prototype.rotr = function (n) {\n \t\tn %= 64;\n \t\tif (n == 0) return this\n \t\tif (n >= 32) {\n \t\t\t// A.B.C.D\n \t\t\t// D.A.B.C rotr(16)\n \t\t\t// C.D.A.B rotr(32)\n \t\t\tvar v = this._a00;\n \t\t\tthis._a00 = this._a32;\n \t\t\tthis._a32 = v;\n \t\t\tv = this._a48;\n \t\t\tthis._a48 = this._a16;\n \t\t\tthis._a16 = v;\n \t\t\tif (n == 32) return this\n \t\t\tn -= 32;\n \t\t}\n\n \t\tvar high = (this._a48 << 16) | this._a32;\n \t\tvar low = (this._a16 << 16) | this._a00;\n\n \t\tvar _high = (high >>> n) | (low << (32 - n));\n \t\tvar _low = (low >>> n) | (high << (32 - n));\n\n \t\tthis._a00 = _low & 0xFFFF;\n \t\tthis._a16 = _low >>> 16;\n \t\tthis._a32 = _high & 0xFFFF;\n \t\tthis._a48 = _high >>> 16;\n\n \t\treturn this\n \t};\n\n \t/**\n \t * Clone the current _UINT64_\n \t * @method clone\n \t * @return {Object} cloned UINT64\n \t */\n \tUINT64.prototype.clone = function () {\n \t\treturn new UINT64(this._a00, this._a16, this._a32, this._a48)\n \t};\n\n \tif ( module.exports) {\n \t\t// Node.js\n \t\tmodule.exports = UINT64;\n \t} else {\n \t\t// Browser\n \t\troot['UINT64'] = UINT64;\n \t}\n\n })(commonjsGlobal);\n });\n\n var UINT32 = uint32;\n var UINT64 = uint64;\n\n var cuint = {\n \tUINT32: UINT32,\n \tUINT64: UINT64\n };\n\n var UINT32$1 = cuint.UINT32;\n\n /*\n \tMerged this sequence of method calls as it speeds up\n \tthe calculations by a factor of 2\n */\n // this.v1.add( other.multiply(PRIME32_2) ).rotl(13).multiply(PRIME32_1);\n UINT32$1.prototype.xxh_update = function (low, high) {\n \tvar b00 = PRIME32_2._low;\n \tvar b16 = PRIME32_2._high;\n\n \tvar c16, c00;\n \tc00 = low * b00;\n \tc16 = c00 >>> 16;\n\n \tc16 += high * b00;\n \tc16 &= 0xFFFF;\t\t// Not required but improves performance\n \tc16 += low * b16;\n\n \tvar a00 = this._low + (c00 & 0xFFFF);\n \tvar a16 = a00 >>> 16;\n\n \ta16 += this._high + (c16 & 0xFFFF);\n\n \tvar v = (a16 << 16) | (a00 & 0xFFFF);\n \tv = (v << 13) | (v >>> 19);\n\n \ta00 = v & 0xFFFF;\n \ta16 = v >>> 16;\n\n \tb00 = PRIME32_1._low;\n \tb16 = PRIME32_1._high;\n\n \tc00 = a00 * b00;\n \tc16 = c00 >>> 16;\n\n \tc16 += a16 * b00;\n \tc16 &= 0xFFFF;\t\t// Not required but improves performance\n \tc16 += a00 * b16;\n\n \tthis._low = c00 & 0xFFFF;\n \tthis._high = c16 & 0xFFFF;\n };\n\n /*\n * Constants\n */\n var PRIME32_1 = UINT32$1( '2654435761' );\n var PRIME32_2 = UINT32$1( '2246822519' );\n var PRIME32_3 = UINT32$1( '3266489917' );\n var PRIME32_4 = UINT32$1( '668265263' );\n var PRIME32_5 = UINT32$1( '374761393' );\n\n /**\n * Convert string to proper UTF-8 array\n * @param str Input string\n * @returns {Uint8Array} UTF8 array is returned as uint8 array\n */\n function toUTF8Array (str) {\n \tvar utf8 = [];\n \tfor (var i=0, n=str.length; i < n; i++) {\n \t\tvar charcode = str.charCodeAt(i);\n \t\tif (charcode < 0x80) utf8.push(charcode);\n \t\telse if (charcode < 0x800) {\n \t\t\tutf8.push(0xc0 | (charcode >> 6),\n \t\t\t0x80 | (charcode & 0x3f));\n \t\t}\n \t\telse if (charcode < 0xd800 || charcode >= 0xe000) {\n \t\t\tutf8.push(0xe0 | (charcode >> 12),\n \t\t\t0x80 | ((charcode>>6) & 0x3f),\n \t\t\t0x80 | (charcode & 0x3f));\n \t\t}\n \t\t// surrogate pair\n \t\telse {\n \t\t\ti++;\n \t\t\t// UTF-16 encodes 0x10000-0x10FFFF by\n \t\t\t// subtracting 0x10000 and splitting the\n \t\t\t// 20 bits of 0x0-0xFFFFF into two halves\n \t\t\tcharcode = 0x10000 + (((charcode & 0x3ff)<<10)\n \t\t\t| (str.charCodeAt(i) & 0x3ff));\n \t\t\tutf8.push(0xf0 | (charcode >>18),\n \t\t\t0x80 | ((charcode>>12) & 0x3f),\n \t\t\t0x80 | ((charcode>>6) & 0x3f),\n \t\t\t0x80 | (charcode & 0x3f));\n \t\t}\n \t}\n\n \treturn new Uint8Array(utf8)\n }\n\n /**\n * XXH object used as a constructor or a function\n * @constructor\n * or\n * @param {Object|String} input data\n * @param {Number|UINT32} seed\n * @return ThisExpression\n * or\n * @return {UINT32} xxHash\n */\n function XXH () {\n \tif (arguments.length == 2)\n \t\treturn new XXH( arguments[1] ).update( arguments[0] ).digest()\n\n \tif (!(this instanceof XXH))\n \t\treturn new XXH( arguments[0] )\n\n \tinit.call(this, arguments[0]);\n }\n\n /**\n * Initialize the XXH instance with the given seed\n * @method init\n * @param {Number|Object} seed as a number or an unsigned 32 bits integer\n * @return ThisExpression\n */\n function init (seed) {\n \tthis.seed = seed instanceof UINT32$1 ? seed.clone() : UINT32$1(seed);\n \tthis.v1 = this.seed.clone().add(PRIME32_1).add(PRIME32_2);\n \tthis.v2 = this.seed.clone().add(PRIME32_2);\n \tthis.v3 = this.seed.clone();\n \tthis.v4 = this.seed.clone().subtract(PRIME32_1);\n \tthis.total_len = 0;\n \tthis.memsize = 0;\n \tthis.memory = null;\n\n \treturn this\n }\n XXH.prototype.init = init;\n\n /**\n * Add data to be computed for the XXH hash\n * @method update\n * @param {String|Buffer|ArrayBuffer} input as a string or nodejs Buffer or ArrayBuffer\n * @return ThisExpression\n */\n XXH.prototype.update = function (input) {\n \tvar isString = typeof input == 'string';\n \tvar isArrayBuffer;\n\n \t// Convert all strings to utf-8 first (issue #5)\n \tif (isString) {\n \t\tinput = toUTF8Array(input);\n \t\tisString = false;\n \t\tisArrayBuffer = true;\n \t}\n\n \tif (typeof ArrayBuffer !== \"undefined\" && input instanceof ArrayBuffer)\n \t{\n \t\tisArrayBuffer = true;\n \t\tinput = new Uint8Array(input);\n \t}\n\n \tvar p = 0;\n \tvar len = input.length;\n \tvar bEnd = p + len;\n\n \tif (len == 0) return this\n\n \tthis.total_len += len;\n\n \tif (this.memsize == 0)\n \t{\n \t\tif (isString) {\n \t\t\tthis.memory = '';\n \t\t} else if (isArrayBuffer) {\n \t\t\tthis.memory = new Uint8Array(16);\n \t\t} else {\n \t\t\tthis.memory = new buffer.Buffer(16);\n \t\t}\n \t}\n\n \tif (this.memsize + len < 16) // fill in tmp buffer\n \t{\n \t\t// XXH_memcpy(this.memory + this.memsize, input, len)\n \t\tif (isString) {\n \t\t\tthis.memory += input;\n \t\t} else if (isArrayBuffer) {\n \t\t\tthis.memory.set( input.subarray(0, len), this.memsize );\n \t\t} else {\n \t\t\tinput.copy( this.memory, this.memsize, 0, len );\n \t\t}\n\n \t\tthis.memsize += len;\n \t\treturn this\n \t}\n\n \tif (this.memsize > 0) // some data left from previous update\n \t{\n \t\t// XXH_memcpy(this.memory + this.memsize, input, 16-this.memsize);\n \t\tif (isString) {\n \t\t\tthis.memory += input.slice(0, 16 - this.memsize);\n \t\t} else if (isArrayBuffer) {\n \t\t\tthis.memory.set( input.subarray(0, 16 - this.memsize), this.memsize );\n \t\t} else {\n \t\t\tinput.copy( this.memory, this.memsize, 0, 16 - this.memsize );\n \t\t}\n\n \t\tvar p32 = 0;\n \t\tif (isString) {\n \t\t\tthis.v1.xxh_update(\n \t\t\t\t(this.memory.charCodeAt(p32+1) << 8) | this.memory.charCodeAt(p32)\n \t\t\t,\t(this.memory.charCodeAt(p32+3) << 8) | this.memory.charCodeAt(p32+2)\n \t\t\t);\n \t\t\tp32 += 4;\n \t\t\tthis.v2.xxh_update(\n \t\t\t\t(this.memory.charCodeAt(p32+1) << 8) | this.memory.charCodeAt(p32)\n \t\t\t,\t(this.memory.charCodeAt(p32+3) << 8) | this.memory.charCodeAt(p32+2)\n \t\t\t);\n \t\t\tp32 += 4;\n \t\t\tthis.v3.xxh_update(\n \t\t\t\t(this.memory.charCodeAt(p32+1) << 8) | this.memory.charCodeAt(p32)\n \t\t\t,\t(this.memory.charCodeAt(p32+3) << 8) | this.memory.charCodeAt(p32+2)\n \t\t\t);\n \t\t\tp32 += 4;\n \t\t\tthis.v4.xxh_update(\n \t\t\t\t(this.memory.charCodeAt(p32+1) << 8) | this.memory.charCodeAt(p32)\n \t\t\t,\t(this.memory.charCodeAt(p32+3) << 8) | this.memory.charCodeAt(p32+2)\n \t\t\t);\n \t\t} else {\n \t\t\tthis.v1.xxh_update(\n \t\t\t\t(this.memory[p32+1] << 8) | this.memory[p32]\n \t\t\t,\t(this.memory[p32+3] << 8) | this.memory[p32+2]\n \t\t\t);\n \t\t\tp32 += 4;\n \t\t\tthis.v2.xxh_update(\n \t\t\t\t(this.memory[p32+1] << 8) | this.memory[p32]\n \t\t\t,\t(this.memory[p32+3] << 8) | this.memory[p32+2]\n \t\t\t);\n \t\t\tp32 += 4;\n \t\t\tthis.v3.xxh_update(\n \t\t\t\t(this.memory[p32+1] << 8) | this.memory[p32]\n \t\t\t,\t(this.memory[p32+3] << 8) | this.memory[p32+2]\n \t\t\t);\n \t\t\tp32 += 4;\n \t\t\tthis.v4.xxh_update(\n \t\t\t\t(this.memory[p32+1] << 8) | this.memory[p32]\n \t\t\t,\t(this.memory[p32+3] << 8) | this.memory[p32+2]\n \t\t\t);\n \t\t}\n\n \t\tp += 16 - this.memsize;\n \t\tthis.memsize = 0;\n \t\tif (isString) this.memory = '';\n \t}\n\n \tif (p <= bEnd - 16)\n \t{\n \t\tvar limit = bEnd - 16;\n\n \t\tdo\n \t\t{\n \t\t\tif (isString) {\n \t\t\t\tthis.v1.xxh_update(\n \t\t\t\t\t(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)\n \t\t\t\t,\t(input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)\n \t\t\t\t);\n \t\t\t\tp += 4;\n \t\t\t\tthis.v2.xxh_update(\n \t\t\t\t\t(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)\n \t\t\t\t,\t(input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)\n \t\t\t\t);\n \t\t\t\tp += 4;\n \t\t\t\tthis.v3.xxh_update(\n \t\t\t\t\t(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)\n \t\t\t\t,\t(input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)\n \t\t\t\t);\n \t\t\t\tp += 4;\n \t\t\t\tthis.v4.xxh_update(\n \t\t\t\t\t(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)\n \t\t\t\t,\t(input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)\n \t\t\t\t);\n \t\t\t} else {\n \t\t\t\tthis.v1.xxh_update(\n \t\t\t\t\t(input[p+1] << 8) | input[p]\n \t\t\t\t,\t(input[p+3] << 8) | input[p+2]\n \t\t\t\t);\n \t\t\t\tp += 4;\n \t\t\t\tthis.v2.xxh_update(\n \t\t\t\t\t(input[p+1] << 8) | input[p]\n \t\t\t\t,\t(input[p+3] << 8) | input[p+2]\n \t\t\t\t);\n \t\t\t\tp += 4;\n \t\t\t\tthis.v3.xxh_update(\n \t\t\t\t\t(input[p+1] << 8) | input[p]\n \t\t\t\t,\t(input[p+3] << 8) | input[p+2]\n \t\t\t\t);\n \t\t\t\tp += 4;\n \t\t\t\tthis.v4.xxh_update(\n \t\t\t\t\t(input[p+1] << 8) | input[p]\n \t\t\t\t,\t(input[p+3] << 8) | input[p+2]\n \t\t\t\t);\n \t\t\t}\n \t\t\tp += 4;\n \t\t} while (p <= limit)\n \t}\n\n \tif (p < bEnd)\n \t{\n \t\t// XXH_memcpy(this.memory, p, bEnd-p);\n \t\tif (isString) {\n \t\t\tthis.memory += input.slice(p);\n \t\t} else if (isArrayBuffer) {\n \t\t\tthis.memory.set( input.subarray(p, bEnd), this.memsize );\n \t\t} else {\n \t\t\tinput.copy( this.memory, this.memsize, p, bEnd );\n \t\t}\n\n \t\tthis.memsize = bEnd - p;\n \t}\n\n \treturn this\n };\n\n /**\n * Finalize the XXH computation. The XXH instance is ready for reuse for the given seed\n * @method digest\n * @return {UINT32} xxHash\n */\n XXH.prototype.digest = function () {\n \tvar input = this.memory;\n \tvar isString = typeof input == 'string';\n \tvar p = 0;\n \tvar bEnd = this.memsize;\n \tvar h32, h;\n \tvar u = new UINT32$1;\n\n \tif (this.total_len >= 16)\n \t{\n \t\th32 = this.v1.rotl(1).add( this.v2.rotl(7).add( this.v3.rotl(12).add( this.v4.rotl(18) ) ) );\n \t}\n \telse\n \t{\n \t\th32 = this.seed.clone().add( PRIME32_5 );\n \t}\n\n \th32.add( u.fromNumber(this.total_len) );\n\n \twhile (p <= bEnd - 4)\n \t{\n \t\tif (isString) {\n \t\t\tu.fromBits(\n \t\t\t\t(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)\n \t\t\t,\t(input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)\n \t\t\t);\n \t\t} else {\n \t\t\tu.fromBits(\n \t\t\t\t(input[p+1] << 8) | input[p]\n \t\t\t,\t(input[p+3] << 8) | input[p+2]\n \t\t\t);\n \t\t}\n \t\th32\n \t\t\t.add( u.multiply(PRIME32_3) )\n \t\t\t.rotl(17)\n \t\t\t.multiply( PRIME32_4 );\n \t\tp += 4;\n \t}\n\n \twhile (p < bEnd)\n \t{\n \t\tu.fromBits( isString ? input.charCodeAt(p++) : input[p++], 0 );\n \t\th32\n \t\t\t.add( u.multiply(PRIME32_5) )\n \t\t\t.rotl(11)\n \t\t\t.multiply(PRIME32_1);\n \t}\n\n \th = h32.clone().shiftRight(15);\n \th32.xor(h).multiply(PRIME32_2);\n\n \th = h32.clone().shiftRight(13);\n \th32.xor(h).multiply(PRIME32_3);\n\n \th = h32.clone().shiftRight(16);\n \th32.xor(h);\n\n \t// Reset the state\n \tthis.init( this.seed );\n\n \treturn h32\n };\n\n var xxhash = XXH;\n\n var UINT64$1 = cuint.UINT64;\n\n /*\n * Constants\n */\n var PRIME64_1 = UINT64$1( '11400714785074694791' );\n var PRIME64_2 = UINT64$1( '14029467366897019727' );\n var PRIME64_3 = UINT64$1( '1609587929392839161' );\n var PRIME64_4 = UINT64$1( '9650029242287828579' );\n var PRIME64_5 = UINT64$1( '2870177450012600261' );\n\n /**\n * Convert string to proper UTF-8 array\n * @param str Input string\n * @returns {Uint8Array} UTF8 array is returned as uint8 array\n */\n function toUTF8Array$1 (str) {\n \tvar utf8 = [];\n \tfor (var i=0, n=str.length; i < n; i++) {\n \t\tvar charcode = str.charCodeAt(i);\n \t\tif (charcode < 0x80) utf8.push(charcode);\n \t\telse if (charcode < 0x800) {\n \t\t\tutf8.push(0xc0 | (charcode >> 6),\n \t\t\t0x80 | (charcode & 0x3f));\n \t\t}\n \t\telse if (charcode < 0xd800 || charcode >= 0xe000) {\n \t\t\tutf8.push(0xe0 | (charcode >> 12),\n \t\t\t0x80 | ((charcode>>6) & 0x3f),\n \t\t\t0x80 | (charcode & 0x3f));\n \t\t}\n \t\t// surrogate pair\n \t\telse {\n \t\t\ti++;\n \t\t\t// UTF-16 encodes 0x10000-0x10FFFF by\n \t\t\t// subtracting 0x10000 and splitting the\n \t\t\t// 20 bits of 0x0-0xFFFFF into two halves\n \t\t\tcharcode = 0x10000 + (((charcode & 0x3ff)<<10)\n \t\t\t| (str.charCodeAt(i) & 0x3ff));\n \t\t\tutf8.push(0xf0 | (charcode >>18),\n \t\t\t0x80 | ((charcode>>12) & 0x3f),\n \t\t\t0x80 | ((charcode>>6) & 0x3f),\n \t\t\t0x80 | (charcode & 0x3f));\n \t\t}\n \t}\n\n \treturn new Uint8Array(utf8)\n }\n\n /**\n * XXH64 object used as a constructor or a function\n * @constructor\n * or\n * @param {Object|String} input data\n * @param {Number|UINT64} seed\n * @return ThisExpression\n * or\n * @return {UINT64} xxHash\n */\n function XXH64 () {\n \tif (arguments.length == 2)\n \t\treturn new XXH64( arguments[1] ).update( arguments[0] ).digest()\n\n \tif (!(this instanceof XXH64))\n \t\treturn new XXH64( arguments[0] )\n\n \tinit$1.call(this, arguments[0]);\n }\n\n /**\n * Initialize the XXH64 instance with the given seed\n * @method init\n * @param {Number|Object} seed as a number or an unsigned 32 bits integer\n * @return ThisExpression\n */\n function init$1 (seed) {\n \tthis.seed = seed instanceof UINT64$1 ? seed.clone() : UINT64$1(seed);\n \tthis.v1 = this.seed.clone().add(PRIME64_1).add(PRIME64_2);\n \tthis.v2 = this.seed.clone().add(PRIME64_2);\n \tthis.v3 = this.seed.clone();\n \tthis.v4 = this.seed.clone().subtract(PRIME64_1);\n \tthis.total_len = 0;\n \tthis.memsize = 0;\n \tthis.memory = null;\n\n \treturn this\n }\n XXH64.prototype.init = init$1;\n\n /**\n * Add data to be computed for the XXH64 hash\n * @method update\n * @param {String|Buffer|ArrayBuffer} input as a string or nodejs Buffer or ArrayBuffer\n * @return ThisExpression\n */\n XXH64.prototype.update = function (input) {\n \tvar isString = typeof input == 'string';\n \tvar isArrayBuffer;\n\n \t// Convert all strings to utf-8 first (issue #5)\n \tif (isString) {\n \t\tinput = toUTF8Array$1(input);\n \t\tisString = false;\n \t\tisArrayBuffer = true;\n \t}\n\n \tif (typeof ArrayBuffer !== \"undefined\" && input instanceof ArrayBuffer)\n \t{\n \t\tisArrayBuffer = true;\n \t\tinput = new Uint8Array(input);\n \t}\n\n \tvar p = 0;\n \tvar len = input.length;\n \tvar bEnd = p + len;\n\n \tif (len == 0) return this\n\n \tthis.total_len += len;\n\n \tif (this.memsize == 0)\n \t{\n \t\tif (isString) {\n \t\t\tthis.memory = '';\n \t\t} else if (isArrayBuffer) {\n \t\t\tthis.memory = new Uint8Array(32);\n \t\t} else {\n \t\t\tthis.memory = new buffer.Buffer(32);\n \t\t}\n \t}\n\n \tif (this.memsize + len < 32) // fill in tmp buffer\n \t{\n \t\t// XXH64_memcpy(this.memory + this.memsize, input, len)\n \t\tif (isString) {\n \t\t\tthis.memory += input;\n \t\t} else if (isArrayBuffer) {\n \t\t\tthis.memory.set( input.subarray(0, len), this.memsize );\n \t\t} else {\n \t\t\tinput.copy( this.memory, this.memsize, 0, len );\n \t\t}\n\n \t\tthis.memsize += len;\n \t\treturn this\n \t}\n\n \tif (this.memsize > 0) // some data left from previous update\n \t{\n \t\t// XXH64_memcpy(this.memory + this.memsize, input, 16-this.memsize);\n \t\tif (isString) {\n \t\t\tthis.memory += input.slice(0, 32 - this.memsize);\n \t\t} else if (isArrayBuffer) {\n \t\t\tthis.memory.set( input.subarray(0, 32 - this.memsize), this.memsize );\n \t\t} else {\n \t\t\tinput.copy( this.memory, this.memsize, 0, 32 - this.memsize );\n \t\t}\n\n \t\tvar p64 = 0;\n \t\tif (isString) {\n \t\t\tvar other;\n \t\t\tother = UINT64$1(\n \t\t\t\t\t(this.memory.charCodeAt(p64+1) << 8) | this.memory.charCodeAt(p64)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+3) << 8) | this.memory.charCodeAt(p64+2)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+5) << 8) | this.memory.charCodeAt(p64+4)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+7) << 8) | this.memory.charCodeAt(p64+6)\n \t\t\t\t);\n \t\t\tthis.v1.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\tp64 += 8;\n \t\t\tother = UINT64$1(\n \t\t\t\t\t(this.memory.charCodeAt(p64+1) << 8) | this.memory.charCodeAt(p64)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+3) << 8) | this.memory.charCodeAt(p64+2)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+5) << 8) | this.memory.charCodeAt(p64+4)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+7) << 8) | this.memory.charCodeAt(p64+6)\n \t\t\t\t);\n \t\t\tthis.v2.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\tp64 += 8;\n \t\t\tother = UINT64$1(\n \t\t\t\t\t(this.memory.charCodeAt(p64+1) << 8) | this.memory.charCodeAt(p64)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+3) << 8) | this.memory.charCodeAt(p64+2)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+5) << 8) | this.memory.charCodeAt(p64+4)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+7) << 8) | this.memory.charCodeAt(p64+6)\n \t\t\t\t);\n \t\t\tthis.v3.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\tp64 += 8;\n \t\t\tother = UINT64$1(\n \t\t\t\t\t(this.memory.charCodeAt(p64+1) << 8) | this.memory.charCodeAt(p64)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+3) << 8) | this.memory.charCodeAt(p64+2)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+5) << 8) | this.memory.charCodeAt(p64+4)\n \t\t\t\t,\t(this.memory.charCodeAt(p64+7) << 8) | this.memory.charCodeAt(p64+6)\n \t\t\t\t);\n \t\t\tthis.v4.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t} else {\n \t\t\tvar other;\n \t\t\tother = UINT64$1(\n \t\t\t\t\t(this.memory[p64+1] << 8) | this.memory[p64]\n \t\t\t\t,\t(this.memory[p64+3] << 8) | this.memory[p64+2]\n \t\t\t\t,\t(this.memory[p64+5] << 8) | this.memory[p64+4]\n \t\t\t\t,\t(this.memory[p64+7] << 8) | this.memory[p64+6]\n \t\t\t\t);\n \t\t\tthis.v1.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\tp64 += 8;\n \t\t\tother = UINT64$1(\n \t\t\t\t\t(this.memory[p64+1] << 8) | this.memory[p64]\n \t\t\t\t,\t(this.memory[p64+3] << 8) | this.memory[p64+2]\n \t\t\t\t,\t(this.memory[p64+5] << 8) | this.memory[p64+4]\n \t\t\t\t,\t(this.memory[p64+7] << 8) | this.memory[p64+6]\n \t\t\t\t);\n \t\t\tthis.v2.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\tp64 += 8;\n \t\t\tother = UINT64$1(\n \t\t\t\t\t(this.memory[p64+1] << 8) | this.memory[p64]\n \t\t\t\t,\t(this.memory[p64+3] << 8) | this.memory[p64+2]\n \t\t\t\t,\t(this.memory[p64+5] << 8) | this.memory[p64+4]\n \t\t\t\t,\t(this.memory[p64+7] << 8) | this.memory[p64+6]\n \t\t\t\t);\n \t\t\tthis.v3.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\tp64 += 8;\n \t\t\tother = UINT64$1(\n \t\t\t\t\t(this.memory[p64+1] << 8) | this.memory[p64]\n \t\t\t\t,\t(this.memory[p64+3] << 8) | this.memory[p64+2]\n \t\t\t\t,\t(this.memory[p64+5] << 8) | this.memory[p64+4]\n \t\t\t\t,\t(this.memory[p64+7] << 8) | this.memory[p64+6]\n \t\t\t\t);\n \t\t\tthis.v4.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t}\n\n \t\tp += 32 - this.memsize;\n \t\tthis.memsize = 0;\n \t\tif (isString) this.memory = '';\n \t}\n\n \tif (p <= bEnd - 32)\n \t{\n \t\tvar limit = bEnd - 32;\n\n \t\tdo\n \t\t{\n \t\t\tif (isString) {\n \t\t\t\tvar other;\n \t\t\t\tother = UINT64$1(\n \t\t\t\t\t\t(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)\n \t\t\t\t\t,\t(input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)\n \t\t\t\t\t,\t(input.charCodeAt(p+5) << 8) | input.charCodeAt(p+4)\n \t\t\t\t\t,\t(input.charCodeAt(p+7) << 8) | input.charCodeAt(p+6)\n \t\t\t\t\t);\n \t\t\t\tthis.v1.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\t\tp += 8;\n \t\t\t\tother = UINT64$1(\n \t\t\t\t\t\t(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)\n \t\t\t\t\t,\t(input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)\n \t\t\t\t\t,\t(input.charCodeAt(p+5) << 8) | input.charCodeAt(p+4)\n \t\t\t\t\t,\t(input.charCodeAt(p+7) << 8) | input.charCodeAt(p+6)\n \t\t\t\t\t);\n \t\t\t\tthis.v2.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\t\tp += 8;\n \t\t\t\tother = UINT64$1(\n \t\t\t\t\t\t(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)\n \t\t\t\t\t,\t(input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)\n \t\t\t\t\t,\t(input.charCodeAt(p+5) << 8) | input.charCodeAt(p+4)\n \t\t\t\t\t,\t(input.charCodeAt(p+7) << 8) | input.charCodeAt(p+6)\n \t\t\t\t\t);\n \t\t\t\tthis.v3.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\t\tp += 8;\n \t\t\t\tother = UINT64$1(\n \t\t\t\t\t\t(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)\n \t\t\t\t\t,\t(input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)\n \t\t\t\t\t,\t(input.charCodeAt(p+5) << 8) | input.charCodeAt(p+4)\n \t\t\t\t\t,\t(input.charCodeAt(p+7) << 8) | input.charCodeAt(p+6)\n \t\t\t\t\t);\n \t\t\t\tthis.v4.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\t} else {\n \t\t\t\tvar other;\n \t\t\t\tother = UINT64$1(\n \t\t\t\t\t\t(input[p+1] << 8) | input[p]\n \t\t\t\t\t,\t(input[p+3] << 8) | input[p+2]\n \t\t\t\t\t,\t(input[p+5] << 8) | input[p+4]\n \t\t\t\t\t,\t(input[p+7] << 8) | input[p+6]\n \t\t\t\t\t);\n \t\t\t\tthis.v1.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\t\tp += 8;\n \t\t\t\tother = UINT64$1(\n \t\t\t\t\t\t(input[p+1] << 8) | input[p]\n \t\t\t\t\t,\t(input[p+3] << 8) | input[p+2]\n \t\t\t\t\t,\t(input[p+5] << 8) | input[p+4]\n \t\t\t\t\t,\t(input[p+7] << 8) | input[p+6]\n \t\t\t\t\t);\n \t\t\t\tthis.v2.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\t\tp += 8;\n \t\t\t\tother = UINT64$1(\n \t\t\t\t\t\t(input[p+1] << 8) | input[p]\n \t\t\t\t\t,\t(input[p+3] << 8) | input[p+2]\n \t\t\t\t\t,\t(input[p+5] << 8) | input[p+4]\n \t\t\t\t\t,\t(input[p+7] << 8) | input[p+6]\n \t\t\t\t\t);\n \t\t\t\tthis.v3.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\t\tp += 8;\n \t\t\t\tother = UINT64$1(\n \t\t\t\t\t\t(input[p+1] << 8) | input[p]\n \t\t\t\t\t,\t(input[p+3] << 8) | input[p+2]\n \t\t\t\t\t,\t(input[p+5] << 8) | input[p+4]\n \t\t\t\t\t,\t(input[p+7] << 8) | input[p+6]\n \t\t\t\t\t);\n \t\t\t\tthis.v4.add( other.multiply(PRIME64_2) ).rotl(31).multiply(PRIME64_1);\n \t\t\t}\n \t\t\tp += 8;\n \t\t} while (p <= limit)\n \t}\n\n \tif (p < bEnd)\n \t{\n \t\t// XXH64_memcpy(this.memory, p, bEnd-p);\n \t\tif (isString) {\n \t\t\tthis.memory += input.slice(p);\n \t\t} else if (isArrayBuffer) {\n \t\t\tthis.memory.set( input.subarray(p, bEnd), this.memsize );\n \t\t} else {\n \t\t\tinput.copy( this.memory, this.memsize, p, bEnd );\n \t\t}\n\n \t\tthis.memsize = bEnd - p;\n \t}\n\n \treturn this\n };\n\n /**\n * Finalize the XXH64 computation. The XXH64 instance is ready for reuse for the given seed\n * @method digest\n * @return {UINT64} xxHash\n */\n XXH64.prototype.digest = function () {\n \tvar input = this.memory;\n \tvar isString = typeof input == 'string';\n \tvar p = 0;\n \tvar bEnd = this.memsize;\n \tvar h64, h;\n \tvar u = new UINT64$1;\n\n \tif (this.total_len >= 32)\n \t{\n \t\th64 = this.v1.clone().rotl(1);\n \t\th64.add( this.v2.clone().rotl(7) );\n \t\th64.add( this.v3.clone().rotl(12) );\n \t\th64.add( this.v4.clone().rotl(18) );\n\n \t\th64.xor( this.v1.multiply(PRIME64_2).rotl(31).multiply(PRIME64_1) );\n \t\th64.multiply(PRIME64_1).add(PRIME64_4);\n\n \t\th64.xor( this.v2.multiply(PRIME64_2).rotl(31).multiply(PRIME64_1) );\n \t\th64.multiply(PRIME64_1).add(PRIME64_4);\n\n \t\th64.xor( this.v3.multiply(PRIME64_2).rotl(31).multiply(PRIME64_1) );\n \t\th64.multiply(PRIME64_1).add(PRIME64_4);\n\n \t\th64.xor( this.v4.multiply(PRIME64_2).rotl(31).multiply(PRIME64_1) );\n \t\th64.multiply(PRIME64_1).add(PRIME64_4);\n \t}\n \telse\n \t{\n \t\th64 = this.seed.clone().add( PRIME64_5 );\n \t}\n\n \th64.add( u.fromNumber(this.total_len) );\n\n \twhile (p <= bEnd - 8)\n \t{\n \t\tif (isString) {\n \t\t\tu.fromBits(\n \t\t\t\t(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)\n \t\t\t,\t(input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)\n \t\t\t,\t(input.charCodeAt(p+5) << 8) | input.charCodeAt(p+4)\n \t\t\t,\t(input.charCodeAt(p+7) << 8) | input.charCodeAt(p+6)\n \t\t\t);\n \t\t} else {\n \t\t\tu.fromBits(\n \t\t\t\t(input[p+1] << 8) | input[p]\n \t\t\t,\t(input[p+3] << 8) | input[p+2]\n \t\t\t,\t(input[p+5] << 8) | input[p+4]\n \t\t\t,\t(input[p+7] << 8) | input[p+6]\n \t\t\t);\n \t\t}\n \t\tu.multiply(PRIME64_2).rotl(31).multiply(PRIME64_1);\n \t\th64\n \t\t\t.xor(u)\n \t\t\t.rotl(27)\n \t\t\t.multiply( PRIME64_1 )\n \t\t\t.add( PRIME64_4 );\n \t\tp += 8;\n \t}\n\n \tif (p + 4 <= bEnd) {\n \t\tif (isString) {\n \t\t\tu.fromBits(\n \t\t\t\t(input.charCodeAt(p+1) << 8) | input.charCodeAt(p)\n \t\t\t,\t(input.charCodeAt(p+3) << 8) | input.charCodeAt(p+2)\n \t\t\t,\t0\n \t\t\t,\t0\n \t\t\t);\n \t\t} else {\n \t\t\tu.fromBits(\n \t\t\t\t(input[p+1] << 8) | input[p]\n \t\t\t,\t(input[p+3] << 8) | input[p+2]\n \t\t\t,\t0\n \t\t\t,\t0\n \t\t\t);\n \t\t}\n \t\th64\n \t\t\t.xor( u.multiply(PRIME64_1) )\n \t\t\t.rotl(23)\n \t\t\t.multiply( PRIME64_2 )\n \t\t\t.add( PRIME64_3 );\n \t\tp += 4;\n \t}\n\n \twhile (p < bEnd)\n \t{\n \t\tu.fromBits( isString ? input.charCodeAt(p++) : input[p++], 0, 0, 0 );\n \t\th64\n \t\t\t.xor( u.multiply(PRIME64_5) )\n \t\t\t.rotl(11)\n \t\t\t.multiply(PRIME64_1);\n \t}\n\n \th = h64.clone().shiftRight(33);\n \th64.xor(h).multiply(PRIME64_2);\n\n \th = h64.clone().shiftRight(29);\n \th64.xor(h).multiply(PRIME64_3);\n\n \th = h64.clone().shiftRight(32);\n \th64.xor(h);\n\n \t// Reset the state\n \tthis.init( this.seed );\n\n \treturn h64\n };\n\n var xxhash64 = XXH64;\n\n var lib$1 = {\n \th32: xxhash\n ,\th64: xxhash64\n };\n\n var __values$1 = (commonjsGlobal && commonjsGlobal.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n };\n var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n var xxhashjs_1 = __importDefault(lib$1);\n /**\n * Create a new array fill with a base value\n * @param size - The size of the array\n * @param defaultValue - The default value used to fill the array. If it's a function, it will be invoked to get the default value.\n * @return A newly allocated array\n * @memberof Utils\n */\n function allocateArray(size, defaultValue) {\n var array = new Array(size);\n var getDefault = (typeof defaultValue === 'function') ? defaultValue : function () { return defaultValue; };\n for (var ind = 0; ind < size; ind++) {\n array[ind] = getDefault();\n }\n return array;\n }\n var allocateArray_1 = allocateArray;\n /**\n * (64-bits only) Hash a value into two values (in hex or integer format)\n * @param value - The value to hash\n * @param asInt - (optional) If True, the values will be returned as an integer. Otherwise, as hexadecimal values.\n * @param seed the seed used for hashing\n * @return The results of the hash functions applied to the value (in hex or integer)\n * @memberof Utils\n * @author Arnaud Grall & Thomas Minier\n */\n function hashTwice(value, asInt, seed) {\n if (asInt === undefined) {\n asInt = false;\n }\n if (seed === undefined) {\n seed = getDefaultSeed();\n }\n var f = xxhashjs_1.default.h64(value, seed + 1);\n var l = xxhashjs_1.default.h64(value, seed + 2);\n if (asInt) {\n return {\n first: f.toNumber(),\n second: l.toNumber()\n };\n }\n else {\n var one = f.toString(16);\n if (one.length < 16) {\n one = '0'.repeat(16 - one.length) + one;\n }\n var two = l.toString(16);\n if (two.length < 16) {\n two = '0'.repeat(16 - two.length) + two;\n }\n return {\n first: Number(one),\n second: Number(two)\n };\n }\n }\n var hashTwice_1 = hashTwice;\n function hashTwiceAsString(value, seed) {\n if (seed === undefined) {\n seed = getDefaultSeed();\n }\n var f = xxhashjs_1.default.h64(value, seed + 1);\n var l = xxhashjs_1.default.h64(value, seed + 2);\n var one = f.toString(16);\n if (one.length < 16)\n one = '0'.repeat(16 - one.length) + one;\n var two = l.toString(16);\n if (two.length < 16)\n two = '0'.repeat(16 - two.length) + two;\n return {\n first: one,\n second: two\n };\n }\n var hashTwiceAsString_1 = hashTwiceAsString;\n /**\n * (64-bits only) Same as hashTwice but return Numbers and String equivalent\n * @param val the value to hash\n * @param seed the seed to change when hashing\n * @return A object of shape {int: {first: <number>, second: <number>}, string: {first: <hex-string>, second: <hex-string>}\n * @author Arnaud Grall\n */\n function allInOneHashTwice(val, seed) {\n if (seed === undefined) {\n seed = getDefaultSeed();\n }\n var one = xxhashjs_1.default.h64(val, seed + 1);\n var two = xxhashjs_1.default.h64(val, seed + 2);\n var stringOne = one.toString(16);\n if (stringOne.length < 16)\n stringOne = '0'.repeat(16 - stringOne.length) + stringOne;\n var stringTwo = two.toString(16);\n if (stringTwo.length < 16)\n stringTwo = '0'.repeat(16 - stringTwo.length) + stringTwo;\n return {\n int: {\n first: one.toNumber(),\n second: two.toNumber()\n },\n string: {\n first: stringOne,\n second: stringTwo\n }\n };\n }\n var allInOneHashTwice_1 = allInOneHashTwice;\n /**\n * Apply Double Hashing to produce a n-hash\n *\n * This implementation used directly the value produced by the two hash functions instead of the functions themselves.\n * @see {@link http://citeseer.ist.psu.edu/viewdoc/download;jsessionid=4060353E67A356EF9528D2C57C064F5A?doi=10.1.1.152.579&rep=rep1&type=pdf} for more details about double hashing.\n * @param n - The indice of the hash function we want to produce\n * @param hashA - The result of the first hash function applied to a value.\n * @param hashB - The result of the second hash function applied to a value.\n * @param size - The size of the datastructures associated to the hash context (ex: the size of a Bloom Filter)\n * @return The result of hash_n applied to a value.\n * @memberof Utils\n * @author Thomas Minier\n */\n function doubleHashing(n, hashA, hashB, size) {\n return Math.abs((hashA + n * hashB) % size);\n }\n var doubleHashing_1 = doubleHashing;\n /**\n * Generate a set of distinct indexes on interval [0, size) using the double hashing technique\n * @param element - The element to hash\n * @param size - the range on which we can generate an index [0, size) = size\n * @param number - The number of indexes desired\n * @param seed - The seed used\n * @return A array of indexes\n * @author Arnaud Grall\n */\n function getDistinctIndices(element, size, number, seed) {\n if (seed === undefined) {\n seed = getDefaultSeed();\n }\n function getDistinctIndicesBis(n, elem, size, count, indexes) {\n if (indexes === void 0) { indexes = []; }\n if (indexes.length === count) {\n return indexes;\n }\n else {\n var hashes = hashTwice(elem, true, seed + size % n);\n var ind = doubleHashing(n, hashes.first, hashes.second, size);\n if (indexes.includes(ind)) {\n // console.log('generate index: %d for %s', ind, elem)\n return getDistinctIndicesBis(n + 1, elem, size, count, indexes);\n }\n else {\n // console.log('already found: %d for %s', ind, elem)\n indexes.push(ind);\n return getDistinctIndicesBis(n + 1, elem, size, count, indexes);\n }\n }\n }\n return getDistinctIndicesBis(1, element, size, number);\n }\n var getDistinctIndices_1 = getDistinctIndices;\n /**\n * Generate hashCount indexes, one index per [0, size)\n * it uses the double hashing technique to generate the indexes\n * @param element - The element to hash\n * @param size - The range on which we can g-enerate the index, exclusive\n * @param hashCount - The number of indexes we want\n * @return An array of indexes\n */\n function getIndices(element, size, hashCount, seed) {\n if (seed === undefined) {\n seed = getDefaultSeed();\n }\n var arr = [];\n for (var i = 1; i <= hashCount; i++) {\n var hashes = hashTwice(element, true, seed + size % i);\n arr.push(doubleHashing(i, hashes.first, hashes.second, size));\n }\n if (arr.length !== hashCount)\n throw new Error('report this, please, shouldnt be of different size');\n return arr;\n }\n var getIndices_1 = getIndices;\n /**\n * Generate a random int bewteen two bounds (included)\n * @param min - The lower bound\n * @param max - The upper bound\n * @param random - Function used to generate random floats\n * @return A random int bewteen lower and upper bound (included)\n * @memberof Utils\n * @author Thomas Minier\n */\n function randomInt(min, max, random) {\n if (random === undefined) {\n random = Math.random;\n }\n min = Math.ceil(min);\n max = Math.floor(max);\n var rn = random();\n return Math.floor(rn * (max - min + 1)) + min;\n }\n var randomInt_1 = randomInt;\n /**\n * Return the non-destructive XOR of two buffers\n * @param a - The buffer to copy, then to xor with b\n * @param b - The buffer to xor with\n * @return The results of the XOR between the two buffers\n * @author Arnaud Grall\n */\n function xorBuffer(a, b) {\n var length = Math.max(a.length, b.length);\n var buffer$1 = buffer.Buffer.allocUnsafe(length).fill(0);\n for (var i = 0; i < length; ++i) {\n if (i < a.length && i < b.length) {\n buffer$1[length - i - 1] = a[a.length - i - 1] ^ b[b.length - i - 1];\n }\n else if (i < a.length && i >= b.length) {\n buffer$1[length - i - 1] ^= a[a.length - i - 1];\n }\n else if (i < b.length && i >= a.length) {\n buffer$1[length - i - 1] ^= b[b.length - i - 1];\n }\n }\n // now need to remove leading zeros in the buffer if any\n var start = 0;\n var it = buffer$1.values();\n var value = it.next();\n while (!value.done && value.value === 0) {\n start++;\n value = it.next();\n }\n var buf2 = buffer$1.slice(start);\n return buf2;\n }\n var xorBuffer_1 = xorBuffer;\n /**\n * Return true if the buffer is empty, i.e., all value are equals to 0.\n * @param buffer - The buffer to inspect\n * @return True if the buffer only contains zero, False otherwise\n * @author Arnaud Grall\n */\n function isEmptyBuffer(buffer) {\n var e_1, _a;\n if (buffer === null || !buffer)\n return true;\n try {\n for (var buffer_1 = __values$1(buffer), buffer_1_1 = buffer_1.next(); !buffer_1_1.done; buffer_1_1 = buffer_1.next()) {\n var value = buffer_1_1.value;\n if (value !== 0) {\n return false;\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (buffer_1_1 && !buffer_1_1.done && (_a = buffer_1.return)) _a.call(buffer_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return true;\n // const json = buffer.toJSON()\n // let i = 0\n // let found = false\n // while (!found && i < json.data.length) {\n // if (json.data[i] !== 0) {\n // found = true\n // }\n // i++\n // }\n // return !found\n }\n var isEmptyBuffer_1 = isEmptyBuffer;\n /**\n * Hash an item as an unsigned int\n * @param elem - Element to hash\n * @param seed - The hash seed. If its is UINT32 make sure to set the length to 32\n * @param length - The length of hashes (defaults to 64 bits)\n * @return The hash value as an unsigned int\n * @author Arnaud Grall\n */\n function hashAsInt(elem, seed, length) {\n if (seed === undefined) {\n seed = getDefaultSeed();\n }\n switch (length) {\n case 32:\n return xxhashjs_1.default.h32(elem, seed).toNumber();\n case 64:\n return xxhashjs_1.default.h64(elem, seed).toNumber();\n default:\n return xxhashjs_1.default.h64(elem, seed).toNumber();\n }\n }\n var hashAsInt_1 = hashAsInt;\n /**\n * Hash an item as a string\n * @param elem - Element to hash\n * @param seed - The hash seed. If its is UINT32 make sure to set the length to 32\n * @param base - The base in which the string will be returned, default: 16\n * @param length - The length of hashes (defaults to 64 bits)\n * @return The hashed value as a string\n * @author Arnaud Grall\n */\n function hashAsString(elem, seed, base, length) {\n if (seed === undefined) {\n seed = getDefaultSeed();\n }\n if (base === undefined) {\n base = 16;\n }\n if (length === undefined) {\n length = 64;\n }\n var hash;\n switch (length) {\n case 32:\n hash = xxhashjs_1.default.h32(elem, seed);\n break;\n case 64:\n hash = xxhashjs_1.default.h64(elem, seed);\n break;\n default:\n hash = xxhashjs_1.default.h64(elem, seed);\n break;\n }\n var result = '';\n if (base === 16) {\n result = hash.toString(base);\n if (result.length < (length / 4)) {\n result = '0'.repeat((length / 4) - result.length) + result;\n }\n }\n else if (base === 2) {\n result = hex2bin(hash.toString(16));\n if (result.length < length) {\n result = '0'.repeat(length - result.length) + result;\n }\n }\n return result;\n }\n var hashAsString_1 = hashAsString;\n /**\n * Hash an item as a string\n * @param elem - Element to hash\n * @param seed - The hash seed. If its is UINT32 make sure to set the length to 32\n * @param base - The base in which the string will be returned, default: 16\n * @param length - The length of hashes (defaults to 64 bits)\n * @return The item hased as an int and a string\n * @author Arnaud Grall\n */\n function hashIntAndString(elem, seed, base, length) {\n if (seed === undefined) {\n seed = getDefaultSeed();\n }\n if (base === undefined) {\n base = 16;\n }\n if (length === undefined) {\n length = 64;\n }\n var hash;\n switch (length) {\n case 32:\n hash = xxhashjs_1.default.h32(elem, seed);\n break;\n case 64:\n hash = xxhashjs_1.default.h64(elem, seed);\n break;\n default:\n hash = xxhashjs_1.default.h64(elem, seed);\n break;\n }\n var result = '';\n if (base === 16) {\n result = hash.toString(base);\n if (result.length < (length / 4)) {\n result = '0'.repeat((length / 4) - result.length) + result;\n }\n }\n else if (base === 2) {\n result = hex2bin(hash.toString(16));\n if (result.length < length) {\n result = '0'.repeat(length - result.length) + result;\n }\n }\n return { int: hash.toNumber(), string: result };\n }\n var hashIntAndString_1 = hashIntAndString;\n /**\n * Return the default seed used in the package\n * @return A ssed as a floating point number\n * @author Arnaud Grall\n */\n function getDefaultSeed() {\n return 0x1234567890;\n }\n var getDefaultSeed_1 = getDefaultSeed;\n /**\n * Return the next power of 2 of x\n * @param x - Value\n * @return The next power of 2 of x\n */\n function power2(x) {\n return Math.ceil(Math.pow(2, Math.floor(Math.log(x) / Math.log(2))));\n }\n var power2_1 = power2;\n /**\n * Convert an hex string into a binary string\n * @param hex - A base 16 string\n * @return A base 2 string\n */\n function hex2bin(hex) {\n return parseInt(hex, 16).toString(2);\n }\n var hex2bin_1 = hex2bin;\n /**\n * Convert an uint8 to an array of 1s and 0s\n * @param uint8 - A uint8 number\n * @return An array of 1s and 0s\n */\n function uint8ToBits(uint8) {\n return [128, 64, 32, 16, 8, 4, 2, 1].map(function (x) { return (x & uint8) > 0 ? 1 : 0; });\n }\n var uint8ToBits_1 = uint8ToBits;\n /**\n * Convert an array of 1s and 0s to a uint8\n * @param bits - An array of 1s and 0s\n * @return A uint8 number\n */\n function bitsToUint8(bits) {\n return bits.reduce(function (acc, cur, i) {\n if (cur === 0) {\n return acc;\n }\n else if (cur === 1) {\n return acc + Math.pow(2, 7 - i);\n }\n else {\n throw new Error(\"Not binary\");\n }\n }, 0);\n }\n var bitsToUint8_1 = bitsToUint8;\n\n var utils$5 = /*#__PURE__*/Object.defineProperty({\n \tallocateArray: allocateArray_1,\n \thashTwice: hashTwice_1,\n \thashTwiceAsString: hashTwiceAsString_1,\n \tallInOneHashTwice: allInOneHashTwice_1,\n \tdoubleHashing: doubleHashing_1,\n \tgetDistinctIndices: getDistinctIndices_1,\n \tgetIndices: getIndices_1,\n \trandomInt: randomInt_1,\n \txorBuffer: xorBuffer_1,\n \tisEmptyBuffer: isEmptyBuffer_1,\n \thashAsInt: hashAsInt_1,\n \thashAsString: hashAsString_1,\n \thashIntAndString: hashIntAndString_1,\n \tgetDefaultSeed: getDefaultSeed_1,\n \tpower2: power2_1,\n \thex2bin: hex2bin_1,\n \tuint8ToBits: uint8ToBits_1,\n \tbitsToUint8: bitsToUint8_1\n }, '__esModule', {value: true});\n\n var alea = createCommonjsModule(function (module) {\n // A port of an algorithm by Johannes Baagøe <baagoe@baagoe.com>, 2010\n // http://baagoe.com/en/RandomMusings/javascript/\n // https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n // Original work is under MIT license -\n\n // Copyright (C) 2010 by Johannes Baagøe <baagoe@baagoe.org>\n //\n // Permission is hereby granted, free of charge, to any person obtaining a copy\n // of this software and associated documentation files (the \"Software\"), to deal\n // in the Software without restriction, including without limitation the rights\n // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n // copies of the Software, and to permit persons to whom the Software is\n // furnished to do so, subject to the following conditions:\n //\n // The above copyright notice and this permission notice shall be included in\n // all copies or substantial portions of the Software.\n //\n // THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n // THE SOFTWARE.\n\n\n\n (function(global, module, define) {\n\n function Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n }\n\n function copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n }\n\n function impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; };\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); };\n }\n return prng;\n }\n\n function Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = String(data);\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n }\n\n\n if (module && module.exports) {\n module.exports = impl;\n } else if (define && define.amd) {\n define(function() { return impl; });\n } else {\n this.alea = impl;\n }\n\n })(\n commonjsGlobal,\n module, // present in node.js\n (typeof undefined) == 'function' // present with an AMD loader\n );\n });\n\n var xor128 = createCommonjsModule(function (module) {\n // A Javascript implementaion of the \"xor128\" prng algorithm by\n // George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n (function(global, module, define) {\n\n function XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n }\n\n function copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n }\n\n function impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); };\n }\n return prng;\n }\n\n if (module && module.exports) {\n module.exports = impl;\n } else if (define && define.amd) {\n define(function() { return impl; });\n } else {\n this.xor128 = impl;\n }\n\n })(\n commonjsGlobal,\n module, // present in node.js\n (typeof undefined) == 'function' // present with an AMD loader\n );\n });\n\n var xorwow = createCommonjsModule(function (module) {\n // A Javascript implementaion of the \"xorwow\" prng algorithm by\n // George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n (function(global, module, define) {\n\n function XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n }\n\n function copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n }\n\n function impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); };\n }\n return prng;\n }\n\n if (module && module.exports) {\n module.exports = impl;\n } else if (define && define.amd) {\n define(function() { return impl; });\n } else {\n this.xorwow = impl;\n }\n\n })(\n commonjsGlobal,\n module, // present in node.js\n (typeof undefined) == 'function' // present with an AMD loader\n );\n });\n\n var xorshift7 = createCommonjsModule(function (module) {\n // A Javascript implementaion of the \"xorshift7\" algorithm by\n // François Panneton and Pierre L'ecuyer:\n // \"On the Xorgshift Random Number Generators\"\n // http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n (function(global, module, define) {\n\n function XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) X[7] = -1;\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n }\n\n function copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n }\n\n function impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); };\n }\n return prng;\n }\n\n if (module && module.exports) {\n module.exports = impl;\n } else if (define && define.amd) {\n define(function() { return impl; });\n } else {\n this.xorshift7 = impl;\n }\n\n })(\n commonjsGlobal,\n module, // present in node.js\n (typeof undefined) == 'function' // present with an AMD loader\n );\n });\n\n var xor4096 = createCommonjsModule(function (module) {\n // A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n //\n // This fast non-cryptographic random number generator is designed for\n // use in Monte-Carlo algorithms. It combines a long-period xorshift\n // generator with a Weyl generator, and it passes all common batteries\n // of stasticial tests for randomness while consuming only a few nanoseconds\n // for each prng generated. For background on the generator, see Brent's\n // paper: \"Some long-period random number generators using shifts and xors.\"\n // http://arxiv.org/pdf/1004.3115v1.pdf\n //\n // Usage:\n //\n // var xor4096 = require('xor4096');\n // random = xor4096(1); // Seed with int32 or string.\n // assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n // assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n //\n // For nonzero numeric keys, this impelementation provides a sequence\n // identical to that by Brent's xorgens 3 implementaion in C. This\n // implementation also provides for initalizing the generator with\n // string seeds, or for saving and restoring the state of the generator.\n //\n // On Chrome, this prng benchmarks about 2.1 times slower than\n // Javascript's built-in Math.random().\n\n (function(global, module, define) {\n\n function XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n }\n\n function copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n }\n function impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); };\n }\n return prng;\n }\n\n if (module && module.exports) {\n module.exports = impl;\n } else if (define && define.amd) {\n define(function() { return impl; });\n } else {\n this.xor4096 = impl;\n }\n\n })(\n commonjsGlobal, // window object or global\n module, // present in node.js\n (typeof undefined) == 'function' // present with an AMD loader\n );\n });\n\n var tychei = createCommonjsModule(function (module) {\n // A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n // Samuel Neves and Filipe Araujo.\n // See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n (function(global, module, define) {\n\n function XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n }\n\n function copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n }\n function impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); };\n }\n return prng;\n }\n\n if (module && module.exports) {\n module.exports = impl;\n } else if (define && define.amd) {\n define(function() { return impl; });\n } else {\n this.tychei = impl;\n }\n\n })(\n commonjsGlobal,\n module, // present in node.js\n (typeof undefined) == 'function' // present with an AMD loader\n );\n });\n\n var _nodeResolve_empty = {};\n\n var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n 'default': _nodeResolve_empty\n });\n\n var require$$0$3 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);\n\n /*\n Copyright 2019 David Bau.\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n */\n\n var seedrandom = createCommonjsModule(function (module) {\n (function (global, pool, math) {\n //\n // The following constants are related to IEEE 754 limits.\n //\n\n var width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n //\n // seedrandom()\n // This is the seedrandom function described above.\n //\n function seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; };\n prng.quick = function() { return arc4.g(4) / 0x100000000; };\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); };\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n }\n\n //\n // ARC4\n //\n // An ARC4 implementation. The constructor takes a key in the form of\n // an array of at most (width) integers that should be 0 <= x < (width).\n //\n // The g(count) method returns a pseudorandom integer that concatenates\n // the next (count) outputs from ARC4. Its return value is a number x\n // that is in the range 0 <= x < (width ^ count).\n //\n function ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n }\n\n //\n // copy()\n // Copies internal state of ARC4 to or from a plain object.\n //\n function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n }\n //\n // flatten()\n // Converts an object tree to nested arrays of strings.\n //\n function flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n }\n\n //\n // mixkey()\n // Mixes a string seed into a key that is an array of integers, and\n // returns a shortened string seed that is equivalent to the result key.\n //\n function mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n }\n\n //\n // autoseed()\n // Returns an object for autoseeding, using window.crypto and Node crypto\n // module if available.\n //\n function autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n }\n\n //\n // tostring()\n // Converts an array of charcodes to a string\n //\n function tostring(a) {\n return String.fromCharCode.apply(0, a);\n }\n\n //\n // When seedrandom.js is loaded, we immediately mix a few bits\n // from the built-in RNG into the entropy pool. Because we do\n // not want to interfere with deterministic PRNG state later,\n // seedrandom will not call math.random on its own again after\n // initialization.\n //\n mixkey(math.random(), pool);\n\n //\n // Nodejs and AMD support: export the implementation as a module using\n // either convention.\n //\n if ( module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = require$$0$3;\n } catch (ex) {}\n } else {\n // When included as a plain script, set up Math.seedrandom global.\n math['seed' + rngname] = seedrandom;\n }\n\n\n // End anonymous scope, and pass initial values.\n })(\n // global: `self` in browsers (including strict mode and web workers),\n // otherwise `this` in Node and other environments\n (typeof self !== 'undefined') ? self : commonjsGlobal,\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n );\n });\n\n // A library of seedable RNGs implemented in Javascript.\n //\n // Usage:\n //\n // var seedrandom = require('seedrandom');\n // var random = seedrandom(1); // or any seed.\n // var x = random(); // 0 <= x < 1. Every bit is random.\n // var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n // alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.\n // Period: ~2^116\n // Reported to pass all BigCrush tests.\n\n\n // xor128, a pure xor-shift generator by George Marsaglia.\n // Period: 2^128-1.\n // Reported to fail: MatrixRank and LinearComp.\n\n\n // xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n // Period: 2^192-2^32\n // Reported to fail: CollisionOver, SimpPoker, and LinearComp.\n\n\n // xorshift7, by François Panneton and Pierre L'ecuyer, takes\n // a different approach: it adds robustness by allowing more shifts\n // than Marsaglia's original three. It is a 7-shift generator\n // with 256 bits, that passes BigCrush with no systmatic failures.\n // Period 2^256-1.\n // No systematic BigCrush failures reported.\n\n\n // xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n // very long period that also adds a Weyl generator. It also passes\n // BigCrush with no systematic failures. Its long period may\n // be useful if you have many generators and need to avoid\n // collisions.\n // Period: 2^4128-2^32.\n // No systematic BigCrush failures reported.\n\n\n // Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n // number generator derived from ChaCha, a modern stream cipher.\n // https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n // Period: ~2^127\n // No systematic BigCrush failures reported.\n\n\n // The original ARC4-based prng included in this library.\n // Period: ~2^1600\n\n\n seedrandom.alea = alea;\n seedrandom.xor128 = xor128;\n seedrandom.xorwow = xorwow;\n seedrandom.xorshift7 = xorshift7;\n seedrandom.xor4096 = xor4096;\n seedrandom.tychei = tychei;\n\n var seedrandom$1 = seedrandom;\n\n /* file : base-filter.ts\n MIT License\n\n Copyright (c) 2017-2020 Thomas Minier & Arnaud Grall\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n };\n var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n var utils$6 = __importStar(utils$5);\n var seedrandom_1 = __importDefault$1(seedrandom$1);\n /**\n * A base class for implementing probailistic filters\n * @author Thomas Minier\n * @author Arnaud Grall\n */\n var BaseFilter = /** @class */ (function () {\n function BaseFilter() {\n this._seed = utils$6.getDefaultSeed();\n this._rng = seedrandom_1.default(\"\" + this._seed);\n }\n Object.defineProperty(BaseFilter.prototype, \"seed\", {\n /**\n * Get the seed used in this structure\n */\n get: function () {\n return this._seed;\n },\n /**\n * Set the seed for this structure\n * @param seed the new seed that will be used in this structure\n */\n set: function (seed) {\n this._seed = seed;\n this._rng = seedrandom_1.default(\"\" + this._seed);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BaseFilter.prototype, \"random\", {\n /**\n * Get a function used to draw random number\n * @return A factory function used to draw random integer\n */\n get: function () {\n return this._rng;\n },\n enumerable: true,\n configurable: true\n });\n return BaseFilter;\n }());\n var _default$8 = BaseFilter;\n\n var baseFilter = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$8\n }, '__esModule', {value: true});\n\n var Reflect$1;\n (function (Reflect) {\n // Metadata Proposal\n // https://rbuckton.github.io/reflect-metadata/\n (function (factory) {\n var root = typeof commonjsGlobal === \"object\" ? commonjsGlobal :\n typeof self === \"object\" ? self :\n typeof this === \"object\" ? this :\n Function(\"return this;\")();\n var exporter = makeExporter(Reflect);\n if (typeof root.Reflect === \"undefined\") {\n root.Reflect = Reflect;\n }\n else {\n exporter = makeExporter(root.Reflect, exporter);\n }\n factory(exporter);\n function makeExporter(target, previous) {\n return function (key, value) {\n if (typeof target[key] !== \"function\") {\n Object.defineProperty(target, key, { configurable: true, writable: true, value: value });\n }\n if (previous)\n previous(key, value);\n };\n }\n })(function (exporter) {\n var hasOwn = Object.prototype.hasOwnProperty;\n // feature test for Symbol support\n var supportsSymbol = typeof Symbol === \"function\";\n var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== \"undefined\" ? Symbol.toPrimitive : \"@@toPrimitive\";\n var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== \"undefined\" ? Symbol.iterator : \"@@iterator\";\n var supportsCreate = typeof Object.create === \"function\"; // feature test for Object.create support\n var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support\n var downLevel = !supportsCreate && !supportsProto;\n var HashMap = {\n // create an object in dictionary mode (a.k.a. \"slow\" mode in v8)\n create: supportsCreate\n ? function () { return MakeDictionary(Object.create(null)); }\n : supportsProto\n ? function () { return MakeDictionary({ __proto__: null }); }\n : function () { return MakeDictionary({}); },\n has: downLevel\n ? function (map, key) { return hasOwn.call(map, key); }\n : function (map, key) { return key in map; },\n get: downLevel\n ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; }\n : function (map, key) { return map[key]; },\n };\n // Load global or shim versions of Map, Set, and WeakMap\n var functionPrototype = Object.getPrototypeOf(Function);\n var usePolyfill = typeof browser$1 === \"object\" && browser$1.env && browser$1.env[\"REFLECT_METADATA_USE_MAP_POLYFILL\"] === \"true\";\n var _Map = !usePolyfill && typeof Map === \"function\" && typeof Map.prototype.entries === \"function\" ? Map : CreateMapPolyfill();\n var _Set = !usePolyfill && typeof Set === \"function\" && typeof Set.prototype.entries === \"function\" ? Set : CreateSetPolyfill();\n var _WeakMap = !usePolyfill && typeof WeakMap === \"function\" ? WeakMap : CreateWeakMapPolyfill();\n // [[Metadata]] internal slot\n // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots\n var Metadata = new _WeakMap();\n /**\n * Applies a set of decorators to a property of a target object.\n * @param decorators An array of decorators.\n * @param target The target object.\n * @param propertyKey (Optional) The property key to decorate.\n * @param attributes (Optional) The property descriptor for the target key.\n * @remarks Decorators are applied in reverse order.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * Example = Reflect.decorate(decoratorsArray, Example);\n *\n * // property (on constructor)\n * Reflect.decorate(decoratorsArray, Example, \"staticProperty\");\n *\n * // property (on prototype)\n * Reflect.decorate(decoratorsArray, Example.prototype, \"property\");\n *\n * // method (on constructor)\n * Object.defineProperty(Example, \"staticMethod\",\n * Reflect.decorate(decoratorsArray, Example, \"staticMethod\",\n * Object.getOwnPropertyDescriptor(Example, \"staticMethod\")));\n *\n * // method (on prototype)\n * Object.defineProperty(Example.prototype, \"method\",\n * Reflect.decorate(decoratorsArray, Example.prototype, \"method\",\n * Object.getOwnPropertyDescriptor(Example.prototype, \"method\")));\n *\n */\n function decorate(decorators, target, propertyKey, attributes) {\n if (!IsUndefined(propertyKey)) {\n if (!IsArray(decorators))\n throw new TypeError();\n if (!IsObject(target))\n throw new TypeError();\n if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes))\n throw new TypeError();\n if (IsNull(attributes))\n attributes = undefined;\n propertyKey = ToPropertyKey(propertyKey);\n return DecorateProperty(decorators, target, propertyKey, attributes);\n }\n else {\n if (!IsArray(decorators))\n throw new TypeError();\n if (!IsConstructor(target))\n throw new TypeError();\n return DecorateConstructor(decorators, target);\n }\n }\n exporter(\"decorate\", decorate);\n // 4.1.2 Reflect.metadata(metadataKey, metadataValue)\n // https://rbuckton.github.io/reflect-metadata/#reflect.metadata\n /**\n * A default metadata decorator factory that can be used on a class, class member, or parameter.\n * @param metadataKey The key for the metadata entry.\n * @param metadataValue The value for the metadata entry.\n * @returns A decorator function.\n * @remarks\n * If `metadataKey` is already defined for the target and target key, the\n * metadataValue for that key will be overwritten.\n * @example\n *\n * // constructor\n * @Reflect.metadata(key, value)\n * class Example {\n * }\n *\n * // property (on constructor, TypeScript only)\n * class Example {\n * @Reflect.metadata(key, value)\n * static staticProperty;\n * }\n *\n * // property (on prototype, TypeScript only)\n * class Example {\n * @Reflect.metadata(key, value)\n * property;\n * }\n *\n * // method (on constructor)\n * class Example {\n * @Reflect.metadata(key, value)\n * static staticMethod() { }\n * }\n *\n * // method (on prototype)\n * class Example {\n * @Reflect.metadata(key, value)\n * method() { }\n * }\n *\n */\n function metadata(metadataKey, metadataValue) {\n function decorator(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey))\n throw new TypeError();\n OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n }\n return decorator;\n }\n exporter(\"metadata\", metadata);\n /**\n * Define a unique metadata entry on the target.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param metadataValue A value that contains attached metadata.\n * @param target The target object on which to define metadata.\n * @param propertyKey (Optional) The property key for the target.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * Reflect.defineMetadata(\"custom:annotation\", options, Example);\n *\n * // property (on constructor)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example, \"staticProperty\");\n *\n * // property (on prototype)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example.prototype, \"property\");\n *\n * // method (on constructor)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example, \"staticMethod\");\n *\n * // method (on prototype)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example.prototype, \"method\");\n *\n * // decorator factory as metadata-producing annotation.\n * function MyAnnotation(options): Decorator {\n * return (target, key?) => Reflect.defineMetadata(\"custom:annotation\", options, target, key);\n * }\n *\n */\n function defineMetadata(metadataKey, metadataValue, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n }\n exporter(\"defineMetadata\", defineMetadata);\n /**\n * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.hasMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function hasMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryHasMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"hasMetadata\", hasMetadata);\n /**\n * Gets a value indicating whether the target object has the provided metadata key defined.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function hasOwnMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"hasOwnMetadata\", hasOwnMetadata);\n /**\n * Gets the metadata value for the provided metadata key on the target object or its prototype chain.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.getMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function getMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryGetMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"getMetadata\", getMetadata);\n /**\n * Gets the metadata value for the provided metadata key on the target object.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function getOwnMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"getOwnMetadata\", getOwnMetadata);\n /**\n * Gets the metadata keys defined on the target object or its prototype chain.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns An array of unique metadata keys.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getMetadataKeys(Example);\n *\n * // property (on constructor)\n * result = Reflect.getMetadataKeys(Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getMetadataKeys(Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getMetadataKeys(Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getMetadataKeys(Example.prototype, \"method\");\n *\n */\n function getMetadataKeys(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryMetadataKeys(target, propertyKey);\n }\n exporter(\"getMetadataKeys\", getMetadataKeys);\n /**\n * Gets the unique metadata keys defined on the target object.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns An array of unique metadata keys.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getOwnMetadataKeys(Example);\n *\n * // property (on constructor)\n * result = Reflect.getOwnMetadataKeys(Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getOwnMetadataKeys(Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getOwnMetadataKeys(Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getOwnMetadataKeys(Example.prototype, \"method\");\n *\n */\n function getOwnMetadataKeys(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryOwnMetadataKeys(target, propertyKey);\n }\n exporter(\"getOwnMetadataKeys\", getOwnMetadataKeys);\n /**\n * Deletes the metadata entry from the target object with the provided key.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata entry was found and deleted; otherwise, false.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function deleteMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n var metadataMap = GetOrCreateMetadataMap(target, propertyKey, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n if (!metadataMap.delete(metadataKey))\n return false;\n if (metadataMap.size > 0)\n return true;\n var targetMetadata = Metadata.get(target);\n targetMetadata.delete(propertyKey);\n if (targetMetadata.size > 0)\n return true;\n Metadata.delete(target);\n return true;\n }\n exporter(\"deleteMetadata\", deleteMetadata);\n function DecorateConstructor(decorators, target) {\n for (var i = decorators.length - 1; i >= 0; --i) {\n var decorator = decorators[i];\n var decorated = decorator(target);\n if (!IsUndefined(decorated) && !IsNull(decorated)) {\n if (!IsConstructor(decorated))\n throw new TypeError();\n target = decorated;\n }\n }\n return target;\n }\n function DecorateProperty(decorators, target, propertyKey, descriptor) {\n for (var i = decorators.length - 1; i >= 0; --i) {\n var decorator = decorators[i];\n var decorated = decorator(target, propertyKey, descriptor);\n if (!IsUndefined(decorated) && !IsNull(decorated)) {\n if (!IsObject(decorated))\n throw new TypeError();\n descriptor = decorated;\n }\n }\n return descriptor;\n }\n function GetOrCreateMetadataMap(O, P, Create) {\n var targetMetadata = Metadata.get(O);\n if (IsUndefined(targetMetadata)) {\n if (!Create)\n return undefined;\n targetMetadata = new _Map();\n Metadata.set(O, targetMetadata);\n }\n var metadataMap = targetMetadata.get(P);\n if (IsUndefined(metadataMap)) {\n if (!Create)\n return undefined;\n metadataMap = new _Map();\n targetMetadata.set(P, metadataMap);\n }\n return metadataMap;\n }\n // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata\n function OrdinaryHasMetadata(MetadataKey, O, P) {\n var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);\n if (hasOwn)\n return true;\n var parent = OrdinaryGetPrototypeOf(O);\n if (!IsNull(parent))\n return OrdinaryHasMetadata(MetadataKey, parent, P);\n return false;\n }\n // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata\n function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n return ToBoolean(metadataMap.has(MetadataKey));\n }\n // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata\n function OrdinaryGetMetadata(MetadataKey, O, P) {\n var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);\n if (hasOwn)\n return OrdinaryGetOwnMetadata(MetadataKey, O, P);\n var parent = OrdinaryGetPrototypeOf(O);\n if (!IsNull(parent))\n return OrdinaryGetMetadata(MetadataKey, parent, P);\n return undefined;\n }\n // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata\n function OrdinaryGetOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return undefined;\n return metadataMap.get(MetadataKey);\n }\n // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata\n function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true);\n metadataMap.set(MetadataKey, MetadataValue);\n }\n // 3.1.6.1 OrdinaryMetadataKeys(O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys\n function OrdinaryMetadataKeys(O, P) {\n var ownKeys = OrdinaryOwnMetadataKeys(O, P);\n var parent = OrdinaryGetPrototypeOf(O);\n if (parent === null)\n return ownKeys;\n var parentKeys = OrdinaryMetadataKeys(parent, P);\n if (parentKeys.length <= 0)\n return ownKeys;\n if (ownKeys.length <= 0)\n return parentKeys;\n var set = new _Set();\n var keys = [];\n for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {\n var key = ownKeys_1[_i];\n var hasKey = set.has(key);\n if (!hasKey) {\n set.add(key);\n keys.push(key);\n }\n }\n for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {\n var key = parentKeys_1[_a];\n var hasKey = set.has(key);\n if (!hasKey) {\n set.add(key);\n keys.push(key);\n }\n }\n return keys;\n }\n // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys\n function OrdinaryOwnMetadataKeys(O, P) {\n var keys = [];\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return keys;\n var keysObj = metadataMap.keys();\n var iterator = GetIterator(keysObj);\n var k = 0;\n while (true) {\n var next = IteratorStep(iterator);\n if (!next) {\n keys.length = k;\n return keys;\n }\n var nextValue = IteratorValue(next);\n try {\n keys[k] = nextValue;\n }\n catch (e) {\n try {\n IteratorClose(iterator);\n }\n finally {\n throw e;\n }\n }\n k++;\n }\n }\n // 6 ECMAScript Data Typ0es and Values\n // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values\n function Type(x) {\n if (x === null)\n return 1 /* Null */;\n switch (typeof x) {\n case \"undefined\": return 0 /* Undefined */;\n case \"boolean\": return 2 /* Boolean */;\n case \"string\": return 3 /* String */;\n case \"symbol\": return 4 /* Symbol */;\n case \"number\": return 5 /* Number */;\n case \"object\": return x === null ? 1 /* Null */ : 6 /* Object */;\n default: return 6 /* Object */;\n }\n }\n // 6.1.1 The Undefined Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type\n function IsUndefined(x) {\n return x === undefined;\n }\n // 6.1.2 The Null Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type\n function IsNull(x) {\n return x === null;\n }\n // 6.1.5 The Symbol Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type\n function IsSymbol(x) {\n return typeof x === \"symbol\";\n }\n // 6.1.7 The Object Type\n // https://tc39.github.io/ecma262/#sec-object-type\n function IsObject(x) {\n return typeof x === \"object\" ? x !== null : typeof x === \"function\";\n }\n // 7.1 Type Conversion\n // https://tc39.github.io/ecma262/#sec-type-conversion\n // 7.1.1 ToPrimitive(input [, PreferredType])\n // https://tc39.github.io/ecma262/#sec-toprimitive\n function ToPrimitive(input, PreferredType) {\n switch (Type(input)) {\n case 0 /* Undefined */: return input;\n case 1 /* Null */: return input;\n case 2 /* Boolean */: return input;\n case 3 /* String */: return input;\n case 4 /* Symbol */: return input;\n case 5 /* Number */: return input;\n }\n var hint = PreferredType === 3 /* String */ ? \"string\" : PreferredType === 5 /* Number */ ? \"number\" : \"default\";\n var exoticToPrim = GetMethod(input, toPrimitiveSymbol);\n if (exoticToPrim !== undefined) {\n var result = exoticToPrim.call(input, hint);\n if (IsObject(result))\n throw new TypeError();\n return result;\n }\n return OrdinaryToPrimitive(input, hint === \"default\" ? \"number\" : hint);\n }\n // 7.1.1.1 OrdinaryToPrimitive(O, hint)\n // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive\n function OrdinaryToPrimitive(O, hint) {\n if (hint === \"string\") {\n var toString_1 = O.toString;\n if (IsCallable(toString_1)) {\n var result = toString_1.call(O);\n if (!IsObject(result))\n return result;\n }\n var valueOf = O.valueOf;\n if (IsCallable(valueOf)) {\n var result = valueOf.call(O);\n if (!IsObject(result))\n return result;\n }\n }\n else {\n var valueOf = O.valueOf;\n if (IsCallable(valueOf)) {\n var result = valueOf.call(O);\n if (!IsObject(result))\n return result;\n }\n var toString_2 = O.toString;\n if (IsCallable(toString_2)) {\n var result = toString_2.call(O);\n if (!IsObject(result))\n return result;\n }\n }\n throw new TypeError();\n }\n // 7.1.2 ToBoolean(argument)\n // https://tc39.github.io/ecma262/2016/#sec-toboolean\n function ToBoolean(argument) {\n return !!argument;\n }\n // 7.1.12 ToString(argument)\n // https://tc39.github.io/ecma262/#sec-tostring\n function ToString(argument) {\n return \"\" + argument;\n }\n // 7.1.14 ToPropertyKey(argument)\n // https://tc39.github.io/ecma262/#sec-topropertykey\n function ToPropertyKey(argument) {\n var key = ToPrimitive(argument, 3 /* String */);\n if (IsSymbol(key))\n return key;\n return ToString(key);\n }\n // 7.2 Testing and Comparison Operations\n // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations\n // 7.2.2 IsArray(argument)\n // https://tc39.github.io/ecma262/#sec-isarray\n function IsArray(argument) {\n return Array.isArray\n ? Array.isArray(argument)\n : argument instanceof Object\n ? argument instanceof Array\n : Object.prototype.toString.call(argument) === \"[object Array]\";\n }\n // 7.2.3 IsCallable(argument)\n // https://tc39.github.io/ecma262/#sec-iscallable\n function IsCallable(argument) {\n // NOTE: This is an approximation as we cannot check for [[Call]] internal method.\n return typeof argument === \"function\";\n }\n // 7.2.4 IsConstructor(argument)\n // https://tc39.github.io/ecma262/#sec-isconstructor\n function IsConstructor(argument) {\n // NOTE: This is an approximation as we cannot check for [[Construct]] internal method.\n return typeof argument === \"function\";\n }\n // 7.2.7 IsPropertyKey(argument)\n // https://tc39.github.io/ecma262/#sec-ispropertykey\n function IsPropertyKey(argument) {\n switch (Type(argument)) {\n case 3 /* String */: return true;\n case 4 /* Symbol */: return true;\n default: return false;\n }\n }\n // 7.3 Operations on Objects\n // https://tc39.github.io/ecma262/#sec-operations-on-objects\n // 7.3.9 GetMethod(V, P)\n // https://tc39.github.io/ecma262/#sec-getmethod\n function GetMethod(V, P) {\n var func = V[P];\n if (func === undefined || func === null)\n return undefined;\n if (!IsCallable(func))\n throw new TypeError();\n return func;\n }\n // 7.4 Operations on Iterator Objects\n // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects\n function GetIterator(obj) {\n var method = GetMethod(obj, iteratorSymbol);\n if (!IsCallable(method))\n throw new TypeError(); // from Call\n var iterator = method.call(obj);\n if (!IsObject(iterator))\n throw new TypeError();\n return iterator;\n }\n // 7.4.4 IteratorValue(iterResult)\n // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue\n function IteratorValue(iterResult) {\n return iterResult.value;\n }\n // 7.4.5 IteratorStep(iterator)\n // https://tc39.github.io/ecma262/#sec-iteratorstep\n function IteratorStep(iterator) {\n var result = iterator.next();\n return result.done ? false : result;\n }\n // 7.4.6 IteratorClose(iterator, completion)\n // https://tc39.github.io/ecma262/#sec-iteratorclose\n function IteratorClose(iterator) {\n var f = iterator[\"return\"];\n if (f)\n f.call(iterator);\n }\n // 9.1 Ordinary Object Internal Methods and Internal Slots\n // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots\n // 9.1.1.1 OrdinaryGetPrototypeOf(O)\n // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof\n function OrdinaryGetPrototypeOf(O) {\n var proto = Object.getPrototypeOf(O);\n if (typeof O !== \"function\" || O === functionPrototype)\n return proto;\n // TypeScript doesn't set __proto__ in ES5, as it's non-standard.\n // Try to determine the superclass constructor. Compatible implementations\n // must either set __proto__ on a subclass constructor to the superclass constructor,\n // or ensure each class has a valid `constructor` property on its prototype that\n // points back to the constructor.\n // If this is not the same as Function.[[Prototype]], then this is definately inherited.\n // This is the case when in ES6 or when using __proto__ in a compatible browser.\n if (proto !== functionPrototype)\n return proto;\n // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage.\n var prototype = O.prototype;\n var prototypeProto = prototype && Object.getPrototypeOf(prototype);\n if (prototypeProto == null || prototypeProto === Object.prototype)\n return proto;\n // If the constructor was not a function, then we cannot determine the heritage.\n var constructor = prototypeProto.constructor;\n if (typeof constructor !== \"function\")\n return proto;\n // If we have some kind of self-reference, then we cannot determine the heritage.\n if (constructor === O)\n return proto;\n // we have a pretty good guess at the heritage.\n return constructor;\n }\n // naive Map shim\n function CreateMapPolyfill() {\n var cacheSentinel = {};\n var arraySentinel = [];\n var MapIterator = /** @class */ (function () {\n function MapIterator(keys, values, selector) {\n this._index = 0;\n this._keys = keys;\n this._values = values;\n this._selector = selector;\n }\n MapIterator.prototype[\"@@iterator\"] = function () { return this; };\n MapIterator.prototype[iteratorSymbol] = function () { return this; };\n MapIterator.prototype.next = function () {\n var index = this._index;\n if (index >= 0 && index < this._keys.length) {\n var result = this._selector(this._keys[index], this._values[index]);\n if (index + 1 >= this._keys.length) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n else {\n this._index++;\n }\n return { value: result, done: false };\n }\n return { value: undefined, done: true };\n };\n MapIterator.prototype.throw = function (error) {\n if (this._index >= 0) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n throw error;\n };\n MapIterator.prototype.return = function (value) {\n if (this._index >= 0) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n return { value: value, done: true };\n };\n return MapIterator;\n }());\n return /** @class */ (function () {\n function Map() {\n this._keys = [];\n this._values = [];\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n }\n Object.defineProperty(Map.prototype, \"size\", {\n get: function () { return this._keys.length; },\n enumerable: true,\n configurable: true\n });\n Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; };\n Map.prototype.get = function (key) {\n var index = this._find(key, /*insert*/ false);\n return index >= 0 ? this._values[index] : undefined;\n };\n Map.prototype.set = function (key, value) {\n var index = this._find(key, /*insert*/ true);\n this._values[index] = value;\n return this;\n };\n Map.prototype.delete = function (key) {\n var index = this._find(key, /*insert*/ false);\n if (index >= 0) {\n var size = this._keys.length;\n for (var i = index + 1; i < size; i++) {\n this._keys[i - 1] = this._keys[i];\n this._values[i - 1] = this._values[i];\n }\n this._keys.length--;\n this._values.length--;\n if (key === this._cacheKey) {\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n }\n return true;\n }\n return false;\n };\n Map.prototype.clear = function () {\n this._keys.length = 0;\n this._values.length = 0;\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n };\n Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); };\n Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); };\n Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); };\n Map.prototype[\"@@iterator\"] = function () { return this.entries(); };\n Map.prototype[iteratorSymbol] = function () { return this.entries(); };\n Map.prototype._find = function (key, insert) {\n if (this._cacheKey !== key) {\n this._cacheIndex = this._keys.indexOf(this._cacheKey = key);\n }\n if (this._cacheIndex < 0 && insert) {\n this._cacheIndex = this._keys.length;\n this._keys.push(key);\n this._values.push(undefined);\n }\n return this._cacheIndex;\n };\n return Map;\n }());\n function getKey(key, _) {\n return key;\n }\n function getValue(_, value) {\n return value;\n }\n function getEntry(key, value) {\n return [key, value];\n }\n }\n // naive Set shim\n function CreateSetPolyfill() {\n return /** @class */ (function () {\n function Set() {\n this._map = new _Map();\n }\n Object.defineProperty(Set.prototype, \"size\", {\n get: function () { return this._map.size; },\n enumerable: true,\n configurable: true\n });\n Set.prototype.has = function (value) { return this._map.has(value); };\n Set.prototype.add = function (value) { return this._map.set(value, value), this; };\n Set.prototype.delete = function (value) { return this._map.delete(value); };\n Set.prototype.clear = function () { this._map.clear(); };\n Set.prototype.keys = function () { return this._map.keys(); };\n Set.prototype.values = function () { return this._map.values(); };\n Set.prototype.entries = function () { return this._map.entries(); };\n Set.prototype[\"@@iterator\"] = function () { return this.keys(); };\n Set.prototype[iteratorSymbol] = function () { return this.keys(); };\n return Set;\n }());\n }\n // naive WeakMap shim\n function CreateWeakMapPolyfill() {\n var UUID_SIZE = 16;\n var keys = HashMap.create();\n var rootKey = CreateUniqueKey();\n return /** @class */ (function () {\n function WeakMap() {\n this._key = CreateUniqueKey();\n }\n WeakMap.prototype.has = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? HashMap.has(table, this._key) : false;\n };\n WeakMap.prototype.get = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? HashMap.get(table, this._key) : undefined;\n };\n WeakMap.prototype.set = function (target, value) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ true);\n table[this._key] = value;\n return this;\n };\n WeakMap.prototype.delete = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? delete table[this._key] : false;\n };\n WeakMap.prototype.clear = function () {\n // NOTE: not a real clear, just makes the previous data unreachable\n this._key = CreateUniqueKey();\n };\n return WeakMap;\n }());\n function CreateUniqueKey() {\n var key;\n do\n key = \"@@WeakMap@@\" + CreateUUID();\n while (HashMap.has(keys, key));\n keys[key] = true;\n return key;\n }\n function GetOrCreateWeakMapTable(target, create) {\n if (!hasOwn.call(target, rootKey)) {\n if (!create)\n return undefined;\n Object.defineProperty(target, rootKey, { value: HashMap.create() });\n }\n return target[rootKey];\n }\n function FillRandomBytes(buffer, size) {\n for (var i = 0; i < size; ++i)\n buffer[i] = Math.random() * 0xff | 0;\n return buffer;\n }\n function GenRandomBytes(size) {\n if (typeof Uint8Array === \"function\") {\n if (typeof crypto !== \"undefined\")\n return crypto.getRandomValues(new Uint8Array(size));\n if (typeof msCrypto !== \"undefined\")\n return msCrypto.getRandomValues(new Uint8Array(size));\n return FillRandomBytes(new Uint8Array(size), size);\n }\n return FillRandomBytes(new Array(size), size);\n }\n function CreateUUID() {\n var data = GenRandomBytes(UUID_SIZE);\n // mark as random - RFC 4122 § 4.4\n data[6] = data[6] & 0x4f | 0x40;\n data[8] = data[8] & 0xbf | 0x80;\n var result = \"\";\n for (var offset = 0; offset < UUID_SIZE; ++offset) {\n var byte = data[offset];\n if (offset === 4 || offset === 6 || offset === 8)\n result += \"-\";\n if (byte < 16)\n result += \"0\";\n result += byte.toString(16).toLowerCase();\n }\n return result;\n }\n }\n // uses a heuristic used by v8 and chakra to force an object into dictionary mode.\n function MakeDictionary(obj) {\n obj.__ = undefined;\n delete obj.__;\n return obj;\n }\n });\n })(Reflect$1 || (Reflect$1 = {}));\n\n /* file : exportable.ts\n MIT License\n\n Copyright (c) 2017-2020 Thomas Minier & Arnaud Grall\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n var __read = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };\n var __spread = (commonjsGlobal && commonjsGlobal.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };\n\n\n /**\n * Clone a field of a filter (array, object or any primary type)\n * @param {*} v - Value to clone\n * @return {*} Cloned value\n */\n function cloneField(v) {\n if (v === null || v === undefined) {\n return v;\n }\n if (Array.isArray(v)) {\n return v.map(cloneField);\n }\n else if (typeof v === 'object') {\n if ('saveAsJSON' in v) {\n return v.saveAsJSON();\n }\n return Object.assign({}, v);\n }\n return v;\n }\n var cloneField_1 = cloneField;\n /**\n * Get a function used to clone an object\n * @param type - Object type\n * @param fields - Object's fields to clone\n * @return A function that clones the given fields of an input object\n */\n function cloneObject(type) {\n var fields = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n fields[_i - 1] = arguments[_i];\n }\n return function (obj) {\n var json = { type: type };\n fields.forEach(function (field) {\n json[field] = cloneField(obj[field]);\n });\n return json;\n };\n }\n var cloneObject_1 = cloneObject;\n /**\n * Turn a datastructure into an exportable one, so it can be serialized from/to JSON objects.\n * @param specs - An object that describes how the datastructure should be exported/imported\n * @author Thomas Minier\n */\n function Exportable(specs) {\n return function (target) {\n target.prototype.saveAsJSON = function () {\n return specs.export(this);\n };\n target.fromJSON = function (json) {\n return specs.import(json);\n };\n return target;\n };\n }\n var Exportable_1 = Exportable;\n var METADATA_CLASSNAME = Symbol('bloom-filters:exportable:class-name');\n var METADATA_FIELDS = Symbol('bloom-filters:exportable:fields');\n var METADATA_PARAMETERS = Symbol('bloom-filters:exportable:constructor-parameters');\n /**\n * Register a field to be exportable/importable\n * @param importer - Function invoked on the JSON field to convert it into JavaScript\n */\n function Field(exporter, importer) {\n if (exporter === undefined) {\n exporter = cloneField;\n }\n if (importer === undefined) {\n importer = function (v) { return v; };\n }\n return function (target, propertyKey) {\n var fields = [];\n if (Reflect.hasMetadata(METADATA_FIELDS, target)) {\n fields = Reflect.getMetadata(METADATA_FIELDS, target);\n }\n fields.push({\n name: propertyKey,\n exporter: exporter,\n importer: importer\n });\n Reflect.defineMetadata(METADATA_FIELDS, fields, target);\n };\n }\n var Field_1 = Field;\n function Parameter(fieldName) {\n return function (target, propertyKey, parameterIndex) {\n var parameters = new Map();\n if (Reflect.hasMetadata(METADATA_PARAMETERS, target)) {\n parameters = Reflect.getMetadata(METADATA_PARAMETERS, target);\n }\n parameters.set(fieldName, parameterIndex);\n Reflect.defineMetadata(METADATA_PARAMETERS, parameters, target);\n };\n }\n var Parameter_1 = Parameter;\n /**\n * Augment a TypeScript class to make it exportable/importable, using @Field and @Parameter decorator\n * @param className - Name of the exportable/importable class\n */\n function AutoExportable(className, otherFields) {\n if (otherFields === void 0) { otherFields = []; }\n return function (target) {\n Reflect.defineMetadata(METADATA_CLASSNAME, className, target.prototype);\n if (!Reflect.hasMetadata(METADATA_FIELDS, target.prototype) || otherFields.length === 0) {\n throw new SyntaxError('No exported fields declared when @AutoExportable is called');\n }\n // define empty parameters map, for object with a constructor without parameters\n if (!Reflect.hasMetadata(METADATA_PARAMETERS, target)) {\n Reflect.defineMetadata(METADATA_PARAMETERS, new Map(), target);\n }\n target.prototype.saveAsJSON = function () {\n var _this = this;\n var json = { 'type': Reflect.getMetadata(METADATA_CLASSNAME, target.prototype) };\n // export fields defined using the @Field decorator\n var fields = Reflect.getMetadata(METADATA_FIELDS, target.prototype);\n fields.forEach(function (field) {\n json[field.name] = field.exporter(_this[field.name]);\n });\n // export fields declared through the otherFields parameter\n otherFields.forEach(function (field) {\n json[field] = cloneField(_this[field]);\n });\n return json;\n };\n target.fromJSON = function (json) {\n var className = Reflect.getMetadata(METADATA_CLASSNAME, target.prototype);\n var parameters = Reflect.getMetadata(METADATA_PARAMETERS, target);\n var fields = Reflect.getMetadata(METADATA_FIELDS, target.prototype);\n // validate the input JSON\n if (json.type !== className) {\n throw new Error(\"Cannot create an object \" + className + \" from a JSON export with type \\\"\" + json.type + \"\\\"\");\n }\n var constructorArgs = [];\n var copyFields = [];\n otherFields.map(function (name) { return ({ name: name, importer: function (v) { return v; } }); }).concat(fields).forEach(function (field) {\n if (!(field.name in json)) {\n throw new Error(\"Invalid import: required field \\\"\" + field + \"\\\" not found in JSON export \\\"\" + json + \"\\\"\");\n }\n // build constructor/copy arguments\n if (parameters.has(field.name)) {\n constructorArgs[parameters.get(field.name)] = field.importer(json[field.name]);\n }\n else {\n copyFields.push({\n name: field.name,\n value: field.importer(json[field.name])\n });\n }\n });\n // build new object\n var obj = new (target.bind.apply(target, __spread([void 0], constructorArgs)))();\n // write non-constructor exported fields\n copyFields.forEach(function (arg) {\n obj[arg.name] = arg.value;\n });\n return obj;\n };\n };\n }\n var AutoExportable_1 = AutoExportable;\n\n var exportable = /*#__PURE__*/Object.defineProperty({\n \tcloneField: cloneField_1,\n \tcloneObject: cloneObject_1,\n \tExportable: Exportable_1,\n \tField: Field_1,\n \tParameter: Parameter_1,\n \tAutoExportable: AutoExportable_1\n }, '__esModule', {value: true});\n\n /* file : formulas.ts\n MIT License\n\n Copyright (c) 2017-2020 Thomas Minier & Arnaud Grall\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n\n /**\n * Various formulas used with Bloom Filters\n * @namespace Formulas\n * @private\n */\n /**\n * Compute the optimal size of a Bloom Filter\n * @param length - The length of the set used to fill the filter\n * @param errorRate - The targeted false positive rate\n * @return The optimal size of a Bloom Filter\n * @memberof Formulas\n */\n function optimalFilterSize(length, errorRate) {\n return Math.ceil(-((length * Math.log(errorRate)) / Math.pow(Math.log(2), 2)));\n }\n var optimalFilterSize_1 = optimalFilterSize;\n /**\n * Compute the optimal number of hash functions to be used by a Bloom Filter\n * @param size - The size of the filter\n * @param length - The length of the set used to fill the filter\n * @return The optimal number of hash functions to be used by a Bloom Filter\n * @memberof Formulas\n */\n function optimalHashes(size, length) {\n return Math.ceil((size / length) * Math.log(2));\n }\n var optimalHashes_1 = optimalHashes;\n\n var formulas = /*#__PURE__*/Object.defineProperty({\n \toptimalFilterSize: optimalFilterSize_1,\n \toptimalHashes: optimalHashes_1\n }, '__esModule', {value: true});\n\n /* file : bloom-filter.ts\n MIT License\n\n Copyright (c) 2017 Thomas Minier & Arnaud Grall\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n var __extends$2 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var __decorate = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata = (commonjsGlobal && commonjsGlobal.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };\n var __param = (commonjsGlobal && commonjsGlobal.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };\n var __importDefault$2 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n var base_filter_1 = __importDefault$2(baseFilter);\n\n\n\n /**\n * A Bloom filter is a space-efficient probabilistic data structure, conceived by Burton Howard Bloom in 1970,\n * that is used to test whether an element is a member of a set. False positive matches are possible, but false negatives are not.\n *\n * Reference: Bloom, B. H. (1970). Space/time trade-offs in hash coding with allowable errors. Communications of the ACM, 13(7), 422-426.\n * @see {@link http://crystal.uta.edu/~mcguigan/cse6350/papers/Bloom.pdf} for more details about classic Bloom Filters.\n * @author Thomas Minier\n * @author Arnaud Grall\n */\n var BloomFilter = /** @class */ (function (_super) {\n __extends$2(BloomFilter, _super);\n /**\n * Constructor\n * @param filter - The filter as an array of 1s & 0s\n * @param nbHashes - The number of hash functions used\n */\n function BloomFilter(filter, nbHashes) {\n var _this = _super.call(this) || this;\n if (nbHashes < 1) {\n throw new Error(\"A BloomFilter cannot uses less than one hash function, while you tried to use \" + nbHashes + \".\");\n }\n _this._size = filter.length;\n _this._nbHashes = nbHashes;\n _this._filter = filter;\n _this._length = 0;\n return _this;\n }\n BloomFilter_1 = BloomFilter;\n /**\n * Create an optimal bloom filter providing the maximum of elements stored and the error rate desired\n * @param size - The number of cells\n * @param nbHashes - The number of hash functions used\n * @return A new {@link BloomFilter}\n */\n BloomFilter.empty = function (size, nbHashes) {\n var filter = utils$5.allocateArray(size, 0);\n return new BloomFilter_1(filter, nbHashes);\n };\n /**\n * Create an optimal bloom filter providing the maximum of elements stored and the error rate desired\n * @param items - The maximum nuber of item to store\n * @param errorRate - The error rate desired for a maximum of items inserted\n * @return A new {@link BloomFilter}\n */\n BloomFilter.create = function (nbItems, errorRate) {\n var size = formulas.optimalFilterSize(nbItems, errorRate);\n var hashes = formulas.optimalHashes(size, nbItems);\n var filter = utils$5.allocateArray(size, 0);\n return new BloomFilter_1(filter, hashes);\n };\n /**\n * Build a new Bloom Filter from an existing iterable with a fixed error rate\n * @param items - The iterable used to populate the filter\n * @param errorRate - The error rate, i.e. 'false positive' rate, targetted by the filter\n * @return A new Bloom Filter filled with the iterable's elements\n * @example\n * // create a filter with a false positive rate of 0.1\n * const filter = BloomFilter.from(['alice', 'bob', 'carl'], 0.1);\n */\n BloomFilter.from = function (items, errorRate) {\n var array = Array.from(items);\n var filter = BloomFilter_1.create(array.length, errorRate);\n array.forEach(function (element) { return filter.add(element); });\n return filter;\n };\n /**\n * Import an existing bloom filter from a Uint8Array\n * @param bytes - The existing bloom filter as Uint8Array\n * @param nbHashes - The number of hash functions used\n * @return A {@link BloomFilter} from the bytes array\n */\n BloomFilter.fromBytes = function (bytes, nbHashes) {\n var filter = [];\n for (var i = 0; i < bytes.length; i++) {\n var bits = utils$5.uint8ToBits(bytes[i]);\n filter = filter.concat(bits);\n }\n return new BloomFilter_1(filter, nbHashes);\n };\n Object.defineProperty(BloomFilter.prototype, \"size\", {\n /**\n * Get the optimal size of the filter\n * @return The size of the filter\n */\n get: function () {\n return this._size;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BloomFilter.prototype, \"length\", {\n /**\n * Get the number of elements currently in the filter\n * @return The filter length\n */\n get: function () {\n return this._length;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Add an element to the filter\n * @param element - The element to add\n * @example\n * const filter = new BloomFilter(15, 0.1);\n * filter.add('foo');\n */\n BloomFilter.prototype.add = function (element) {\n var indexes = utils$5.getDistinctIndices(element, this._size, this._nbHashes, this.seed);\n for (var i = 0; i < indexes.length; i++) {\n this._filter[indexes[i]] = 1;\n }\n this._length++;\n };\n /**\n * Test an element for membership\n * @param element - The element to look for in the filter\n * @return False if the element is definitively not in the filter, True is the element might be in the filter\n * @example\n * const filter = new BloomFilter(15, 0.1);\n * filter.add('foo');\n * console.log(filter.has('foo')); // output: true\n * console.log(filter.has('bar')); // output: false\n */\n BloomFilter.prototype.has = function (element) {\n var indexes = utils$5.getDistinctIndices(element, this._size, this._nbHashes, this.seed);\n for (var i = 0; i < indexes.length; i++) {\n if (!this._filter[indexes[i]]) {\n return false;\n }\n }\n return true;\n };\n /**\n * Get the current false positive rate (or error rate) of the filter\n * @return The current false positive rate of the filter\n * @example\n * const filter = new BloomFilter(15, 0.1);\n * console.log(filter.rate()); // output: something around 0.1\n */\n BloomFilter.prototype.rate = function () {\n return Math.pow(1 - Math.exp((-this._nbHashes * this._length) / this._size), this._nbHashes);\n };\n /**\n * Check if another Bloom Filter is equal to this one\n * @param filter - The filter to compare to this one\n * @return True if they are equal, false otherwise\n */\n BloomFilter.prototype.equals = function (other) {\n if (this._size !== other._size || this._nbHashes !== other._nbHashes) {\n return false;\n }\n return this._filter.every(function (value, index) { return other._filter[index] === value; });\n };\n /**\n * Exports to a Uint8Array\n * @return Uint8Array of filter\n */\n BloomFilter.prototype.toBytes = function () {\n var arr = new Uint8Array(Math.ceil(this._size / 8));\n for (var i = 0; i < arr.length; i++) {\n var bits = this._filter.slice(i * 8, i * 8 + 8);\n arr[i] = utils$5.bitsToUint8(bits);\n }\n return arr;\n };\n var BloomFilter_1;\n __decorate([\n exportable.Field(),\n __metadata(\"design:type\", Number)\n ], BloomFilter.prototype, \"_size\", void 0);\n __decorate([\n exportable.Field(),\n __metadata(\"design:type\", Number)\n ], BloomFilter.prototype, \"_nbHashes\", void 0);\n __decorate([\n exportable.Field(),\n __metadata(\"design:type\", Array)\n ], BloomFilter.prototype, \"_filter\", void 0);\n __decorate([\n exportable.Field(),\n __metadata(\"design:type\", Number)\n ], BloomFilter.prototype, \"_length\", void 0);\n BloomFilter = BloomFilter_1 = __decorate([\n exportable.AutoExportable('BloomFilter', ['_seed']),\n __param(0, exportable.Parameter('_filter')), __param(1, exportable.Parameter('_nbHashes')),\n __metadata(\"design:paramtypes\", [Array, Number])\n ], BloomFilter);\n return BloomFilter;\n }(base_filter_1.default));\n var _default$9 = BloomFilter;\n\n var bloomFilter = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$9\n }, '__esModule', {value: true});\n\n /* file : counting-bloom-filter.ts\n MIT License\n\n Copyright (c) 2017 Thomas Minier & Arnaud Grall\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n var __extends$3 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var __decorate$1 = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata$1 = (commonjsGlobal && commonjsGlobal.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };\n var __param$1 = (commonjsGlobal && commonjsGlobal.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };\n var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n var base_filter_1$1 = __importDefault$3(baseFilter);\n\n\n\n /**\n * A Counting Bloom filter works in a similar manner as a regular Bloom filter; however, it is able to keep track of insertions and deletions. In a counting Bloom filter, each entry in the Bloom filter is a small counter associated with a basic Bloom filter bit.\n *\n * Reference: F. Bonomi, M. Mitzenmacher, R. Panigrahy, S. Singh, and G. Varghese, “An Improved Construction for Counting Bloom Filters,” in 14th Annual European Symposium on Algorithms, LNCS 4168, 2006, pp.\n 684–695.\n * @author Thomas Minier & Arnaud Grall\n */\n var CountingBloomFilter = /** @class */ (function (_super) {\n __extends$3(CountingBloomFilter, _super);\n /**\n * Constructor\n * @param size - The size of the filter\n * @param nbHashes - The number of hash functions\n */\n function CountingBloomFilter(size, nbHashes) {\n var _this = _super.call(this) || this;\n if (nbHashes < 1) {\n throw new Error(\"A CountingBloomFilter must used at least one hash function, but you tried to use \" + nbHashes + \" functions. Consider increasing it.\");\n }\n _this._size = size; // fm.optimalFilterSize(capacity, errorRate)\n _this._nbHashes = nbHashes; // fm.optimalHashes(this._size, capacity)\n // the filter contains tuples [bit, counter]\n _this._filter = utils$5.allocateArray(_this._size, function () { return [0, 0]; });\n _this._length = 0;\n return _this;\n }\n CountingBloomFilter_1 = CountingBloomFilter;\n /**\n * Allocate a CountingBloomFilter with a target maximum capacity and error rate\n * @param capacity - The maximum capacity of the filter\n * @param errorRate - The error rate of the filter\n * @return A new {@link CountingBloomFilter}\n */\n CountingBloomFilter.create = function (capacity, errorRate) {\n var s = formulas.optimalFilterSize(capacity, errorRate);\n return new CountingBloomFilter_1(s, formulas.optimalHashes(s, capacity));\n };\n /**\n * Build a new Bloom Filter from an iterable with a fixed error rate\n * @param items - Iterable used to populate the filter\n * @param errorRate - The error rate of the filter\n * @return A new Bloom Filter filled with the iterable's elements\n * @example\n * // create a filter with a false positive rate of 0.1\n * const filter = CountingBloomFilter.from(['alice', 'bob', 'carl'], 0.1);\n */\n CountingBloomFilter.from = function (items, errorRate) {\n var array = Array.from(items);\n var filter = CountingBloomFilter_1.create(array.length, errorRate);\n array.forEach(function (element) { return filter.add(element); });\n return filter;\n };\n Object.defineProperty(CountingBloomFilter.prototype, \"size\", {\n /**\n * Get the optimal size of the filter\n */\n get: function () {\n return this._size;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CountingBloomFilter.prototype, \"length\", {\n /**\n * Get the number of elements currently in the filter\n */\n get: function () {\n return this._length;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Add an element to the filter\n * @param element - The element to add\n * @example\n * const filter = new CountingBloomFilter(15, 0.1);\n * filter.add('foo');\n */\n CountingBloomFilter.prototype.add = function (element) {\n var indexes = utils$5.getDistinctIndices(element, this._size, this._nbHashes, this.seed);\n for (var i = 0; i < indexes.length; i++) {\n // increment counter\n this._filter[indexes[i]][1] += 1;\n // set bit if necessary\n if (this._filter[indexes[i]][1] > 0) {\n this._filter[indexes[i]][0] = 1;\n }\n }\n this._length++;\n };\n /**\n * Remove an element from the filter\n * @param element - The element to delete\n * @example\n * const filter = new CountingBloomFilter(15, 0.1);\n * filter.remove('foo');\n */\n CountingBloomFilter.prototype.remove = function (element) {\n var indexes = utils$5.getDistinctIndices(element, this._size, this._nbHashes, this.seed);\n var success = true;\n for (var i = 0; i < indexes.length; i++) {\n // decrement counter\n this._filter[indexes[i]][1] -= 1;\n // set bit if necessary\n if (this._filter[indexes[i]][1] <= 0) {\n this._filter[indexes[i]][0] = 0;\n }\n }\n this._length--;\n return success;\n };\n /**\n * Test an element for membership\n * @param element - The element to look for in the filter\n * @return False if the element is definitively not in the filter, True is the element might be in the filter\n * @example\n * const filter = new CountingBloomFilter(15, 0.1);\n * filter.add('foo');\n * console.log(filter.has('foo')); // output: true\n * console.log(filter.has('bar')); // output: false\n */\n CountingBloomFilter.prototype.has = function (element) {\n var indexes = utils$5.getDistinctIndices(element, this._size, this._nbHashes, this.seed);\n for (var i = 0; i < indexes.length; i++) {\n if (!this._filter[indexes[i]][0]) {\n return false;\n }\n }\n return true;\n };\n /**\n * Get the current false positive rate (or error rate) of the filter\n * @return The current false positive rate of the filter\n * @example\n * const filter = new BloomFilter(15, 0.1);\n * console.log(filter.rate()); // output: something around 0.1\n */\n CountingBloomFilter.prototype.rate = function () {\n return Math.pow(1 - Math.exp((-this._nbHashes * this._length) / this._size), this._nbHashes);\n };\n /**\n * Check if another Counting Bloom Filter is equal to this one\n * @param filter - The filter to compare to this one\n * @return True if they are equal, false otherwise\n */\n CountingBloomFilter.prototype.equals = function (other) {\n if (this._size !== other._size || this._nbHashes !== other._nbHashes || this._length !== other._length) {\n return false;\n }\n return this._filter.every(function (value, index) { return other._filter[index][0] === value[0] && other._filter[index][1] === value[1]; });\n };\n var CountingBloomFilter_1;\n __decorate$1([\n exportable.Field(),\n __metadata$1(\"design:type\", Number)\n ], CountingBloomFilter.prototype, \"_size\", void 0);\n __decorate$1([\n exportable.Field(),\n __metadata$1(\"design:type\", Number)\n ], CountingBloomFilter.prototype, \"_nbHashes\", void 0);\n __decorate$1([\n exportable.Field(),\n __metadata$1(\"design:type\", Array)\n ], CountingBloomFilter.prototype, \"_filter\", void 0);\n __decorate$1([\n exportable.Field(),\n __metadata$1(\"design:type\", Number)\n ], CountingBloomFilter.prototype, \"_length\", void 0);\n CountingBloomFilter = CountingBloomFilter_1 = __decorate$1([\n exportable.AutoExportable('CountingBloomFilter', ['_seed']),\n __param$1(0, exportable.Parameter('_size')), __param$1(1, exportable.Parameter('_nbHashes')),\n __metadata$1(\"design:paramtypes\", [Number, Number])\n ], CountingBloomFilter);\n return CountingBloomFilter;\n }(base_filter_1$1.default));\n var _default$a = CountingBloomFilter;\n\n var countingBloomFilter = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$a\n }, '__esModule', {value: true});\n\n /* file : partitioned-bloom-filter.ts\n MIT License\n\n Copyright (c) 2017-2020 Thomas Minier & Arnaud Grall\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n var __extends$4 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var __decorate$2 = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata$2 = (commonjsGlobal && commonjsGlobal.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };\n var __param$2 = (commonjsGlobal && commonjsGlobal.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };\n var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n var base_filter_1$2 = __importDefault$4(baseFilter);\n\n\n /**\n * Return the optimal number of hashes needed for a given error rate and load factor\n * P = p^k <=> k = ln(P)/ln(p)\n * @param errorRate - The provided error rate\n * @param loadFactor - The load factor, ideally 0.5\n * @return The number of hash function to use\n */\n function computeOptimalNumberOfhashes(errorRate, loadFactor) {\n // P = p^k <=> k = ln(P)/ln(p)\n return Math.ceil(Math.log(errorRate) / Math.log(loadFactor));\n }\n /**\n * Return the total number of bits needed for this filter\n * n = M*(ln(p)ln(1-p))/(-ln(P)) <=> M = (n*-ln(P)/(ln(p)ln(1-p))\n * @param size - The number of desired items\n * @param rate - The error rate desired\n * @param loadFactor - The load factor desired\n * @return The total number of cells this filter will have\n */\n function computeOptimalNumberOfCells(size, rate, loadFactor) {\n // n=M*(ln(p)ln(1-p))/(-ln(P)) <=> M=(n*-ln(P)/(ln(p)ln(1-p))\n return Math.ceil((size * -Math.log(rate)) / (Math.log(loadFactor) * Math.log(1 - loadFactor)));\n }\n /**\n * Return the maximum number of items this filter can store\n * @param totalBits - The total number of cells in the filter\n * @param loadFactor - The load factor desired\n * @param nbHashes - The number of hash functions used\n * @return The maximum number of items this filter store\n */\n function computeNumberOfItems(totalBits, loadFactor, nbHashes) {\n return Math.ceil(totalBits * (Math.log(loadFactor) * Math.log(1 - loadFactor)) / (-(nbHashes * Math.log(loadFactor))));\n }\n /**\n * A Partitioned Bloom Filter is a variation of a classic Bloom filter.\n *\n * This filter works by partitioning the M-sized bit array into k slices of size m = M/k bits, k = nb of hash functions in the filter.\n * Each hash function produces an index over m for its respective slice.\n * Thus, each element is described by exactly k bits, meaning the distribution of false positives is uniform across all elements.\n *\n * Be careful, as a Partitioned Bloom Filter have much higher collison risks that a classic Bloom Filter on small sets of data.\n *\n * Reference: Chang, F., Feng, W. C., & Li, K. (2004, March). Approximate caches for packet classification. In INFOCOM 2004. Twenty-third AnnualJoint Conference of the IEEE Computer and Communications Societies (Vol. 4, pp. 2196-2207). IEEE.\n * @see {@link https://pdfs.semanticscholar.org/0e18/e24b37a1f4196fddf8c9ff8e4368b74cfd88.pdf} for more details about Partitioned Bloom Filters\n * @author Thomas Minier & Arnaud Grall\n */\n var PartitionedBloomFilter = /** @class */ (function (_super) {\n __extends$4(PartitionedBloomFilter, _super);\n /**\n * Constructor\n * @param size - The total number of cells\n * @param nbHashes - The number of hash functions\n * @param loadFactor - The load factor\n * @param capacity - The filter capacity\n */\n function PartitionedBloomFilter(size, nbHashes, loadFactor, capacity) {\n var _this = _super.call(this) || this;\n _this._size = size;\n _this._nbHashes = nbHashes;\n _this._loadFactor = loadFactor;\n _this._m = Math.ceil(_this._size / _this._nbHashes);\n _this._filter = utils$5.allocateArray(_this._nbHashes, function () { return utils$5.allocateArray(_this._m, 0); });\n _this._capacity = (capacity !== undefined) ? capacity : computeNumberOfItems(_this._size, loadFactor, nbHashes);\n _this._length = 0;\n return _this;\n }\n PartitionedBloomFilter_1 = PartitionedBloomFilter;\n /**\n * Return a PartitionedBloomFilter for a given number of elements and under a given error rate\n * @param size - The max allowable number of items to insert\n * @param errorRate - The desired error rate\n * @return A new PartitionedBloomFilter optimal for the given parameters\n */\n PartitionedBloomFilter.create = function (size, errorRate, loadFactor) {\n if (loadFactor === void 0) { loadFactor = 0.5; }\n var capacity = computeOptimalNumberOfCells(size, errorRate, loadFactor);\n var nbHashes = computeOptimalNumberOfhashes(errorRate, loadFactor);\n return new PartitionedBloomFilter_1(capacity, nbHashes, loadFactor, size);\n };\n /**\n * Build a new Partitioned Bloom Filter from an existing iterable with a fixed error rate\n * @param items - The iterable used to populate the filter\n * @param errorRate - The error rate, i.e. 'false positive' rate, targetted by the filter\n * @param loadFactor - The filter's load factor\n * @return A new Bloom Filter filled with the iterable's elements\n * @example\n * // create a filter with a false positive rate of 0.1\n * const filter = PartitionedBloomFilter.from(['alice', 'bob', 'carl'], 0.1);\n */\n PartitionedBloomFilter.from = function (items, errorRate, loadFactor) {\n if (loadFactor === void 0) { loadFactor = 0.5; }\n var array = Array.from(items);\n var filter = PartitionedBloomFilter_1.create(array.length, errorRate, loadFactor);\n array.forEach(function (element) { return filter.add(element); });\n return filter;\n };\n Object.defineProperty(PartitionedBloomFilter.prototype, \"capacity\", {\n /**\n * Get the filter capacity, i.e. the maximum number of elements it will contains\n */\n get: function () {\n return this._capacity;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PartitionedBloomFilter.prototype, \"size\", {\n /**\n * Get the size of the filter\n */\n get: function () {\n return this._size;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PartitionedBloomFilter.prototype, \"length\", {\n /**\n * Get the number of elements currently in the filter\n */\n get: function () {\n return this._length;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PartitionedBloomFilter.prototype, \"loadFactor\", {\n /**\n * Get the filter's load factor\n */\n get: function () {\n return this._loadFactor;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Add an element to the filter\n * @param element - The element to add\n * @example\n * const filter = new PartitionedBloomFilter(15, 0.1);\n * filter.add('foo');\n */\n PartitionedBloomFilter.prototype.add = function (element) {\n var indexes = utils$5.getIndices(element, this._m, this._nbHashes, this.seed);\n for (var i = 0; i < this._nbHashes; i++) {\n this._filter[i][indexes[i]] = 1;\n }\n this._length++;\n };\n /**\n * Test an element for membership\n * @param element - The element to look for in the filter\n * @return False if the element is definitively not in the filter, True is the element might be in the filter\n * @example\n * const filter = new PartitionedBloomFilter(15, 0.1);\n * filter.add('foo');\n * console.log(filter.has('foo')); // output: true\n * console.log(filter.has('bar')); // output: false\n */\n PartitionedBloomFilter.prototype.has = function (element) {\n var indexes = utils$5.getIndices(element, this._m, this._nbHashes, this.seed);\n for (var i = 0; i < this._nbHashes; i++) {\n if (!this._filter[i][indexes[i]]) {\n return false;\n }\n }\n return true;\n };\n /**\n * Compute the current false positive rate (or error rate) of the filter\n * @return The current false positive rate of the filter\n * @example\n * const filter = PartitionedBloomFilter.create(15, 0.1);\n * console.log(filter.rate()); // output: something around 0.1\n */\n PartitionedBloomFilter.prototype.rate = function () {\n // get the error rate for the first bucket (1 - (1 - 1/m)^n), where m is the size of a slice and n is the number of inserted elements\n var p = this._currentload();\n // P = p^k\n return Math.pow(p, this._nbHashes);\n };\n /**\n * Check if another Partitioned Bloom Filter is equal to this one\n * @param filter - The filter to compare to this one\n * @return True if they are equal, false otherwise\n */\n PartitionedBloomFilter.prototype.equals = function (other) {\n if (this._size !== other._size || this._nbHashes !== other._nbHashes || this._length !== other._length || this._loadFactor !== other._loadFactor) {\n return false;\n }\n return this._filter.every(function (array, outerIndex) { return other._filter[outerIndex].every(function (item, innerIndex) { return array[innerIndex] === item; }); });\n };\n /**\n * Return the current load of this filter, iterate on all buckets\n * @return An integer between 0 and 1, where 0 = filter empty and 1 = filter full\n */\n PartitionedBloomFilter.prototype._currentload = function () {\n var values = this._filter.map(function (bucket) {\n return bucket.reduce(function (a, b) { return a + b; }, 0);\n });\n var used = values.reduce(function (a, b) { return a + b; }, 0);\n return used / this._size;\n };\n var PartitionedBloomFilter_1;\n __decorate$2([\n exportable.Field(),\n __metadata$2(\"design:type\", Number)\n ], PartitionedBloomFilter.prototype, \"_size\", void 0);\n __decorate$2([\n exportable.Field(),\n __metadata$2(\"design:type\", Number)\n ], PartitionedBloomFilter.prototype, \"_nbHashes\", void 0);\n __decorate$2([\n exportable.Field(),\n __metadata$2(\"design:type\", Number)\n ], PartitionedBloomFilter.prototype, \"_loadFactor\", void 0);\n __decorate$2([\n exportable.Field(),\n __metadata$2(\"design:type\", Number)\n ], PartitionedBloomFilter.prototype, \"_m\", void 0);\n __decorate$2([\n exportable.Field(),\n __metadata$2(\"design:type\", Array)\n ], PartitionedBloomFilter.prototype, \"_filter\", void 0);\n __decorate$2([\n exportable.Field(),\n __metadata$2(\"design:type\", Number)\n ], PartitionedBloomFilter.prototype, \"_capacity\", void 0);\n __decorate$2([\n exportable.Field(),\n __metadata$2(\"design:type\", Number)\n ], PartitionedBloomFilter.prototype, \"_length\", void 0);\n PartitionedBloomFilter = PartitionedBloomFilter_1 = __decorate$2([\n exportable.AutoExportable('PartitionedBloomFilter', ['_seed']),\n __param$2(0, exportable.Parameter('_size')), __param$2(1, exportable.Parameter('_nbHashes')), __param$2(2, exportable.Parameter('_loadFactor')), __param$2(3, exportable.Parameter('_capacity')),\n __metadata$2(\"design:paramtypes\", [Number, Number, Number, Number])\n ], PartitionedBloomFilter);\n return PartitionedBloomFilter;\n }(base_filter_1$2.default));\n var _default$b = PartitionedBloomFilter;\n\n var partitionedBloomFilter = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$b\n }, '__esModule', {value: true});\n\n /* file : count-min-sketch.ts\n MIT License\n\n Copyright (c) 2017-2020 Thomas Minier & Arnaud Grall\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n var __extends$5 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var __decorate$3 = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata$3 = (commonjsGlobal && commonjsGlobal.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };\n var __param$3 = (commonjsGlobal && commonjsGlobal.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };\n var __values$2 = (commonjsGlobal && commonjsGlobal.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n };\n var __importDefault$5 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n var base_filter_1$3 = __importDefault$5(baseFilter);\n\n\n /**\n * The count–min sketch (CM sketch) is a probabilistic data structure that serves as a frequency table of events in a stream of data.\n * It uses hash functions to map events to frequencies, but unlike a hash table uses only sub-linear space, at the expense of overcounting some events due to collisions.\n *\n * Reference: Cormode, G., & Muthukrishnan, S. (2005). An improved data stream summary: the count-min sketch and its applications. Journal of Algorithms, 55(1), 58-75.\n * @see {@link http://vaffanculo.twiki.di.uniroma1.it/pub/Ing_algo/WebHome/p14_Cormode_JAl_05.pdf} for more details on Count Min Sketch\n * @extends Exportable\n * @author Thomas Minier & Arnaud Grall\n */\n var CountMinSketch = /** @class */ (function (_super) {\n __extends$5(CountMinSketch, _super);\n /**\n * Constructor\n * @param columns - Number of columns\n * @param rows - Number of rows\n */\n function CountMinSketch(columns, rows) {\n var _this = _super.call(this) || this;\n _this._columns = columns;\n _this._rows = rows;\n _this._matrix = utils$5.allocateArray(_this._rows, function () { return utils$5.allocateArray(_this._columns, 0); });\n _this._allSums = 0;\n return _this;\n }\n CountMinSketch_1 = CountMinSketch;\n /**\n * Create a count-min sketch, with a target error rate and probability of accuracy\n * @param errorRate - The error rate\n * @param accuracy - The probability of accuracy\n * @return A new Count Min Sketch optimal for the input parameters\n */\n CountMinSketch.create = function (errorRate, accuracy) {\n if (accuracy === void 0) { accuracy = 0.999; }\n // columns = Math.ceil(Math.E / epsilon) and rows = Math.ceil(Math.log(1 / delta))\n var columns = Math.ceil(Math.E / errorRate);\n var rows = Math.ceil(Math.log(1 / accuracy));\n return new CountMinSketch_1(columns, rows);\n };\n /**\n * Create a Count Min Sketch from a set of items, with a target error rate and probability of accuracy\n * @param items - An iterable to yield items to be inserted into the filter\n * @param errorRate - The error rate\n * @param accuracy - The probability of accuracy\n * @return A new Count Min Sketch filled with the iterable's items.\n */\n CountMinSketch.from = function (items, errorRate, accuracy) {\n var e_1, _a;\n if (accuracy === void 0) { accuracy = 0.999; }\n var filter = CountMinSketch_1.create(errorRate, accuracy);\n try {\n for (var items_1 = __values$2(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {\n var item = items_1_1.value;\n filter.update(item);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return filter;\n };\n Object.defineProperty(CountMinSketch.prototype, \"columns\", {\n /**\n * Return the number of columns in the sketch\n */\n get: function () {\n return this._columns;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CountMinSketch.prototype, \"rows\", {\n /**\n * Return the number of rows in the sketch\n */\n get: function () {\n return this._rows;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CountMinSketch.prototype, \"sum\", {\n /**\n * Get the sum of all counts in the sketch\n */\n get: function () {\n return this._allSums;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Update the count min sketch with a new occurrence of an element\n * @param element - The new element\n * @param count - Number of occurences of the elemnt (defauls to one)\n */\n CountMinSketch.prototype.update = function (element, count) {\n if (count === void 0) { count = 1; }\n this._allSums += count;\n var indexes = utils$5.getDistinctIndices(element, this._columns, this._rows, this.seed);\n for (var i = 0; i < this._rows; i++) {\n this._matrix[i][indexes[i]] += count;\n }\n };\n /**\n * Perform a point query: estimate the number of occurence of an element\n * @param element - The element we want to count\n * @return The estimate number of occurence of the element\n */\n CountMinSketch.prototype.count = function (element) {\n var min = Infinity;\n var indexes = utils$5.getDistinctIndices(element, this._columns, this._rows, this.seed);\n for (var i = 0; i < this._rows; i++) {\n var v = this._matrix[i][indexes[i]];\n min = Math.min(v, min);\n }\n return min;\n };\n /**\n * Check if another Count Min Sketch is equal to this one\n * @param filter - The filter to compare to this one\n * @return True if they are equal, false otherwise\n */\n CountMinSketch.prototype.equals = function (other) {\n if (this._columns !== other._columns || this._rows !== other._rows) {\n return false;\n }\n for (var i = 0; i < this._rows; i++) {\n for (var j = 0; j < this._columns; j++) {\n if (this._matrix[i][j] !== other._matrix[i][j]) {\n return false;\n }\n }\n }\n return true;\n };\n /**\n * Merge (in place) this sketch with another sketch, if they have the same number of columns and rows.\n * @param sketch - The sketch to merge with\n */\n CountMinSketch.prototype.merge = function (sketch) {\n if (this._columns !== sketch._columns) {\n throw new Error('Cannot merge two sketches with different number of columns');\n }\n if (this._rows !== sketch._rows) {\n throw new Error('Cannot merge two sketches with different number of rows');\n }\n for (var i = 0; i < this._rows; i++) {\n for (var j = 0; j < this._columns; j++) {\n this._matrix[i][j] += sketch._matrix[i][j];\n }\n }\n };\n /**\n * Clone the sketch\n * @return A new cloned sketch\n */\n CountMinSketch.prototype.clone = function () {\n var sketch = new CountMinSketch_1(this._columns, this._rows);\n sketch.merge(this);\n sketch.seed = this.seed;\n return sketch;\n };\n var CountMinSketch_1;\n __decorate$3([\n exportable.Field(),\n __metadata$3(\"design:type\", Number)\n ], CountMinSketch.prototype, \"_columns\", void 0);\n __decorate$3([\n exportable.Field(),\n __metadata$3(\"design:type\", Number)\n ], CountMinSketch.prototype, \"_rows\", void 0);\n __decorate$3([\n exportable.Field(),\n __metadata$3(\"design:type\", Array)\n ], CountMinSketch.prototype, \"_matrix\", void 0);\n __decorate$3([\n exportable.Field(),\n __metadata$3(\"design:type\", Number)\n ], CountMinSketch.prototype, \"_allSums\", void 0);\n CountMinSketch = CountMinSketch_1 = __decorate$3([\n exportable.AutoExportable('CountMinSketch', ['_seed']),\n __param$3(0, exportable.Parameter('_columns')), __param$3(1, exportable.Parameter('_rows')),\n __metadata$3(\"design:paramtypes\", [Number, Number])\n ], CountMinSketch);\n return CountMinSketch;\n }(base_filter_1$3.default));\n var _default$c = CountMinSketch;\n\n var countMinSketch = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$c\n }, '__esModule', {value: true});\n\n /* file: hyperloglog.ts\n MIT License\n\n Copyright (c) 2019-2020 Thomas Minier\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the 'Software'), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n var __extends$6 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var __decorate$4 = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata$4 = (commonjsGlobal && commonjsGlobal.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };\n var __param$4 = (commonjsGlobal && commonjsGlobal.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };\n var __importDefault$6 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n var base_filter_1$4 = __importDefault$6(baseFilter);\n\n\n // 2^32, computed as a constant as we use it a lot in the HyperLogLog algorithm\n var TWO_POW_32 = Math.pow(2, 32);\n /**\n * Estimlate the bias-correction constant, denoted alpha in the algorithm, based on the number of registers.\n * As alpha is pretty expensive to compute, we estimate it with the formula from Flajolet et al.\n * @param m - Number of registers in the HyperLogLog algorithm\n * @return The estimated bias-correction constant\n */\n function computeAlpha(m) {\n switch (m) {\n case 16:\n return 0.673;\n case 32:\n return 0.697;\n case 64:\n return 0.709;\n default:\n return 0.7213 / (1.0 + 1.079 / m);\n }\n }\n /**\n * HyperLogLog is an algorithm for the count-distinct problem, approximating the number of distinct elements in a multiset.\n * @see HyperLogLog: the analysis of a near-optimal cardinality estimation algorithm {@link http://algo.inria.fr/flajolet/Publications/FlFuGaMe07.pdf}\n * @author Thomas Minier\n */\n var HyperLogLog = /** @class */ (function (_super) {\n __extends$6(HyperLogLog, _super);\n /**\n * Constructor\n * @param nbRegisters - The number of registers to use\n */\n function HyperLogLog(nbRegisters) {\n var _this = _super.call(this) || this;\n _this._nbRegisters = nbRegisters;\n _this._nbBytesPerHash = Math.round(Math.log2(nbRegisters));\n _this._correctionBias = computeAlpha(nbRegisters);\n _this._registers = utils$5.allocateArray(_this._nbRegisters, 0);\n return _this;\n }\n HyperLogLog_1 = HyperLogLog;\n Object.defineProperty(HyperLogLog.prototype, \"nbRegisters\", {\n /**\n * Get the number of registers used by the HyperLogLog\n */\n get: function () {\n return this._nbRegisters;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Update The multiset with a new element\n * @param element - Element to add\n */\n HyperLogLog.prototype.update = function (element) {\n // const hashedValue = Buffer.from(hashAsString(element, this.seed))\n var hashedValue = utils$5.hashAsInt(element, this.seed).toString(2);\n var registerIndex = 1 + parseInt(hashedValue.slice(0, this._nbBytesPerHash - 1), 2);\n // find the left most 1-bit in the second part of the buffer \n var secondPart = hashedValue.slice(this._nbBytesPerHash);\n var posLeftMost = 0;\n while (secondPart[posLeftMost] !== '1' && posLeftMost < secondPart.length - 1) {\n posLeftMost++;\n }\n // update the register\n this._registers[registerIndex] = Math.max(this._registers[registerIndex], posLeftMost);\n };\n /**\n * Estimate the cardinality of the multiset\n * @return The estimated cardinality of the multiset\n */\n HyperLogLog.prototype.count = function (round) {\n if (round === void 0) { round = false; }\n // Use the standard HyperLogLog estimator\n var harmonicMean = this._registers.reduce(function (acc, value) { return acc + Math.pow(2, -value); }, 0);\n var estimation = (this._correctionBias * Math.pow(this._nbRegisters, 2)) / harmonicMean;\n // use linear counting to correct the estimation if E < 5m/2 and some registers are set to zero\n /*if (estimation < ((5/2) * this._nbRegisters) && this._registers.some(value => value === 0)) {\n const nbZeroRegisters = this._registers.filter(value => value === 0).length\n estimation = this._nbRegisters * Math.log(this._nbRegisters / nbZeroRegisters)\n }*/\n // correct the estimation for very large registers\n if (estimation > (TWO_POW_32 / 30)) {\n estimation = -TWO_POW_32 * Math.log(1 - (estimation / TWO_POW_32));\n }\n // round if required\n if (round) {\n estimation = Math.round(estimation);\n }\n return estimation;\n };\n /**\n * Compute the accuracy of the cardinality estimation produced by this HyperLogLog\n * @return The accuracy of the cardinality estimation\n */\n HyperLogLog.prototype.accuracy = function () {\n return 1.04 / Math.sqrt(this._nbRegisters);\n };\n /**\n * Perform the union with another HyperLogLog multiset\n * @param other - Multiset ot merge with\n * @return The union of the two multisets\n */\n HyperLogLog.prototype.merge = function (other) {\n if (this.nbRegisters !== other.nbRegisters) {\n throw new Error(\"Two HyperLogLog must have the same number of registers to be merged. Tried to merge two HyperLogLog with m = \" + this.nbRegisters + \" and m = \" + other.nbRegisters);\n }\n var newSketch = new HyperLogLog_1(this.nbRegisters);\n for (var i = 0; i < this.nbRegisters - 1; i++) {\n newSketch._registers[i] = Math.max(this._registers[i], other._registers[i]);\n }\n return newSketch;\n };\n /**\n * Check if another HyperLogLog is equal to this one\n * @param other - The HyperLogLog to compare to this one\n * @return True if they are equal, false otherwise\n */\n HyperLogLog.prototype.equals = function (other) {\n if (this.nbRegisters !== other.nbRegisters) {\n return false;\n }\n for (var i = 0; i < this.nbRegisters - 1; i++) {\n if (this._registers[i] !== other._registers[i]) {\n return false;\n }\n }\n return true;\n };\n var HyperLogLog_1;\n __decorate$4([\n exportable.Field(),\n __metadata$4(\"design:type\", Number)\n ], HyperLogLog.prototype, \"_nbRegisters\", void 0);\n __decorate$4([\n exportable.Field(),\n __metadata$4(\"design:type\", Number)\n ], HyperLogLog.prototype, \"_nbBytesPerHash\", void 0);\n __decorate$4([\n exportable.Field(),\n __metadata$4(\"design:type\", Number)\n ], HyperLogLog.prototype, \"_correctionBias\", void 0);\n __decorate$4([\n exportable.Field(),\n __metadata$4(\"design:type\", Array)\n ], HyperLogLog.prototype, \"_registers\", void 0);\n HyperLogLog = HyperLogLog_1 = __decorate$4([\n exportable.AutoExportable('HyperLogLog', ['_seed']),\n __param$4(0, exportable.Parameter('_nbRegisters')),\n __metadata$4(\"design:paramtypes\", [Number])\n ], HyperLogLog);\n return HyperLogLog;\n }(base_filter_1$4.default));\n var _default$d = HyperLogLog;\n\n var hyperloglog = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$d\n }, '__esModule', {value: true});\n\n /**\n * @license\n * Lodash <https://lodash.com/>\n * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n var lodash = createCommonjsModule(function (module, exports) {\n (function() {\n\n /** Used as a safe reference for `undefined` in pre-ES5 environments. */\n var undefined$1;\n\n /** Used as the semantic version number. */\n var VERSION = '4.17.20';\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE = 200;\n\n /** Error message constants. */\n var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',\n FUNC_ERROR_TEXT = 'Expected a function';\n\n /** Used to stand-in for `undefined` hash values. */\n var HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n /** Used as the maximum memoize cache size. */\n var MAX_MEMOIZE_SIZE = 500;\n\n /** Used as the internal argument placeholder. */\n var PLACEHOLDER = '__lodash_placeholder__';\n\n /** Used to compose bitmasks for cloning. */\n var CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n /** Used to compose bitmasks for function metadata. */\n var WRAP_BIND_FLAG = 1,\n WRAP_BIND_KEY_FLAG = 2,\n WRAP_CURRY_BOUND_FLAG = 4,\n WRAP_CURRY_FLAG = 8,\n WRAP_CURRY_RIGHT_FLAG = 16,\n WRAP_PARTIAL_FLAG = 32,\n WRAP_PARTIAL_RIGHT_FLAG = 64,\n WRAP_ARY_FLAG = 128,\n WRAP_REARG_FLAG = 256,\n WRAP_FLIP_FLAG = 512;\n\n /** Used as default options for `_.truncate`. */\n var DEFAULT_TRUNC_LENGTH = 30,\n DEFAULT_TRUNC_OMISSION = '...';\n\n /** Used to detect hot functions by number of calls within a span of milliseconds. */\n var HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n /** Used to indicate the type of lazy iteratees. */\n var LAZY_FILTER_FLAG = 1,\n LAZY_MAP_FLAG = 2,\n LAZY_WHILE_FLAG = 3;\n\n /** Used as references for various `Number` constants. */\n var INFINITY = 1 / 0,\n MAX_SAFE_INTEGER = 9007199254740991,\n MAX_INTEGER = 1.7976931348623157e+308,\n NAN = 0 / 0;\n\n /** Used as references for the maximum length and index of an array. */\n var MAX_ARRAY_LENGTH = 4294967295,\n MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,\n HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;\n\n /** Used to associate wrap methods with their bit flags. */\n var wrapFlags = [\n ['ary', WRAP_ARY_FLAG],\n ['bind', WRAP_BIND_FLAG],\n ['bindKey', WRAP_BIND_KEY_FLAG],\n ['curry', WRAP_CURRY_FLAG],\n ['curryRight', WRAP_CURRY_RIGHT_FLAG],\n ['flip', WRAP_FLIP_FLAG],\n ['partial', WRAP_PARTIAL_FLAG],\n ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],\n ['rearg', WRAP_REARG_FLAG]\n ];\n\n /** `Object#toString` result references. */\n var argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n domExcTag = '[object DOMException]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]',\n weakSetTag = '[object WeakSet]';\n\n var arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n /** Used to match empty string literals in compiled template source. */\n var reEmptyStringLeading = /\\b__p \\+= '';/g,\n reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n /** Used to match HTML entities and HTML characters. */\n var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,\n reUnescapedHtml = /[&<>\"']/g,\n reHasEscapedHtml = RegExp(reEscapedHtml.source),\n reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n /** Used to match template delimiters. */\n var reEscape = /<%-([\\s\\S]+?)%>/g,\n reEvaluate = /<%([\\s\\S]+?)%>/g,\n reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\n /** Used to match property names within property paths. */\n var reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/,\n rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n /**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\n var reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g,\n reHasRegExpChar = RegExp(reRegExpChar.source);\n\n /** Used to match leading and trailing whitespace. */\n var reTrim = /^\\s+|\\s+$/g,\n reTrimStart = /^\\s+/,\n reTrimEnd = /\\s+$/;\n\n /** Used to match wrap detail comments. */\n var reWrapComment = /\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,\n reWrapDetails = /\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,\n reSplitDetails = /,? & /;\n\n /** Used to match words composed of alphanumeric characters. */\n var reAsciiWord = /[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g;\n\n /** Used to match backslashes in property paths. */\n var reEscapeChar = /\\\\(\\\\)?/g;\n\n /**\n * Used to match\n * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).\n */\n var reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n /** Used to match `RegExp` flags from their coerced string values. */\n var reFlags = /\\w*$/;\n\n /** Used to detect bad signed hexadecimal string values. */\n var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n /** Used to detect binary string values. */\n var reIsBinary = /^0b[01]+$/i;\n\n /** Used to detect host constructors (Safari). */\n var reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n /** Used to detect octal string values. */\n var reIsOctal = /^0o[0-7]+$/i;\n\n /** Used to detect unsigned integer values. */\n var reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n /** Used to match Latin Unicode letters (excluding mathematical operators). */\n var reLatin = /[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g;\n\n /** Used to ensure capturing order of template delimiters. */\n var reNoMatch = /($^)/;\n\n /** Used to match unescaped characters in compiled string literals. */\n var reUnescapedString = /['\\n\\r\\u2028\\u2029\\\\]/g;\n\n /** Used to compose unicode character classes. */\n var rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsDingbatRange = '\\\\u2700-\\\\u27bf',\n rsLowerRange = 'a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff',\n rsMathOpRange = '\\\\xac\\\\xb1\\\\xd7\\\\xf7',\n rsNonCharRange = '\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf',\n rsPunctuationRange = '\\\\u2000-\\\\u206f',\n rsSpaceRange = ' \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000',\n rsUpperRange = 'A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde',\n rsVarRange = '\\\\ufe0e\\\\ufe0f',\n rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;\n\n /** Used to compose unicode capture groups. */\n var rsApos = \"['\\u2019]\",\n rsAstral = '[' + rsAstralRange + ']',\n rsBreak = '[' + rsBreakRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsDigits = '\\\\d+',\n rsDingbat = '[' + rsDingbatRange + ']',\n rsLower = '[' + rsLowerRange + ']',\n rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsUpper = '[' + rsUpperRange + ']',\n rsZWJ = '\\\\u200d';\n\n /** Used to compose unicode regexes. */\n var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',\n rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',\n rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',\n rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',\n reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsOrdLower = '\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])',\n rsOrdUpper = '\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n /** Used to match apostrophes. */\n var reApos = RegExp(rsApos, 'g');\n\n /**\n * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\n * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\n */\n var reComboMark = RegExp(rsCombo, 'g');\n\n /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\n var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n /** Used to match complex or compound words. */\n var reUnicodeWord = RegExp([\n rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\n rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',\n rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,\n rsUpper + '+' + rsOptContrUpper,\n rsOrdUpper,\n rsOrdLower,\n rsDigits,\n rsEmoji\n ].join('|'), 'g');\n\n /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\n var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n /** Used to detect strings that need a more robust regexp to match words. */\n var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\n\n /** Used to assign default `context` object properties. */\n var contextProps = [\n 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',\n 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',\n 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',\n 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',\n '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'\n ];\n\n /** Used to make template sourceURLs easier to identify. */\n var templateCounter = -1;\n\n /** Used to identify `toStringTag` values of typed arrays. */\n var typedArrayTags = {};\n typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\n typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\n typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\n typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\n typedArrayTags[uint32Tag] = true;\n typedArrayTags[argsTag] = typedArrayTags[arrayTag] =\n typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\n typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\n typedArrayTags[errorTag] = typedArrayTags[funcTag] =\n typedArrayTags[mapTag] = typedArrayTags[numberTag] =\n typedArrayTags[objectTag] = typedArrayTags[regexpTag] =\n typedArrayTags[setTag] = typedArrayTags[stringTag] =\n typedArrayTags[weakMapTag] = false;\n\n /** Used to identify `toStringTag` values supported by `_.clone`. */\n var cloneableTags = {};\n cloneableTags[argsTag] = cloneableTags[arrayTag] =\n cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\n cloneableTags[boolTag] = cloneableTags[dateTag] =\n cloneableTags[float32Tag] = cloneableTags[float64Tag] =\n cloneableTags[int8Tag] = cloneableTags[int16Tag] =\n cloneableTags[int32Tag] = cloneableTags[mapTag] =\n cloneableTags[numberTag] = cloneableTags[objectTag] =\n cloneableTags[regexpTag] = cloneableTags[setTag] =\n cloneableTags[stringTag] = cloneableTags[symbolTag] =\n cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\n cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\n cloneableTags[errorTag] = cloneableTags[funcTag] =\n cloneableTags[weakMapTag] = false;\n\n /** Used to map Latin Unicode letters to basic Latin letters. */\n var deburredLetters = {\n // Latin-1 Supplement block.\n '\\xc0': 'A', '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n '\\xe0': 'a', '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n '\\xc7': 'C', '\\xe7': 'c',\n '\\xd0': 'D', '\\xf0': 'd',\n '\\xc8': 'E', '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n '\\xe8': 'e', '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n '\\xcc': 'I', '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n '\\xec': 'i', '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n '\\xd1': 'N', '\\xf1': 'n',\n '\\xd2': 'O', '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n '\\xf2': 'o', '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n '\\xd9': 'U', '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n '\\xf9': 'u', '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n '\\xdd': 'Y', '\\xfd': 'y', '\\xff': 'y',\n '\\xc6': 'Ae', '\\xe6': 'ae',\n '\\xde': 'Th', '\\xfe': 'th',\n '\\xdf': 'ss',\n // Latin Extended-A block.\n '\\u0100': 'A', '\\u0102': 'A', '\\u0104': 'A',\n '\\u0101': 'a', '\\u0103': 'a', '\\u0105': 'a',\n '\\u0106': 'C', '\\u0108': 'C', '\\u010a': 'C', '\\u010c': 'C',\n '\\u0107': 'c', '\\u0109': 'c', '\\u010b': 'c', '\\u010d': 'c',\n '\\u010e': 'D', '\\u0110': 'D', '\\u010f': 'd', '\\u0111': 'd',\n '\\u0112': 'E', '\\u0114': 'E', '\\u0116': 'E', '\\u0118': 'E', '\\u011a': 'E',\n '\\u0113': 'e', '\\u0115': 'e', '\\u0117': 'e', '\\u0119': 'e', '\\u011b': 'e',\n '\\u011c': 'G', '\\u011e': 'G', '\\u0120': 'G', '\\u0122': 'G',\n '\\u011d': 'g', '\\u011f': 'g', '\\u0121': 'g', '\\u0123': 'g',\n '\\u0124': 'H', '\\u0126': 'H', '\\u0125': 'h', '\\u0127': 'h',\n '\\u0128': 'I', '\\u012a': 'I', '\\u012c': 'I', '\\u012e': 'I', '\\u0130': 'I',\n '\\u0129': 'i', '\\u012b': 'i', '\\u012d': 'i', '\\u012f': 'i', '\\u0131': 'i',\n '\\u0134': 'J', '\\u0135': 'j',\n '\\u0136': 'K', '\\u0137': 'k', '\\u0138': 'k',\n '\\u0139': 'L', '\\u013b': 'L', '\\u013d': 'L', '\\u013f': 'L', '\\u0141': 'L',\n '\\u013a': 'l', '\\u013c': 'l', '\\u013e': 'l', '\\u0140': 'l', '\\u0142': 'l',\n '\\u0143': 'N', '\\u0145': 'N', '\\u0147': 'N', '\\u014a': 'N',\n '\\u0144': 'n', '\\u0146': 'n', '\\u0148': 'n', '\\u014b': 'n',\n '\\u014c': 'O', '\\u014e': 'O', '\\u0150': 'O',\n '\\u014d': 'o', '\\u014f': 'o', '\\u0151': 'o',\n '\\u0154': 'R', '\\u0156': 'R', '\\u0158': 'R',\n '\\u0155': 'r', '\\u0157': 'r', '\\u0159': 'r',\n '\\u015a': 'S', '\\u015c': 'S', '\\u015e': 'S', '\\u0160': 'S',\n '\\u015b': 's', '\\u015d': 's', '\\u015f': 's', '\\u0161': 's',\n '\\u0162': 'T', '\\u0164': 'T', '\\u0166': 'T',\n '\\u0163': 't', '\\u0165': 't', '\\u0167': 't',\n '\\u0168': 'U', '\\u016a': 'U', '\\u016c': 'U', '\\u016e': 'U', '\\u0170': 'U', '\\u0172': 'U',\n '\\u0169': 'u', '\\u016b': 'u', '\\u016d': 'u', '\\u016f': 'u', '\\u0171': 'u', '\\u0173': 'u',\n '\\u0174': 'W', '\\u0175': 'w',\n '\\u0176': 'Y', '\\u0177': 'y', '\\u0178': 'Y',\n '\\u0179': 'Z', '\\u017b': 'Z', '\\u017d': 'Z',\n '\\u017a': 'z', '\\u017c': 'z', '\\u017e': 'z',\n '\\u0132': 'IJ', '\\u0133': 'ij',\n '\\u0152': 'Oe', '\\u0153': 'oe',\n '\\u0149': \"'n\", '\\u017f': 's'\n };\n\n /** Used to map characters to HTML entities. */\n var htmlEscapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": '''\n };\n\n /** Used to map HTML entities to characters. */\n var htmlUnescapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '"': '\"',\n ''': \"'\"\n };\n\n /** Used to escape characters for inclusion in compiled string literals. */\n var stringEscapes = {\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\\n': 'n',\n '\\r': 'r',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n };\n\n /** Built-in method references without a dependency on `root`. */\n var freeParseFloat = parseFloat,\n freeParseInt = parseInt;\n\n /** Detect free variable `global` from Node.js. */\n var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;\n\n /** Detect free variable `self`. */\n var freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n /** Used as a reference to the global object. */\n var root = freeGlobal || freeSelf || Function('return this')();\n\n /** Detect free variable `exports`. */\n var freeExports = exports && !exports.nodeType && exports;\n\n /** Detect free variable `module`. */\n var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports = freeModule && freeModule.exports === freeExports;\n\n /** Detect free variable `process` from Node.js. */\n var freeProcess = moduleExports && freeGlobal.process;\n\n /** Used to access faster Node.js helpers. */\n var nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n }());\n\n /* Node.js helper references. */\n var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,\n nodeIsDate = nodeUtil && nodeUtil.isDate,\n nodeIsMap = nodeUtil && nodeUtil.isMap,\n nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,\n nodeIsSet = nodeUtil && nodeUtil.isSet,\n nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\n function apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n }\n\n /**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.forEachRight` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEachRight(array, iteratee) {\n var length = array == null ? 0 : array.length;\n\n while (length--) {\n if (iteratee(array[length], length, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.every` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\n function arrayEvery(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n }\n\n /**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n }\n\n /**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\n function arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n }\n\n /**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.reduceRight` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the last element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduceRight(array, iteratee, accumulator, initAccum) {\n var length = array == null ? 0 : array.length;\n if (initAccum && length) {\n accumulator = array[--length];\n }\n while (length--) {\n accumulator = iteratee(accumulator, array[length], length, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Gets the size of an ASCII `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\n var asciiSize = baseProperty('length');\n\n /**\n * Converts an ASCII `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function asciiToArray(string) {\n return string.split('');\n }\n\n /**\n * Splits an ASCII `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\n function asciiWords(string) {\n return string.match(reAsciiWord) || [];\n }\n\n /**\n * The base implementation of methods like `_.findKey` and `_.findLastKey`,\n * without support for iteratee shorthands, which iterates over `collection`\n * using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the found element or its key, else `undefined`.\n */\n function baseFindKey(collection, predicate, eachFunc) {\n var result;\n eachFunc(collection, function(value, key, collection) {\n if (predicate(value, key, collection)) {\n result = key;\n return false;\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n }\n\n /**\n * This function is like `baseIndexOf` except that it accepts a comparator.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOfWith(array, value, fromIndex, comparator) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (comparator(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\n function baseIsNaN(value) {\n return value !== value;\n }\n\n /**\n * The base implementation of `_.mean` and `_.meanBy` without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the mean.\n */\n function baseMean(array, iteratee) {\n var length = array == null ? 0 : array.length;\n return length ? (baseSum(array, iteratee) / length) : NAN;\n }\n\n /**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function baseProperty(key) {\n return function(object) {\n return object == null ? undefined$1 : object[key];\n };\n }\n\n /**\n * The base implementation of `_.propertyOf` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyOf(object) {\n return function(key) {\n return object == null ? undefined$1 : object[key];\n };\n }\n\n /**\n * The base implementation of `_.reduce` and `_.reduceRight`, without support\n * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initAccum Specify using the first or last element of\n * `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\n function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\n eachFunc(collection, function(value, index, collection) {\n accumulator = initAccum\n ? (initAccum = false, value)\n : iteratee(accumulator, value, index, collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.sortBy` which uses `comparer` to define the\n * sort order of `array` and replaces criteria objects with their corresponding\n * values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\n function baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.sum` and `_.sumBy` without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the sum.\n */\n function baseSum(array, iteratee) {\n var result,\n index = -1,\n length = array.length;\n\n while (++index < length) {\n var current = iteratee(array[index]);\n if (current !== undefined$1) {\n result = result === undefined$1 ? current : (result + current);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\n function baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n }\n\n /**\n * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array\n * of key-value pairs for `object` corresponding to the property names of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the key-value pairs.\n */\n function baseToPairs(object, props) {\n return arrayMap(props, function(key) {\n return [key, object[key]];\n });\n }\n\n /**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\n function baseUnary(func) {\n return function(value) {\n return func(value);\n };\n }\n\n /**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\n function baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n }\n\n /**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function cacheHas(cache, key) {\n return cache.has(key);\n }\n\n /**\n * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the first unmatched string symbol.\n */\n function charsStartIndex(strSymbols, chrSymbols) {\n var index = -1,\n length = strSymbols.length;\n\n while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n }\n\n /**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the last unmatched string symbol.\n */\n function charsEndIndex(strSymbols, chrSymbols) {\n var index = strSymbols.length;\n\n while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n }\n\n /**\n * Gets the number of `placeholder` occurrences in `array`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} placeholder The placeholder to search for.\n * @returns {number} Returns the placeholder count.\n */\n function countHolders(array, placeholder) {\n var length = array.length,\n result = 0;\n\n while (length--) {\n if (array[length] === placeholder) {\n ++result;\n }\n }\n return result;\n }\n\n /**\n * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A\n * letters to basic Latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\n var deburrLetter = basePropertyOf(deburredLetters);\n\n /**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n var escapeHtmlChar = basePropertyOf(htmlEscapes);\n\n /**\n * Used by `_.template` to escape characters for inclusion in compiled string literals.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n function escapeStringChar(chr) {\n return '\\\\' + stringEscapes[chr];\n }\n\n /**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function getValue(object, key) {\n return object == null ? undefined$1 : object[key];\n }\n\n /**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\n function hasUnicode(string) {\n return reHasUnicode.test(string);\n }\n\n /**\n * Checks if `string` contains a word composed of Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a word is found, else `false`.\n */\n function hasUnicodeWord(string) {\n return reHasUnicodeWord.test(string);\n }\n\n /**\n * Converts `iterator` to an array.\n *\n * @private\n * @param {Object} iterator The iterator to convert.\n * @returns {Array} Returns the converted array.\n */\n function iteratorToArray(iterator) {\n var data,\n result = [];\n\n while (!(data = iterator.next()).done) {\n result.push(data.value);\n }\n return result;\n }\n\n /**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\n function mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n }\n\n /**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\n function overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n }\n\n /**\n * Replaces all `placeholder` elements in `array` with an internal placeholder\n * and returns an array of their indexes.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {*} placeholder The placeholder to replace.\n * @returns {Array} Returns the new array of placeholder indexes.\n */\n function replaceHolders(array, placeholder) {\n var index = -1,\n length = array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value === placeholder || value === PLACEHOLDER) {\n array[index] = PLACEHOLDER;\n result[resIndex++] = index;\n }\n }\n return result;\n }\n\n /**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\n function setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n }\n\n /**\n * Converts `set` to its value-value pairs.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the value-value pairs.\n */\n function setToPairs(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = [value, value];\n });\n return result;\n }\n\n /**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * A specialized version of `_.lastIndexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictLastIndexOf(array, value, fromIndex) {\n var index = fromIndex + 1;\n while (index--) {\n if (array[index] === value) {\n return index;\n }\n }\n return index;\n }\n\n /**\n * Gets the number of symbols in `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the string size.\n */\n function stringSize(string) {\n return hasUnicode(string)\n ? unicodeSize(string)\n : asciiSize(string);\n }\n\n /**\n * Converts `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function stringToArray(string) {\n return hasUnicode(string)\n ? unicodeToArray(string)\n : asciiToArray(string);\n }\n\n /**\n * Used by `_.unescape` to convert HTML entities to characters.\n *\n * @private\n * @param {string} chr The matched character to unescape.\n * @returns {string} Returns the unescaped character.\n */\n var unescapeHtmlChar = basePropertyOf(htmlUnescapes);\n\n /**\n * Gets the size of a Unicode `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\n function unicodeSize(string) {\n var result = reUnicode.lastIndex = 0;\n while (reUnicode.test(string)) {\n ++result;\n }\n return result;\n }\n\n /**\n * Converts a Unicode `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function unicodeToArray(string) {\n return string.match(reUnicode) || [];\n }\n\n /**\n * Splits a Unicode `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\n function unicodeWords(string) {\n return string.match(reUnicodeWord) || [];\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Create a new pristine `lodash` function using the `context` object.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Util\n * @param {Object} [context=root] The context object.\n * @returns {Function} Returns a new `lodash` function.\n * @example\n *\n * _.mixin({ 'foo': _.constant('foo') });\n *\n * var lodash = _.runInContext();\n * lodash.mixin({ 'bar': lodash.constant('bar') });\n *\n * _.isFunction(_.foo);\n * // => true\n * _.isFunction(_.bar);\n * // => false\n *\n * lodash.isFunction(lodash.foo);\n * // => false\n * lodash.isFunction(lodash.bar);\n * // => true\n *\n * // Create a suped-up `defer` in Node.js.\n * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;\n */\n var runInContext = (function runInContext(context) {\n context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));\n\n /** Built-in constructor references. */\n var Array = context.Array,\n Date = context.Date,\n Error = context.Error,\n Function = context.Function,\n Math = context.Math,\n Object = context.Object,\n RegExp = context.RegExp,\n String = context.String,\n TypeError = context.TypeError;\n\n /** Used for built-in method references. */\n var arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n /** Used to detect overreaching core-js shims. */\n var coreJsData = context['__core-js_shared__'];\n\n /** Used to resolve the decompiled source of functions. */\n var funcToString = funcProto.toString;\n\n /** Used to check objects for own properties. */\n var hasOwnProperty = objectProto.hasOwnProperty;\n\n /** Used to generate unique IDs. */\n var idCounter = 0;\n\n /** Used to detect methods masquerading as native. */\n var maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n }());\n\n /**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\n var nativeObjectToString = objectProto.toString;\n\n /** Used to infer the `Object` constructor. */\n var objectCtorString = funcToString.call(Object);\n\n /** Used to restore the original `_` reference in `_.noConflict`. */\n var oldDash = root._;\n\n /** Used to detect if a method is native. */\n var reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n );\n\n /** Built-in value references. */\n var Buffer = moduleExports ? context.Buffer : undefined$1,\n Symbol = context.Symbol,\n Uint8Array = context.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined$1,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined$1,\n symIterator = Symbol ? Symbol.iterator : undefined$1,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined$1;\n\n var defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n }());\n\n /** Mocked built-ins. */\n var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,\n ctxNow = Date && Date.now !== root.Date.now && Date.now,\n ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeCeil = Math.ceil,\n nativeFloor = Math.floor,\n nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined$1,\n nativeIsFinite = context.isFinite,\n nativeJoin = arrayProto.join,\n nativeKeys = overArg(Object.keys, Object),\n nativeMax = Math.max,\n nativeMin = Math.min,\n nativeNow = Date.now,\n nativeParseInt = context.parseInt,\n nativeRandom = Math.random,\n nativeReverse = arrayProto.reverse;\n\n /* Built-in method references that are verified to be native. */\n var DataView = getNative(context, 'DataView'),\n Map = getNative(context, 'Map'),\n Promise = getNative(context, 'Promise'),\n Set = getNative(context, 'Set'),\n WeakMap = getNative(context, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n /** Used to store function metadata. */\n var metaMap = WeakMap && new WeakMap;\n\n /** Used to lookup unminified function names. */\n var realNames = {};\n\n /** Used to detect maps, sets, and weakmaps. */\n var dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n /** Used to convert symbols to primitives and strings. */\n var symbolProto = Symbol ? Symbol.prototype : undefined$1,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1,\n symbolToString = symbolProto ? symbolProto.toString : undefined$1;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` object which wraps `value` to enable implicit method\n * chain sequences. Methods that operate on and return arrays, collections,\n * and functions can be chained together. Methods that retrieve a single value\n * or may return a primitive value will automatically end the chain sequence\n * and return the unwrapped value. Otherwise, the value must be unwrapped\n * with `_#value`.\n *\n * Explicit chain sequences, which must be unwrapped with `_#value`, may be\n * enabled using `_.chain`.\n *\n * The execution of chained methods is lazy, that is, it's deferred until\n * `_#value` is implicitly or explicitly called.\n *\n * Lazy evaluation allows several methods to support shortcut fusion.\n * Shortcut fusion is an optimization to merge iteratee calls; this avoids\n * the creation of intermediate arrays and can greatly reduce the number of\n * iteratee executions. Sections of a chain sequence qualify for shortcut\n * fusion if the section is applied to an array and iteratees accept only\n * one argument. The heuristic for whether a section qualifies for shortcut\n * fusion is subject to change.\n *\n * Chaining is supported in custom builds as long as the `_#value` method is\n * directly or indirectly included in the build.\n *\n * In addition to lodash methods, wrappers have `Array` and `String` methods.\n *\n * The wrapper `Array` methods are:\n * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`\n *\n * The wrapper `String` methods are:\n * `replace` and `split`\n *\n * The wrapper methods that support shortcut fusion are:\n * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,\n * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,\n * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`\n *\n * The chainable wrapper methods are:\n * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,\n * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,\n * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,\n * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,\n * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,\n * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,\n * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,\n * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,\n * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,\n * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,\n * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,\n * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,\n * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,\n * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,\n * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,\n * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,\n * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,\n * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,\n * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,\n * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,\n * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,\n * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,\n * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,\n * `zipObject`, `zipObjectDeep`, and `zipWith`\n *\n * The wrapper methods that are **not** chainable by default are:\n * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,\n * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,\n * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,\n * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,\n * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,\n * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,\n * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,\n * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,\n * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,\n * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,\n * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,\n * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,\n * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,\n * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,\n * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,\n * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,\n * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,\n * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,\n * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,\n * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,\n * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,\n * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,\n * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,\n * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,\n * `upperFirst`, `value`, and `words`\n *\n * @name _\n * @constructor\n * @category Seq\n * @param {*} value The value to wrap in a `lodash` instance.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var wrapped = _([1, 2, 3]);\n *\n * // Returns an unwrapped value.\n * wrapped.reduce(_.add);\n * // => 6\n *\n * // Returns a wrapped value.\n * var squares = wrapped.map(square);\n *\n * _.isArray(squares);\n * // => false\n *\n * _.isArray(squares.value());\n * // => true\n */\n function lodash(value) {\n if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {\n if (value instanceof LodashWrapper) {\n return value;\n }\n if (hasOwnProperty.call(value, '__wrapped__')) {\n return wrapperClone(value);\n }\n }\n return new LodashWrapper(value);\n }\n\n /**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\n var baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined$1;\n return result;\n };\n }());\n\n /**\n * The function whose prototype chain sequence wrappers inherit from.\n *\n * @private\n */\n function baseLodash() {\n // No operation performed.\n }\n\n /**\n * The base constructor for creating `lodash` wrapper objects.\n *\n * @private\n * @param {*} value The value to wrap.\n * @param {boolean} [chainAll] Enable explicit method chain sequences.\n */\n function LodashWrapper(value, chainAll) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__chain__ = !!chainAll;\n this.__index__ = 0;\n this.__values__ = undefined$1;\n }\n\n /**\n * By default, the template delimiters used by lodash are like those in\n * embedded Ruby (ERB) as well as ES2015 template strings. Change the\n * following template settings to use alternative delimiters.\n *\n * @static\n * @memberOf _\n * @type {Object}\n */\n lodash.templateSettings = {\n\n /**\n * Used to detect `data` property values to be HTML-escaped.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'escape': reEscape,\n\n /**\n * Used to detect code to be evaluated.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'evaluate': reEvaluate,\n\n /**\n * Used to detect `data` property values to inject.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'interpolate': reInterpolate,\n\n /**\n * Used to reference the data object in the template text.\n *\n * @memberOf _.templateSettings\n * @type {string}\n */\n 'variable': '',\n\n /**\n * Used to import variables into the compiled template.\n *\n * @memberOf _.templateSettings\n * @type {Object}\n */\n 'imports': {\n\n /**\n * A reference to the `lodash` function.\n *\n * @memberOf _.templateSettings.imports\n * @type {Function}\n */\n '_': lodash\n }\n };\n\n // Ensure wrappers are instances of `baseLodash`.\n lodash.prototype = baseLodash.prototype;\n lodash.prototype.constructor = lodash;\n\n LodashWrapper.prototype = baseCreate(baseLodash.prototype);\n LodashWrapper.prototype.constructor = LodashWrapper;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.\n *\n * @private\n * @constructor\n * @param {*} value The value to wrap.\n */\n function LazyWrapper(value) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__dir__ = 1;\n this.__filtered__ = false;\n this.__iteratees__ = [];\n this.__takeCount__ = MAX_ARRAY_LENGTH;\n this.__views__ = [];\n }\n\n /**\n * Creates a clone of the lazy wrapper object.\n *\n * @private\n * @name clone\n * @memberOf LazyWrapper\n * @returns {Object} Returns the cloned `LazyWrapper` object.\n */\n function lazyClone() {\n var result = new LazyWrapper(this.__wrapped__);\n result.__actions__ = copyArray(this.__actions__);\n result.__dir__ = this.__dir__;\n result.__filtered__ = this.__filtered__;\n result.__iteratees__ = copyArray(this.__iteratees__);\n result.__takeCount__ = this.__takeCount__;\n result.__views__ = copyArray(this.__views__);\n return result;\n }\n\n /**\n * Reverses the direction of lazy iteration.\n *\n * @private\n * @name reverse\n * @memberOf LazyWrapper\n * @returns {Object} Returns the new reversed `LazyWrapper` object.\n */\n function lazyReverse() {\n if (this.__filtered__) {\n var result = new LazyWrapper(this);\n result.__dir__ = -1;\n result.__filtered__ = true;\n } else {\n result = this.clone();\n result.__dir__ *= -1;\n }\n return result;\n }\n\n /**\n * Extracts the unwrapped value from its lazy wrapper.\n *\n * @private\n * @name value\n * @memberOf LazyWrapper\n * @returns {*} Returns the unwrapped value.\n */\n function lazyValue() {\n var array = this.__wrapped__.value(),\n dir = this.__dir__,\n isArr = isArray(array),\n isRight = dir < 0,\n arrLength = isArr ? array.length : 0,\n view = getView(0, arrLength, this.__views__),\n start = view.start,\n end = view.end,\n length = end - start,\n index = isRight ? end : (start - 1),\n iteratees = this.__iteratees__,\n iterLength = iteratees.length,\n resIndex = 0,\n takeCount = nativeMin(length, this.__takeCount__);\n\n if (!isArr || (!isRight && arrLength == length && takeCount == length)) {\n return baseWrapperValue(array, this.__actions__);\n }\n var result = [];\n\n outer:\n while (length-- && resIndex < takeCount) {\n index += dir;\n\n var iterIndex = -1,\n value = array[index];\n\n while (++iterIndex < iterLength) {\n var data = iteratees[iterIndex],\n iteratee = data.iteratee,\n type = data.type,\n computed = iteratee(value);\n\n if (type == LAZY_MAP_FLAG) {\n value = computed;\n } else if (!computed) {\n if (type == LAZY_FILTER_FLAG) {\n continue outer;\n } else {\n break outer;\n }\n }\n }\n result[resIndex++] = value;\n }\n return result;\n }\n\n // Ensure `LazyWrapper` is an instance of `baseLodash`.\n LazyWrapper.prototype = baseCreate(baseLodash.prototype);\n LazyWrapper.prototype.constructor = LazyWrapper;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\n function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n }\n\n /**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined$1 : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined$1;\n }\n\n /**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined$1) : hasOwnProperty.call(data, key);\n }\n\n /**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\n function hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined$1) ? HASH_UNDEFINED : value;\n return this;\n }\n\n // Add methods to `Hash`.\n Hash.prototype.clear = hashClear;\n Hash.prototype['delete'] = hashDelete;\n Hash.prototype.get = hashGet;\n Hash.prototype.has = hashHas;\n Hash.prototype.set = hashSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\n function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n }\n\n /**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined$1 : data[index][1];\n }\n\n /**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n }\n\n /**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\n function listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n }\n\n // Add methods to `ListCache`.\n ListCache.prototype.clear = listCacheClear;\n ListCache.prototype['delete'] = listCacheDelete;\n ListCache.prototype.get = listCacheGet;\n ListCache.prototype.has = listCacheHas;\n ListCache.prototype.set = listCacheSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\n function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n }\n\n /**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n }\n\n /**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function mapCacheGet(key) {\n return getMapData(this, key).get(key);\n }\n\n /**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function mapCacheHas(key) {\n return getMapData(this, key).has(key);\n }\n\n /**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\n function mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n }\n\n // Add methods to `MapCache`.\n MapCache.prototype.clear = mapCacheClear;\n MapCache.prototype['delete'] = mapCacheDelete;\n MapCache.prototype.get = mapCacheGet;\n MapCache.prototype.has = mapCacheHas;\n MapCache.prototype.set = mapCacheSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\n function SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n }\n\n /**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\n function setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n }\n\n /**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\n function setCacheHas(value) {\n return this.__data__.has(value);\n }\n\n // Add methods to `SetCache`.\n SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\n SetCache.prototype.has = setCacheHas;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n }\n\n /**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\n function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n }\n\n /**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function stackGet(key) {\n return this.__data__.get(key);\n }\n\n /**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function stackHas(key) {\n return this.__data__.has(key);\n }\n\n /**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\n function stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n }\n\n // Add methods to `Stack`.\n Stack.prototype.clear = stackClear;\n Stack.prototype['delete'] = stackDelete;\n Stack.prototype.get = stackGet;\n Stack.prototype.has = stackHas;\n Stack.prototype.set = stackSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\n function arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.sample` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @returns {*} Returns the random element.\n */\n function arraySample(array) {\n var length = array.length;\n return length ? array[baseRandom(0, length - 1)] : undefined$1;\n }\n\n /**\n * A specialized version of `_.sampleSize` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\n function arraySampleSize(array, n) {\n return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));\n }\n\n /**\n * A specialized version of `_.shuffle` for arrays.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @returns {Array} Returns the new shuffled array.\n */\n function arrayShuffle(array) {\n return shuffleSelf(copyArray(array));\n }\n\n /**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignMergeValue(object, key, value) {\n if ((value !== undefined$1 && !eq(object[key], value)) ||\n (value === undefined$1 && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n }\n\n /**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined$1 && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n }\n\n /**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n }\n\n /**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n }\n\n /**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n }\n\n /**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n }\n\n /**\n * The base implementation of `_.at` without support for individual paths.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {string[]} paths The property paths to pick.\n * @returns {Array} Returns the picked elements.\n */\n function baseAt(object, paths) {\n var index = -1,\n length = paths.length,\n result = Array(length),\n skip = object == null;\n\n while (++index < length) {\n result[index] = skip ? undefined$1 : get(object, paths[index]);\n }\n return result;\n }\n\n /**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\n function baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined$1) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined$1) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n }\n\n /**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\n function baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined$1) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined$1 : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n }\n\n /**\n * The base implementation of `_.conforms` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property predicates to conform to.\n * @returns {Function} Returns the new spec function.\n */\n function baseConforms(source) {\n var props = keys(source);\n return function(object) {\n return baseConformsTo(object, source, props);\n };\n }\n\n /**\n * The base implementation of `_.conformsTo` which accepts `props` to check.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property predicates to conform to.\n * @returns {boolean} Returns `true` if `object` conforms, else `false`.\n */\n function baseConformsTo(object, source, props) {\n var length = props.length;\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (length--) {\n var key = props[length],\n predicate = source[key],\n value = object[key];\n\n if ((value === undefined$1 && !(key in object)) || !predicate(value)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.delay` and `_.defer` which accepts `args`\n * to provide to `func`.\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {Array} args The arguments to provide to `func`.\n * @returns {number|Object} Returns the timer id or timeout object.\n */\n function baseDelay(func, wait, args) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return setTimeout(function() { func.apply(undefined$1, args); }, wait);\n }\n\n /**\n * The base implementation of methods like `_.difference` without support\n * for excluding multiple arrays or iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n */\n function baseDifference(array, values, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n isCommon = true,\n length = array.length,\n result = [],\n valuesLength = values.length;\n\n if (!length) {\n return result;\n }\n if (iteratee) {\n values = arrayMap(values, baseUnary(iteratee));\n }\n if (comparator) {\n includes = arrayIncludesWith;\n isCommon = false;\n }\n else if (values.length >= LARGE_ARRAY_SIZE) {\n includes = cacheHas;\n isCommon = false;\n values = new SetCache(values);\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee == null ? value : iteratee(value);\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var valuesIndex = valuesLength;\n while (valuesIndex--) {\n if (values[valuesIndex] === computed) {\n continue outer;\n }\n }\n result.push(value);\n }\n else if (!includes(values, computed, comparator)) {\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEach = createBaseEach(baseForOwn);\n\n /**\n * The base implementation of `_.forEachRight` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEachRight = createBaseEach(baseForOwnRight, true);\n\n /**\n * The base implementation of `_.every` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\n function baseEvery(collection, predicate) {\n var result = true;\n baseEach(collection, function(value, index, collection) {\n result = !!predicate(value, index, collection);\n return result;\n });\n return result;\n }\n\n /**\n * The base implementation of methods like `_.max` and `_.min` which accepts a\n * `comparator` to determine the extremum value.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The iteratee invoked per iteration.\n * @param {Function} comparator The comparator used to compare values.\n * @returns {*} Returns the extremum value.\n */\n function baseExtremum(array, iteratee, comparator) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index],\n current = iteratee(value);\n\n if (current != null && (computed === undefined$1\n ? (current === current && !isSymbol(current))\n : comparator(current, computed)\n )) {\n var computed = current,\n result = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.fill` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n */\n function baseFill(array, value, start, end) {\n var length = array.length;\n\n start = toInteger(start);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined$1 || end > length) ? length : toInteger(end);\n if (end < 0) {\n end += length;\n }\n end = start > end ? 0 : toLength(end);\n while (start < end) {\n array[start++] = value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.filter` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\n function baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseFor = createBaseFor();\n\n /**\n * This function is like `baseFor` except that it iterates over properties\n * in the opposite order.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseForRight = createBaseFor(true);\n\n /**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.forOwnRight` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwnRight(object, iteratee) {\n return object && baseForRight(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.functions` which creates an array of\n * `object` function property names filtered from `props`.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Array} props The property names to filter.\n * @returns {Array} Returns the function names.\n */\n function baseFunctions(object, props) {\n return arrayFilter(props, function(key) {\n return isFunction(object[key]);\n });\n }\n\n /**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\n function baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined$1;\n }\n\n /**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n }\n\n /**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n function baseGetTag(value) {\n if (value == null) {\n return value === undefined$1 ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n }\n\n /**\n * The base implementation of `_.gt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n */\n function baseGt(value, other) {\n return value > other;\n }\n\n /**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHas(object, key) {\n return object != null && hasOwnProperty.call(object, key);\n }\n\n /**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHasIn(object, key) {\n return object != null && key in Object(object);\n }\n\n /**\n * The base implementation of `_.inRange` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to check.\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n */\n function baseInRange(number, start, end) {\n return number >= nativeMin(start, end) && number < nativeMax(start, end);\n }\n\n /**\n * The base implementation of methods like `_.intersection`, without support\n * for iteratee shorthands, that accepts an array of arrays to inspect.\n *\n * @private\n * @param {Array} arrays The arrays to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of shared values.\n */\n function baseIntersection(arrays, iteratee, comparator) {\n var includes = comparator ? arrayIncludesWith : arrayIncludes,\n length = arrays[0].length,\n othLength = arrays.length,\n othIndex = othLength,\n caches = Array(othLength),\n maxLength = Infinity,\n result = [];\n\n while (othIndex--) {\n var array = arrays[othIndex];\n if (othIndex && iteratee) {\n array = arrayMap(array, baseUnary(iteratee));\n }\n maxLength = nativeMin(array.length, maxLength);\n caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))\n ? new SetCache(othIndex && array)\n : undefined$1;\n }\n array = arrays[0];\n\n var index = -1,\n seen = caches[0];\n\n outer:\n while (++index < length && result.length < maxLength) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (!(seen\n ? cacheHas(seen, computed)\n : includes(result, computed, comparator)\n )) {\n othIndex = othLength;\n while (--othIndex) {\n var cache = caches[othIndex];\n if (!(cache\n ? cacheHas(cache, computed)\n : includes(arrays[othIndex], computed, comparator))\n ) {\n continue outer;\n }\n }\n if (seen) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.invert` and `_.invertBy` which inverts\n * `object` with values transformed by `iteratee` and set by `setter`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform values.\n * @param {Object} accumulator The initial inverted object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseInverter(object, setter, iteratee, accumulator) {\n baseForOwn(object, function(value, key, object) {\n setter(accumulator, iteratee(value), key, object);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.invoke` without support for individual\n * method arguments.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {Array} args The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n */\n function baseInvoke(object, path, args) {\n path = castPath(path, object);\n object = parent(object, path);\n var func = object == null ? object : object[toKey(last(path))];\n return func == null ? undefined$1 : apply(func, object, args);\n }\n\n /**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\n function baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n }\n\n /**\n * The base implementation of `_.isArrayBuffer` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.\n */\n function baseIsArrayBuffer(value) {\n return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;\n }\n\n /**\n * The base implementation of `_.isDate` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a date object, else `false`.\n */\n function baseIsDate(value) {\n return isObjectLike(value) && baseGetTag(value) == dateTag;\n }\n\n /**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\n function baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n }\n\n /**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n }\n\n /**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\n function baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n }\n\n /**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\n function baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined$1 && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined$1\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\n function baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n }\n\n /**\n * The base implementation of `_.isRegExp` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n */\n function baseIsRegExp(value) {\n return isObjectLike(value) && baseGetTag(value) == regexpTag;\n }\n\n /**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\n function baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n }\n\n /**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\n function baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n }\n\n /**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\n function baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == 'object') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n }\n\n /**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.lt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n */\n function baseLt(value, other) {\n return value < other;\n }\n\n /**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n }\n\n /**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n }\n\n /**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined$1 && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n }\n\n /**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\n function baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined$1;\n\n if (newValue === undefined$1) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n }\n\n /**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\n function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined$1;\n\n var isCommon = newValue === undefined$1;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n }\n\n /**\n * The base implementation of `_.nth` which doesn't coerce arguments.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {number} n The index of the element to return.\n * @returns {*} Returns the nth element of `array`.\n */\n function baseNth(array, n) {\n var length = array.length;\n if (!length) {\n return;\n }\n n += n < 0 ? length : 0;\n return isIndex(n, length) ? array[n] : undefined$1;\n }\n\n /**\n * The base implementation of `_.orderBy` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {string[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\n function baseOrderBy(collection, iteratees, orders) {\n if (iteratees.length) {\n iteratees = arrayMap(iteratees, function(iteratee) {\n if (isArray(iteratee)) {\n return function(value) {\n return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);\n }\n }\n return iteratee;\n });\n } else {\n iteratees = [identity];\n }\n\n var index = -1;\n iteratees = arrayMap(iteratees, baseUnary(getIteratee()));\n\n var result = baseMap(collection, function(value, key, collection) {\n var criteria = arrayMap(iteratees, function(iteratee) {\n return iteratee(value);\n });\n return { 'criteria': criteria, 'index': ++index, 'value': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n }\n\n /**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @returns {Object} Returns the new object.\n */\n function basePick(object, paths) {\n return basePickBy(object, paths, function(value, path) {\n return hasIn(object, path);\n });\n }\n\n /**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\n function basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n }\n\n /**\n * The base implementation of `_.pullAllBy` without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns `array`.\n */\n function basePullAll(array, values, iteratee, comparator) {\n var indexOf = comparator ? baseIndexOfWith : baseIndexOf,\n index = -1,\n length = values.length,\n seen = array;\n\n if (array === values) {\n values = copyArray(values);\n }\n if (iteratee) {\n seen = arrayMap(array, baseUnary(iteratee));\n }\n while (++index < length) {\n var fromIndex = 0,\n value = values[index],\n computed = iteratee ? iteratee(value) : value;\n\n while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {\n if (seen !== array) {\n splice.call(seen, fromIndex, 1);\n }\n splice.call(array, fromIndex, 1);\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.pullAt` without support for individual\n * indexes or capturing the removed elements.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {number[]} indexes The indexes of elements to remove.\n * @returns {Array} Returns `array`.\n */\n function basePullAt(array, indexes) {\n var length = array ? indexes.length : 0,\n lastIndex = length - 1;\n\n while (length--) {\n var index = indexes[length];\n if (length == lastIndex || index !== previous) {\n var previous = index;\n if (isIndex(index)) {\n splice.call(array, index, 1);\n } else {\n baseUnset(array, index);\n }\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.random` without support for returning\n * floating-point numbers.\n *\n * @private\n * @param {number} lower The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the random number.\n */\n function baseRandom(lower, upper) {\n return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n }\n\n /**\n * The base implementation of `_.range` and `_.rangeRight` which doesn't\n * coerce arguments.\n *\n * @private\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @param {number} step The value to increment or decrement by.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the range of numbers.\n */\n function baseRange(start, end, step, fromRight) {\n var index = -1,\n length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n result = Array(length);\n\n while (length--) {\n result[fromRight ? length : ++index] = start;\n start += step;\n }\n return result;\n }\n\n /**\n * The base implementation of `_.repeat` which doesn't coerce arguments.\n *\n * @private\n * @param {string} string The string to repeat.\n * @param {number} n The number of times to repeat the string.\n * @returns {string} Returns the repeated string.\n */\n function baseRepeat(string, n) {\n var result = '';\n if (!string || n < 1 || n > MAX_SAFE_INTEGER) {\n return result;\n }\n // Leverage the exponentiation by squaring algorithm for a faster repeat.\n // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n do {\n if (n % 2) {\n result += string;\n }\n n = nativeFloor(n / 2);\n if (n) {\n string += string;\n }\n } while (n);\n\n return result;\n }\n\n /**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\n function baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n }\n\n /**\n * The base implementation of `_.sample`.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @returns {*} Returns the random element.\n */\n function baseSample(collection) {\n return arraySample(values(collection));\n }\n\n /**\n * The base implementation of `_.sampleSize` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\n function baseSampleSize(collection, n) {\n var array = values(collection);\n return shuffleSelf(array, baseClamp(n, 0, array.length));\n }\n\n /**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object;\n }\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined$1;\n if (newValue === undefined$1) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n }\n\n /**\n * The base implementation of `setData` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var baseSetData = !metaMap ? identity : function(func, data) {\n metaMap.set(func, data);\n return func;\n };\n\n /**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n };\n\n /**\n * The base implementation of `_.shuffle`.\n *\n * @private\n * @param {Array|Object} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n */\n function baseShuffle(collection) {\n return shuffleSelf(values(collection));\n }\n\n /**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n }\n\n /**\n * The base implementation of `_.some` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function baseSome(collection, predicate) {\n var result;\n\n baseEach(collection, function(value, index, collection) {\n result = predicate(value, index, collection);\n return !result;\n });\n return !!result;\n }\n\n /**\n * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which\n * performs a binary search of `array` to determine the index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function baseSortedIndex(array, value, retHighest) {\n var low = 0,\n high = array == null ? low : array.length;\n\n if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {\n while (low < high) {\n var mid = (low + high) >>> 1,\n computed = array[mid];\n\n if (computed !== null && !isSymbol(computed) &&\n (retHighest ? (computed <= value) : (computed < value))) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n return baseSortedIndexBy(array, value, identity, retHighest);\n }\n\n /**\n * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`\n * which invokes `iteratee` for `value` and each element of `array` to compute\n * their sort ranking. The iteratee is invoked with one argument; (value).\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} iteratee The iteratee invoked per element.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function baseSortedIndexBy(array, value, iteratee, retHighest) {\n var low = 0,\n high = array == null ? 0 : array.length;\n if (high === 0) {\n return 0;\n }\n\n value = iteratee(value);\n var valIsNaN = value !== value,\n valIsNull = value === null,\n valIsSymbol = isSymbol(value),\n valIsUndefined = value === undefined$1;\n\n while (low < high) {\n var mid = nativeFloor((low + high) / 2),\n computed = iteratee(array[mid]),\n othIsDefined = computed !== undefined$1,\n othIsNull = computed === null,\n othIsReflexive = computed === computed,\n othIsSymbol = isSymbol(computed);\n\n if (valIsNaN) {\n var setLow = retHighest || othIsReflexive;\n } else if (valIsUndefined) {\n setLow = othIsReflexive && (retHighest || othIsDefined);\n } else if (valIsNull) {\n setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);\n } else if (valIsSymbol) {\n setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);\n } else if (othIsNull || othIsSymbol) {\n setLow = false;\n } else {\n setLow = retHighest ? (computed <= value) : (computed < value);\n }\n if (setLow) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return nativeMin(high, MAX_ARRAY_INDEX);\n }\n\n /**\n * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseSortedUniq(array, iteratee) {\n var index = -1,\n length = array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n if (!index || !eq(computed, seen)) {\n var seen = computed;\n result[resIndex++] = value === 0 ? 0 : value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.toNumber` which doesn't ensure correct\n * conversions of binary, hexadecimal, or octal string values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n */\n function baseToNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n return +value;\n }\n\n /**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\n function baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n }\n\n /**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.unset`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The property path to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n */\n function baseUnset(object, path) {\n path = castPath(path, object);\n object = parent(object, path);\n return object == null || delete object[toKey(last(path))];\n }\n\n /**\n * The base implementation of `_.update`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to update.\n * @param {Function} updater The function to produce the updated value.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseUpdate(object, path, updater, customizer) {\n return baseSet(object, path, updater(baseGet(object, path)), customizer);\n }\n\n /**\n * The base implementation of methods like `_.dropWhile` and `_.takeWhile`\n * without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {Function} predicate The function invoked per iteration.\n * @param {boolean} [isDrop] Specify dropping elements instead of taking them.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseWhile(array, predicate, isDrop, fromRight) {\n var length = array.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length) &&\n predicate(array[index], index, array)) {}\n\n return isDrop\n ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))\n : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));\n }\n\n /**\n * The base implementation of `wrapperValue` which returns the result of\n * performing a sequence of actions on the unwrapped `value`, where each\n * successive action is supplied the return value of the previous.\n *\n * @private\n * @param {*} value The unwrapped value.\n * @param {Array} actions Actions to perform to resolve the unwrapped value.\n * @returns {*} Returns the resolved value.\n */\n function baseWrapperValue(value, actions) {\n var result = value;\n if (result instanceof LazyWrapper) {\n result = result.value();\n }\n return arrayReduce(actions, function(result, action) {\n return action.func.apply(action.thisArg, arrayPush([result], action.args));\n }, result);\n }\n\n /**\n * The base implementation of methods like `_.xor`, without support for\n * iteratee shorthands, that accepts an array of arrays to inspect.\n *\n * @private\n * @param {Array} arrays The arrays to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of values.\n */\n function baseXor(arrays, iteratee, comparator) {\n var length = arrays.length;\n if (length < 2) {\n return length ? baseUniq(arrays[0]) : [];\n }\n var index = -1,\n result = Array(length);\n\n while (++index < length) {\n var array = arrays[index],\n othIndex = -1;\n\n while (++othIndex < length) {\n if (othIndex != index) {\n result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);\n }\n }\n }\n return baseUniq(baseFlatten(result, 1), iteratee, comparator);\n }\n\n /**\n * This base implementation of `_.zipObject` which assigns values using `assignFunc`.\n *\n * @private\n * @param {Array} props The property identifiers.\n * @param {Array} values The property values.\n * @param {Function} assignFunc The function to assign values.\n * @returns {Object} Returns the new object.\n */\n function baseZipObject(props, values, assignFunc) {\n var index = -1,\n length = props.length,\n valsLength = values.length,\n result = {};\n\n while (++index < length) {\n var value = index < valsLength ? values[index] : undefined$1;\n assignFunc(result, props[index], value);\n }\n return result;\n }\n\n /**\n * Casts `value` to an empty array if it's not an array like object.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Array|Object} Returns the cast array-like object.\n */\n function castArrayLikeObject(value) {\n return isArrayLikeObject(value) ? value : [];\n }\n\n /**\n * Casts `value` to `identity` if it's not a function.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Function} Returns cast function.\n */\n function castFunction(value) {\n return typeof value == 'function' ? value : identity;\n }\n\n /**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\n function castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n }\n\n /**\n * A `baseRest` alias which can be replaced with `identity` by module\n * replacement plugins.\n *\n * @private\n * @type {Function}\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\n var castRest = baseRest;\n\n /**\n * Casts `array` to a slice if it's needed.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {number} start The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the cast slice.\n */\n function castSlice(array, start, end) {\n var length = array.length;\n end = end === undefined$1 ? length : end;\n return (!start && end >= length) ? array : baseSlice(array, start, end);\n }\n\n /**\n * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).\n *\n * @private\n * @param {number|Object} id The timer id or timeout object of the timer to clear.\n */\n var clearTimeout = ctxClearTimeout || function(id) {\n return root.clearTimeout(id);\n };\n\n /**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\n function cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n }\n\n /**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\n function cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n }\n\n /**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\n function cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n }\n\n /**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\n function cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n }\n\n /**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\n function cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n }\n\n /**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\n function cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n }\n\n /**\n * Compares values to sort them in ascending order.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\n function compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined$1,\n valIsNull = value === null,\n valIsReflexive = value === value,\n valIsSymbol = isSymbol(value);\n\n var othIsDefined = other !== undefined$1,\n othIsNull = other === null,\n othIsReflexive = other === other,\n othIsSymbol = isSymbol(other);\n\n if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||\n (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||\n (valIsNull && othIsDefined && othIsReflexive) ||\n (!valIsDefined && othIsReflexive) ||\n !valIsReflexive) {\n return 1;\n }\n if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||\n (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||\n (othIsNull && valIsDefined && valIsReflexive) ||\n (!othIsDefined && valIsReflexive) ||\n !othIsReflexive) {\n return -1;\n }\n }\n return 0;\n }\n\n /**\n * Used by `_.orderBy` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\n * specify an order of \"desc\" for descending or \"asc\" for ascending sort order\n * of corresponding values.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]|string[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\n function compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = compareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * (order == 'desc' ? -1 : 1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n }\n\n /**\n * Creates an array that is the composition of partially applied arguments,\n * placeholders, and provided arguments into a single array of arguments.\n *\n * @private\n * @param {Array} args The provided arguments.\n * @param {Array} partials The arguments to prepend to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @params {boolean} [isCurried] Specify composing for a curried function.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgs(args, partials, holders, isCurried) {\n var argsIndex = -1,\n argsLength = args.length,\n holdersLength = holders.length,\n leftIndex = -1,\n leftLength = partials.length,\n rangeLength = nativeMax(argsLength - holdersLength, 0),\n result = Array(leftLength + rangeLength),\n isUncurried = !isCurried;\n\n while (++leftIndex < leftLength) {\n result[leftIndex] = partials[leftIndex];\n }\n while (++argsIndex < holdersLength) {\n if (isUncurried || argsIndex < argsLength) {\n result[holders[argsIndex]] = args[argsIndex];\n }\n }\n while (rangeLength--) {\n result[leftIndex++] = args[argsIndex++];\n }\n return result;\n }\n\n /**\n * This function is like `composeArgs` except that the arguments composition\n * is tailored for `_.partialRight`.\n *\n * @private\n * @param {Array} args The provided arguments.\n * @param {Array} partials The arguments to append to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @params {boolean} [isCurried] Specify composing for a curried function.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgsRight(args, partials, holders, isCurried) {\n var argsIndex = -1,\n argsLength = args.length,\n holdersIndex = -1,\n holdersLength = holders.length,\n rightIndex = -1,\n rightLength = partials.length,\n rangeLength = nativeMax(argsLength - holdersLength, 0),\n result = Array(rangeLength + rightLength),\n isUncurried = !isCurried;\n\n while (++argsIndex < rangeLength) {\n result[argsIndex] = args[argsIndex];\n }\n var offset = argsIndex;\n while (++rightIndex < rightLength) {\n result[offset + rightIndex] = partials[rightIndex];\n }\n while (++holdersIndex < holdersLength) {\n if (isUncurried || argsIndex < argsLength) {\n result[offset + holders[holdersIndex]] = args[argsIndex++];\n }\n }\n return result;\n }\n\n /**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\n function copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n }\n\n /**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\n function copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined$1;\n\n if (newValue === undefined$1) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n }\n\n /**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n }\n\n /**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n }\n\n /**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\n function createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, getIteratee(iteratee, 2), accumulator);\n };\n }\n\n /**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\n function createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined$1,\n guard = length > 2 ? sources[2] : undefined$1;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined$1;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined$1 : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n }\n\n /**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n }\n\n /**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with the optional `this`\n * binding of `thisArg`.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createBind(func, bitmask, thisArg) {\n var isBind = bitmask & WRAP_BIND_FLAG,\n Ctor = createCtor(func);\n\n function wrapper() {\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return fn.apply(isBind ? thisArg : this, arguments);\n }\n return wrapper;\n }\n\n /**\n * Creates a function like `_.lowerFirst`.\n *\n * @private\n * @param {string} methodName The name of the `String` case method to use.\n * @returns {Function} Returns the new case function.\n */\n function createCaseFirst(methodName) {\n return function(string) {\n string = toString(string);\n\n var strSymbols = hasUnicode(string)\n ? stringToArray(string)\n : undefined$1;\n\n var chr = strSymbols\n ? strSymbols[0]\n : string.charAt(0);\n\n var trailing = strSymbols\n ? castSlice(strSymbols, 1).join('')\n : string.slice(1);\n\n return chr[methodName]() + trailing;\n };\n }\n\n /**\n * Creates a function like `_.camelCase`.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\n function createCompounder(callback) {\n return function(string) {\n return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');\n };\n }\n\n /**\n * Creates a function that produces an instance of `Ctor` regardless of\n * whether it was invoked as part of a `new` expression or by `call` or `apply`.\n *\n * @private\n * @param {Function} Ctor The constructor to wrap.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCtor(Ctor) {\n return function() {\n // Use a `switch` statement to work with class constructors. See\n // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist\n // for more details.\n var args = arguments;\n switch (args.length) {\n case 0: return new Ctor;\n case 1: return new Ctor(args[0]);\n case 2: return new Ctor(args[0], args[1]);\n case 3: return new Ctor(args[0], args[1], args[2]);\n case 4: return new Ctor(args[0], args[1], args[2], args[3]);\n case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);\n case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);\n case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\n }\n var thisBinding = baseCreate(Ctor.prototype),\n result = Ctor.apply(thisBinding, args);\n\n // Mimic the constructor's `return` behavior.\n // See https://es5.github.io/#x13.2.2 for more details.\n return isObject(result) ? result : thisBinding;\n };\n }\n\n /**\n * Creates a function that wraps `func` to enable currying.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {number} arity The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCurry(func, bitmask, arity) {\n var Ctor = createCtor(func);\n\n function wrapper() {\n var length = arguments.length,\n args = Array(length),\n index = length,\n placeholder = getHolder(wrapper);\n\n while (index--) {\n args[index] = arguments[index];\n }\n var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)\n ? []\n : replaceHolders(args, placeholder);\n\n length -= holders.length;\n if (length < arity) {\n return createRecurry(\n func, bitmask, createHybrid, wrapper.placeholder, undefined$1,\n args, holders, undefined$1, undefined$1, arity - length);\n }\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return apply(fn, this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\n function createFind(findIndexFunc) {\n return function(collection, predicate, fromIndex) {\n var iterable = Object(collection);\n if (!isArrayLike(collection)) {\n var iteratee = getIteratee(predicate, 3);\n collection = keys(collection);\n predicate = function(key) { return iteratee(iterable[key], key, iterable); };\n }\n var index = findIndexFunc(collection, predicate, fromIndex);\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined$1;\n };\n }\n\n /**\n * Creates a `_.flow` or `_.flowRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new flow function.\n */\n function createFlow(fromRight) {\n return flatRest(function(funcs) {\n var length = funcs.length,\n index = length,\n prereq = LodashWrapper.prototype.thru;\n\n if (fromRight) {\n funcs.reverse();\n }\n while (index--) {\n var func = funcs[index];\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (prereq && !wrapper && getFuncName(func) == 'wrapper') {\n var wrapper = new LodashWrapper([], true);\n }\n }\n index = wrapper ? index : length;\n while (++index < length) {\n func = funcs[index];\n\n var funcName = getFuncName(func),\n data = funcName == 'wrapper' ? getData(func) : undefined$1;\n\n if (data && isLaziable(data[0]) &&\n data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&\n !data[4].length && data[9] == 1\n ) {\n wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);\n } else {\n wrapper = (func.length == 1 && isLaziable(func))\n ? wrapper[funcName]()\n : wrapper.thru(func);\n }\n }\n return function() {\n var args = arguments,\n value = args[0];\n\n if (wrapper && args.length == 1 && isArray(value)) {\n return wrapper.plant(value).value();\n }\n var index = 0,\n result = length ? funcs[index].apply(this, args) : value;\n\n while (++index < length) {\n result = funcs[index].call(this, result);\n }\n return result;\n };\n });\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with optional `this`\n * binding of `thisArg`, partial application, and currying.\n *\n * @private\n * @param {Function|string} func The function or method name to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to\n * the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [partialsRight] The arguments to append to those provided\n * to the new function.\n * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {\n var isAry = bitmask & WRAP_ARY_FLAG,\n isBind = bitmask & WRAP_BIND_FLAG,\n isBindKey = bitmask & WRAP_BIND_KEY_FLAG,\n isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),\n isFlip = bitmask & WRAP_FLIP_FLAG,\n Ctor = isBindKey ? undefined$1 : createCtor(func);\n\n function wrapper() {\n var length = arguments.length,\n args = Array(length),\n index = length;\n\n while (index--) {\n args[index] = arguments[index];\n }\n if (isCurried) {\n var placeholder = getHolder(wrapper),\n holdersCount = countHolders(args, placeholder);\n }\n if (partials) {\n args = composeArgs(args, partials, holders, isCurried);\n }\n if (partialsRight) {\n args = composeArgsRight(args, partialsRight, holdersRight, isCurried);\n }\n length -= holdersCount;\n if (isCurried && length < arity) {\n var newHolders = replaceHolders(args, placeholder);\n return createRecurry(\n func, bitmask, createHybrid, wrapper.placeholder, thisArg,\n args, newHolders, argPos, ary, arity - length\n );\n }\n var thisBinding = isBind ? thisArg : this,\n fn = isBindKey ? thisBinding[func] : func;\n\n length = args.length;\n if (argPos) {\n args = reorder(args, argPos);\n } else if (isFlip && length > 1) {\n args.reverse();\n }\n if (isAry && ary < length) {\n args.length = ary;\n }\n if (this && this !== root && this instanceof wrapper) {\n fn = Ctor || createCtor(fn);\n }\n return fn.apply(thisBinding, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a function like `_.invertBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} toIteratee The function to resolve iteratees.\n * @returns {Function} Returns the new inverter function.\n */\n function createInverter(setter, toIteratee) {\n return function(object, iteratee) {\n return baseInverter(object, setter, toIteratee(iteratee), {});\n };\n }\n\n /**\n * Creates a function that performs a mathematical operation on two values.\n *\n * @private\n * @param {Function} operator The function to perform the operation.\n * @param {number} [defaultValue] The value used for `undefined` arguments.\n * @returns {Function} Returns the new mathematical operation function.\n */\n function createMathOperation(operator, defaultValue) {\n return function(value, other) {\n var result;\n if (value === undefined$1 && other === undefined$1) {\n return defaultValue;\n }\n if (value !== undefined$1) {\n result = value;\n }\n if (other !== undefined$1) {\n if (result === undefined$1) {\n return other;\n }\n if (typeof value == 'string' || typeof other == 'string') {\n value = baseToString(value);\n other = baseToString(other);\n } else {\n value = baseToNumber(value);\n other = baseToNumber(other);\n }\n result = operator(value, other);\n }\n return result;\n };\n }\n\n /**\n * Creates a function like `_.over`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over iteratees.\n * @returns {Function} Returns the new over function.\n */\n function createOver(arrayFunc) {\n return flatRest(function(iteratees) {\n iteratees = arrayMap(iteratees, baseUnary(getIteratee()));\n return baseRest(function(args) {\n var thisArg = this;\n return arrayFunc(iteratees, function(iteratee) {\n return apply(iteratee, thisArg, args);\n });\n });\n });\n }\n\n /**\n * Creates the padding for `string` based on `length`. The `chars` string\n * is truncated if the number of characters exceeds `length`.\n *\n * @private\n * @param {number} length The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padding for `string`.\n */\n function createPadding(length, chars) {\n chars = chars === undefined$1 ? ' ' : baseToString(chars);\n\n var charsLength = chars.length;\n if (charsLength < 2) {\n return charsLength ? baseRepeat(chars, length) : chars;\n }\n var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));\n return hasUnicode(chars)\n ? castSlice(stringToArray(result), 0, length).join('')\n : result.slice(0, length);\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with the `this` binding\n * of `thisArg` and `partials` prepended to the arguments it receives.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} partials The arguments to prepend to those provided to\n * the new function.\n * @returns {Function} Returns the new wrapped function.\n */\n function createPartial(func, bitmask, thisArg, partials) {\n var isBind = bitmask & WRAP_BIND_FLAG,\n Ctor = createCtor(func);\n\n function wrapper() {\n var argsIndex = -1,\n argsLength = arguments.length,\n leftIndex = -1,\n leftLength = partials.length,\n args = Array(leftLength + argsLength),\n fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n\n while (++leftIndex < leftLength) {\n args[leftIndex] = partials[leftIndex];\n }\n while (argsLength--) {\n args[leftIndex++] = arguments[++argsIndex];\n }\n return apply(fn, isBind ? thisArg : this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.range` or `_.rangeRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new range function.\n */\n function createRange(fromRight) {\n return function(start, end, step) {\n if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {\n end = step = undefined$1;\n }\n // Ensure the sign of `-0` is preserved.\n start = toFinite(start);\n if (end === undefined$1) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n step = step === undefined$1 ? (start < end ? 1 : -1) : toFinite(step);\n return baseRange(start, end, step, fromRight);\n };\n }\n\n /**\n * Creates a function that performs a relational operation on two values.\n *\n * @private\n * @param {Function} operator The function to perform the operation.\n * @returns {Function} Returns the new relational operation function.\n */\n function createRelationalOperation(operator) {\n return function(value, other) {\n if (!(typeof value == 'string' && typeof other == 'string')) {\n value = toNumber(value);\n other = toNumber(other);\n }\n return operator(value, other);\n };\n }\n\n /**\n * Creates a function that wraps `func` to continue currying.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {Function} wrapFunc The function to create the `func` wrapper.\n * @param {*} placeholder The placeholder value.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to\n * the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {\n var isCurry = bitmask & WRAP_CURRY_FLAG,\n newHolders = isCurry ? holders : undefined$1,\n newHoldersRight = isCurry ? undefined$1 : holders,\n newPartials = isCurry ? partials : undefined$1,\n newPartialsRight = isCurry ? undefined$1 : partials;\n\n bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);\n bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);\n\n if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {\n bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);\n }\n var newData = [\n func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,\n newHoldersRight, argPos, ary, arity\n ];\n\n var result = wrapFunc.apply(undefined$1, newData);\n if (isLaziable(func)) {\n setData(result, newData);\n }\n result.placeholder = placeholder;\n return setWrapToString(result, func, bitmask);\n }\n\n /**\n * Creates a function like `_.round`.\n *\n * @private\n * @param {string} methodName The name of the `Math` method to use when rounding.\n * @returns {Function} Returns the new round function.\n */\n function createRound(methodName) {\n var func = Math[methodName];\n return function(number, precision) {\n number = toNumber(number);\n precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);\n if (precision && nativeIsFinite(number)) {\n // Shift with exponential notation to avoid floating-point issues.\n // See [MDN](https://mdn.io/round#Examples) for more details.\n var pair = (toString(number) + 'e').split('e'),\n value = func(pair[0] + 'e' + (+pair[1] + precision));\n\n pair = (toString(value) + 'e').split('e');\n return +(pair[0] + 'e' + (+pair[1] - precision));\n }\n return func(number);\n };\n }\n\n /**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\n var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n };\n\n /**\n * Creates a `_.toPairs` or `_.toPairsIn` function.\n *\n * @private\n * @param {Function} keysFunc The function to get the keys of a given object.\n * @returns {Function} Returns the new pairs function.\n */\n function createToPairs(keysFunc) {\n return function(object) {\n var tag = getTag(object);\n if (tag == mapTag) {\n return mapToArray(object);\n }\n if (tag == setTag) {\n return setToPairs(object);\n }\n return baseToPairs(object, keysFunc(object));\n };\n }\n\n /**\n * Creates a function that either curries or invokes `func` with optional\n * `this` binding and partially applied arguments.\n *\n * @private\n * @param {Function|string} func The function or method name to wrap.\n * @param {number} bitmask The bitmask flags.\n * 1 - `_.bind`\n * 2 - `_.bindKey`\n * 4 - `_.curry` or `_.curryRight` of a bound function\n * 8 - `_.curry`\n * 16 - `_.curryRight`\n * 32 - `_.partial`\n * 64 - `_.partialRight`\n * 128 - `_.rearg`\n * 256 - `_.ary`\n * 512 - `_.flip`\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to be partially applied.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {\n var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;\n if (!isBindKey && typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var length = partials ? partials.length : 0;\n if (!length) {\n bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);\n partials = holders = undefined$1;\n }\n ary = ary === undefined$1 ? ary : nativeMax(toInteger(ary), 0);\n arity = arity === undefined$1 ? arity : toInteger(arity);\n length -= holders ? holders.length : 0;\n\n if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {\n var partialsRight = partials,\n holdersRight = holders;\n\n partials = holders = undefined$1;\n }\n var data = isBindKey ? undefined$1 : getData(func);\n\n var newData = [\n func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,\n argPos, ary, arity\n ];\n\n if (data) {\n mergeData(newData, data);\n }\n func = newData[0];\n bitmask = newData[1];\n thisArg = newData[2];\n partials = newData[3];\n holders = newData[4];\n arity = newData[9] = newData[9] === undefined$1\n ? (isBindKey ? 0 : func.length)\n : nativeMax(newData[9] - length, 0);\n\n if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {\n bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);\n }\n if (!bitmask || bitmask == WRAP_BIND_FLAG) {\n var result = createBind(func, bitmask, thisArg);\n } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {\n result = createCurry(func, bitmask, arity);\n } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {\n result = createPartial(func, bitmask, thisArg, partials);\n } else {\n result = createHybrid.apply(undefined$1, newData);\n }\n var setter = data ? baseSetData : setData;\n return setWrapToString(setter(result, newData), func, bitmask);\n }\n\n /**\n * Used by `_.defaults` to customize its `_.assignIn` use to assign properties\n * of source objects to the destination object for all destination properties\n * that resolve to `undefined`.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\n function customDefaultsAssignIn(objValue, srcValue, key, object) {\n if (objValue === undefined$1 ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n }\n\n /**\n * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source\n * objects into destination objects that are passed thru.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to merge.\n * @param {Object} object The parent object of `objValue`.\n * @param {Object} source The parent object of `srcValue`.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n * @returns {*} Returns the value to assign.\n */\n function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {\n if (isObject(objValue) && isObject(srcValue)) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, objValue);\n baseMerge(objValue, srcValue, undefined$1, customDefaultsMerge, stack);\n stack['delete'](srcValue);\n }\n return objValue;\n }\n\n /**\n * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain\n * objects.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {string} key The key of the property to inspect.\n * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.\n */\n function customOmitClone(value) {\n return isPlainObject(value) ? undefined$1 : value;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\n function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined$1;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined$1) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined$1\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n }\n\n /**\n * A specialized version of `baseRest` which flattens the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\n function flatRest(func) {\n return setToString(overRest(func, undefined$1, flatten), func + '');\n }\n\n /**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n }\n\n /**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n }\n\n /**\n * Gets metadata for `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {*} Returns the metadata for `func`.\n */\n var getData = !metaMap ? noop : function(func) {\n return metaMap.get(func);\n };\n\n /**\n * Gets the name of `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {string} Returns the function name.\n */\n function getFuncName(func) {\n var result = (func.name + ''),\n array = realNames[result],\n length = hasOwnProperty.call(realNames, result) ? array.length : 0;\n\n while (length--) {\n var data = array[length],\n otherFunc = data.func;\n if (otherFunc == null || otherFunc == func) {\n return data.name;\n }\n }\n return result;\n }\n\n /**\n * Gets the argument placeholder value for `func`.\n *\n * @private\n * @param {Function} func The function to inspect.\n * @returns {*} Returns the placeholder value.\n */\n function getHolder(func) {\n var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;\n return object.placeholder;\n }\n\n /**\n * Gets the appropriate \"iteratee\" function. If `_.iteratee` is customized,\n * this function returns the custom method, otherwise it returns `baseIteratee`.\n * If arguments are provided, the chosen function is invoked with them and\n * its result is returned.\n *\n * @private\n * @param {*} [value] The value to convert to an iteratee.\n * @param {number} [arity] The arity of the created iteratee.\n * @returns {Function} Returns the chosen function or its result.\n */\n function getIteratee() {\n var result = lodash.iteratee || iteratee;\n result = result === iteratee ? baseIteratee : result;\n return arguments.length ? result(arguments[0], arguments[1]) : result;\n }\n\n /**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\n function getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n }\n\n /**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\n function getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n }\n\n /**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\n function getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined$1;\n }\n\n /**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\n function getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined$1;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n }\n\n /**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n };\n\n /**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n };\n\n /**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n var getTag = baseGetTag;\n\n // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\n if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined$1,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n }\n\n /**\n * Gets the view, applying any `transforms` to the `start` and `end` positions.\n *\n * @private\n * @param {number} start The start of the view.\n * @param {number} end The end of the view.\n * @param {Array} transforms The transformations to apply to the view.\n * @returns {Object} Returns an object containing the `start` and `end`\n * positions of the view.\n */\n function getView(start, end, transforms) {\n var index = -1,\n length = transforms.length;\n\n while (++index < length) {\n var data = transforms[index],\n size = data.size;\n\n switch (data.type) {\n case 'drop': start += size; break;\n case 'dropRight': end -= size; break;\n case 'take': end = nativeMin(end, start + size); break;\n case 'takeRight': start = nativeMax(start, end - size); break;\n }\n }\n return { 'start': start, 'end': end };\n }\n\n /**\n * Extracts wrapper details from the `source` body comment.\n *\n * @private\n * @param {string} source The source to inspect.\n * @returns {Array} Returns the wrapper details.\n */\n function getWrapDetails(source) {\n var match = source.match(reWrapDetails);\n return match ? match[1].split(reSplitDetails) : [];\n }\n\n /**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\n function hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n }\n\n /**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\n function initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n }\n\n /**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n }\n\n /**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n }\n\n /**\n * Inserts wrapper `details` in a comment at the top of the `source` body.\n *\n * @private\n * @param {string} source The source to modify.\n * @returns {Array} details The details to insert.\n * @returns {string} Returns the modified source.\n */\n function insertWrapDetails(source, details) {\n var length = details.length;\n if (!length) {\n return source;\n }\n var lastIndex = length - 1;\n details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];\n details = details.join(length > 2 ? ', ' : ' ');\n return source.replace(reWrapComment, '{\\n/* [wrapped with ' + details + '] */\\n');\n }\n\n /**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\n function isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n }\n\n /**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\n function isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n }\n\n /**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\n function isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n }\n\n /**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\n function isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n }\n\n /**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\n function isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n }\n\n /**\n * Checks if `func` has a lazy counterpart.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` has a lazy counterpart,\n * else `false`.\n */\n function isLaziable(func) {\n var funcName = getFuncName(func),\n other = lodash[funcName];\n\n if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {\n return false;\n }\n if (func === other) {\n return true;\n }\n var data = getData(other);\n return !!data && func === data[0];\n }\n\n /**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\n function isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n }\n\n /**\n * Checks if `func` is capable of being masked.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `func` is maskable, else `false`.\n */\n var isMaskable = coreJsData ? isFunction : stubFalse;\n\n /**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\n function isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n }\n\n /**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\n function isStrictComparable(value) {\n return value === value && !isObject(value);\n }\n\n /**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined$1 || (key in Object(object)));\n };\n }\n\n /**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\n function memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n }\n\n /**\n * Merges the function metadata of `source` into `data`.\n *\n * Merging metadata reduces the number of wrappers used to invoke a function.\n * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`\n * may be applied regardless of execution order. Methods like `_.ary` and\n * `_.rearg` modify function arguments, making the order in which they are\n * executed important, preventing the merging of metadata. However, we make\n * an exception for a safe combined case where curried functions have `_.ary`\n * and or `_.rearg` applied.\n *\n * @private\n * @param {Array} data The destination metadata.\n * @param {Array} source The source metadata.\n * @returns {Array} Returns `data`.\n */\n function mergeData(data, source) {\n var bitmask = data[1],\n srcBitmask = source[1],\n newBitmask = bitmask | srcBitmask,\n isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);\n\n var isCombo =\n ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||\n ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||\n ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));\n\n // Exit early if metadata can't be merged.\n if (!(isCommon || isCombo)) {\n return data;\n }\n // Use source `thisArg` if available.\n if (srcBitmask & WRAP_BIND_FLAG) {\n data[2] = source[2];\n // Set when currying a bound function.\n newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;\n }\n // Compose partial arguments.\n var value = source[3];\n if (value) {\n var partials = data[3];\n data[3] = partials ? composeArgs(partials, value, source[4]) : value;\n data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];\n }\n // Compose partial right arguments.\n value = source[5];\n if (value) {\n partials = data[5];\n data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;\n data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];\n }\n // Use source `argPos` if available.\n value = source[7];\n if (value) {\n data[7] = value;\n }\n // Use source `ary` if it's smaller.\n if (srcBitmask & WRAP_ARY_FLAG) {\n data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);\n }\n // Use source `arity` if one is not provided.\n if (data[9] == null) {\n data[9] = source[9];\n }\n // Use source `func` and merge bitmasks.\n data[0] = source[0];\n data[1] = newBitmask;\n\n return data;\n }\n\n /**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\n function objectToString(value) {\n return nativeObjectToString.call(value);\n }\n\n /**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\n function overRest(func, start, transform) {\n start = nativeMax(start === undefined$1 ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n }\n\n /**\n * Gets the parent value at `path` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path to get the parent value of.\n * @returns {*} Returns the parent value.\n */\n function parent(object, path) {\n return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));\n }\n\n /**\n * Reorder `array` according to the specified indexes where the element at\n * the first index is assigned as the first element, the element at\n * the second index is assigned as the second element, and so on.\n *\n * @private\n * @param {Array} array The array to reorder.\n * @param {Array} indexes The arranged array indexes.\n * @returns {Array} Returns `array`.\n */\n function reorder(array, indexes) {\n var arrLength = array.length,\n length = nativeMin(indexes.length, arrLength),\n oldArray = copyArray(array);\n\n while (length--) {\n var index = indexes[length];\n array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined$1;\n }\n return array;\n }\n\n /**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n }\n\n /**\n * Sets metadata for `func`.\n *\n * **Note:** If this function becomes hot, i.e. is invoked a lot in a short\n * period of time, it will trip its breaker and transition to an identity\n * function to avoid garbage collection pauses in V8. See\n * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)\n * for more details.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var setData = shortOut(baseSetData);\n\n /**\n * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @returns {number|Object} Returns the timer id or timeout object.\n */\n var setTimeout = ctxSetTimeout || function(func, wait) {\n return root.setTimeout(func, wait);\n };\n\n /**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var setToString = shortOut(baseSetToString);\n\n /**\n * Sets the `toString` method of `wrapper` to mimic the source of `reference`\n * with wrapper details in a comment at the top of the source body.\n *\n * @private\n * @param {Function} wrapper The function to modify.\n * @param {Function} reference The reference function.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @returns {Function} Returns `wrapper`.\n */\n function setWrapToString(wrapper, reference, bitmask) {\n var source = (reference + '');\n return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));\n }\n\n /**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\n function shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined$1, arguments);\n };\n }\n\n /**\n * A specialized version of `_.shuffle` which mutates and sets the size of `array`.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @param {number} [size=array.length] The size of `array`.\n * @returns {Array} Returns `array`.\n */\n function shuffleSelf(array, size) {\n var index = -1,\n length = array.length,\n lastIndex = length - 1;\n\n size = size === undefined$1 ? length : size;\n while (++index < size) {\n var rand = baseRandom(index, lastIndex),\n value = array[rand];\n\n array[rand] = array[index];\n array[index] = value;\n }\n array.length = size;\n return array;\n }\n\n /**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\n var stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n });\n\n /**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\n function toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n }\n\n /**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\n function toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n }\n\n /**\n * Updates wrapper `details` based on `bitmask` flags.\n *\n * @private\n * @returns {Array} details The details to modify.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @returns {Array} Returns `details`.\n */\n function updateWrapDetails(details, bitmask) {\n arrayEach(wrapFlags, function(pair) {\n var value = '_.' + pair[0];\n if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {\n details.push(value);\n }\n });\n return details.sort();\n }\n\n /**\n * Creates a clone of `wrapper`.\n *\n * @private\n * @param {Object} wrapper The wrapper to clone.\n * @returns {Object} Returns the cloned wrapper.\n */\n function wrapperClone(wrapper) {\n if (wrapper instanceof LazyWrapper) {\n return wrapper.clone();\n }\n var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);\n result.__actions__ = copyArray(wrapper.__actions__);\n result.__index__ = wrapper.__index__;\n result.__values__ = wrapper.__values__;\n return result;\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of elements split into groups the length of `size`.\n * If `array` can't be split evenly, the final chunk will be the remaining\n * elements.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to process.\n * @param {number} [size=1] The length of each chunk\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the new array of chunks.\n * @example\n *\n * _.chunk(['a', 'b', 'c', 'd'], 2);\n * // => [['a', 'b'], ['c', 'd']]\n *\n * _.chunk(['a', 'b', 'c', 'd'], 3);\n * // => [['a', 'b', 'c'], ['d']]\n */\n function chunk(array, size, guard) {\n if ((guard ? isIterateeCall(array, size, guard) : size === undefined$1)) {\n size = 1;\n } else {\n size = nativeMax(toInteger(size), 0);\n }\n var length = array == null ? 0 : array.length;\n if (!length || size < 1) {\n return [];\n }\n var index = 0,\n resIndex = 0,\n result = Array(nativeCeil(length / size));\n\n while (index < length) {\n result[resIndex++] = baseSlice(array, index, (index += size));\n }\n return result;\n }\n\n /**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\n function compact(array) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n }\n\n /**\n * Creates a new array concatenating `array` with any additional arrays\n * and/or values.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to concatenate.\n * @param {...*} [values] The values to concatenate.\n * @returns {Array} Returns the new concatenated array.\n * @example\n *\n * var array = [1];\n * var other = _.concat(array, 2, [3], [[4]]);\n *\n * console.log(other);\n * // => [1, 2, 3, [4]]\n *\n * console.log(array);\n * // => [1]\n */\n function concat() {\n var length = arguments.length;\n if (!length) {\n return [];\n }\n var args = Array(length - 1),\n array = arguments[0],\n index = length;\n\n while (index--) {\n args[index - 1] = arguments[index];\n }\n return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));\n }\n\n /**\n * Creates an array of `array` values not included in the other given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * **Note:** Unlike `_.pullAll`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.without, _.xor\n * @example\n *\n * _.difference([2, 1], [2, 3]);\n * // => [1]\n */\n var difference = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))\n : [];\n });\n\n /**\n * This method is like `_.difference` except that it accepts `iteratee` which\n * is invoked for each element of `array` and `values` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array. The iteratee is invoked with one argument:\n * (value).\n *\n * **Note:** Unlike `_.pullAllBy`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');\n * // => [{ 'x': 2 }]\n */\n var differenceBy = baseRest(function(array, values) {\n var iteratee = last(values);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined$1;\n }\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))\n : [];\n });\n\n /**\n * This method is like `_.difference` except that it accepts `comparator`\n * which is invoked to compare elements of `array` to `values`. The order and\n * references of result values are determined by the first array. The comparator\n * is invoked with two arguments: (arrVal, othVal).\n *\n * **Note:** Unlike `_.pullAllWith`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n *\n * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);\n * // => [{ 'x': 2, 'y': 1 }]\n */\n var differenceWith = baseRest(function(array, values) {\n var comparator = last(values);\n if (isArrayLikeObject(comparator)) {\n comparator = undefined$1;\n }\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined$1, comparator)\n : [];\n });\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.drop([1, 2, 3]);\n * // => [2, 3]\n *\n * _.drop([1, 2, 3], 2);\n * // => [3]\n *\n * _.drop([1, 2, 3], 5);\n * // => []\n *\n * _.drop([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function drop(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined$1) ? 1 : toInteger(n);\n return baseSlice(array, n < 0 ? 0 : n, length);\n }\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRight([1, 2, 3]);\n * // => [1, 2]\n *\n * _.dropRight([1, 2, 3], 2);\n * // => [1]\n *\n * _.dropRight([1, 2, 3], 5);\n * // => []\n *\n * _.dropRight([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function dropRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined$1) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the end.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.dropRightWhile(users, function(o) { return !o.active; });\n * // => objects for ['barney']\n *\n * // The `_.matches` iteratee shorthand.\n * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });\n * // => objects for ['barney', 'fred']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.dropRightWhile(users, ['active', false]);\n * // => objects for ['barney']\n *\n * // The `_.property` iteratee shorthand.\n * _.dropRightWhile(users, 'active');\n * // => objects for ['barney', 'fred', 'pebbles']\n */\n function dropRightWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), true, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the beginning.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.dropWhile(users, function(o) { return !o.active; });\n * // => objects for ['pebbles']\n *\n * // The `_.matches` iteratee shorthand.\n * _.dropWhile(users, { 'user': 'barney', 'active': false });\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.dropWhile(users, ['active', false]);\n * // => objects for ['pebbles']\n *\n * // The `_.property` iteratee shorthand.\n * _.dropWhile(users, 'active');\n * // => objects for ['barney', 'fred', 'pebbles']\n */\n function dropWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), true)\n : [];\n }\n\n /**\n * Fills elements of `array` with `value` from `start` up to, but not\n * including, `end`.\n *\n * **Note:** This method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Array\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.fill(array, 'a');\n * console.log(array);\n * // => ['a', 'a', 'a']\n *\n * _.fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * _.fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n */\n function fill(array, value, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {\n start = 0;\n end = length;\n }\n return baseFill(array, value, start, end);\n }\n\n /**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(o) { return o.user == 'barney'; });\n * // => 0\n *\n * // The `_.matches` iteratee shorthand.\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findIndex(users, ['active', false]);\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.findIndex(users, 'active');\n * // => 2\n */\n function findIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseFindIndex(array, getIteratee(predicate, 3), index);\n }\n\n /**\n * This method is like `_.findIndex` except that it iterates over elements\n * of `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=array.length-1] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });\n * // => 2\n *\n * // The `_.matches` iteratee shorthand.\n * _.findLastIndex(users, { 'user': 'barney', 'active': true });\n * // => 0\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findLastIndex(users, ['active', false]);\n * // => 2\n *\n * // The `_.property` iteratee shorthand.\n * _.findLastIndex(users, 'active');\n * // => 0\n */\n function findLastIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = length - 1;\n if (fromIndex !== undefined$1) {\n index = toInteger(fromIndex);\n index = fromIndex < 0\n ? nativeMax(length + index, 0)\n : nativeMin(index, length - 1);\n }\n return baseFindIndex(array, getIteratee(predicate, 3), index, true);\n }\n\n /**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\n function flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : [];\n }\n\n /**\n * Recursively flattens `array`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flattenDeep([1, [2, [3, [4]], 5]]);\n * // => [1, 2, 3, 4, 5]\n */\n function flattenDeep(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, INFINITY) : [];\n }\n\n /**\n * Recursively flatten `array` up to `depth` times.\n *\n * @static\n * @memberOf _\n * @since 4.4.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @param {number} [depth=1] The maximum recursion depth.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * var array = [1, [2, [3, [4]], 5]];\n *\n * _.flattenDepth(array, 1);\n * // => [1, 2, [3, [4]], 5]\n *\n * _.flattenDepth(array, 2);\n * // => [1, 2, 3, [4], 5]\n */\n function flattenDepth(array, depth) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n depth = depth === undefined$1 ? 1 : toInteger(depth);\n return baseFlatten(array, depth);\n }\n\n /**\n * The inverse of `_.toPairs`; this method returns an object composed\n * from key-value `pairs`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} pairs The key-value pairs.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.fromPairs([['a', 1], ['b', 2]]);\n * // => { 'a': 1, 'b': 2 }\n */\n function fromPairs(pairs) {\n var index = -1,\n length = pairs == null ? 0 : pairs.length,\n result = {};\n\n while (++index < length) {\n var pair = pairs[index];\n result[pair[0]] = pair[1];\n }\n return result;\n }\n\n /**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias first\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.head([1, 2, 3]);\n * // => 1\n *\n * _.head([]);\n * // => undefined\n */\n function head(array) {\n return (array && array.length) ? array[0] : undefined$1;\n }\n\n /**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it's used as the\n * offset from the end of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // Search from the `fromIndex`.\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n */\n function indexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseIndexOf(array, value, index);\n }\n\n /**\n * Gets all but the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.initial([1, 2, 3]);\n * // => [1, 2]\n */\n function initial(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseSlice(array, 0, -1) : [];\n }\n\n /**\n * Creates an array of unique values that are included in all given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * _.intersection([2, 1], [2, 3]);\n * // => [2]\n */\n var intersection = baseRest(function(arrays) {\n var mapped = arrayMap(arrays, castArrayLikeObject);\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped)\n : [];\n });\n\n /**\n * This method is like `_.intersection` except that it accepts `iteratee`\n * which is invoked for each element of each `arrays` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [2.1]\n *\n * // The `_.property` iteratee shorthand.\n * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }]\n */\n var intersectionBy = baseRest(function(arrays) {\n var iteratee = last(arrays),\n mapped = arrayMap(arrays, castArrayLikeObject);\n\n if (iteratee === last(mapped)) {\n iteratee = undefined$1;\n } else {\n mapped.pop();\n }\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped, getIteratee(iteratee, 2))\n : [];\n });\n\n /**\n * This method is like `_.intersection` except that it accepts `comparator`\n * which is invoked to compare elements of `arrays`. The order and references\n * of result values are determined by the first array. The comparator is\n * invoked with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.intersectionWith(objects, others, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }]\n */\n var intersectionWith = baseRest(function(arrays) {\n var comparator = last(arrays),\n mapped = arrayMap(arrays, castArrayLikeObject);\n\n comparator = typeof comparator == 'function' ? comparator : undefined$1;\n if (comparator) {\n mapped.pop();\n }\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped, undefined$1, comparator)\n : [];\n });\n\n /**\n * Converts all elements in `array` into a string separated by `separator`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to convert.\n * @param {string} [separator=','] The element separator.\n * @returns {string} Returns the joined string.\n * @example\n *\n * _.join(['a', 'b', 'c'], '~');\n * // => 'a~b~c'\n */\n function join(array, separator) {\n return array == null ? '' : nativeJoin.call(array, separator);\n }\n\n /**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\n function last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined$1;\n }\n\n /**\n * This method is like `_.indexOf` except that it iterates over elements of\n * `array` from right to left.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=array.length-1] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.lastIndexOf([1, 2, 1, 2], 2);\n * // => 3\n *\n * // Search from the `fromIndex`.\n * _.lastIndexOf([1, 2, 1, 2], 2, 2);\n * // => 1\n */\n function lastIndexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = length;\n if (fromIndex !== undefined$1) {\n index = toInteger(fromIndex);\n index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);\n }\n return value === value\n ? strictLastIndexOf(array, value, index)\n : baseFindIndex(array, baseIsNaN, index, true);\n }\n\n /**\n * Gets the element at index `n` of `array`. If `n` is negative, the nth\n * element from the end is returned.\n *\n * @static\n * @memberOf _\n * @since 4.11.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=0] The index of the element to return.\n * @returns {*} Returns the nth element of `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'd'];\n *\n * _.nth(array, 1);\n * // => 'b'\n *\n * _.nth(array, -2);\n * // => 'c';\n */\n function nth(array, n) {\n return (array && array.length) ? baseNth(array, toInteger(n)) : undefined$1;\n }\n\n /**\n * Removes all given values from `array` using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`\n * to remove elements from an array by predicate.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...*} [values] The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'a', 'b', 'c'];\n *\n * _.pull(array, 'a', 'c');\n * console.log(array);\n * // => ['b', 'b']\n */\n var pull = baseRest(pullAll);\n\n /**\n * This method is like `_.pull` except that it accepts an array of values to remove.\n *\n * **Note:** Unlike `_.difference`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'a', 'b', 'c'];\n *\n * _.pullAll(array, ['a', 'c']);\n * console.log(array);\n * // => ['b', 'b']\n */\n function pullAll(array, values) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values)\n : array;\n }\n\n /**\n * This method is like `_.pullAll` except that it accepts `iteratee` which is\n * invoked for each element of `array` and `values` to generate the criterion\n * by which they're compared. The iteratee is invoked with one argument: (value).\n *\n * **Note:** Unlike `_.differenceBy`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];\n *\n * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');\n * console.log(array);\n * // => [{ 'x': 2 }]\n */\n function pullAllBy(array, values, iteratee) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values, getIteratee(iteratee, 2))\n : array;\n }\n\n /**\n * This method is like `_.pullAll` except that it accepts `comparator` which\n * is invoked to compare elements of `array` to `values`. The comparator is\n * invoked with two arguments: (arrVal, othVal).\n *\n * **Note:** Unlike `_.differenceWith`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];\n *\n * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);\n * console.log(array);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]\n */\n function pullAllWith(array, values, comparator) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values, undefined$1, comparator)\n : array;\n }\n\n /**\n * Removes elements from `array` corresponding to `indexes` and returns an\n * array of removed elements.\n *\n * **Note:** Unlike `_.at`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...(number|number[])} [indexes] The indexes of elements to remove.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = ['a', 'b', 'c', 'd'];\n * var pulled = _.pullAt(array, [1, 3]);\n *\n * console.log(array);\n * // => ['a', 'c']\n *\n * console.log(pulled);\n * // => ['b', 'd']\n */\n var pullAt = flatRest(function(array, indexes) {\n var length = array == null ? 0 : array.length,\n result = baseAt(array, indexes);\n\n basePullAt(array, arrayMap(indexes, function(index) {\n return isIndex(index, length) ? +index : index;\n }).sort(compareAscending));\n\n return result;\n });\n\n /**\n * Removes all elements from `array` that `predicate` returns truthy for\n * and returns an array of the removed elements. The predicate is invoked\n * with three arguments: (value, index, array).\n *\n * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`\n * to pull elements from an array by value.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = [1, 2, 3, 4];\n * var evens = _.remove(array, function(n) {\n * return n % 2 == 0;\n * });\n *\n * console.log(array);\n * // => [1, 3]\n *\n * console.log(evens);\n * // => [2, 4]\n */\n function remove(array, predicate) {\n var result = [];\n if (!(array && array.length)) {\n return result;\n }\n var index = -1,\n indexes = [],\n length = array.length;\n\n predicate = getIteratee(predicate, 3);\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result.push(value);\n indexes.push(index);\n }\n }\n basePullAt(array, indexes);\n return result;\n }\n\n /**\n * Reverses `array` so that the first element becomes the last, the second\n * element becomes the second to last, and so on.\n *\n * **Note:** This method mutates `array` and is based on\n * [`Array#reverse`](https://mdn.io/Array/reverse).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.reverse(array);\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function reverse(array) {\n return array == null ? array : nativeReverse.call(array);\n }\n\n /**\n * Creates a slice of `array` from `start` up to, but not including, `end`.\n *\n * **Note:** This method is used instead of\n * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are\n * returned.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function slice(array, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {\n start = 0;\n end = length;\n }\n else {\n start = start == null ? 0 : toInteger(start);\n end = end === undefined$1 ? length : toInteger(end);\n }\n return baseSlice(array, start, end);\n }\n\n /**\n * Uses a binary search to determine the lowest index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedIndex([30, 50], 40);\n * // => 1\n */\n function sortedIndex(array, value) {\n return baseSortedIndex(array, value);\n }\n\n /**\n * This method is like `_.sortedIndex` except that it accepts `iteratee`\n * which is invoked for `value` and each element of `array` to compute their\n * sort ranking. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * var objects = [{ 'x': 4 }, { 'x': 5 }];\n *\n * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.sortedIndexBy(objects, { 'x': 4 }, 'x');\n * // => 0\n */\n function sortedIndexBy(array, value, iteratee) {\n return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));\n }\n\n /**\n * This method is like `_.indexOf` except that it performs a binary\n * search on a sorted `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.sortedIndexOf([4, 5, 5, 5, 6], 5);\n * // => 1\n */\n function sortedIndexOf(array, value) {\n var length = array == null ? 0 : array.length;\n if (length) {\n var index = baseSortedIndex(array, value);\n if (index < length && eq(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * This method is like `_.sortedIndex` except that it returns the highest\n * index at which `value` should be inserted into `array` in order to\n * maintain its sort order.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedLastIndex([4, 5, 5, 5, 6], 5);\n * // => 4\n */\n function sortedLastIndex(array, value) {\n return baseSortedIndex(array, value, true);\n }\n\n /**\n * This method is like `_.sortedLastIndex` except that it accepts `iteratee`\n * which is invoked for `value` and each element of `array` to compute their\n * sort ranking. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * var objects = [{ 'x': 4 }, { 'x': 5 }];\n *\n * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });\n * // => 1\n *\n * // The `_.property` iteratee shorthand.\n * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');\n * // => 1\n */\n function sortedLastIndexBy(array, value, iteratee) {\n return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);\n }\n\n /**\n * This method is like `_.lastIndexOf` except that it performs a binary\n * search on a sorted `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);\n * // => 3\n */\n function sortedLastIndexOf(array, value) {\n var length = array == null ? 0 : array.length;\n if (length) {\n var index = baseSortedIndex(array, value, true) - 1;\n if (eq(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * This method is like `_.uniq` except that it's designed and optimized\n * for sorted arrays.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.sortedUniq([1, 1, 2]);\n * // => [1, 2]\n */\n function sortedUniq(array) {\n return (array && array.length)\n ? baseSortedUniq(array)\n : [];\n }\n\n /**\n * This method is like `_.uniqBy` except that it's designed and optimized\n * for sorted arrays.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);\n * // => [1.1, 2.3]\n */\n function sortedUniqBy(array, iteratee) {\n return (array && array.length)\n ? baseSortedUniq(array, getIteratee(iteratee, 2))\n : [];\n }\n\n /**\n * Gets all but the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.tail([1, 2, 3]);\n * // => [2, 3]\n */\n function tail(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseSlice(array, 1, length) : [];\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.take([1, 2, 3]);\n * // => [1]\n *\n * _.take([1, 2, 3], 2);\n * // => [1, 2]\n *\n * _.take([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.take([1, 2, 3], 0);\n * // => []\n */\n function take(array, n, guard) {\n if (!(array && array.length)) {\n return [];\n }\n n = (guard || n === undefined$1) ? 1 : toInteger(n);\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.takeRight([1, 2, 3]);\n * // => [3]\n *\n * _.takeRight([1, 2, 3], 2);\n * // => [2, 3]\n *\n * _.takeRight([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.takeRight([1, 2, 3], 0);\n * // => []\n */\n function takeRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined$1) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, n < 0 ? 0 : n, length);\n }\n\n /**\n * Creates a slice of `array` with elements taken from the end. Elements are\n * taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.takeRightWhile(users, function(o) { return !o.active; });\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.matches` iteratee shorthand.\n * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });\n * // => objects for ['pebbles']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.takeRightWhile(users, ['active', false]);\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.property` iteratee shorthand.\n * _.takeRightWhile(users, 'active');\n * // => []\n */\n function takeRightWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), false, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` with elements taken from the beginning. Elements\n * are taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.takeWhile(users, function(o) { return !o.active; });\n * // => objects for ['barney', 'fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.takeWhile(users, { 'user': 'barney', 'active': false });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.takeWhile(users, ['active', false]);\n * // => objects for ['barney', 'fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.takeWhile(users, 'active');\n * // => []\n */\n function takeWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3))\n : [];\n }\n\n /**\n * Creates an array of unique values, in order, from all given arrays using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([2], [1, 2]);\n * // => [2, 1]\n */\n var union = baseRest(function(arrays) {\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));\n });\n\n /**\n * This method is like `_.union` except that it accepts `iteratee` which is\n * invoked for each element of each `arrays` to generate the criterion by\n * which uniqueness is computed. Result values are chosen from the first\n * array in which the value occurs. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.unionBy([2.1], [1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n var unionBy = baseRest(function(arrays) {\n var iteratee = last(arrays);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined$1;\n }\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));\n });\n\n /**\n * This method is like `_.union` except that it accepts `comparator` which\n * is invoked to compare elements of `arrays`. Result values are chosen from\n * the first array in which the value occurs. The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.unionWith(objects, others, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n */\n var unionWith = baseRest(function(arrays) {\n var comparator = last(arrays);\n comparator = typeof comparator == 'function' ? comparator : undefined$1;\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined$1, comparator);\n });\n\n /**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurrence of each element\n * is kept. The order of result values is determined by the order they occur\n * in the array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n */\n function uniq(array) {\n return (array && array.length) ? baseUniq(array) : [];\n }\n\n /**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The order of result values is determined by the\n * order they occur in the array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n function uniqBy(array, iteratee) {\n return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];\n }\n\n /**\n * This method is like `_.uniq` except that it accepts `comparator` which\n * is invoked to compare elements of `array`. The order of result values is\n * determined by the order they occur in the array.The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.uniqWith(objects, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n */\n function uniqWith(array, comparator) {\n comparator = typeof comparator == 'function' ? comparator : undefined$1;\n return (array && array.length) ? baseUniq(array, undefined$1, comparator) : [];\n }\n\n /**\n * This method is like `_.zip` except that it accepts an array of grouped\n * elements and creates an array regrouping the elements to their pre-zip\n * configuration.\n *\n * @static\n * @memberOf _\n * @since 1.2.0\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);\n * // => [['a', 1, true], ['b', 2, false]]\n *\n * _.unzip(zipped);\n * // => [['a', 'b'], [1, 2], [true, false]]\n */\n function unzip(array) {\n if (!(array && array.length)) {\n return [];\n }\n var length = 0;\n array = arrayFilter(array, function(group) {\n if (isArrayLikeObject(group)) {\n length = nativeMax(group.length, length);\n return true;\n }\n });\n return baseTimes(length, function(index) {\n return arrayMap(array, baseProperty(index));\n });\n }\n\n /**\n * This method is like `_.unzip` except that it accepts `iteratee` to specify\n * how regrouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @param {Function} [iteratee=_.identity] The function to combine\n * regrouped values.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip([1, 2], [10, 20], [100, 200]);\n * // => [[1, 10, 100], [2, 20, 200]]\n *\n * _.unzipWith(zipped, _.add);\n * // => [3, 30, 300]\n */\n function unzipWith(array, iteratee) {\n if (!(array && array.length)) {\n return [];\n }\n var result = unzip(array);\n if (iteratee == null) {\n return result;\n }\n return arrayMap(result, function(group) {\n return apply(iteratee, undefined$1, group);\n });\n }\n\n /**\n * Creates an array excluding all given values using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.pull`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...*} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.difference, _.xor\n * @example\n *\n * _.without([2, 1, 2, 3], 1, 2);\n * // => [3]\n */\n var without = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, values)\n : [];\n });\n\n /**\n * Creates an array of unique values that is the\n * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)\n * of the given arrays. The order of result values is determined by the order\n * they occur in the arrays.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.difference, _.without\n * @example\n *\n * _.xor([2, 1], [2, 3]);\n * // => [1, 3]\n */\n var xor = baseRest(function(arrays) {\n return baseXor(arrayFilter(arrays, isArrayLikeObject));\n });\n\n /**\n * This method is like `_.xor` except that it accepts `iteratee` which is\n * invoked for each element of each `arrays` to generate the criterion by\n * which by which they're compared. The order of result values is determined\n * by the order they occur in the arrays. The iteratee is invoked with one\n * argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [1.2, 3.4]\n *\n * // The `_.property` iteratee shorthand.\n * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 2 }]\n */\n var xorBy = baseRest(function(arrays) {\n var iteratee = last(arrays);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined$1;\n }\n return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));\n });\n\n /**\n * This method is like `_.xor` except that it accepts `comparator` which is\n * invoked to compare elements of `arrays`. The order of result values is\n * determined by the order they occur in the arrays. The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.xorWith(objects, others, _.isEqual);\n * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n */\n var xorWith = baseRest(function(arrays) {\n var comparator = last(arrays);\n comparator = typeof comparator == 'function' ? comparator : undefined$1;\n return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined$1, comparator);\n });\n\n /**\n * Creates an array of grouped elements, the first of which contains the\n * first elements of the given arrays, the second of which contains the\n * second elements of the given arrays, and so on.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zip(['a', 'b'], [1, 2], [true, false]);\n * // => [['a', 1, true], ['b', 2, false]]\n */\n var zip = baseRest(unzip);\n\n /**\n * This method is like `_.fromPairs` except that it accepts two arrays,\n * one of property identifiers and one of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 0.4.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObject(['a', 'b'], [1, 2]);\n * // => { 'a': 1, 'b': 2 }\n */\n function zipObject(props, values) {\n return baseZipObject(props || [], values || [], assignValue);\n }\n\n /**\n * This method is like `_.zipObject` except that it supports property paths.\n *\n * @static\n * @memberOf _\n * @since 4.1.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);\n * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\n function zipObjectDeep(props, values) {\n return baseZipObject(props || [], values || [], baseSet);\n }\n\n /**\n * This method is like `_.zip` except that it accepts `iteratee` to specify\n * how grouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @param {Function} [iteratee=_.identity] The function to combine\n * grouped values.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {\n * return a + b + c;\n * });\n * // => [111, 222]\n */\n var zipWith = baseRest(function(arrays) {\n var length = arrays.length,\n iteratee = length > 1 ? arrays[length - 1] : undefined$1;\n\n iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined$1;\n return unzipWith(arrays, iteratee);\n });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` wrapper instance that wraps `value` with explicit method\n * chain sequences enabled. The result of such sequences must be unwrapped\n * with `_#value`.\n *\n * @static\n * @memberOf _\n * @since 1.3.0\n * @category Seq\n * @param {*} value The value to wrap.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'pebbles', 'age': 1 }\n * ];\n *\n * var youngest = _\n * .chain(users)\n * .sortBy('age')\n * .map(function(o) {\n * return o.user + ' is ' + o.age;\n * })\n * .head()\n * .value();\n * // => 'pebbles is 1'\n */\n function chain(value) {\n var result = lodash(value);\n result.__chain__ = true;\n return result;\n }\n\n /**\n * This method invokes `interceptor` and returns `value`. The interceptor\n * is invoked with one argument; (value). The purpose of this method is to\n * \"tap into\" a method chain sequence in order to modify intermediate results.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @returns {*} Returns `value`.\n * @example\n *\n * _([1, 2, 3])\n * .tap(function(array) {\n * // Mutate input array.\n * array.pop();\n * })\n * .reverse()\n * .value();\n * // => [2, 1]\n */\n function tap(value, interceptor) {\n interceptor(value);\n return value;\n }\n\n /**\n * This method is like `_.tap` except that it returns the result of `interceptor`.\n * The purpose of this method is to \"pass thru\" values replacing intermediate\n * results in a method chain sequence.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Seq\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @returns {*} Returns the result of `interceptor`.\n * @example\n *\n * _(' abc ')\n * .chain()\n * .trim()\n * .thru(function(value) {\n * return [value];\n * })\n * .value();\n * // => ['abc']\n */\n function thru(value, interceptor) {\n return interceptor(value);\n }\n\n /**\n * This method is the wrapper version of `_.at`.\n *\n * @name at\n * @memberOf _\n * @since 1.0.0\n * @category Seq\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n *\n * _(object).at(['a[0].b.c', 'a[1]']).value();\n * // => [3, 4]\n */\n var wrapperAt = flatRest(function(paths) {\n var length = paths.length,\n start = length ? paths[0] : 0,\n value = this.__wrapped__,\n interceptor = function(object) { return baseAt(object, paths); };\n\n if (length > 1 || this.__actions__.length ||\n !(value instanceof LazyWrapper) || !isIndex(start)) {\n return this.thru(interceptor);\n }\n value = value.slice(start, +start + (length ? 1 : 0));\n value.__actions__.push({\n 'func': thru,\n 'args': [interceptor],\n 'thisArg': undefined$1\n });\n return new LodashWrapper(value, this.__chain__).thru(function(array) {\n if (length && !array.length) {\n array.push(undefined$1);\n }\n return array;\n });\n });\n\n /**\n * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.\n *\n * @name chain\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 }\n * ];\n *\n * // A sequence without explicit chaining.\n * _(users).head();\n * // => { 'user': 'barney', 'age': 36 }\n *\n * // A sequence with explicit chaining.\n * _(users)\n * .chain()\n * .head()\n * .pick('user')\n * .value();\n * // => { 'user': 'barney' }\n */\n function wrapperChain() {\n return chain(this);\n }\n\n /**\n * Executes the chain sequence and returns the wrapped result.\n *\n * @name commit\n * @memberOf _\n * @since 3.2.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2];\n * var wrapped = _(array).push(3);\n *\n * console.log(array);\n * // => [1, 2]\n *\n * wrapped = wrapped.commit();\n * console.log(array);\n * // => [1, 2, 3]\n *\n * wrapped.last();\n * // => 3\n *\n * console.log(array);\n * // => [1, 2, 3]\n */\n function wrapperCommit() {\n return new LodashWrapper(this.value(), this.__chain__);\n }\n\n /**\n * Gets the next value on a wrapped object following the\n * [iterator protocol](https://mdn.io/iteration_protocols#iterator).\n *\n * @name next\n * @memberOf _\n * @since 4.0.0\n * @category Seq\n * @returns {Object} Returns the next iterator value.\n * @example\n *\n * var wrapped = _([1, 2]);\n *\n * wrapped.next();\n * // => { 'done': false, 'value': 1 }\n *\n * wrapped.next();\n * // => { 'done': false, 'value': 2 }\n *\n * wrapped.next();\n * // => { 'done': true, 'value': undefined }\n */\n function wrapperNext() {\n if (this.__values__ === undefined$1) {\n this.__values__ = toArray(this.value());\n }\n var done = this.__index__ >= this.__values__.length,\n value = done ? undefined$1 : this.__values__[this.__index__++];\n\n return { 'done': done, 'value': value };\n }\n\n /**\n * Enables the wrapper to be iterable.\n *\n * @name Symbol.iterator\n * @memberOf _\n * @since 4.0.0\n * @category Seq\n * @returns {Object} Returns the wrapper object.\n * @example\n *\n * var wrapped = _([1, 2]);\n *\n * wrapped[Symbol.iterator]() === wrapped;\n * // => true\n *\n * Array.from(wrapped);\n * // => [1, 2]\n */\n function wrapperToIterator() {\n return this;\n }\n\n /**\n * Creates a clone of the chain sequence planting `value` as the wrapped value.\n *\n * @name plant\n * @memberOf _\n * @since 3.2.0\n * @category Seq\n * @param {*} value The value to plant.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var wrapped = _([1, 2]).map(square);\n * var other = wrapped.plant([3, 4]);\n *\n * other.value();\n * // => [9, 16]\n *\n * wrapped.value();\n * // => [1, 4]\n */\n function wrapperPlant(value) {\n var result,\n parent = this;\n\n while (parent instanceof baseLodash) {\n var clone = wrapperClone(parent);\n clone.__index__ = 0;\n clone.__values__ = undefined$1;\n if (result) {\n previous.__wrapped__ = clone;\n } else {\n result = clone;\n }\n var previous = clone;\n parent = parent.__wrapped__;\n }\n previous.__wrapped__ = value;\n return result;\n }\n\n /**\n * This method is the wrapper version of `_.reverse`.\n *\n * **Note:** This method mutates the wrapped array.\n *\n * @name reverse\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _(array).reverse().value()\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function wrapperReverse() {\n var value = this.__wrapped__;\n if (value instanceof LazyWrapper) {\n var wrapped = value;\n if (this.__actions__.length) {\n wrapped = new LazyWrapper(this);\n }\n wrapped = wrapped.reverse();\n wrapped.__actions__.push({\n 'func': thru,\n 'args': [reverse],\n 'thisArg': undefined$1\n });\n return new LodashWrapper(wrapped, this.__chain__);\n }\n return this.thru(reverse);\n }\n\n /**\n * Executes the chain sequence to resolve the unwrapped value.\n *\n * @name value\n * @memberOf _\n * @since 0.1.0\n * @alias toJSON, valueOf\n * @category Seq\n * @returns {*} Returns the resolved unwrapped value.\n * @example\n *\n * _([1, 2, 3]).value();\n * // => [1, 2, 3]\n */\n function wrapperValue() {\n return baseWrapperValue(this.__wrapped__, this.__actions__);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the number of times the key was returned by `iteratee`. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.countBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': 1, '6': 2 }\n *\n * // The `_.property` iteratee shorthand.\n * _.countBy(['one', 'two', 'three'], 'length');\n * // => { '3': 2, '5': 1 }\n */\n var countBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n ++result[key];\n } else {\n baseAssignValue(result, key, 1);\n }\n });\n\n /**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * Iteration is stopped once `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * **Note:** This method returns `true` for\n * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because\n * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\n * elements of empty collections.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.every(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.every(users, 'active');\n * // => false\n */\n function every(collection, predicate, guard) {\n var func = isArray(collection) ? arrayEvery : baseEvery;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined$1;\n }\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * **Note:** Unlike `_.remove`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.reject\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.filter(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, { 'age': 36, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.filter(users, 'active');\n * // => objects for ['barney']\n *\n * // Combining several predicates using `_.overEvery` or `_.overSome`.\n * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));\n * // => objects for ['fred', 'barney']\n */\n function filter(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\n var find = createFind(findIndex);\n\n /**\n * This method is like `_.find` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=collection.length-1] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * _.findLast([1, 2, 3, 4], function(n) {\n * return n % 2 == 1;\n * });\n * // => 3\n */\n var findLast = createFind(findLastIndex);\n\n /**\n * Creates a flattened array of values by running each element in `collection`\n * thru `iteratee` and flattening the mapped results. The iteratee is invoked\n * with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [n, n];\n * }\n *\n * _.flatMap([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMap(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), 1);\n }\n\n /**\n * This method is like `_.flatMap` except that it recursively flattens the\n * mapped results.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [[[n, n]]];\n * }\n *\n * _.flatMapDeep([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMapDeep(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), INFINITY);\n }\n\n /**\n * This method is like `_.flatMap` except that it recursively flattens the\n * mapped results up to `depth` times.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {number} [depth=1] The maximum recursion depth.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [[[n, n]]];\n * }\n *\n * _.flatMapDepth([1, 2], duplicate, 2);\n * // => [[1, 1], [2, 2]]\n */\n function flatMapDepth(collection, iteratee, depth) {\n depth = depth === undefined$1 ? 1 : toInteger(depth);\n return baseFlatten(map(collection, iteratee), depth);\n }\n\n /**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _.forEach([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forEach(collection, iteratee) {\n var func = isArray(collection) ? arrayEach : baseEach;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.forEach` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @alias eachRight\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEach\n * @example\n *\n * _.forEachRight([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `2` then `1`.\n */\n function forEachRight(collection, iteratee) {\n var func = isArray(collection) ? arrayEachRight : baseEachRight;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The order of grouped values\n * is determined by the order they occur in `collection`. The corresponding\n * value of each key is an array of elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': [4.2], '6': [6.1, 6.3] }\n *\n * // The `_.property` iteratee shorthand.\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\n var groupBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n baseAssignValue(result, key, [value]);\n }\n });\n\n /**\n * Checks if `value` is in `collection`. If `collection` is a string, it's\n * checked for a substring of `value`, otherwise\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * is used for equality comparisons. If `fromIndex` is negative, it's used as\n * the offset from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {boolean} Returns `true` if `value` is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'a': 1, 'b': 2 }, 1);\n * // => true\n *\n * _.includes('abcd', 'bc');\n * // => true\n */\n function includes(collection, value, fromIndex, guard) {\n collection = isArrayLike(collection) ? collection : values(collection);\n fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;\n\n var length = collection.length;\n if (fromIndex < 0) {\n fromIndex = nativeMax(length + fromIndex, 0);\n }\n return isString(collection)\n ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)\n : (!!length && baseIndexOf(collection, value, fromIndex) > -1);\n }\n\n /**\n * Invokes the method at `path` of each element in `collection`, returning\n * an array of the results of each invoked method. Any additional arguments\n * are provided to each invoked method. If `path` is a function, it's invoked\n * for, and `this` bound to, each element in `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Array|Function|string} path The path of the method to invoke or\n * the function invoked per iteration.\n * @param {...*} [args] The arguments to invoke each method with.\n * @returns {Array} Returns the array of results.\n * @example\n *\n * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');\n * // => [[1, 5, 7], [1, 2, 3]]\n *\n * _.invokeMap([123, 456], String.prototype.split, '');\n * // => [['1', '2', '3'], ['4', '5', '6']]\n */\n var invokeMap = baseRest(function(collection, path, args) {\n var index = -1,\n isFunc = typeof path == 'function',\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value) {\n result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);\n });\n return result;\n });\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the last element responsible for generating the key. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * var array = [\n * { 'dir': 'left', 'code': 97 },\n * { 'dir': 'right', 'code': 100 }\n * ];\n *\n * _.keyBy(array, function(o) {\n * return String.fromCharCode(o.code);\n * });\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n *\n * _.keyBy(array, 'dir');\n * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n */\n var keyBy = createAggregator(function(result, value, key) {\n baseAssignValue(result, key, value);\n });\n\n /**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\n function map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.sortBy` except that it allows specifying the sort\n * orders of the iteratees to sort by. If `orders` is unspecified, all values\n * are sorted in ascending order. Otherwise, specify an order of \"desc\" for\n * descending or \"asc\" for ascending sort order of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @param {string[]} [orders] The sort orders of `iteratees`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 34 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'barney', 'age': 36 }\n * ];\n *\n * // Sort by `user` in ascending order and by `age` in descending order.\n * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\n */\n function orderBy(collection, iteratees, orders, guard) {\n if (collection == null) {\n return [];\n }\n if (!isArray(iteratees)) {\n iteratees = iteratees == null ? [] : [iteratees];\n }\n orders = guard ? undefined$1 : orders;\n if (!isArray(orders)) {\n orders = orders == null ? [] : [orders];\n }\n return baseOrderBy(collection, iteratees, orders);\n }\n\n /**\n * Creates an array of elements split into two groups, the first of which\n * contains elements `predicate` returns truthy for, the second of which\n * contains elements `predicate` returns falsey for. The predicate is\n * invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the array of grouped elements.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true },\n * { 'user': 'pebbles', 'age': 1, 'active': false }\n * ];\n *\n * _.partition(users, function(o) { return o.active; });\n * // => objects for [['fred'], ['barney', 'pebbles']]\n *\n * // The `_.matches` iteratee shorthand.\n * _.partition(users, { 'age': 1, 'active': false });\n * // => objects for [['pebbles'], ['barney', 'fred']]\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.partition(users, ['active', false]);\n * // => objects for [['barney', 'pebbles'], ['fred']]\n *\n * // The `_.property` iteratee shorthand.\n * _.partition(users, 'active');\n * // => objects for [['fred'], ['barney', 'pebbles']]\n */\n var partition = createAggregator(function(result, value, key) {\n result[key ? 0 : 1].push(value);\n }, function() { return [[], []]; });\n\n /**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` thru `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not given, the first element of `collection` is used as the initial\n * value. The iteratee is invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\n * and `sortBy`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduceRight\n * @example\n *\n * _.reduce([1, 2], function(sum, n) {\n * return sum + n;\n * }, 0);\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * return result;\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n */\n function reduce(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduce : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);\n }\n\n /**\n * This method is like `_.reduce` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduce\n * @example\n *\n * var array = [[0, 1], [2, 3], [4, 5]];\n *\n * _.reduceRight(array, function(flattened, other) {\n * return flattened.concat(other);\n * }, []);\n * // => [4, 5, 2, 3, 0, 1]\n */\n function reduceRight(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduceRight : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);\n }\n\n /**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.filter\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * _.reject(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.reject(users, { 'age': 40, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.reject(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.reject(users, 'active');\n * // => objects for ['barney']\n */\n function reject(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, negate(getIteratee(predicate, 3)));\n }\n\n /**\n * Gets a random element from `collection`.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @returns {*} Returns the random element.\n * @example\n *\n * _.sample([1, 2, 3, 4]);\n * // => 2\n */\n function sample(collection) {\n var func = isArray(collection) ? arraySample : baseSample;\n return func(collection);\n }\n\n /**\n * Gets `n` random elements at unique keys from `collection` up to the\n * size of `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @param {number} [n=1] The number of elements to sample.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the random elements.\n * @example\n *\n * _.sampleSize([1, 2, 3], 2);\n * // => [3, 1]\n *\n * _.sampleSize([1, 2, 3], 4);\n * // => [2, 3, 1]\n */\n function sampleSize(collection, n, guard) {\n if ((guard ? isIterateeCall(collection, n, guard) : n === undefined$1)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n var func = isArray(collection) ? arraySampleSize : baseSampleSize;\n return func(collection, n);\n }\n\n /**\n * Creates an array of shuffled values, using a version of the\n * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n * @example\n *\n * _.shuffle([1, 2, 3, 4]);\n * // => [4, 1, 3, 2]\n */\n function shuffle(collection) {\n var func = isArray(collection) ? arrayShuffle : baseShuffle;\n return func(collection);\n }\n\n /**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable string keyed properties for objects.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the collection size.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\n function size(collection) {\n if (collection == null) {\n return 0;\n }\n if (isArrayLike(collection)) {\n return isString(collection) ? stringSize(collection) : collection.length;\n }\n var tag = getTag(collection);\n if (tag == mapTag || tag == setTag) {\n return collection.size;\n }\n return baseKeys(collection).length;\n }\n\n /**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * Iteration is stopped once `predicate` returns truthy. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.some(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.some(users, 'active');\n * // => true\n */\n function some(collection, predicate, guard) {\n var func = isArray(collection) ? arraySome : baseSome;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined$1;\n }\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection thru each iteratee. This method\n * performs a stable sort, that is, it preserves the original sort order of\n * equal elements. The iteratees are invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 30 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.sortBy(users, [function(o) { return o.user; }]);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]\n *\n * _.sortBy(users, ['user', 'age']);\n * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]\n */\n var sortBy = baseRest(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var length = iteratees.length;\n if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\n iteratees = [];\n } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\n iteratees = [iteratees[0]];\n }\n return baseOrderBy(collection, baseFlatten(iteratees, 1), []);\n });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\n var now = ctxNow || function() {\n return root.Date.now();\n };\n\n /*------------------------------------------------------------------------*/\n\n /**\n * The opposite of `_.before`; this method creates a function that invokes\n * `func` once it's called `n` or more times.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {number} n The number of calls before `func` is invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var saves = ['profile', 'settings'];\n *\n * var done = _.after(saves.length, function() {\n * console.log('done saving!');\n * });\n *\n * _.forEach(saves, function(type) {\n * asyncSave({ 'type': type, 'complete': done });\n * });\n * // => Logs 'done saving!' after the two async saves have completed.\n */\n function after(n, func) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n n = toInteger(n);\n return function() {\n if (--n < 1) {\n return func.apply(this, arguments);\n }\n };\n }\n\n /**\n * Creates a function that invokes `func`, with up to `n` arguments,\n * ignoring any additional arguments.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @param {number} [n=func.length] The arity cap.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new capped function.\n * @example\n *\n * _.map(['6', '8', '10'], _.ary(parseInt, 1));\n * // => [6, 8, 10]\n */\n function ary(func, n, guard) {\n n = guard ? undefined$1 : n;\n n = (func && n == null) ? func.length : n;\n return createWrap(func, WRAP_ARY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, n);\n }\n\n /**\n * Creates a function that invokes `func`, with the `this` binding and arguments\n * of the created function, while it's called less than `n` times. Subsequent\n * calls to the created function return the result of the last `func` invocation.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {number} n The number of calls at which `func` is no longer invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * jQuery(element).on('click', _.before(5, addContactToList));\n * // => Allows adding up to 4 contacts to the list.\n */\n function before(n, func) {\n var result;\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n n = toInteger(n);\n return function() {\n if (--n > 0) {\n result = func.apply(this, arguments);\n }\n if (n <= 1) {\n func = undefined$1;\n }\n return result;\n };\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of `thisArg`\n * and `partials` prepended to the arguments it receives.\n *\n * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for partially applied arguments.\n *\n * **Note:** Unlike native `Function#bind`, this method doesn't set the \"length\"\n * property of bound functions.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * function greet(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n *\n * var object = { 'user': 'fred' };\n *\n * var bound = _.bind(greet, object, 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * // Bound with placeholders.\n * var bound = _.bind(greet, object, _, '!');\n * bound('hi');\n * // => 'hi fred!'\n */\n var bind = baseRest(function(func, thisArg, partials) {\n var bitmask = WRAP_BIND_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, getHolder(bind));\n bitmask |= WRAP_PARTIAL_FLAG;\n }\n return createWrap(func, bitmask, thisArg, partials, holders);\n });\n\n /**\n * Creates a function that invokes the method at `object[key]` with `partials`\n * prepended to the arguments it receives.\n *\n * This method differs from `_.bind` by allowing bound functions to reference\n * methods that may be redefined or don't yet exist. See\n * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)\n * for more details.\n *\n * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Function\n * @param {Object} object The object to invoke the method on.\n * @param {string} key The key of the method.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * var object = {\n * 'user': 'fred',\n * 'greet': function(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n * };\n *\n * var bound = _.bindKey(object, 'greet', 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * object.greet = function(greeting, punctuation) {\n * return greeting + 'ya ' + this.user + punctuation;\n * };\n *\n * bound('!');\n * // => 'hiya fred!'\n *\n * // Bound with placeholders.\n * var bound = _.bindKey(object, 'greet', _, '!');\n * bound('hi');\n * // => 'hiya fred!'\n */\n var bindKey = baseRest(function(object, key, partials) {\n var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, getHolder(bindKey));\n bitmask |= WRAP_PARTIAL_FLAG;\n }\n return createWrap(key, bitmask, object, partials, holders);\n });\n\n /**\n * Creates a function that accepts arguments of `func` and either invokes\n * `func` returning its result, if at least `arity` number of arguments have\n * been provided, or returns a function that accepts the remaining `func`\n * arguments, and so on. The arity of `func` may be specified if `func.length`\n * is not sufficient.\n *\n * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for provided arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curry(abc);\n *\n * curried(1)(2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // Curried with placeholders.\n * curried(1)(_, 3)(2);\n * // => [1, 2, 3]\n */\n function curry(func, arity, guard) {\n arity = guard ? undefined$1 : arity;\n var result = createWrap(func, WRAP_CURRY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity);\n result.placeholder = curry.placeholder;\n return result;\n }\n\n /**\n * This method is like `_.curry` except that arguments are applied to `func`\n * in the manner of `_.partialRight` instead of `_.partial`.\n *\n * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for provided arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curryRight(abc);\n *\n * curried(3)(2)(1);\n * // => [1, 2, 3]\n *\n * curried(2, 3)(1);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // Curried with placeholders.\n * curried(3)(1, _)(2);\n * // => [1, 2, 3]\n */\n function curryRight(func, arity, guard) {\n arity = guard ? undefined$1 : arity;\n var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity);\n result.placeholder = curryRight.placeholder;\n return result;\n }\n\n /**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\n function debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined$1;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined$1 || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined$1;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined$1;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined$1) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined$1;\n }\n\n function flush() {\n return timerId === undefined$1 ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined$1) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined$1) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n }\n\n /**\n * Defers invoking the `func` until the current call stack has cleared. Any\n * additional arguments are provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to defer.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.defer(function(text) {\n * console.log(text);\n * }, 'deferred');\n * // => Logs 'deferred' after one millisecond.\n */\n var defer = baseRest(function(func, args) {\n return baseDelay(func, 1, args);\n });\n\n /**\n * Invokes `func` after `wait` milliseconds. Any additional arguments are\n * provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.delay(function(text) {\n * console.log(text);\n * }, 1000, 'later');\n * // => Logs 'later' after one second.\n */\n var delay = baseRest(function(func, wait, args) {\n return baseDelay(func, toNumber(wait) || 0, args);\n });\n\n /**\n * Creates a function that invokes `func` with arguments reversed.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to flip arguments for.\n * @returns {Function} Returns the new flipped function.\n * @example\n *\n * var flipped = _.flip(function() {\n * return _.toArray(arguments);\n * });\n *\n * flipped('a', 'b', 'c', 'd');\n * // => ['d', 'c', 'b', 'a']\n */\n function flip(func) {\n return createWrap(func, WRAP_FLIP_FLAG);\n }\n\n /**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\n function memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n }\n\n // Expose `MapCache`.\n memoize.Cache = MapCache;\n\n /**\n * Creates a function that negates the result of the predicate `func`. The\n * `func` predicate is invoked with the `this` binding and arguments of the\n * created function.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} predicate The predicate to negate.\n * @returns {Function} Returns the new negated function.\n * @example\n *\n * function isEven(n) {\n * return n % 2 == 0;\n * }\n *\n * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n * // => [1, 3, 5]\n */\n function negate(predicate) {\n if (typeof predicate != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return function() {\n var args = arguments;\n switch (args.length) {\n case 0: return !predicate.call(this);\n case 1: return !predicate.call(this, args[0]);\n case 2: return !predicate.call(this, args[0], args[1]);\n case 3: return !predicate.call(this, args[0], args[1], args[2]);\n }\n return !predicate.apply(this, args);\n };\n }\n\n /**\n * Creates a function that is restricted to invoking `func` once. Repeat calls\n * to the function return the value of the first invocation. The `func` is\n * invoked with the `this` binding and arguments of the created function.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var initialize = _.once(createApplication);\n * initialize();\n * initialize();\n * // => `createApplication` is invoked once\n */\n function once(func) {\n return before(2, func);\n }\n\n /**\n * Creates a function that invokes `func` with its arguments transformed.\n *\n * @static\n * @since 4.0.0\n * @memberOf _\n * @category Function\n * @param {Function} func The function to wrap.\n * @param {...(Function|Function[])} [transforms=[_.identity]]\n * The argument transforms.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function doubled(n) {\n * return n * 2;\n * }\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var func = _.overArgs(function(x, y) {\n * return [x, y];\n * }, [square, doubled]);\n *\n * func(9, 3);\n * // => [81, 6]\n *\n * func(10, 5);\n * // => [100, 10]\n */\n var overArgs = castRest(function(func, transforms) {\n transforms = (transforms.length == 1 && isArray(transforms[0]))\n ? arrayMap(transforms[0], baseUnary(getIteratee()))\n : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));\n\n var funcsLength = transforms.length;\n return baseRest(function(args) {\n var index = -1,\n length = nativeMin(args.length, funcsLength);\n\n while (++index < length) {\n args[index] = transforms[index].call(this, args[index]);\n }\n return apply(func, this, args);\n });\n });\n\n /**\n * Creates a function that invokes `func` with `partials` prepended to the\n * arguments it receives. This method is like `_.bind` except it does **not**\n * alter the `this` binding.\n *\n * The `_.partial.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @since 0.2.0\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * function greet(greeting, name) {\n * return greeting + ' ' + name;\n * }\n *\n * var sayHelloTo = _.partial(greet, 'hello');\n * sayHelloTo('fred');\n * // => 'hello fred'\n *\n * // Partially applied with placeholders.\n * var greetFred = _.partial(greet, _, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n */\n var partial = baseRest(function(func, partials) {\n var holders = replaceHolders(partials, getHolder(partial));\n return createWrap(func, WRAP_PARTIAL_FLAG, undefined$1, partials, holders);\n });\n\n /**\n * This method is like `_.partial` except that partially applied arguments\n * are appended to the arguments it receives.\n *\n * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * function greet(greeting, name) {\n * return greeting + ' ' + name;\n * }\n *\n * var greetFred = _.partialRight(greet, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n *\n * // Partially applied with placeholders.\n * var sayHelloTo = _.partialRight(greet, 'hello', _);\n * sayHelloTo('fred');\n * // => 'hello fred'\n */\n var partialRight = baseRest(function(func, partials) {\n var holders = replaceHolders(partials, getHolder(partialRight));\n return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined$1, partials, holders);\n });\n\n /**\n * Creates a function that invokes `func` with arguments arranged according\n * to the specified `indexes` where the argument value at the first index is\n * provided as the first argument, the argument value at the second index is\n * provided as the second argument, and so on.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to rearrange arguments for.\n * @param {...(number|number[])} indexes The arranged argument indexes.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var rearged = _.rearg(function(a, b, c) {\n * return [a, b, c];\n * }, [2, 0, 1]);\n *\n * rearged('b', 'c', 'a')\n * // => ['a', 'b', 'c']\n */\n var rearg = flatRest(function(func, indexes) {\n return createWrap(func, WRAP_REARG_FLAG, undefined$1, undefined$1, undefined$1, indexes);\n });\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as\n * an array.\n *\n * **Note:** This method is based on the\n * [rest parameter](https://mdn.io/rest_parameters).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.rest(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\n function rest(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = start === undefined$1 ? start : toInteger(start);\n return baseRest(func, start);\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * create function and an array of arguments much like\n * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).\n *\n * **Note:** This method is based on the\n * [spread operator](https://mdn.io/spread_operator).\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Function\n * @param {Function} func The function to spread arguments over.\n * @param {number} [start=0] The start position of the spread.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.spread(function(who, what) {\n * return who + ' says ' + what;\n * });\n *\n * say(['fred', 'hello']);\n * // => 'fred says hello'\n *\n * var numbers = Promise.all([\n * Promise.resolve(40),\n * Promise.resolve(36)\n * ]);\n *\n * numbers.then(_.spread(function(x, y) {\n * return x + y;\n * }));\n * // => a Promise of 76\n */\n function spread(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = start == null ? 0 : nativeMax(toInteger(start), 0);\n return baseRest(function(args) {\n var array = args[start],\n otherArgs = castSlice(args, 0, start);\n\n if (array) {\n arrayPush(otherArgs, array);\n }\n return apply(func, this, otherArgs);\n });\n }\n\n /**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\n function throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n }\n\n /**\n * Creates a function that accepts up to one argument, ignoring any\n * additional arguments.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n * @example\n *\n * _.map(['6', '8', '10'], _.unary(parseInt));\n * // => [6, 8, 10]\n */\n function unary(func) {\n return ary(func, 1);\n }\n\n /**\n * Creates a function that provides `value` to `wrapper` as its first\n * argument. Any additional arguments provided to the function are appended\n * to those provided to the `wrapper`. The wrapper is invoked with the `this`\n * binding of the created function.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {*} value The value to wrap.\n * @param {Function} [wrapper=identity] The wrapper function.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var p = _.wrap(_.escape, function(func, text) {\n * return '<p>' + func(text) + '</p>';\n * });\n *\n * p('fred, barney, & pebbles');\n * // => '<p>fred, barney, & pebbles</p>'\n */\n function wrap(value, wrapper) {\n return partial(castFunction(wrapper), value);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Casts `value` as an array if it's not one.\n *\n * @static\n * @memberOf _\n * @since 4.4.0\n * @category Lang\n * @param {*} value The value to inspect.\n * @returns {Array} Returns the cast array.\n * @example\n *\n * _.castArray(1);\n * // => [1]\n *\n * _.castArray({ 'a': 1 });\n * // => [{ 'a': 1 }]\n *\n * _.castArray('abc');\n * // => ['abc']\n *\n * _.castArray(null);\n * // => [null]\n *\n * _.castArray(undefined);\n * // => [undefined]\n *\n * _.castArray();\n * // => []\n *\n * var array = [1, 2, 3];\n * console.log(_.castArray(array) === array);\n * // => true\n */\n function castArray() {\n if (!arguments.length) {\n return [];\n }\n var value = arguments[0];\n return isArray(value) ? value : [value];\n }\n\n /**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\n function clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG);\n }\n\n /**\n * This method is like `_.clone` except that it accepts `customizer` which\n * is invoked to produce the cloned value. If `customizer` returns `undefined`,\n * cloning is handled by the method instead. The `customizer` is invoked with\n * up to four arguments; (value [, index|key, object, stack]).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to clone.\n * @param {Function} [customizer] The function to customize cloning.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeepWith\n * @example\n *\n * function customizer(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(false);\n * }\n * }\n *\n * var el = _.cloneWith(document.body, customizer);\n *\n * console.log(el === document.body);\n * // => false\n * console.log(el.nodeName);\n * // => 'BODY'\n * console.log(el.childNodes.length);\n * // => 0\n */\n function cloneWith(value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined$1;\n return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);\n }\n\n /**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\n function cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n }\n\n /**\n * This method is like `_.cloneWith` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @param {Function} [customizer] The function to customize cloning.\n * @returns {*} Returns the deep cloned value.\n * @see _.cloneWith\n * @example\n *\n * function customizer(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(true);\n * }\n * }\n *\n * var el = _.cloneDeepWith(document.body, customizer);\n *\n * console.log(el === document.body);\n * // => false\n * console.log(el.nodeName);\n * // => 'BODY'\n * console.log(el.childNodes.length);\n * // => 20\n */\n function cloneDeepWith(value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined$1;\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);\n }\n\n /**\n * Checks if `object` conforms to `source` by invoking the predicate\n * properties of `source` with the corresponding property values of `object`.\n *\n * **Note:** This method is equivalent to `_.conforms` when `source` is\n * partially applied.\n *\n * @static\n * @memberOf _\n * @since 4.14.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property predicates to conform to.\n * @returns {boolean} Returns `true` if `object` conforms, else `false`.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n *\n * _.conformsTo(object, { 'b': function(n) { return n > 1; } });\n * // => true\n *\n * _.conformsTo(object, { 'b': function(n) { return n > 2; } });\n * // => false\n */\n function conformsTo(object, source) {\n return source == null || baseConformsTo(object, source, keys(source));\n }\n\n /**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\n function eq(value, other) {\n return value === other || (value !== value && other !== other);\n }\n\n /**\n * Checks if `value` is greater than `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n * @see _.lt\n * @example\n *\n * _.gt(3, 1);\n * // => true\n *\n * _.gt(3, 3);\n * // => false\n *\n * _.gt(1, 3);\n * // => false\n */\n var gt = createRelationalOperation(baseGt);\n\n /**\n * Checks if `value` is greater than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than or equal to\n * `other`, else `false`.\n * @see _.lte\n * @example\n *\n * _.gte(3, 1);\n * // => true\n *\n * _.gte(3, 3);\n * // => true\n *\n * _.gte(1, 3);\n * // => false\n */\n var gte = createRelationalOperation(function(value, other) {\n return value >= other;\n });\n\n /**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\n var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n };\n\n /**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\n var isArray = Array.isArray;\n\n /**\n * Checks if `value` is classified as an `ArrayBuffer` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.\n * @example\n *\n * _.isArrayBuffer(new ArrayBuffer(2));\n * // => true\n *\n * _.isArrayBuffer(new Array(2));\n * // => false\n */\n var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;\n\n /**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\n function isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n }\n\n /**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\n function isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n }\n\n /**\n * Checks if `value` is classified as a boolean primitive or object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.\n * @example\n *\n * _.isBoolean(false);\n * // => true\n *\n * _.isBoolean(null);\n * // => false\n */\n function isBoolean(value) {\n return value === true || value === false ||\n (isObjectLike(value) && baseGetTag(value) == boolTag);\n }\n\n /**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\n var isBuffer = nativeIsBuffer || stubFalse;\n\n /**\n * Checks if `value` is classified as a `Date` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a date object, else `false`.\n * @example\n *\n * _.isDate(new Date);\n * // => true\n *\n * _.isDate('Mon April 23 2012');\n * // => false\n */\n var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;\n\n /**\n * Checks if `value` is likely a DOM element.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.\n * @example\n *\n * _.isElement(document.body);\n * // => true\n *\n * _.isElement('<body>');\n * // => false\n */\n function isElement(value) {\n return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);\n }\n\n /**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\n function isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) &&\n (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||\n isBuffer(value) || isTypedArray(value) || isArguments(value))) {\n return !value.length;\n }\n var tag = getTag(value);\n if (tag == mapTag || tag == setTag) {\n return !value.size;\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length;\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\n function isEqual(value, other) {\n return baseIsEqual(value, other);\n }\n\n /**\n * This method is like `_.isEqual` except that it accepts `customizer` which\n * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n * are handled by the method instead. The `customizer` is invoked with up to\n * six arguments: (objValue, othValue [, index|key, object, other, stack]).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * function isGreeting(value) {\n * return /^h(?:i|ello)$/.test(value);\n * }\n *\n * function customizer(objValue, othValue) {\n * if (isGreeting(objValue) && isGreeting(othValue)) {\n * return true;\n * }\n * }\n *\n * var array = ['hello', 'goodbye'];\n * var other = ['hi', 'goodbye'];\n *\n * _.isEqualWith(array, other, customizer);\n * // => true\n */\n function isEqualWith(value, other, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined$1;\n var result = customizer ? customizer(value, other) : undefined$1;\n return result === undefined$1 ? baseIsEqual(value, other, undefined$1, customizer) : !!result;\n }\n\n /**\n * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an error object, else `false`.\n * @example\n *\n * _.isError(new Error);\n * // => true\n *\n * _.isError(Error);\n * // => false\n */\n function isError(value) {\n if (!isObjectLike(value)) {\n return false;\n }\n var tag = baseGetTag(value);\n return tag == errorTag || tag == domExcTag ||\n (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));\n }\n\n /**\n * Checks if `value` is a finite primitive number.\n *\n * **Note:** This method is based on\n * [`Number.isFinite`](https://mdn.io/Number/isFinite).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.\n * @example\n *\n * _.isFinite(3);\n * // => true\n *\n * _.isFinite(Number.MIN_VALUE);\n * // => true\n *\n * _.isFinite(Infinity);\n * // => false\n *\n * _.isFinite('3');\n * // => false\n */\n function isFinite(value) {\n return typeof value == 'number' && nativeIsFinite(value);\n }\n\n /**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\n function isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n }\n\n /**\n * Checks if `value` is an integer.\n *\n * **Note:** This method is based on\n * [`Number.isInteger`](https://mdn.io/Number/isInteger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an integer, else `false`.\n * @example\n *\n * _.isInteger(3);\n * // => true\n *\n * _.isInteger(Number.MIN_VALUE);\n * // => false\n *\n * _.isInteger(Infinity);\n * // => false\n *\n * _.isInteger('3');\n * // => false\n */\n function isInteger(value) {\n return typeof value == 'number' && value == toInteger(value);\n }\n\n /**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\n function isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n }\n\n /**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\n function isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n }\n\n /**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\n function isObjectLike(value) {\n return value != null && typeof value == 'object';\n }\n\n /**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\n var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\n /**\n * Performs a partial deep comparison between `object` and `source` to\n * determine if `object` contains equivalent property values.\n *\n * **Note:** This method is equivalent to `_.matches` when `source` is\n * partially applied.\n *\n * Partial comparisons will match empty array and empty object `source`\n * values against any array or object value, respectively. See `_.isEqual`\n * for a list of supported value comparisons.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n *\n * _.isMatch(object, { 'b': 2 });\n * // => true\n *\n * _.isMatch(object, { 'b': 1 });\n * // => false\n */\n function isMatch(object, source) {\n return object === source || baseIsMatch(object, source, getMatchData(source));\n }\n\n /**\n * This method is like `_.isMatch` except that it accepts `customizer` which\n * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n * are handled by the method instead. The `customizer` is invoked with five\n * arguments: (objValue, srcValue, index|key, object, source).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * function isGreeting(value) {\n * return /^h(?:i|ello)$/.test(value);\n * }\n *\n * function customizer(objValue, srcValue) {\n * if (isGreeting(objValue) && isGreeting(srcValue)) {\n * return true;\n * }\n * }\n *\n * var object = { 'greeting': 'hello' };\n * var source = { 'greeting': 'hi' };\n *\n * _.isMatchWith(object, source, customizer);\n * // => true\n */\n function isMatchWith(object, source, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined$1;\n return baseIsMatch(object, source, getMatchData(source), customizer);\n }\n\n /**\n * Checks if `value` is `NaN`.\n *\n * **Note:** This method is based on\n * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as\n * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for\n * `undefined` and other non-number values.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n * @example\n *\n * _.isNaN(NaN);\n * // => true\n *\n * _.isNaN(new Number(NaN));\n * // => true\n *\n * isNaN(undefined);\n * // => true\n *\n * _.isNaN(undefined);\n * // => false\n */\n function isNaN(value) {\n // An `NaN` primitive is the only value that is not equal to itself.\n // Perform the `toStringTag` check first to avoid errors with some\n // ActiveX objects in IE.\n return isNumber(value) && value != +value;\n }\n\n /**\n * Checks if `value` is a pristine native function.\n *\n * **Note:** This method can't reliably detect native functions in the presence\n * of the core-js package because core-js circumvents this kind of detection.\n * Despite multiple requests, the core-js maintainer has made it clear: any\n * attempt to fix the detection will be obstructed. As a result, we're left\n * with little choice but to throw an error. Unfortunately, this also affects\n * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),\n * which rely on core-js.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\n function isNative(value) {\n if (isMaskable(value)) {\n throw new Error(CORE_ERROR_TEXT);\n }\n return baseIsNative(value);\n }\n\n /**\n * Checks if `value` is `null`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `null`, else `false`.\n * @example\n *\n * _.isNull(null);\n * // => true\n *\n * _.isNull(void 0);\n * // => false\n */\n function isNull(value) {\n return value === null;\n }\n\n /**\n * Checks if `value` is `null` or `undefined`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is nullish, else `false`.\n * @example\n *\n * _.isNil(null);\n * // => true\n *\n * _.isNil(void 0);\n * // => true\n *\n * _.isNil(NaN);\n * // => false\n */\n function isNil(value) {\n return value == null;\n }\n\n /**\n * Checks if `value` is classified as a `Number` primitive or object.\n *\n * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are\n * classified as numbers, use the `_.isFinite` method.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a number, else `false`.\n * @example\n *\n * _.isNumber(3);\n * // => true\n *\n * _.isNumber(Number.MIN_VALUE);\n * // => true\n *\n * _.isNumber(Infinity);\n * // => true\n *\n * _.isNumber('3');\n * // => false\n */\n function isNumber(value) {\n return typeof value == 'number' ||\n (isObjectLike(value) && baseGetTag(value) == numberTag);\n }\n\n /**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\n function isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n }\n\n /**\n * Checks if `value` is classified as a `RegExp` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\n var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;\n\n /**\n * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754\n * double precision number which isn't the result of a rounded unsafe integer.\n *\n * **Note:** This method is based on\n * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.\n * @example\n *\n * _.isSafeInteger(3);\n * // => true\n *\n * _.isSafeInteger(Number.MIN_VALUE);\n * // => false\n *\n * _.isSafeInteger(Infinity);\n * // => false\n *\n * _.isSafeInteger('3');\n * // => false\n */\n function isSafeInteger(value) {\n return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;\n }\n\n /**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\n var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\n /**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\n function isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n }\n\n /**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\n function isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n }\n\n /**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\n var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n /**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\n function isUndefined(value) {\n return value === undefined$1;\n }\n\n /**\n * Checks if `value` is classified as a `WeakMap` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.\n * @example\n *\n * _.isWeakMap(new WeakMap);\n * // => true\n *\n * _.isWeakMap(new Map);\n * // => false\n */\n function isWeakMap(value) {\n return isObjectLike(value) && getTag(value) == weakMapTag;\n }\n\n /**\n * Checks if `value` is classified as a `WeakSet` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.\n * @example\n *\n * _.isWeakSet(new WeakSet);\n * // => true\n *\n * _.isWeakSet(new Set);\n * // => false\n */\n function isWeakSet(value) {\n return isObjectLike(value) && baseGetTag(value) == weakSetTag;\n }\n\n /**\n * Checks if `value` is less than `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n * @see _.gt\n * @example\n *\n * _.lt(1, 3);\n * // => true\n *\n * _.lt(3, 3);\n * // => false\n *\n * _.lt(3, 1);\n * // => false\n */\n var lt = createRelationalOperation(baseLt);\n\n /**\n * Checks if `value` is less than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than or equal to\n * `other`, else `false`.\n * @see _.gte\n * @example\n *\n * _.lte(1, 3);\n * // => true\n *\n * _.lte(3, 3);\n * // => true\n *\n * _.lte(3, 1);\n * // => false\n */\n var lte = createRelationalOperation(function(value, other) {\n return value <= other;\n });\n\n /**\n * Converts `value` to an array.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Array} Returns the converted array.\n * @example\n *\n * _.toArray({ 'a': 1, 'b': 2 });\n * // => [1, 2]\n *\n * _.toArray('abc');\n * // => ['a', 'b', 'c']\n *\n * _.toArray(1);\n * // => []\n *\n * _.toArray(null);\n * // => []\n */\n function toArray(value) {\n if (!value) {\n return [];\n }\n if (isArrayLike(value)) {\n return isString(value) ? stringToArray(value) : copyArray(value);\n }\n if (symIterator && value[symIterator]) {\n return iteratorToArray(value[symIterator]());\n }\n var tag = getTag(value),\n func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);\n\n return func(value);\n }\n\n /**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\n function toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n }\n\n /**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\n function toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n }\n\n /**\n * Converts `value` to an integer suitable for use as the length of an\n * array-like object.\n *\n * **Note:** This method is based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toLength(3.2);\n * // => 3\n *\n * _.toLength(Number.MIN_VALUE);\n * // => 0\n *\n * _.toLength(Infinity);\n * // => 4294967295\n *\n * _.toLength('3.2');\n * // => 3\n */\n function toLength(value) {\n return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;\n }\n\n /**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\n function toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n }\n\n /**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\n function toPlainObject(value) {\n return copyObject(value, keysIn(value));\n }\n\n /**\n * Converts `value` to a safe integer. A safe integer can be compared and\n * represented correctly.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toSafeInteger(3.2);\n * // => 3\n *\n * _.toSafeInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toSafeInteger(Infinity);\n * // => 9007199254740991\n *\n * _.toSafeInteger('3.2');\n * // => 3\n */\n function toSafeInteger(value) {\n return value\n ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)\n : (value === 0 ? value : 0);\n }\n\n /**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\n function toString(value) {\n return value == null ? '' : baseToString(value);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Assigns own enumerable string keyed properties of source objects to the\n * destination object. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assignIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assign({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3 }\n */\n var assign = createAssigner(function(object, source) {\n if (isPrototype(source) || isArrayLike(source)) {\n copyObject(source, keys(source), object);\n return;\n }\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n assignValue(object, key, source[key]);\n }\n }\n });\n\n /**\n * This method is like `_.assign` except that it iterates over own and\n * inherited source properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extend\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assign\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assignIn({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }\n */\n var assignIn = createAssigner(function(object, source) {\n copyObject(source, keysIn(source), object);\n });\n\n /**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n });\n\n /**\n * This method is like `_.assign` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignInWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var assignWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keys(source), object, customizer);\n });\n\n /**\n * Creates an array of values corresponding to `paths` of `object`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Array} Returns the picked values.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n *\n * _.at(object, ['a[0].b.c', 'a[1]']);\n * // => [3, 4]\n */\n var at = flatRest(baseAt);\n\n /**\n * Creates an object that inherits from the `prototype` object. If a\n * `properties` object is given, its own enumerable string keyed properties\n * are assigned to the created object.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Object\n * @param {Object} prototype The object to inherit from.\n * @param {Object} [properties] The properties to assign to the object.\n * @returns {Object} Returns the new object.\n * @example\n *\n * function Shape() {\n * this.x = 0;\n * this.y = 0;\n * }\n *\n * function Circle() {\n * Shape.call(this);\n * }\n *\n * Circle.prototype = _.create(Shape.prototype, {\n * 'constructor': Circle\n * });\n *\n * var circle = new Circle;\n * circle instanceof Circle;\n * // => true\n *\n * circle instanceof Shape;\n * // => true\n */\n function create(prototype, properties) {\n var result = baseCreate(prototype);\n return properties == null ? result : baseAssign(result, properties);\n }\n\n /**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var defaults = baseRest(function(object, sources) {\n object = Object(object);\n\n var index = -1;\n var length = sources.length;\n var guard = length > 2 ? sources[2] : undefined$1;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n length = 1;\n }\n\n while (++index < length) {\n var source = sources[index];\n var props = keysIn(source);\n var propsIndex = -1;\n var propsLength = props.length;\n\n while (++propsIndex < propsLength) {\n var key = props[propsIndex];\n var value = object[key];\n\n if (value === undefined$1 ||\n (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n object[key] = source[key];\n }\n }\n }\n\n return object;\n });\n\n /**\n * This method is like `_.defaults` except that it recursively assigns\n * default properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaults\n * @example\n *\n * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });\n * // => { 'a': { 'b': 2, 'c': 3 } }\n */\n var defaultsDeep = baseRest(function(args) {\n args.push(undefined$1, customDefaultsMerge);\n return apply(mergeWith, undefined$1, args);\n });\n\n /**\n * This method is like `_.find` except that it returns the key of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {string|undefined} Returns the key of the matched element,\n * else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findKey(users, function(o) { return o.age < 40; });\n * // => 'barney' (iteration order is not guaranteed)\n *\n * // The `_.matches` iteratee shorthand.\n * _.findKey(users, { 'age': 1, 'active': true });\n * // => 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findKey(users, ['active', false]);\n * // => 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.findKey(users, 'active');\n * // => 'barney'\n */\n function findKey(object, predicate) {\n return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);\n }\n\n /**\n * This method is like `_.findKey` except that it iterates over elements of\n * a collection in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {string|undefined} Returns the key of the matched element,\n * else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findLastKey(users, function(o) { return o.age < 40; });\n * // => returns 'pebbles' assuming `_.findKey` returns 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.findLastKey(users, { 'age': 36, 'active': true });\n * // => 'barney'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findLastKey(users, ['active', false]);\n * // => 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.findLastKey(users, 'active');\n * // => 'pebbles'\n */\n function findLastKey(object, predicate) {\n return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);\n }\n\n /**\n * Iterates over own and inherited enumerable string keyed properties of an\n * object and invokes `iteratee` for each property. The iteratee is invoked\n * with three arguments: (value, key, object). Iteratee functions may exit\n * iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forInRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forIn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).\n */\n function forIn(object, iteratee) {\n return object == null\n ? object\n : baseFor(object, getIteratee(iteratee, 3), keysIn);\n }\n\n /**\n * This method is like `_.forIn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forInRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.\n */\n function forInRight(object, iteratee) {\n return object == null\n ? object\n : baseForRight(object, getIteratee(iteratee, 3), keysIn);\n }\n\n /**\n * Iterates over own enumerable string keyed properties of an object and\n * invokes `iteratee` for each property. The iteratee is invoked with three\n * arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwnRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forOwn(object, iteratee) {\n return object && baseForOwn(object, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.forOwn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwnRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.\n */\n function forOwnRight(object, iteratee) {\n return object && baseForOwnRight(object, getIteratee(iteratee, 3));\n }\n\n /**\n * Creates an array of function property names from own enumerable properties\n * of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the function names.\n * @see _.functionsIn\n * @example\n *\n * function Foo() {\n * this.a = _.constant('a');\n * this.b = _.constant('b');\n * }\n *\n * Foo.prototype.c = _.constant('c');\n *\n * _.functions(new Foo);\n * // => ['a', 'b']\n */\n function functions(object) {\n return object == null ? [] : baseFunctions(object, keys(object));\n }\n\n /**\n * Creates an array of function property names from own and inherited\n * enumerable properties of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the function names.\n * @see _.functions\n * @example\n *\n * function Foo() {\n * this.a = _.constant('a');\n * this.b = _.constant('b');\n * }\n *\n * Foo.prototype.c = _.constant('c');\n *\n * _.functionsIn(new Foo);\n * // => ['a', 'b', 'c']\n */\n function functionsIn(object) {\n return object == null ? [] : baseFunctions(object, keysIn(object));\n }\n\n /**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\n function get(object, path, defaultValue) {\n var result = object == null ? undefined$1 : baseGet(object, path);\n return result === undefined$1 ? defaultValue : result;\n }\n\n /**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\n function has(object, path) {\n return object != null && hasPath(object, path, baseHas);\n }\n\n /**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\n function hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n }\n\n /**\n * Creates an object composed of the inverted keys and values of `object`.\n * If `object` contains duplicate values, subsequent values overwrite\n * property assignments of previous values.\n *\n * @static\n * @memberOf _\n * @since 0.7.0\n * @category Object\n * @param {Object} object The object to invert.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invert(object);\n * // => { '1': 'c', '2': 'b' }\n */\n var invert = createInverter(function(result, value, key) {\n if (value != null &&\n typeof value.toString != 'function') {\n value = nativeObjectToString.call(value);\n }\n\n result[value] = key;\n }, constant(identity));\n\n /**\n * This method is like `_.invert` except that the inverted object is generated\n * from the results of running each element of `object` thru `iteratee`. The\n * corresponding inverted value of each inverted key is an array of keys\n * responsible for generating the inverted value. The iteratee is invoked\n * with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.1.0\n * @category Object\n * @param {Object} object The object to invert.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invertBy(object);\n * // => { '1': ['a', 'c'], '2': ['b'] }\n *\n * _.invertBy(object, function(value) {\n * return 'group' + value;\n * });\n * // => { 'group1': ['a', 'c'], 'group2': ['b'] }\n */\n var invertBy = createInverter(function(result, value, key) {\n if (value != null &&\n typeof value.toString != 'function') {\n value = nativeObjectToString.call(value);\n }\n\n if (hasOwnProperty.call(result, value)) {\n result[value].push(key);\n } else {\n result[value] = [key];\n }\n }, getIteratee);\n\n /**\n * Invokes the method at `path` of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {...*} [args] The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };\n *\n * _.invoke(object, 'a[0].b.c.slice', 1, 3);\n * // => [2, 3]\n */\n var invoke = baseRest(baseInvoke);\n\n /**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\n function keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n }\n\n /**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\n function keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n }\n\n /**\n * The opposite of `_.mapValues`; this method creates an object with the\n * same values as `object` and keys generated by running each own enumerable\n * string keyed property of `object` thru `iteratee`. The iteratee is invoked\n * with three arguments: (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapValues\n * @example\n *\n * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\n * return key + value;\n * });\n * // => { 'a1': 1, 'b2': 2 }\n */\n function mapKeys(object, iteratee) {\n var result = {};\n iteratee = getIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, iteratee(value, key, object), value);\n });\n return result;\n }\n\n /**\n * Creates an object with the same keys as `object` and values generated\n * by running each own enumerable string keyed property of `object` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapKeys\n * @example\n *\n * var users = {\n * 'fred': { 'user': 'fred', 'age': 40 },\n * 'pebbles': { 'user': 'pebbles', 'age': 1 }\n * };\n *\n * _.mapValues(users, function(o) { return o.age; });\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n *\n * // The `_.property` iteratee shorthand.\n * _.mapValues(users, 'age');\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n */\n function mapValues(object, iteratee) {\n var result = {};\n iteratee = getIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, key, iteratee(value, key, object));\n });\n return result;\n }\n\n /**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\n var merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n });\n\n /**\n * This method is like `_.merge` except that it accepts `customizer` which\n * is invoked to produce the merged values of the destination and source\n * properties. If `customizer` returns `undefined`, merging is handled by the\n * method instead. The `customizer` is invoked with six arguments:\n * (objValue, srcValue, key, object, source, stack).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function customizer(objValue, srcValue) {\n * if (_.isArray(objValue)) {\n * return objValue.concat(srcValue);\n * }\n * }\n *\n * var object = { 'a': [1], 'b': [2] };\n * var other = { 'a': [3], 'b': [4] };\n *\n * _.mergeWith(object, other, customizer);\n * // => { 'a': [1, 3], 'b': [2, 4] }\n */\n var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {\n baseMerge(object, source, srcIndex, customizer);\n });\n\n /**\n * The opposite of `_.pick`; this method creates an object composed of the\n * own and inherited enumerable property paths of `object` that are not omitted.\n *\n * **Note:** This method is considerably slower than `_.pick`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to omit.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omit(object, ['a', 'c']);\n * // => { 'b': '2' }\n */\n var omit = flatRest(function(object, paths) {\n var result = {};\n if (object == null) {\n return result;\n }\n var isDeep = false;\n paths = arrayMap(paths, function(path) {\n path = castPath(path, object);\n isDeep || (isDeep = path.length > 1);\n return path;\n });\n copyObject(object, getAllKeysIn(object), result);\n if (isDeep) {\n result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);\n }\n var length = paths.length;\n while (length--) {\n baseUnset(result, paths[length]);\n }\n return result;\n });\n\n /**\n * The opposite of `_.pickBy`; this method creates an object composed of\n * the own and inherited enumerable string keyed properties of `object` that\n * `predicate` doesn't return truthy for. The predicate is invoked with two\n * arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omitBy(object, _.isNumber);\n * // => { 'b': '2' }\n */\n function omitBy(object, predicate) {\n return pickBy(object, negate(getIteratee(predicate)));\n }\n\n /**\n * Creates an object composed of the picked `object` properties.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\n var pick = flatRest(function(object, paths) {\n return object == null ? {} : basePick(object, paths);\n });\n\n /**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pickBy(object, _.isNumber);\n * // => { 'a': 1, 'c': 3 }\n */\n function pickBy(object, predicate) {\n if (object == null) {\n return {};\n }\n var props = arrayMap(getAllKeysIn(object), function(prop) {\n return [prop];\n });\n predicate = getIteratee(predicate);\n return basePickBy(object, props, function(value, path) {\n return predicate(value, path[0]);\n });\n }\n\n /**\n * This method is like `_.get` except that if the resolved value is a\n * function it's invoked with the `this` binding of its parent object and\n * its result is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to resolve.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };\n *\n * _.result(object, 'a[0].b.c1');\n * // => 3\n *\n * _.result(object, 'a[0].b.c2');\n * // => 4\n *\n * _.result(object, 'a[0].b.c3', 'default');\n * // => 'default'\n *\n * _.result(object, 'a[0].b.c3', _.constant('default'));\n * // => 'default'\n */\n function result(object, path, defaultValue) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length;\n\n // Ensure the loop is entered when path is empty.\n if (!length) {\n length = 1;\n object = undefined$1;\n }\n while (++index < length) {\n var value = object == null ? undefined$1 : object[toKey(path[index])];\n if (value === undefined$1) {\n index = length;\n value = defaultValue;\n }\n object = isFunction(value) ? value.call(object) : value;\n }\n return object;\n }\n\n /**\n * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,\n * it's created. Arrays are created for missing index properties while objects\n * are created for all other missing properties. Use `_.setWith` to customize\n * `path` creation.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.set(object, 'a[0].b.c', 4);\n * console.log(object.a[0].b.c);\n * // => 4\n *\n * _.set(object, ['x', '0', 'y', 'z'], 5);\n * console.log(object.x[0].y.z);\n * // => 5\n */\n function set(object, path, value) {\n return object == null ? object : baseSet(object, path, value);\n }\n\n /**\n * This method is like `_.set` except that it accepts `customizer` which is\n * invoked to produce the objects of `path`. If `customizer` returns `undefined`\n * path creation is handled by the method instead. The `customizer` is invoked\n * with three arguments: (nsValue, key, nsObject).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {};\n *\n * _.setWith(object, '[0][1]', 'a', Object);\n * // => { '0': { '1': 'a' } }\n */\n function setWith(object, path, value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined$1;\n return object == null ? object : baseSet(object, path, value, customizer);\n }\n\n /**\n * Creates an array of own enumerable string keyed-value pairs for `object`\n * which can be consumed by `_.fromPairs`. If `object` is a map or set, its\n * entries are returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias entries\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the key-value pairs.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.toPairs(new Foo);\n * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)\n */\n var toPairs = createToPairs(keys);\n\n /**\n * Creates an array of own and inherited enumerable string keyed-value pairs\n * for `object` which can be consumed by `_.fromPairs`. If `object` is a map\n * or set, its entries are returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias entriesIn\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the key-value pairs.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.toPairsIn(new Foo);\n * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)\n */\n var toPairsIn = createToPairs(keysIn);\n\n /**\n * An alternative to `_.reduce`; this method transforms `object` to a new\n * `accumulator` object which is the result of running each of its own\n * enumerable string keyed properties thru `iteratee`, with each invocation\n * potentially mutating the `accumulator` object. If `accumulator` is not\n * provided, a new object with the same `[[Prototype]]` will be used. The\n * iteratee is invoked with four arguments: (accumulator, value, key, object).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 1.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The custom accumulator value.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.transform([2, 3, 4], function(result, n) {\n * result.push(n *= n);\n * return n % 2 == 0;\n * }, []);\n * // => [4, 9]\n *\n * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] }\n */\n function transform(object, iteratee, accumulator) {\n var isArr = isArray(object),\n isArrLike = isArr || isBuffer(object) || isTypedArray(object);\n\n iteratee = getIteratee(iteratee, 4);\n if (accumulator == null) {\n var Ctor = object && object.constructor;\n if (isArrLike) {\n accumulator = isArr ? new Ctor : [];\n }\n else if (isObject(object)) {\n accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};\n }\n else {\n accumulator = {};\n }\n }\n (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {\n return iteratee(accumulator, value, index, object);\n });\n return accumulator;\n }\n\n /**\n * Removes the property at `path` of `object`.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 7 } }] };\n * _.unset(object, 'a[0].b.c');\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n *\n * _.unset(object, ['a', '0', 'b', 'c']);\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n */\n function unset(object, path) {\n return object == null ? true : baseUnset(object, path);\n }\n\n /**\n * This method is like `_.set` except that accepts `updater` to produce the\n * value to set. Use `_.updateWith` to customize `path` creation. The `updater`\n * is invoked with one argument: (value).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {Function} updater The function to produce the updated value.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.update(object, 'a[0].b.c', function(n) { return n * n; });\n * console.log(object.a[0].b.c);\n * // => 9\n *\n * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });\n * console.log(object.x[0].y.z);\n * // => 0\n */\n function update(object, path, updater) {\n return object == null ? object : baseUpdate(object, path, castFunction(updater));\n }\n\n /**\n * This method is like `_.update` except that it accepts `customizer` which is\n * invoked to produce the objects of `path`. If `customizer` returns `undefined`\n * path creation is handled by the method instead. The `customizer` is invoked\n * with three arguments: (nsValue, key, nsObject).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {Function} updater The function to produce the updated value.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {};\n *\n * _.updateWith(object, '[0][1]', _.constant('a'), Object);\n * // => { '0': { '1': 'a' } }\n */\n function updateWith(object, path, updater, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined$1;\n return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);\n }\n\n /**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\n function values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n }\n\n /**\n * Creates an array of the own and inherited enumerable string keyed property\n * values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.valuesIn(new Foo);\n * // => [1, 2, 3] (iteration order is not guaranteed)\n */\n function valuesIn(object) {\n return object == null ? [] : baseValues(object, keysIn(object));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Clamps `number` within the inclusive `lower` and `upper` bounds.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Number\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n * @example\n *\n * _.clamp(-10, -5, 5);\n * // => -5\n *\n * _.clamp(10, -5, 5);\n * // => 5\n */\n function clamp(number, lower, upper) {\n if (upper === undefined$1) {\n upper = lower;\n lower = undefined$1;\n }\n if (upper !== undefined$1) {\n upper = toNumber(upper);\n upper = upper === upper ? upper : 0;\n }\n if (lower !== undefined$1) {\n lower = toNumber(lower);\n lower = lower === lower ? lower : 0;\n }\n return baseClamp(toNumber(number), lower, upper);\n }\n\n /**\n * Checks if `n` is between `start` and up to, but not including, `end`. If\n * `end` is not specified, it's set to `start` with `start` then set to `0`.\n * If `start` is greater than `end` the params are swapped to support\n * negative ranges.\n *\n * @static\n * @memberOf _\n * @since 3.3.0\n * @category Number\n * @param {number} number The number to check.\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n * @see _.range, _.rangeRight\n * @example\n *\n * _.inRange(3, 2, 4);\n * // => true\n *\n * _.inRange(4, 8);\n * // => true\n *\n * _.inRange(4, 2);\n * // => false\n *\n * _.inRange(2, 2);\n * // => false\n *\n * _.inRange(1.2, 2);\n * // => true\n *\n * _.inRange(5.2, 4);\n * // => false\n *\n * _.inRange(-3, -2, -6);\n * // => true\n */\n function inRange(number, start, end) {\n start = toFinite(start);\n if (end === undefined$1) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n number = toNumber(number);\n return baseInRange(number, start, end);\n }\n\n /**\n * Produces a random number between the inclusive `lower` and `upper` bounds.\n * If only one argument is provided a number between `0` and the given number\n * is returned. If `floating` is `true`, or either `lower` or `upper` are\n * floats, a floating-point number is returned instead of an integer.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @memberOf _\n * @since 0.7.0\n * @category Number\n * @param {number} [lower=0] The lower bound.\n * @param {number} [upper=1] The upper bound.\n * @param {boolean} [floating] Specify returning a floating-point number.\n * @returns {number} Returns the random number.\n * @example\n *\n * _.random(0, 5);\n * // => an integer between 0 and 5\n *\n * _.random(5);\n * // => also an integer between 0 and 5\n *\n * _.random(5, true);\n * // => a floating-point number between 0 and 5\n *\n * _.random(1.2, 5.2);\n * // => a floating-point number between 1.2 and 5.2\n */\n function random(lower, upper, floating) {\n if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {\n upper = floating = undefined$1;\n }\n if (floating === undefined$1) {\n if (typeof upper == 'boolean') {\n floating = upper;\n upper = undefined$1;\n }\n else if (typeof lower == 'boolean') {\n floating = lower;\n lower = undefined$1;\n }\n }\n if (lower === undefined$1 && upper === undefined$1) {\n lower = 0;\n upper = 1;\n }\n else {\n lower = toFinite(lower);\n if (upper === undefined$1) {\n upper = lower;\n lower = 0;\n } else {\n upper = toFinite(upper);\n }\n }\n if (lower > upper) {\n var temp = lower;\n lower = upper;\n upper = temp;\n }\n if (floating || lower % 1 || upper % 1) {\n var rand = nativeRandom();\n return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);\n }\n return baseRandom(lower, upper);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the camel cased string.\n * @example\n *\n * _.camelCase('Foo Bar');\n * // => 'fooBar'\n *\n * _.camelCase('--foo-bar--');\n * // => 'fooBar'\n *\n * _.camelCase('__FOO_BAR__');\n * // => 'fooBar'\n */\n var camelCase = createCompounder(function(result, word, index) {\n word = word.toLowerCase();\n return result + (index ? capitalize(word) : word);\n });\n\n /**\n * Converts the first character of `string` to upper case and the remaining\n * to lower case.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to capitalize.\n * @returns {string} Returns the capitalized string.\n * @example\n *\n * _.capitalize('FRED');\n * // => 'Fred'\n */\n function capitalize(string) {\n return upperFirst(toString(string).toLowerCase());\n }\n\n /**\n * Deburrs `string` by converting\n * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)\n * letters to basic Latin letters and removing\n * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\n function deburr(string) {\n string = toString(string);\n return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');\n }\n\n /**\n * Checks if `string` ends with the given target string.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {string} [target] The string to search for.\n * @param {number} [position=string.length] The position to search up to.\n * @returns {boolean} Returns `true` if `string` ends with `target`,\n * else `false`.\n * @example\n *\n * _.endsWith('abc', 'c');\n * // => true\n *\n * _.endsWith('abc', 'b');\n * // => false\n *\n * _.endsWith('abc', 'b', 2);\n * // => true\n */\n function endsWith(string, target, position) {\n string = toString(string);\n target = baseToString(target);\n\n var length = string.length;\n position = position === undefined$1\n ? length\n : baseClamp(toInteger(position), 0, length);\n\n var end = position;\n position -= target.length;\n return position >= 0 && string.slice(position, end) == target;\n }\n\n /**\n * Converts the characters \"&\", \"<\", \">\", '\"', and \"'\" in `string` to their\n * corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional\n * characters use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value. See\n * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * When working with HTML you should always\n * [quote attribute values](http://wonko.com/post/html-escaping) to reduce\n * XSS vectors.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, & pebbles'\n */\n function escape(string) {\n string = toString(string);\n return (string && reHasUnescapedHtml.test(string))\n ? string.replace(reUnescapedHtml, escapeHtmlChar)\n : string;\n }\n\n /**\n * Escapes the `RegExp` special characters \"^\", \"$\", \"\\\", \".\", \"*\", \"+\",\n * \"?\", \"(\", \")\", \"[\", \"]\", \"{\", \"}\", and \"|\" in `string`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escapeRegExp('[lodash](https://lodash.com/)');\n * // => '\\[lodash\\]\\(https://lodash\\.com/\\)'\n */\n function escapeRegExp(string) {\n string = toString(string);\n return (string && reHasRegExpChar.test(string))\n ? string.replace(reRegExpChar, '\\\\$&')\n : string;\n }\n\n /**\n * Converts `string` to\n * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the kebab cased string.\n * @example\n *\n * _.kebabCase('Foo Bar');\n * // => 'foo-bar'\n *\n * _.kebabCase('fooBar');\n * // => 'foo-bar'\n *\n * _.kebabCase('__FOO_BAR__');\n * // => 'foo-bar'\n */\n var kebabCase = createCompounder(function(result, word, index) {\n return result + (index ? '-' : '') + word.toLowerCase();\n });\n\n /**\n * Converts `string`, as space separated words, to lower case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the lower cased string.\n * @example\n *\n * _.lowerCase('--Foo-Bar--');\n * // => 'foo bar'\n *\n * _.lowerCase('fooBar');\n * // => 'foo bar'\n *\n * _.lowerCase('__FOO_BAR__');\n * // => 'foo bar'\n */\n var lowerCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + word.toLowerCase();\n });\n\n /**\n * Converts the first character of `string` to lower case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.lowerFirst('Fred');\n * // => 'fred'\n *\n * _.lowerFirst('FRED');\n * // => 'fRED'\n */\n var lowerFirst = createCaseFirst('toLowerCase');\n\n /**\n * Pads `string` on the left and right sides if it's shorter than `length`.\n * Padding characters are truncated if they can't be evenly divided by `length`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.pad('abc', 8);\n * // => ' abc '\n *\n * _.pad('abc', 8, '_-');\n * // => '_-abc_-_'\n *\n * _.pad('abc', 3);\n * // => 'abc'\n */\n function pad(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n if (!length || strLength >= length) {\n return string;\n }\n var mid = (length - strLength) / 2;\n return (\n createPadding(nativeFloor(mid), chars) +\n string +\n createPadding(nativeCeil(mid), chars)\n );\n }\n\n /**\n * Pads `string` on the right side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padEnd('abc', 6);\n * // => 'abc '\n *\n * _.padEnd('abc', 6, '_-');\n * // => 'abc_-_'\n *\n * _.padEnd('abc', 3);\n * // => 'abc'\n */\n function padEnd(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n return (length && strLength < length)\n ? (string + createPadding(length - strLength, chars))\n : string;\n }\n\n /**\n * Pads `string` on the left side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padStart('abc', 6);\n * // => ' abc'\n *\n * _.padStart('abc', 6, '_-');\n * // => '_-_abc'\n *\n * _.padStart('abc', 3);\n * // => 'abc'\n */\n function padStart(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n return (length && strLength < length)\n ? (createPadding(length - strLength, chars) + string)\n : string;\n }\n\n /**\n * Converts `string` to an integer of the specified radix. If `radix` is\n * `undefined` or `0`, a `radix` of `10` is used unless `value` is a\n * hexadecimal, in which case a `radix` of `16` is used.\n *\n * **Note:** This method aligns with the\n * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category String\n * @param {string} string The string to convert.\n * @param {number} [radix=10] The radix to interpret `value` by.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.parseInt('08');\n * // => 8\n *\n * _.map(['6', '08', '10'], _.parseInt);\n * // => [6, 8, 10]\n */\n function parseInt(string, radix, guard) {\n if (guard || radix == null) {\n radix = 0;\n } else if (radix) {\n radix = +radix;\n }\n return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);\n }\n\n /**\n * Repeats the given string `n` times.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to repeat.\n * @param {number} [n=1] The number of times to repeat the string.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the repeated string.\n * @example\n *\n * _.repeat('*', 3);\n * // => '***'\n *\n * _.repeat('abc', 2);\n * // => 'abcabc'\n *\n * _.repeat('abc', 0);\n * // => ''\n */\n function repeat(string, n, guard) {\n if ((guard ? isIterateeCall(string, n, guard) : n === undefined$1)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n return baseRepeat(toString(string), n);\n }\n\n /**\n * Replaces matches for `pattern` in `string` with `replacement`.\n *\n * **Note:** This method is based on\n * [`String#replace`](https://mdn.io/String/replace).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to modify.\n * @param {RegExp|string} pattern The pattern to replace.\n * @param {Function|string} replacement The match replacement.\n * @returns {string} Returns the modified string.\n * @example\n *\n * _.replace('Hi Fred', 'Fred', 'Barney');\n * // => 'Hi Barney'\n */\n function replace() {\n var args = arguments,\n string = toString(args[0]);\n\n return args.length < 3 ? string : string.replace(args[1], args[2]);\n }\n\n /**\n * Converts `string` to\n * [snake case](https://en.wikipedia.org/wiki/Snake_case).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the snake cased string.\n * @example\n *\n * _.snakeCase('Foo Bar');\n * // => 'foo_bar'\n *\n * _.snakeCase('fooBar');\n * // => 'foo_bar'\n *\n * _.snakeCase('--FOO-BAR--');\n * // => 'foo_bar'\n */\n var snakeCase = createCompounder(function(result, word, index) {\n return result + (index ? '_' : '') + word.toLowerCase();\n });\n\n /**\n * Splits `string` by `separator`.\n *\n * **Note:** This method is based on\n * [`String#split`](https://mdn.io/String/split).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to split.\n * @param {RegExp|string} separator The separator pattern to split by.\n * @param {number} [limit] The length to truncate results to.\n * @returns {Array} Returns the string segments.\n * @example\n *\n * _.split('a-b-c', '-', 2);\n * // => ['a', 'b']\n */\n function split(string, separator, limit) {\n if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {\n separator = limit = undefined$1;\n }\n limit = limit === undefined$1 ? MAX_ARRAY_LENGTH : limit >>> 0;\n if (!limit) {\n return [];\n }\n string = toString(string);\n if (string && (\n typeof separator == 'string' ||\n (separator != null && !isRegExp(separator))\n )) {\n separator = baseToString(separator);\n if (!separator && hasUnicode(string)) {\n return castSlice(stringToArray(string), 0, limit);\n }\n }\n return string.split(separator, limit);\n }\n\n /**\n * Converts `string` to\n * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).\n *\n * @static\n * @memberOf _\n * @since 3.1.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the start cased string.\n * @example\n *\n * _.startCase('--foo-bar--');\n * // => 'Foo Bar'\n *\n * _.startCase('fooBar');\n * // => 'Foo Bar'\n *\n * _.startCase('__FOO_BAR__');\n * // => 'FOO BAR'\n */\n var startCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + upperFirst(word);\n });\n\n /**\n * Checks if `string` starts with the given target string.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {string} [target] The string to search for.\n * @param {number} [position=0] The position to search from.\n * @returns {boolean} Returns `true` if `string` starts with `target`,\n * else `false`.\n * @example\n *\n * _.startsWith('abc', 'a');\n * // => true\n *\n * _.startsWith('abc', 'b');\n * // => false\n *\n * _.startsWith('abc', 'b', 1);\n * // => true\n */\n function startsWith(string, target, position) {\n string = toString(string);\n position = position == null\n ? 0\n : baseClamp(toInteger(position), 0, string.length);\n\n target = baseToString(target);\n return string.slice(position, position + target.length) == target;\n }\n\n /**\n * Creates a compiled template function that can interpolate data properties\n * in \"interpolate\" delimiters, HTML-escape interpolated data properties in\n * \"escape\" delimiters, and execute JavaScript in \"evaluate\" delimiters. Data\n * properties may be accessed as free variables in the template. If a setting\n * object is given, it takes precedence over `_.templateSettings` values.\n *\n * **Note:** In the development build `_.template` utilizes\n * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\n * for easier debugging.\n *\n * For more information on precompiling templates see\n * [lodash's custom builds documentation](https://lodash.com/custom-builds).\n *\n * For more information on Chrome extension sandboxes see\n * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The template string.\n * @param {Object} [options={}] The options object.\n * @param {RegExp} [options.escape=_.templateSettings.escape]\n * The HTML \"escape\" delimiter.\n * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]\n * The \"evaluate\" delimiter.\n * @param {Object} [options.imports=_.templateSettings.imports]\n * An object to import into the template as free variables.\n * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]\n * The \"interpolate\" delimiter.\n * @param {string} [options.sourceURL='lodash.templateSources[n]']\n * The sourceURL of the compiled template.\n * @param {string} [options.variable='obj']\n * The data object variable name.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the compiled template function.\n * @example\n *\n * // Use the \"interpolate\" delimiter to create a compiled template.\n * var compiled = _.template('hello <%= user %>!');\n * compiled({ 'user': 'fred' });\n * // => 'hello fred!'\n *\n * // Use the HTML \"escape\" delimiter to escape data property values.\n * var compiled = _.template('<b><%- value %></b>');\n * compiled({ 'value': '<script>' });\n * // => '<b><script></b>'\n *\n * // Use the \"evaluate\" delimiter to execute JavaScript and generate HTML.\n * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');\n * compiled({ 'users': ['fred', 'barney'] });\n * // => '<li>fred</li><li>barney</li>'\n *\n * // Use the internal `print` function in \"evaluate\" delimiters.\n * var compiled = _.template('<% print(\"hello \" + user); %>!');\n * compiled({ 'user': 'barney' });\n * // => 'hello barney!'\n *\n * // Use the ES template literal delimiter as an \"interpolate\" delimiter.\n * // Disable support by replacing the \"interpolate\" delimiter.\n * var compiled = _.template('hello ${ user }!');\n * compiled({ 'user': 'pebbles' });\n * // => 'hello pebbles!'\n *\n * // Use backslashes to treat delimiters as plain text.\n * var compiled = _.template('<%= \"\\\\<%- value %\\\\>\" %>');\n * compiled({ 'value': 'ignored' });\n * // => '<%- value %>'\n *\n * // Use the `imports` option to import `jQuery` as `jq`.\n * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';\n * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });\n * compiled({ 'users': ['fred', 'barney'] });\n * // => '<li>fred</li><li>barney</li>'\n *\n * // Use the `sourceURL` option to specify a custom sourceURL for the template.\n * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });\n * compiled(data);\n * // => Find the source of \"greeting.jst\" under the Sources tab or Resources panel of the web inspector.\n *\n * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.\n * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });\n * compiled.source;\n * // => function(data) {\n * // var __t, __p = '';\n * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';\n * // return __p;\n * // }\n *\n * // Use custom template delimiters.\n * _.templateSettings.interpolate = /{{([\\s\\S]+?)}}/g;\n * var compiled = _.template('hello {{ user }}!');\n * compiled({ 'user': 'mustache' });\n * // => 'hello mustache!'\n *\n * // Use the `source` property to inline compiled templates for meaningful\n * // line numbers in error messages and stack traces.\n * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\\\n * var JST = {\\\n * \"main\": ' + _.template(mainText).source + '\\\n * };\\\n * ');\n */\n function template(string, options, guard) {\n // Based on John Resig's `tmpl` implementation\n // (http://ejohn.org/blog/javascript-micro-templating/)\n // and Laura Doktorova's doT.js (https://github.com/olado/doT).\n var settings = lodash.templateSettings;\n\n if (guard && isIterateeCall(string, options, guard)) {\n options = undefined$1;\n }\n string = toString(string);\n options = assignInWith({}, options, settings, customDefaultsAssignIn);\n\n var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),\n importsKeys = keys(imports),\n importsValues = baseValues(imports, importsKeys);\n\n var isEscaping,\n isEvaluating,\n index = 0,\n interpolate = options.interpolate || reNoMatch,\n source = \"__p += '\";\n\n // Compile the regexp to match each delimiter.\n var reDelimiters = RegExp(\n (options.escape || reNoMatch).source + '|' +\n interpolate.source + '|' +\n (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +\n (options.evaluate || reNoMatch).source + '|$'\n , 'g');\n\n // Use a sourceURL for easier debugging.\n // The sourceURL gets injected into the source that's eval-ed, so be careful\n // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in\n // and escape the comment, thus injecting code that gets evaled.\n var sourceURL = '//# sourceURL=' +\n (hasOwnProperty.call(options, 'sourceURL')\n ? (options.sourceURL + '').replace(/\\s/g, ' ')\n : ('lodash.templateSources[' + (++templateCounter) + ']')\n ) + '\\n';\n\n string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {\n interpolateValue || (interpolateValue = esTemplateValue);\n\n // Escape characters that can't be included in string literals.\n source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);\n\n // Replace delimiters with snippets.\n if (escapeValue) {\n isEscaping = true;\n source += \"' +\\n__e(\" + escapeValue + \") +\\n'\";\n }\n if (evaluateValue) {\n isEvaluating = true;\n source += \"';\\n\" + evaluateValue + \";\\n__p += '\";\n }\n if (interpolateValue) {\n source += \"' +\\n((__t = (\" + interpolateValue + \")) == null ? '' : __t) +\\n'\";\n }\n index = offset + match.length;\n\n // The JS engine embedded in Adobe products needs `match` returned in\n // order to produce the correct `offset` value.\n return match;\n });\n\n source += \"';\\n\";\n\n // If `variable` is not specified wrap a with-statement around the generated\n // code to add the data object to the top of the scope chain.\n var variable = hasOwnProperty.call(options, 'variable') && options.variable;\n if (!variable) {\n source = 'with (obj) {\\n' + source + '\\n}\\n';\n }\n // Cleanup code by stripping empty strings.\n source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)\n .replace(reEmptyStringMiddle, '$1')\n .replace(reEmptyStringTrailing, '$1;');\n\n // Frame code as the function body.\n source = 'function(' + (variable || 'obj') + ') {\\n' +\n (variable\n ? ''\n : 'obj || (obj = {});\\n'\n ) +\n \"var __t, __p = ''\" +\n (isEscaping\n ? ', __e = _.escape'\n : ''\n ) +\n (isEvaluating\n ? ', __j = Array.prototype.join;\\n' +\n \"function print() { __p += __j.call(arguments, '') }\\n\"\n : ';\\n'\n ) +\n source +\n 'return __p\\n}';\n\n var result = attempt(function() {\n return Function(importsKeys, sourceURL + 'return ' + source)\n .apply(undefined$1, importsValues);\n });\n\n // Provide the compiled function's source by its `toString` method or\n // the `source` property as a convenience for inlining compiled templates.\n result.source = source;\n if (isError(result)) {\n throw result;\n }\n return result;\n }\n\n /**\n * Converts `string`, as a whole, to lower case just like\n * [String#toLowerCase](https://mdn.io/toLowerCase).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the lower cased string.\n * @example\n *\n * _.toLower('--Foo-Bar--');\n * // => '--foo-bar--'\n *\n * _.toLower('fooBar');\n * // => 'foobar'\n *\n * _.toLower('__FOO_BAR__');\n * // => '__foo_bar__'\n */\n function toLower(value) {\n return toString(value).toLowerCase();\n }\n\n /**\n * Converts `string`, as a whole, to upper case just like\n * [String#toUpperCase](https://mdn.io/toUpperCase).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the upper cased string.\n * @example\n *\n * _.toUpper('--foo-bar--');\n * // => '--FOO-BAR--'\n *\n * _.toUpper('fooBar');\n * // => 'FOOBAR'\n *\n * _.toUpper('__foo_bar__');\n * // => '__FOO_BAR__'\n */\n function toUpper(value) {\n return toString(value).toUpperCase();\n }\n\n /**\n * Removes leading and trailing whitespace or specified characters from `string`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to trim.\n * @param {string} [chars=whitespace] The characters to trim.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the trimmed string.\n * @example\n *\n * _.trim(' abc ');\n * // => 'abc'\n *\n * _.trim('-_-abc-_-', '_-');\n * // => 'abc'\n *\n * _.map([' foo ', ' bar '], _.trim);\n * // => ['foo', 'bar']\n */\n function trim(string, chars, guard) {\n string = toString(string);\n if (string && (guard || chars === undefined$1)) {\n return string.replace(reTrim, '');\n }\n if (!string || !(chars = baseToString(chars))) {\n return string;\n }\n var strSymbols = stringToArray(string),\n chrSymbols = stringToArray(chars),\n start = charsStartIndex(strSymbols, chrSymbols),\n end = charsEndIndex(strSymbols, chrSymbols) + 1;\n\n return castSlice(strSymbols, start, end).join('');\n }\n\n /**\n * Removes trailing whitespace or specified characters from `string`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to trim.\n * @param {string} [chars=whitespace] The characters to trim.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the trimmed string.\n * @example\n *\n * _.trimEnd(' abc ');\n * // => ' abc'\n *\n * _.trimEnd('-_-abc-_-', '_-');\n * // => '-_-abc'\n */\n function trimEnd(string, chars, guard) {\n string = toString(string);\n if (string && (guard || chars === undefined$1)) {\n return string.replace(reTrimEnd, '');\n }\n if (!string || !(chars = baseToString(chars))) {\n return string;\n }\n var strSymbols = stringToArray(string),\n end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;\n\n return castSlice(strSymbols, 0, end).join('');\n }\n\n /**\n * Removes leading whitespace or specified characters from `string`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to trim.\n * @param {string} [chars=whitespace] The characters to trim.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the trimmed string.\n * @example\n *\n * _.trimStart(' abc ');\n * // => 'abc '\n *\n * _.trimStart('-_-abc-_-', '_-');\n * // => 'abc-_-'\n */\n function trimStart(string, chars, guard) {\n string = toString(string);\n if (string && (guard || chars === undefined$1)) {\n return string.replace(reTrimStart, '');\n }\n if (!string || !(chars = baseToString(chars))) {\n return string;\n }\n var strSymbols = stringToArray(string),\n start = charsStartIndex(strSymbols, stringToArray(chars));\n\n return castSlice(strSymbols, start).join('');\n }\n\n /**\n * Truncates `string` if it's longer than the given maximum string length.\n * The last characters of the truncated string are replaced with the omission\n * string which defaults to \"...\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to truncate.\n * @param {Object} [options={}] The options object.\n * @param {number} [options.length=30] The maximum string length.\n * @param {string} [options.omission='...'] The string to indicate text is omitted.\n * @param {RegExp|string} [options.separator] The separator pattern to truncate to.\n * @returns {string} Returns the truncated string.\n * @example\n *\n * _.truncate('hi-diddly-ho there, neighborino');\n * // => 'hi-diddly-ho there, neighbo...'\n *\n * _.truncate('hi-diddly-ho there, neighborino', {\n * 'length': 24,\n * 'separator': ' '\n * });\n * // => 'hi-diddly-ho there,...'\n *\n * _.truncate('hi-diddly-ho there, neighborino', {\n * 'length': 24,\n * 'separator': /,? +/\n * });\n * // => 'hi-diddly-ho there...'\n *\n * _.truncate('hi-diddly-ho there, neighborino', {\n * 'omission': ' [...]'\n * });\n * // => 'hi-diddly-ho there, neig [...]'\n */\n function truncate(string, options) {\n var length = DEFAULT_TRUNC_LENGTH,\n omission = DEFAULT_TRUNC_OMISSION;\n\n if (isObject(options)) {\n var separator = 'separator' in options ? options.separator : separator;\n length = 'length' in options ? toInteger(options.length) : length;\n omission = 'omission' in options ? baseToString(options.omission) : omission;\n }\n string = toString(string);\n\n var strLength = string.length;\n if (hasUnicode(string)) {\n var strSymbols = stringToArray(string);\n strLength = strSymbols.length;\n }\n if (length >= strLength) {\n return string;\n }\n var end = length - stringSize(omission);\n if (end < 1) {\n return omission;\n }\n var result = strSymbols\n ? castSlice(strSymbols, 0, end).join('')\n : string.slice(0, end);\n\n if (separator === undefined$1) {\n return result + omission;\n }\n if (strSymbols) {\n end += (result.length - end);\n }\n if (isRegExp(separator)) {\n if (string.slice(end).search(separator)) {\n var match,\n substring = result;\n\n if (!separator.global) {\n separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');\n }\n separator.lastIndex = 0;\n while ((match = separator.exec(substring))) {\n var newEnd = match.index;\n }\n result = result.slice(0, newEnd === undefined$1 ? end : newEnd);\n }\n } else if (string.indexOf(baseToString(separator), end) != end) {\n var index = result.lastIndexOf(separator);\n if (index > -1) {\n result = result.slice(0, index);\n }\n }\n return result + omission;\n }\n\n /**\n * The inverse of `_.escape`; this method converts the HTML entities\n * `&`, `<`, `>`, `"`, and `'` in `string` to\n * their corresponding characters.\n *\n * **Note:** No other HTML entities are unescaped. To unescape additional\n * HTML entities use a third-party library like [_he_](https://mths.be/he).\n *\n * @static\n * @memberOf _\n * @since 0.6.0\n * @category String\n * @param {string} [string=''] The string to unescape.\n * @returns {string} Returns the unescaped string.\n * @example\n *\n * _.unescape('fred, barney, & pebbles');\n * // => 'fred, barney, & pebbles'\n */\n function unescape(string) {\n string = toString(string);\n return (string && reHasEscapedHtml.test(string))\n ? string.replace(reEscapedHtml, unescapeHtmlChar)\n : string;\n }\n\n /**\n * Converts `string`, as space separated words, to upper case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the upper cased string.\n * @example\n *\n * _.upperCase('--foo-bar');\n * // => 'FOO BAR'\n *\n * _.upperCase('fooBar');\n * // => 'FOO BAR'\n *\n * _.upperCase('__foo_bar__');\n * // => 'FOO BAR'\n */\n var upperCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + word.toUpperCase();\n });\n\n /**\n * Converts the first character of `string` to upper case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.upperFirst('fred');\n * // => 'Fred'\n *\n * _.upperFirst('FRED');\n * // => 'FRED'\n */\n var upperFirst = createCaseFirst('toUpperCase');\n\n /**\n * Splits `string` into an array of its words.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {RegExp|string} [pattern] The pattern to match words.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the words of `string`.\n * @example\n *\n * _.words('fred, barney, & pebbles');\n * // => ['fred', 'barney', 'pebbles']\n *\n * _.words('fred, barney, & pebbles', /[^, ]+/g);\n * // => ['fred', 'barney', '&', 'pebbles']\n */\n function words(string, pattern, guard) {\n string = toString(string);\n pattern = guard ? undefined$1 : pattern;\n\n if (pattern === undefined$1) {\n return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);\n }\n return string.match(pattern) || [];\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Attempts to invoke `func`, returning either the result or the caught error\n * object. Any additional arguments are provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Util\n * @param {Function} func The function to attempt.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {*} Returns the `func` result or error object.\n * @example\n *\n * // Avoid throwing errors for invalid selectors.\n * var elements = _.attempt(function(selector) {\n * return document.querySelectorAll(selector);\n * }, '>_>');\n *\n * if (_.isError(elements)) {\n * elements = [];\n * }\n */\n var attempt = baseRest(function(func, args) {\n try {\n return apply(func, undefined$1, args);\n } catch (e) {\n return isError(e) ? e : new Error(e);\n }\n });\n\n /**\n * Binds methods of an object to the object itself, overwriting the existing\n * method.\n *\n * **Note:** This method doesn't set the \"length\" property of bound functions.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {Object} object The object to bind and assign the bound methods to.\n * @param {...(string|string[])} methodNames The object method names to bind.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var view = {\n * 'label': 'docs',\n * 'click': function() {\n * console.log('clicked ' + this.label);\n * }\n * };\n *\n * _.bindAll(view, ['click']);\n * jQuery(element).on('click', view.click);\n * // => Logs 'clicked docs' when clicked.\n */\n var bindAll = flatRest(function(object, methodNames) {\n arrayEach(methodNames, function(key) {\n key = toKey(key);\n baseAssignValue(object, key, bind(object[key], object));\n });\n return object;\n });\n\n /**\n * Creates a function that iterates over `pairs` and invokes the corresponding\n * function of the first predicate to return truthy. The predicate-function\n * pairs are invoked with the `this` binding and arguments of the created\n * function.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {Array} pairs The predicate-function pairs.\n * @returns {Function} Returns the new composite function.\n * @example\n *\n * var func = _.cond([\n * [_.matches({ 'a': 1 }), _.constant('matches A')],\n * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],\n * [_.stubTrue, _.constant('no match')]\n * ]);\n *\n * func({ 'a': 1, 'b': 2 });\n * // => 'matches A'\n *\n * func({ 'a': 0, 'b': 1 });\n * // => 'matches B'\n *\n * func({ 'a': '1', 'b': '2' });\n * // => 'no match'\n */\n function cond(pairs) {\n var length = pairs == null ? 0 : pairs.length,\n toIteratee = getIteratee();\n\n pairs = !length ? [] : arrayMap(pairs, function(pair) {\n if (typeof pair[1] != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return [toIteratee(pair[0]), pair[1]];\n });\n\n return baseRest(function(args) {\n var index = -1;\n while (++index < length) {\n var pair = pairs[index];\n if (apply(pair[0], this, args)) {\n return apply(pair[1], this, args);\n }\n }\n });\n }\n\n /**\n * Creates a function that invokes the predicate properties of `source` with\n * the corresponding property values of a given object, returning `true` if\n * all predicates return truthy, else `false`.\n *\n * **Note:** The created function is equivalent to `_.conformsTo` with\n * `source` partially applied.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {Object} source The object of property predicates to conform to.\n * @returns {Function} Returns the new spec function.\n * @example\n *\n * var objects = [\n * { 'a': 2, 'b': 1 },\n * { 'a': 1, 'b': 2 }\n * ];\n *\n * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));\n * // => [{ 'a': 1, 'b': 2 }]\n */\n function conforms(source) {\n return baseConforms(baseClone(source, CLONE_DEEP_FLAG));\n }\n\n /**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\n function constant(value) {\n return function() {\n return value;\n };\n }\n\n /**\n * Checks `value` to determine whether a default value should be returned in\n * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,\n * or `undefined`.\n *\n * @static\n * @memberOf _\n * @since 4.14.0\n * @category Util\n * @param {*} value The value to check.\n * @param {*} defaultValue The default value.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * _.defaultTo(1, 10);\n * // => 1\n *\n * _.defaultTo(undefined, 10);\n * // => 10\n */\n function defaultTo(value, defaultValue) {\n return (value == null || value !== value) ? defaultValue : value;\n }\n\n /**\n * Creates a function that returns the result of invoking the given functions\n * with the `this` binding of the created function, where each successive\n * invocation is supplied the return value of the previous.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Util\n * @param {...(Function|Function[])} [funcs] The functions to invoke.\n * @returns {Function} Returns the new composite function.\n * @see _.flowRight\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var addSquare = _.flow([_.add, square]);\n * addSquare(1, 2);\n * // => 9\n */\n var flow = createFlow();\n\n /**\n * This method is like `_.flow` except that it creates a function that\n * invokes the given functions from right to left.\n *\n * @static\n * @since 3.0.0\n * @memberOf _\n * @category Util\n * @param {...(Function|Function[])} [funcs] The functions to invoke.\n * @returns {Function} Returns the new composite function.\n * @see _.flow\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var addSquare = _.flowRight([square, _.add]);\n * addSquare(1, 2);\n * // => 9\n */\n var flowRight = createFlow(true);\n\n /**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\n function identity(value) {\n return value;\n }\n\n /**\n * Creates a function that invokes `func` with the arguments of the created\n * function. If `func` is a property name, the created function returns the\n * property value for a given element. If `func` is an array or object, the\n * created function returns `true` for elements that contain the equivalent\n * source properties, otherwise it returns `false`.\n *\n * @static\n * @since 4.0.0\n * @memberOf _\n * @category Util\n * @param {*} [func=_.identity] The value to convert to a callback.\n * @returns {Function} Returns the callback.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));\n * // => [{ 'user': 'barney', 'age': 36, 'active': true }]\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, _.iteratee(['user', 'fred']));\n * // => [{ 'user': 'fred', 'age': 40 }]\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, _.iteratee('user'));\n * // => ['barney', 'fred']\n *\n * // Create custom iteratee shorthands.\n * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {\n * return !_.isRegExp(func) ? iteratee(func) : function(string) {\n * return func.test(string);\n * };\n * });\n *\n * _.filter(['abc', 'def'], /ef/);\n * // => ['def']\n */\n function iteratee(func) {\n return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));\n }\n\n /**\n * Creates a function that performs a partial deep comparison between a given\n * object and `source`, returning `true` if the given object has equivalent\n * property values, else `false`.\n *\n * **Note:** The created function is equivalent to `_.isMatch` with `source`\n * partially applied.\n *\n * Partial comparisons will match empty array and empty object `source`\n * values against any array or object value, respectively. See `_.isEqual`\n * for a list of supported value comparisons.\n *\n * **Note:** Multiple values can be checked by combining several matchers\n * using `_.overSome`\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Util\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n * @example\n *\n * var objects = [\n * { 'a': 1, 'b': 2, 'c': 3 },\n * { 'a': 4, 'b': 5, 'c': 6 }\n * ];\n *\n * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));\n * // => [{ 'a': 4, 'b': 5, 'c': 6 }]\n *\n * // Checking for several possible values\n * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));\n * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]\n */\n function matches(source) {\n return baseMatches(baseClone(source, CLONE_DEEP_FLAG));\n }\n\n /**\n * Creates a function that performs a partial deep comparison between the\n * value at `path` of a given object to `srcValue`, returning `true` if the\n * object value is equivalent, else `false`.\n *\n * **Note:** Partial comparisons will match empty array and empty object\n * `srcValue` values against any array or object value, respectively. See\n * `_.isEqual` for a list of supported value comparisons.\n *\n * **Note:** Multiple values can be checked by combining several matchers\n * using `_.overSome`\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n * @example\n *\n * var objects = [\n * { 'a': 1, 'b': 2, 'c': 3 },\n * { 'a': 4, 'b': 5, 'c': 6 }\n * ];\n *\n * _.find(objects, _.matchesProperty('a', 4));\n * // => { 'a': 4, 'b': 5, 'c': 6 }\n *\n * // Checking for several possible values\n * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));\n * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]\n */\n function matchesProperty(path, srcValue) {\n return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));\n }\n\n /**\n * Creates a function that invokes the method at `path` of a given object.\n * Any additional arguments are provided to the invoked method.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Util\n * @param {Array|string} path The path of the method to invoke.\n * @param {...*} [args] The arguments to invoke the method with.\n * @returns {Function} Returns the new invoker function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': _.constant(2) } },\n * { 'a': { 'b': _.constant(1) } }\n * ];\n *\n * _.map(objects, _.method('a.b'));\n * // => [2, 1]\n *\n * _.map(objects, _.method(['a', 'b']));\n * // => [2, 1]\n */\n var method = baseRest(function(path, args) {\n return function(object) {\n return baseInvoke(object, path, args);\n };\n });\n\n /**\n * The opposite of `_.method`; this method creates a function that invokes\n * the method at a given path of `object`. Any additional arguments are\n * provided to the invoked method.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Util\n * @param {Object} object The object to query.\n * @param {...*} [args] The arguments to invoke the method with.\n * @returns {Function} Returns the new invoker function.\n * @example\n *\n * var array = _.times(3, _.constant),\n * object = { 'a': array, 'b': array, 'c': array };\n *\n * _.map(['a[2]', 'c[0]'], _.methodOf(object));\n * // => [2, 0]\n *\n * _.map([['a', '2'], ['c', '0']], _.methodOf(object));\n * // => [2, 0]\n */\n var methodOf = baseRest(function(object, args) {\n return function(path) {\n return baseInvoke(object, path, args);\n };\n });\n\n /**\n * Adds all own enumerable string keyed function properties of a source\n * object to the destination object. If `object` is a function, then methods\n * are added to its prototype as well.\n *\n * **Note:** Use `_.runInContext` to create a pristine `lodash` function to\n * avoid conflicts caused by modifying the original.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {Function|Object} [object=lodash] The destination object.\n * @param {Object} source The object of functions to add.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.chain=true] Specify whether mixins are chainable.\n * @returns {Function|Object} Returns `object`.\n * @example\n *\n * function vowels(string) {\n * return _.filter(string, function(v) {\n * return /[aeiou]/i.test(v);\n * });\n * }\n *\n * _.mixin({ 'vowels': vowels });\n * _.vowels('fred');\n * // => ['e']\n *\n * _('fred').vowels().value();\n * // => ['e']\n *\n * _.mixin({ 'vowels': vowels }, { 'chain': false });\n * _('fred').vowels();\n * // => ['e']\n */\n function mixin(object, source, options) {\n var props = keys(source),\n methodNames = baseFunctions(source, props);\n\n if (options == null &&\n !(isObject(source) && (methodNames.length || !props.length))) {\n options = source;\n source = object;\n object = this;\n methodNames = baseFunctions(source, keys(source));\n }\n var chain = !(isObject(options) && 'chain' in options) || !!options.chain,\n isFunc = isFunction(object);\n\n arrayEach(methodNames, function(methodName) {\n var func = source[methodName];\n object[methodName] = func;\n if (isFunc) {\n object.prototype[methodName] = function() {\n var chainAll = this.__chain__;\n if (chain || chainAll) {\n var result = object(this.__wrapped__),\n actions = result.__actions__ = copyArray(this.__actions__);\n\n actions.push({ 'func': func, 'args': arguments, 'thisArg': object });\n result.__chain__ = chainAll;\n return result;\n }\n return func.apply(object, arrayPush([this.value()], arguments));\n };\n }\n });\n\n return object;\n }\n\n /**\n * Reverts the `_` variable to its previous value and returns a reference to\n * the `lodash` function.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @returns {Function} Returns the `lodash` function.\n * @example\n *\n * var lodash = _.noConflict();\n */\n function noConflict() {\n if (root._ === this) {\n root._ = oldDash;\n }\n return this;\n }\n\n /**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\n function noop() {\n // No operation performed.\n }\n\n /**\n * Creates a function that gets the argument at index `n`. If `n` is negative,\n * the nth argument from the end is returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {number} [n=0] The index of the argument to return.\n * @returns {Function} Returns the new pass-thru function.\n * @example\n *\n * var func = _.nthArg(1);\n * func('a', 'b', 'c', 'd');\n * // => 'b'\n *\n * var func = _.nthArg(-2);\n * func('a', 'b', 'c', 'd');\n * // => 'c'\n */\n function nthArg(n) {\n n = toInteger(n);\n return baseRest(function(args) {\n return baseNth(args, n);\n });\n }\n\n /**\n * Creates a function that invokes `iteratees` with the arguments it receives\n * and returns their results.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to invoke.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var func = _.over([Math.max, Math.min]);\n *\n * func(1, 2, 3, 4);\n * // => [4, 1]\n */\n var over = createOver(arrayMap);\n\n /**\n * Creates a function that checks if **all** of the `predicates` return\n * truthy when invoked with the arguments it receives.\n *\n * Following shorthands are possible for providing predicates.\n * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.\n * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {...(Function|Function[])} [predicates=[_.identity]]\n * The predicates to check.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var func = _.overEvery([Boolean, isFinite]);\n *\n * func('1');\n * // => true\n *\n * func(null);\n * // => false\n *\n * func(NaN);\n * // => false\n */\n var overEvery = createOver(arrayEvery);\n\n /**\n * Creates a function that checks if **any** of the `predicates` return\n * truthy when invoked with the arguments it receives.\n *\n * Following shorthands are possible for providing predicates.\n * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.\n * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {...(Function|Function[])} [predicates=[_.identity]]\n * The predicates to check.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var func = _.overSome([Boolean, isFinite]);\n *\n * func('1');\n * // => true\n *\n * func(null);\n * // => true\n *\n * func(NaN);\n * // => false\n *\n * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])\n * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])\n */\n var overSome = createOver(arraySome);\n\n /**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\n function property(path) {\n return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);\n }\n\n /**\n * The opposite of `_.property`; this method creates a function that returns\n * the value at a given path of `object`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Util\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var array = [0, 1, 2],\n * object = { 'a': array, 'b': array, 'c': array };\n *\n * _.map(['a[2]', 'c[0]'], _.propertyOf(object));\n * // => [2, 0]\n *\n * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));\n * // => [2, 0]\n */\n function propertyOf(object) {\n return function(path) {\n return object == null ? undefined$1 : baseGet(object, path);\n };\n }\n\n /**\n * Creates an array of numbers (positive and/or negative) progressing from\n * `start` up to, but not including, `end`. A step of `-1` is used if a negative\n * `start` is specified without an `end` or `step`. If `end` is not specified,\n * it's set to `start` with `start` then set to `0`.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @param {number} [step=1] The value to increment or decrement by.\n * @returns {Array} Returns the range of numbers.\n * @see _.inRange, _.rangeRight\n * @example\n *\n * _.range(4);\n * // => [0, 1, 2, 3]\n *\n * _.range(-4);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 5);\n * // => [1, 2, 3, 4]\n *\n * _.range(0, 20, 5);\n * // => [0, 5, 10, 15]\n *\n * _.range(0, -4, -1);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 4, 0);\n * // => [1, 1, 1]\n *\n * _.range(0);\n * // => []\n */\n var range = createRange();\n\n /**\n * This method is like `_.range` except that it populates values in\n * descending order.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @param {number} [step=1] The value to increment or decrement by.\n * @returns {Array} Returns the range of numbers.\n * @see _.inRange, _.range\n * @example\n *\n * _.rangeRight(4);\n * // => [3, 2, 1, 0]\n *\n * _.rangeRight(-4);\n * // => [-3, -2, -1, 0]\n *\n * _.rangeRight(1, 5);\n * // => [4, 3, 2, 1]\n *\n * _.rangeRight(0, 20, 5);\n * // => [15, 10, 5, 0]\n *\n * _.rangeRight(0, -4, -1);\n * // => [-3, -2, -1, 0]\n *\n * _.rangeRight(1, 4, 0);\n * // => [1, 1, 1]\n *\n * _.rangeRight(0);\n * // => []\n */\n var rangeRight = createRange(true);\n\n /**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\n function stubArray() {\n return [];\n }\n\n /**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\n function stubFalse() {\n return false;\n }\n\n /**\n * This method returns a new empty object.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Object} Returns the new empty object.\n * @example\n *\n * var objects = _.times(2, _.stubObject);\n *\n * console.log(objects);\n * // => [{}, {}]\n *\n * console.log(objects[0] === objects[1]);\n * // => false\n */\n function stubObject() {\n return {};\n }\n\n /**\n * This method returns an empty string.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {string} Returns the empty string.\n * @example\n *\n * _.times(2, _.stubString);\n * // => ['', '']\n */\n function stubString() {\n return '';\n }\n\n /**\n * This method returns `true`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `true`.\n * @example\n *\n * _.times(2, _.stubTrue);\n * // => [true, true]\n */\n function stubTrue() {\n return true;\n }\n\n /**\n * Invokes the iteratee `n` times, returning an array of the results of\n * each invocation. The iteratee is invoked with one argument; (index).\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n * @example\n *\n * _.times(3, String);\n * // => ['0', '1', '2']\n *\n * _.times(4, _.constant(0));\n * // => [0, 0, 0, 0]\n */\n function times(n, iteratee) {\n n = toInteger(n);\n if (n < 1 || n > MAX_SAFE_INTEGER) {\n return [];\n }\n var index = MAX_ARRAY_LENGTH,\n length = nativeMin(n, MAX_ARRAY_LENGTH);\n\n iteratee = getIteratee(iteratee);\n n -= MAX_ARRAY_LENGTH;\n\n var result = baseTimes(length, iteratee);\n while (++index < n) {\n iteratee(index);\n }\n return result;\n }\n\n /**\n * Converts `value` to a property path array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {*} value The value to convert.\n * @returns {Array} Returns the new property path array.\n * @example\n *\n * _.toPath('a.b.c');\n * // => ['a', 'b', 'c']\n *\n * _.toPath('a[0].b.c');\n * // => ['a', '0', 'b', 'c']\n */\n function toPath(value) {\n if (isArray(value)) {\n return arrayMap(value, toKey);\n }\n return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));\n }\n\n /**\n * Generates a unique ID. If `prefix` is given, the ID is appended to it.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {string} [prefix=''] The value to prefix the ID with.\n * @returns {string} Returns the unique ID.\n * @example\n *\n * _.uniqueId('contact_');\n * // => 'contact_104'\n *\n * _.uniqueId();\n * // => '105'\n */\n function uniqueId(prefix) {\n var id = ++idCounter;\n return toString(prefix) + id;\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Adds two numbers.\n *\n * @static\n * @memberOf _\n * @since 3.4.0\n * @category Math\n * @param {number} augend The first number in an addition.\n * @param {number} addend The second number in an addition.\n * @returns {number} Returns the total.\n * @example\n *\n * _.add(6, 4);\n * // => 10\n */\n var add = createMathOperation(function(augend, addend) {\n return augend + addend;\n }, 0);\n\n /**\n * Computes `number` rounded up to `precision`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Math\n * @param {number} number The number to round up.\n * @param {number} [precision=0] The precision to round up to.\n * @returns {number} Returns the rounded up number.\n * @example\n *\n * _.ceil(4.006);\n * // => 5\n *\n * _.ceil(6.004, 2);\n * // => 6.01\n *\n * _.ceil(6040, -2);\n * // => 6100\n */\n var ceil = createRound('ceil');\n\n /**\n * Divide two numbers.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Math\n * @param {number} dividend The first number in a division.\n * @param {number} divisor The second number in a division.\n * @returns {number} Returns the quotient.\n * @example\n *\n * _.divide(6, 4);\n * // => 1.5\n */\n var divide = createMathOperation(function(dividend, divisor) {\n return dividend / divisor;\n }, 1);\n\n /**\n * Computes `number` rounded down to `precision`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Math\n * @param {number} number The number to round down.\n * @param {number} [precision=0] The precision to round down to.\n * @returns {number} Returns the rounded down number.\n * @example\n *\n * _.floor(4.006);\n * // => 4\n *\n * _.floor(0.046, 2);\n * // => 0.04\n *\n * _.floor(4060, -2);\n * // => 4000\n */\n var floor = createRound('floor');\n\n /**\n * Computes the maximum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the maximum value.\n * @example\n *\n * _.max([4, 2, 8, 6]);\n * // => 8\n *\n * _.max([]);\n * // => undefined\n */\n function max(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseGt)\n : undefined$1;\n }\n\n /**\n * This method is like `_.max` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * the value is ranked. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {*} Returns the maximum value.\n * @example\n *\n * var objects = [{ 'n': 1 }, { 'n': 2 }];\n *\n * _.maxBy(objects, function(o) { return o.n; });\n * // => { 'n': 2 }\n *\n * // The `_.property` iteratee shorthand.\n * _.maxBy(objects, 'n');\n * // => { 'n': 2 }\n */\n function maxBy(array, iteratee) {\n return (array && array.length)\n ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)\n : undefined$1;\n }\n\n /**\n * Computes the mean of the values in `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {number} Returns the mean.\n * @example\n *\n * _.mean([4, 2, 8, 6]);\n * // => 5\n */\n function mean(array) {\n return baseMean(array, identity);\n }\n\n /**\n * This method is like `_.mean` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the value to be averaged.\n * The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the mean.\n * @example\n *\n * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];\n *\n * _.meanBy(objects, function(o) { return o.n; });\n * // => 5\n *\n * // The `_.property` iteratee shorthand.\n * _.meanBy(objects, 'n');\n * // => 5\n */\n function meanBy(array, iteratee) {\n return baseMean(array, getIteratee(iteratee, 2));\n }\n\n /**\n * Computes the minimum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * _.min([4, 2, 8, 6]);\n * // => 2\n *\n * _.min([]);\n * // => undefined\n */\n function min(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseLt)\n : undefined$1;\n }\n\n /**\n * This method is like `_.min` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * the value is ranked. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * var objects = [{ 'n': 1 }, { 'n': 2 }];\n *\n * _.minBy(objects, function(o) { return o.n; });\n * // => { 'n': 1 }\n *\n * // The `_.property` iteratee shorthand.\n * _.minBy(objects, 'n');\n * // => { 'n': 1 }\n */\n function minBy(array, iteratee) {\n return (array && array.length)\n ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)\n : undefined$1;\n }\n\n /**\n * Multiply two numbers.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Math\n * @param {number} multiplier The first number in a multiplication.\n * @param {number} multiplicand The second number in a multiplication.\n * @returns {number} Returns the product.\n * @example\n *\n * _.multiply(6, 4);\n * // => 24\n */\n var multiply = createMathOperation(function(multiplier, multiplicand) {\n return multiplier * multiplicand;\n }, 1);\n\n /**\n * Computes `number` rounded to `precision`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Math\n * @param {number} number The number to round.\n * @param {number} [precision=0] The precision to round to.\n * @returns {number} Returns the rounded number.\n * @example\n *\n * _.round(4.006);\n * // => 4\n *\n * _.round(4.006, 2);\n * // => 4.01\n *\n * _.round(4060, -2);\n * // => 4100\n */\n var round = createRound('round');\n\n /**\n * Subtract two numbers.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {number} minuend The first number in a subtraction.\n * @param {number} subtrahend The second number in a subtraction.\n * @returns {number} Returns the difference.\n * @example\n *\n * _.subtract(6, 4);\n * // => 2\n */\n var subtract = createMathOperation(function(minuend, subtrahend) {\n return minuend - subtrahend;\n }, 0);\n\n /**\n * Computes the sum of the values in `array`.\n *\n * @static\n * @memberOf _\n * @since 3.4.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {number} Returns the sum.\n * @example\n *\n * _.sum([4, 2, 8, 6]);\n * // => 20\n */\n function sum(array) {\n return (array && array.length)\n ? baseSum(array, identity)\n : 0;\n }\n\n /**\n * This method is like `_.sum` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the value to be summed.\n * The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the sum.\n * @example\n *\n * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];\n *\n * _.sumBy(objects, function(o) { return o.n; });\n * // => 20\n *\n * // The `_.property` iteratee shorthand.\n * _.sumBy(objects, 'n');\n * // => 20\n */\n function sumBy(array, iteratee) {\n return (array && array.length)\n ? baseSum(array, getIteratee(iteratee, 2))\n : 0;\n }\n\n /*------------------------------------------------------------------------*/\n\n // Add methods that return wrapped values in chain sequences.\n lodash.after = after;\n lodash.ary = ary;\n lodash.assign = assign;\n lodash.assignIn = assignIn;\n lodash.assignInWith = assignInWith;\n lodash.assignWith = assignWith;\n lodash.at = at;\n lodash.before = before;\n lodash.bind = bind;\n lodash.bindAll = bindAll;\n lodash.bindKey = bindKey;\n lodash.castArray = castArray;\n lodash.chain = chain;\n lodash.chunk = chunk;\n lodash.compact = compact;\n lodash.concat = concat;\n lodash.cond = cond;\n lodash.conforms = conforms;\n lodash.constant = constant;\n lodash.countBy = countBy;\n lodash.create = create;\n lodash.curry = curry;\n lodash.curryRight = curryRight;\n lodash.debounce = debounce;\n lodash.defaults = defaults;\n lodash.defaultsDeep = defaultsDeep;\n lodash.defer = defer;\n lodash.delay = delay;\n lodash.difference = difference;\n lodash.differenceBy = differenceBy;\n lodash.differenceWith = differenceWith;\n lodash.drop = drop;\n lodash.dropRight = dropRight;\n lodash.dropRightWhile = dropRightWhile;\n lodash.dropWhile = dropWhile;\n lodash.fill = fill;\n lodash.filter = filter;\n lodash.flatMap = flatMap;\n lodash.flatMapDeep = flatMapDeep;\n lodash.flatMapDepth = flatMapDepth;\n lodash.flatten = flatten;\n lodash.flattenDeep = flattenDeep;\n lodash.flattenDepth = flattenDepth;\n lodash.flip = flip;\n lodash.flow = flow;\n lodash.flowRight = flowRight;\n lodash.fromPairs = fromPairs;\n lodash.functions = functions;\n lodash.functionsIn = functionsIn;\n lodash.groupBy = groupBy;\n lodash.initial = initial;\n lodash.intersection = intersection;\n lodash.intersectionBy = intersectionBy;\n lodash.intersectionWith = intersectionWith;\n lodash.invert = invert;\n lodash.invertBy = invertBy;\n lodash.invokeMap = invokeMap;\n lodash.iteratee = iteratee;\n lodash.keyBy = keyBy;\n lodash.keys = keys;\n lodash.keysIn = keysIn;\n lodash.map = map;\n lodash.mapKeys = mapKeys;\n lodash.mapValues = mapValues;\n lodash.matches = matches;\n lodash.matchesProperty = matchesProperty;\n lodash.memoize = memoize;\n lodash.merge = merge;\n lodash.mergeWith = mergeWith;\n lodash.method = method;\n lodash.methodOf = methodOf;\n lodash.mixin = mixin;\n lodash.negate = negate;\n lodash.nthArg = nthArg;\n lodash.omit = omit;\n lodash.omitBy = omitBy;\n lodash.once = once;\n lodash.orderBy = orderBy;\n lodash.over = over;\n lodash.overArgs = overArgs;\n lodash.overEvery = overEvery;\n lodash.overSome = overSome;\n lodash.partial = partial;\n lodash.partialRight = partialRight;\n lodash.partition = partition;\n lodash.pick = pick;\n lodash.pickBy = pickBy;\n lodash.property = property;\n lodash.propertyOf = propertyOf;\n lodash.pull = pull;\n lodash.pullAll = pullAll;\n lodash.pullAllBy = pullAllBy;\n lodash.pullAllWith = pullAllWith;\n lodash.pullAt = pullAt;\n lodash.range = range;\n lodash.rangeRight = rangeRight;\n lodash.rearg = rearg;\n lodash.reject = reject;\n lodash.remove = remove;\n lodash.rest = rest;\n lodash.reverse = reverse;\n lodash.sampleSize = sampleSize;\n lodash.set = set;\n lodash.setWith = setWith;\n lodash.shuffle = shuffle;\n lodash.slice = slice;\n lodash.sortBy = sortBy;\n lodash.sortedUniq = sortedUniq;\n lodash.sortedUniqBy = sortedUniqBy;\n lodash.split = split;\n lodash.spread = spread;\n lodash.tail = tail;\n lodash.take = take;\n lodash.takeRight = takeRight;\n lodash.takeRightWhile = takeRightWhile;\n lodash.takeWhile = takeWhile;\n lodash.tap = tap;\n lodash.throttle = throttle;\n lodash.thru = thru;\n lodash.toArray = toArray;\n lodash.toPairs = toPairs;\n lodash.toPairsIn = toPairsIn;\n lodash.toPath = toPath;\n lodash.toPlainObject = toPlainObject;\n lodash.transform = transform;\n lodash.unary = unary;\n lodash.union = union;\n lodash.unionBy = unionBy;\n lodash.unionWith = unionWith;\n lodash.uniq = uniq;\n lodash.uniqBy = uniqBy;\n lodash.uniqWith = uniqWith;\n lodash.unset = unset;\n lodash.unzip = unzip;\n lodash.unzipWith = unzipWith;\n lodash.update = update;\n lodash.updateWith = updateWith;\n lodash.values = values;\n lodash.valuesIn = valuesIn;\n lodash.without = without;\n lodash.words = words;\n lodash.wrap = wrap;\n lodash.xor = xor;\n lodash.xorBy = xorBy;\n lodash.xorWith = xorWith;\n lodash.zip = zip;\n lodash.zipObject = zipObject;\n lodash.zipObjectDeep = zipObjectDeep;\n lodash.zipWith = zipWith;\n\n // Add aliases.\n lodash.entries = toPairs;\n lodash.entriesIn = toPairsIn;\n lodash.extend = assignIn;\n lodash.extendWith = assignInWith;\n\n // Add methods to `lodash.prototype`.\n mixin(lodash, lodash);\n\n /*------------------------------------------------------------------------*/\n\n // Add methods that return unwrapped values in chain sequences.\n lodash.add = add;\n lodash.attempt = attempt;\n lodash.camelCase = camelCase;\n lodash.capitalize = capitalize;\n lodash.ceil = ceil;\n lodash.clamp = clamp;\n lodash.clone = clone;\n lodash.cloneDeep = cloneDeep;\n lodash.cloneDeepWith = cloneDeepWith;\n lodash.cloneWith = cloneWith;\n lodash.conformsTo = conformsTo;\n lodash.deburr = deburr;\n lodash.defaultTo = defaultTo;\n lodash.divide = divide;\n lodash.endsWith = endsWith;\n lodash.eq = eq;\n lodash.escape = escape;\n lodash.escapeRegExp = escapeRegExp;\n lodash.every = every;\n lodash.find = find;\n lodash.findIndex = findIndex;\n lodash.findKey = findKey;\n lodash.findLast = findLast;\n lodash.findLastIndex = findLastIndex;\n lodash.findLastKey = findLastKey;\n lodash.floor = floor;\n lodash.forEach = forEach;\n lodash.forEachRight = forEachRight;\n lodash.forIn = forIn;\n lodash.forInRight = forInRight;\n lodash.forOwn = forOwn;\n lodash.forOwnRight = forOwnRight;\n lodash.get = get;\n lodash.gt = gt;\n lodash.gte = gte;\n lodash.has = has;\n lodash.hasIn = hasIn;\n lodash.head = head;\n lodash.identity = identity;\n lodash.includes = includes;\n lodash.indexOf = indexOf;\n lodash.inRange = inRange;\n lodash.invoke = invoke;\n lodash.isArguments = isArguments;\n lodash.isArray = isArray;\n lodash.isArrayBuffer = isArrayBuffer;\n lodash.isArrayLike = isArrayLike;\n lodash.isArrayLikeObject = isArrayLikeObject;\n lodash.isBoolean = isBoolean;\n lodash.isBuffer = isBuffer;\n lodash.isDate = isDate;\n lodash.isElement = isElement;\n lodash.isEmpty = isEmpty;\n lodash.isEqual = isEqual;\n lodash.isEqualWith = isEqualWith;\n lodash.isError = isError;\n lodash.isFinite = isFinite;\n lodash.isFunction = isFunction;\n lodash.isInteger = isInteger;\n lodash.isLength = isLength;\n lodash.isMap = isMap;\n lodash.isMatch = isMatch;\n lodash.isMatchWith = isMatchWith;\n lodash.isNaN = isNaN;\n lodash.isNative = isNative;\n lodash.isNil = isNil;\n lodash.isNull = isNull;\n lodash.isNumber = isNumber;\n lodash.isObject = isObject;\n lodash.isObjectLike = isObjectLike;\n lodash.isPlainObject = isPlainObject;\n lodash.isRegExp = isRegExp;\n lodash.isSafeInteger = isSafeInteger;\n lodash.isSet = isSet;\n lodash.isString = isString;\n lodash.isSymbol = isSymbol;\n lodash.isTypedArray = isTypedArray;\n lodash.isUndefined = isUndefined;\n lodash.isWeakMap = isWeakMap;\n lodash.isWeakSet = isWeakSet;\n lodash.join = join;\n lodash.kebabCase = kebabCase;\n lodash.last = last;\n lodash.lastIndexOf = lastIndexOf;\n lodash.lowerCase = lowerCase;\n lodash.lowerFirst = lowerFirst;\n lodash.lt = lt;\n lodash.lte = lte;\n lodash.max = max;\n lodash.maxBy = maxBy;\n lodash.mean = mean;\n lodash.meanBy = meanBy;\n lodash.min = min;\n lodash.minBy = minBy;\n lodash.stubArray = stubArray;\n lodash.stubFalse = stubFalse;\n lodash.stubObject = stubObject;\n lodash.stubString = stubString;\n lodash.stubTrue = stubTrue;\n lodash.multiply = multiply;\n lodash.nth = nth;\n lodash.noConflict = noConflict;\n lodash.noop = noop;\n lodash.now = now;\n lodash.pad = pad;\n lodash.padEnd = padEnd;\n lodash.padStart = padStart;\n lodash.parseInt = parseInt;\n lodash.random = random;\n lodash.reduce = reduce;\n lodash.reduceRight = reduceRight;\n lodash.repeat = repeat;\n lodash.replace = replace;\n lodash.result = result;\n lodash.round = round;\n lodash.runInContext = runInContext;\n lodash.sample = sample;\n lodash.size = size;\n lodash.snakeCase = snakeCase;\n lodash.some = some;\n lodash.sortedIndex = sortedIndex;\n lodash.sortedIndexBy = sortedIndexBy;\n lodash.sortedIndexOf = sortedIndexOf;\n lodash.sortedLastIndex = sortedLastIndex;\n lodash.sortedLastIndexBy = sortedLastIndexBy;\n lodash.sortedLastIndexOf = sortedLastIndexOf;\n lodash.startCase = startCase;\n lodash.startsWith = startsWith;\n lodash.subtract = subtract;\n lodash.sum = sum;\n lodash.sumBy = sumBy;\n lodash.template = template;\n lodash.times = times;\n lodash.toFinite = toFinite;\n lodash.toInteger = toInteger;\n lodash.toLength = toLength;\n lodash.toLower = toLower;\n lodash.toNumber = toNumber;\n lodash.toSafeInteger = toSafeInteger;\n lodash.toString = toString;\n lodash.toUpper = toUpper;\n lodash.trim = trim;\n lodash.trimEnd = trimEnd;\n lodash.trimStart = trimStart;\n lodash.truncate = truncate;\n lodash.unescape = unescape;\n lodash.uniqueId = uniqueId;\n lodash.upperCase = upperCase;\n lodash.upperFirst = upperFirst;\n\n // Add aliases.\n lodash.each = forEach;\n lodash.eachRight = forEachRight;\n lodash.first = head;\n\n mixin(lodash, (function() {\n var source = {};\n baseForOwn(lodash, function(func, methodName) {\n if (!hasOwnProperty.call(lodash.prototype, methodName)) {\n source[methodName] = func;\n }\n });\n return source;\n }()), { 'chain': false });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * The semantic version number.\n *\n * @static\n * @memberOf _\n * @type {string}\n */\n lodash.VERSION = VERSION;\n\n // Assign default placeholders.\n arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {\n lodash[methodName].placeholder = lodash;\n });\n\n // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.\n arrayEach(['drop', 'take'], function(methodName, index) {\n LazyWrapper.prototype[methodName] = function(n) {\n n = n === undefined$1 ? 1 : nativeMax(toInteger(n), 0);\n\n var result = (this.__filtered__ && !index)\n ? new LazyWrapper(this)\n : this.clone();\n\n if (result.__filtered__) {\n result.__takeCount__ = nativeMin(n, result.__takeCount__);\n } else {\n result.__views__.push({\n 'size': nativeMin(n, MAX_ARRAY_LENGTH),\n 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')\n });\n }\n return result;\n };\n\n LazyWrapper.prototype[methodName + 'Right'] = function(n) {\n return this.reverse()[methodName](n).reverse();\n };\n });\n\n // Add `LazyWrapper` methods that accept an `iteratee` value.\n arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {\n var type = index + 1,\n isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;\n\n LazyWrapper.prototype[methodName] = function(iteratee) {\n var result = this.clone();\n result.__iteratees__.push({\n 'iteratee': getIteratee(iteratee, 3),\n 'type': type\n });\n result.__filtered__ = result.__filtered__ || isFilter;\n return result;\n };\n });\n\n // Add `LazyWrapper` methods for `_.head` and `_.last`.\n arrayEach(['head', 'last'], function(methodName, index) {\n var takeName = 'take' + (index ? 'Right' : '');\n\n LazyWrapper.prototype[methodName] = function() {\n return this[takeName](1).value()[0];\n };\n });\n\n // Add `LazyWrapper` methods for `_.initial` and `_.tail`.\n arrayEach(['initial', 'tail'], function(methodName, index) {\n var dropName = 'drop' + (index ? '' : 'Right');\n\n LazyWrapper.prototype[methodName] = function() {\n return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);\n };\n });\n\n LazyWrapper.prototype.compact = function() {\n return this.filter(identity);\n };\n\n LazyWrapper.prototype.find = function(predicate) {\n return this.filter(predicate).head();\n };\n\n LazyWrapper.prototype.findLast = function(predicate) {\n return this.reverse().find(predicate);\n };\n\n LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {\n if (typeof path == 'function') {\n return new LazyWrapper(this);\n }\n return this.map(function(value) {\n return baseInvoke(value, path, args);\n });\n });\n\n LazyWrapper.prototype.reject = function(predicate) {\n return this.filter(negate(getIteratee(predicate)));\n };\n\n LazyWrapper.prototype.slice = function(start, end) {\n start = toInteger(start);\n\n var result = this;\n if (result.__filtered__ && (start > 0 || end < 0)) {\n return new LazyWrapper(result);\n }\n if (start < 0) {\n result = result.takeRight(-start);\n } else if (start) {\n result = result.drop(start);\n }\n if (end !== undefined$1) {\n end = toInteger(end);\n result = end < 0 ? result.dropRight(-end) : result.take(end - start);\n }\n return result;\n };\n\n LazyWrapper.prototype.takeRightWhile = function(predicate) {\n return this.reverse().takeWhile(predicate).reverse();\n };\n\n LazyWrapper.prototype.toArray = function() {\n return this.take(MAX_ARRAY_LENGTH);\n };\n\n // Add `LazyWrapper` methods to `lodash.prototype`.\n baseForOwn(LazyWrapper.prototype, function(func, methodName) {\n var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),\n isTaker = /^(?:head|last)$/.test(methodName),\n lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],\n retUnwrapped = isTaker || /^find/.test(methodName);\n\n if (!lodashFunc) {\n return;\n }\n lodash.prototype[methodName] = function() {\n var value = this.__wrapped__,\n args = isTaker ? [1] : arguments,\n isLazy = value instanceof LazyWrapper,\n iteratee = args[0],\n useLazy = isLazy || isArray(value);\n\n var interceptor = function(value) {\n var result = lodashFunc.apply(lodash, arrayPush([value], args));\n return (isTaker && chainAll) ? result[0] : result;\n };\n\n if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {\n // Avoid lazy use if the iteratee has a \"length\" value other than `1`.\n isLazy = useLazy = false;\n }\n var chainAll = this.__chain__,\n isHybrid = !!this.__actions__.length,\n isUnwrapped = retUnwrapped && !chainAll,\n onlyLazy = isLazy && !isHybrid;\n\n if (!retUnwrapped && useLazy) {\n value = onlyLazy ? value : new LazyWrapper(this);\n var result = func.apply(value, args);\n result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined$1 });\n return new LodashWrapper(result, chainAll);\n }\n if (isUnwrapped && onlyLazy) {\n return func.apply(this, args);\n }\n result = this.thru(interceptor);\n return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;\n };\n });\n\n // Add `Array` methods to `lodash.prototype`.\n arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {\n var func = arrayProto[methodName],\n chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',\n retUnwrapped = /^(?:pop|shift)$/.test(methodName);\n\n lodash.prototype[methodName] = function() {\n var args = arguments;\n if (retUnwrapped && !this.__chain__) {\n var value = this.value();\n return func.apply(isArray(value) ? value : [], args);\n }\n return this[chainName](function(value) {\n return func.apply(isArray(value) ? value : [], args);\n });\n };\n });\n\n // Map minified method names to their real names.\n baseForOwn(LazyWrapper.prototype, function(func, methodName) {\n var lodashFunc = lodash[methodName];\n if (lodashFunc) {\n var key = lodashFunc.name + '';\n if (!hasOwnProperty.call(realNames, key)) {\n realNames[key] = [];\n }\n realNames[key].push({ 'name': methodName, 'func': lodashFunc });\n }\n });\n\n realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{\n 'name': 'wrapper',\n 'func': undefined$1\n }];\n\n // Add methods to `LazyWrapper`.\n LazyWrapper.prototype.clone = lazyClone;\n LazyWrapper.prototype.reverse = lazyReverse;\n LazyWrapper.prototype.value = lazyValue;\n\n // Add chain sequence methods to the `lodash` wrapper.\n lodash.prototype.at = wrapperAt;\n lodash.prototype.chain = wrapperChain;\n lodash.prototype.commit = wrapperCommit;\n lodash.prototype.next = wrapperNext;\n lodash.prototype.plant = wrapperPlant;\n lodash.prototype.reverse = wrapperReverse;\n lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;\n\n // Add lazy aliases.\n lodash.prototype.first = lodash.prototype.head;\n\n if (symIterator) {\n lodash.prototype[symIterator] = wrapperToIterator;\n }\n return lodash;\n });\n\n /*--------------------------------------------------------------------------*/\n\n // Export lodash.\n var _ = runInContext();\n\n // Some AMD build optimizers, like r.js, check for condition patterns like:\n if (freeModule) {\n // Export for Node.js.\n (freeModule.exports = _)._ = _;\n // Export for CommonJS support.\n freeExports._ = _;\n }\n else {\n // Export to the global object.\n root._ = _;\n }\n }.call(commonjsGlobal));\n });\n\n /* file: topk.ts\n MIT License\n\n Copyright (c) 2019-2020 Thomas Minier\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the 'Software'), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n var __extends$7 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var __decorate$5 = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata$5 = (commonjsGlobal && commonjsGlobal.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };\n var __param$5 = (commonjsGlobal && commonjsGlobal.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };\n var __generator$9 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n var __importDefault$7 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n var base_filter_1$5 = __importDefault$7(baseFilter);\n var count_min_sketch_1 = __importDefault$7(countMinSketch);\n\n\n /**\n * A MinHeap stores items sorted by ascending frequency\n * @author Thomas Minier\n */\n var MinHeap = /** @class */ (function () {\n function MinHeap() {\n this._content = [];\n }\n Object.defineProperty(MinHeap.prototype, \"length\", {\n /**\n * Get the number of items in the heap\n */\n get: function () {\n return this._content.length;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MinHeap.prototype, \"content\", {\n get: function () {\n return this._content;\n },\n set: function (value) {\n this._content = value;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Access an item at a given index\n * @param index - Index of the item\n * @return The item or `undefined` if the index is out of the array\n */\n MinHeap.prototype.get = function (index) {\n return this._content[index];\n };\n /**\n * Add a new element to the heap and keep items sorted by ascending frequency\n * @param element - Element to insert\n */\n MinHeap.prototype.add = function (element) {\n // kepp items sorted by frequency\n var index = lodash.sortedIndexBy(this._content, element, function (heapElement) { return heapElement.frequency; });\n this._content.splice(index, 0, element);\n };\n /**\n * Remove an item at a given index and keep items sorted by ascending frequency\n * @param index - Index of the item to remove\n */\n MinHeap.prototype.remove = function (index) {\n this._content.splice(index, 1);\n };\n /**\n * Remove and returns the element with the smallest frequency in the heap\n * @return The element with the smallest frequency in the heap\n */\n MinHeap.prototype.popMin = function () {\n return this._content.shift();\n };\n /**\n * Get the index of an element by its value\n * @param value - Value of the element to search for\n * @return Index of the element or -1 if it is not in the heap\n */\n MinHeap.prototype.indexOf = function (value) {\n // TODO optimize\n return this._content.findIndex(function (heapElement) { return heapElement.value === value; });\n // const index = sortedIndexBy(this._content, {value, frequency: 0}, heapElement => heapElement.value)\n // if (this._content[index] !== undefined && this._content[index].value === value) {\n // return index\n // }\n // return -1\n };\n /**\n * Clear the content of the heap\n */\n MinHeap.prototype.clear = function () {\n this._content = [];\n };\n return MinHeap;\n }());\n /**\n * A TopK computes the ranking of elements in a multiset (by an arbitrary score) and returns the `k` results with the highest scores.\n * This implementation of the TopK problem sorts items based on their estimated cardinality in the multiset.\n * It is based on a Count Min Sketch, for estimating the cardinality of items, and a MinHeap, for implementing a sliding window over the `k` results with the highest scores.\n * @author Thomas Minier\n * @author Arnaud Grall\n */\n var TopK = /** @class */ (function (_super) {\n __extends$7(TopK, _super);\n /**\n * Constructor\n * @param k - How many elements to store\n * @param errorRate - The error rate\n * @param accuracy - The probability of accuracy\n */\n function TopK(k, errorRate, accuracy) {\n var _this = _super.call(this) || this;\n _this._k = k;\n _this._errorRate = errorRate;\n _this._accuracy = accuracy;\n _this._sketch = count_min_sketch_1.default.create(errorRate, accuracy);\n _this._heap = new MinHeap();\n return _this;\n }\n /**\n * Add an element to the TopK\n * @param element - Element to add\n */\n TopK.prototype.add = function (element) {\n this._sketch.update(element);\n var frequency = this._sketch.count(element);\n if (this._heap.length < this._k || frequency >= this._heap.get(0).frequency) {\n var index = this._heap.indexOf(element);\n // remove the entry if it is already in the MinHeap\n if (index > -1) {\n this._heap.remove(index);\n }\n // add the new entry\n this._heap.add({\n value: element,\n frequency: frequency\n });\n // if there is more items than K, then remove the smallest item in the heap\n if (this._heap.length > this._k) {\n this._heap.popMin();\n }\n }\n };\n /**\n * Clear the content of the TopK\n */\n TopK.prototype.clear = function () {\n this._sketch = count_min_sketch_1.default.create(this._errorRate, this._accuracy);\n this._heap.clear();\n };\n /**\n * Get the top-k values as an array of objects {value: string, frequency: number, rank: number}\n * @return The top-k values as an array of objects {value: string, frequency: number, rank: number}\n */\n TopK.prototype.values = function () {\n var res = [];\n for (var i = this._heap.length - 1; i > 0; i--) {\n var elt = this._heap.get(i);\n res.push({\n value: elt.value,\n frequency: elt.frequency,\n rank: this._heap.length - i\n });\n }\n return res;\n };\n /**\n * Get the top-k values as an iterator that yields objects {value: string, frequency: number, rank: number}.\n * WARNING: With this method, values are produced on-the-fly, hence you should not modify the TopK\n * while the iteration is not completed, otherwise the generated values may not respect the TopK properties.\n * @return The top-k values as an iterator of object {value: string, frequency: number, rank: number}\n */\n TopK.prototype.iterator = function () {\n var heap = this._heap;\n return function () {\n var i, elt;\n return __generator$9(this, function (_a) {\n switch (_a.label) {\n case 0:\n i = heap.length - 1;\n _a.label = 1;\n case 1:\n if (!(i > 0)) return [3 /*break*/, 4];\n elt = heap.get(i);\n return [4 /*yield*/, {\n value: elt.value,\n frequency: elt.frequency,\n rank: heap.length - i\n }];\n case 2:\n _a.sent();\n _a.label = 3;\n case 3:\n i--;\n return [3 /*break*/, 1];\n case 4: return [2 /*return*/];\n }\n });\n }();\n };\n __decorate$5([\n exportable.Field(),\n __metadata$5(\"design:type\", Number)\n ], TopK.prototype, \"_k\", void 0);\n __decorate$5([\n exportable.Field(),\n __metadata$5(\"design:type\", Number)\n ], TopK.prototype, \"_errorRate\", void 0);\n __decorate$5([\n exportable.Field(),\n __metadata$5(\"design:type\", Number)\n ], TopK.prototype, \"_accuracy\", void 0);\n __decorate$5([\n exportable.Field(),\n __metadata$5(\"design:type\", count_min_sketch_1.default)\n ], TopK.prototype, \"_sketch\", void 0);\n __decorate$5([\n exportable.Field(function (heap) { return heap.content; }, function (json) {\n var heap = new MinHeap();\n heap.content = json;\n return heap;\n }),\n __metadata$5(\"design:type\", MinHeap\n /**\n * Constructor\n * @param k - How many elements to store\n * @param errorRate - The error rate\n * @param accuracy - The probability of accuracy\n */\n )\n ], TopK.prototype, \"_heap\", void 0);\n TopK = __decorate$5([\n exportable.AutoExportable('TopK', ['_seed']),\n __param$5(0, exportable.Parameter('_k')), __param$5(1, exportable.Parameter('_errorRate')), __param$5(2, exportable.Parameter('_accuracy')),\n __metadata$5(\"design:paramtypes\", [Number, Number, Number])\n ], TopK);\n return TopK;\n }(base_filter_1$5.default));\n var _default$e = TopK;\n\n var topk = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$e\n }, '__esModule', {value: true});\n\n /* file: min-hash.ts\n MIT License\n\n Copyright (c) 2019-2020 Thomas Minier\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the 'Software'), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n var __extends$8 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var __decorate$6 = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata$6 = (commonjsGlobal && commonjsGlobal.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };\n var __param$6 = (commonjsGlobal && commonjsGlobal.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };\n var __read$1 = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };\n var __spread$1 = (commonjsGlobal && commonjsGlobal.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i]));\n return ar;\n };\n var __importDefault$8 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n var base_filter_1$6 = __importDefault$8(baseFilter);\n\n\n\n /**\n * An error thrown when we try to compute the Jaccard Similarity with an empty MinHash\n * @author Thomas Minier\n */\n var EmptyMinHashError = /** @class */ (function (_super) {\n __extends$8(EmptyMinHashError, _super);\n function EmptyMinHashError() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return EmptyMinHashError;\n }(Error));\n /**\n * Apply a hash function to a number to produce a hash\n * @param x - Value to hash\n * @param fn - HashFunction to apply\n * @return The hashed value\n */\n function applyHashFunction(x, fn) {\n return (fn.a * x + fn.b) % fn.c;\n }\n /**\n * MinHash (or the min-wise independent permutations locality sensitive hashing scheme) is a technique for quickly estimating how similar two sets are.\n * It is able to estimate the Jaccard similarity between two large sets of numbers using random hashing.\n *\n * **WARNING**: Only the MinHash produced by the same {@link MinHashFactory} can be compared between them.\n *\n * @see \"On the resemblance and containment of documents\", by Andrei Z. Broder, in Compression and Complexity of Sequences: Proceedings, Positano, Amalfitan Coast, Salerno, Italy, June 11-13, 1997.\n * @author Thomas Minier\n */\n var MinHash = /** @class */ (function (_super) {\n __extends$8(MinHash, _super);\n /**\n * Constructor\n * @param nbHashes - Number of hash functions to use for comouting the MinHash signature\n * @param hashFunctions - Hash functions used to compute the signature\n */\n function MinHash(nbHashes, hashFunctions) {\n var _this = _super.call(this) || this;\n _this._nbHashes = nbHashes;\n _this._hashFunctions = hashFunctions;\n _this._signature = utils$5.allocateArray(_this._nbHashes, Infinity);\n return _this;\n }\n Object.defineProperty(MinHash.prototype, \"nbHashes\", {\n /**\n * Get the number of hash functions used by the MinHash\n */\n get: function () {\n return this._nbHashes;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Test if the signature of the MinHash is empty\n * @return True if the MinHash is empty, False otherwise\n */\n MinHash.prototype.isEmpty = function () {\n return this._signature[0] === Infinity;\n };\n /**\n * Insert a value into the MinHash and update its signature.\n * @param value - Value to insert\n */\n MinHash.prototype.add = function (value) {\n for (var i = 0; i < this._nbHashes; i++) {\n this._signature[i] = Math.min(this._signature[i], applyHashFunction(value, this._hashFunctions[i]));\n }\n };\n /**\n * Ingest a set of values into the MinHash, in an efficient manner, and update its signature.\n * @param values - Set of values to load\n */\n MinHash.prototype.bulkLoad = function (values) {\n var _this = this;\n var _loop_1 = function (i) {\n var candidateSignatures = values.map(function (value) { return applyHashFunction(value, _this._hashFunctions[i]); });\n this_1._signature[i] = Math.min.apply(Math, __spread$1([this_1._signature[i]], candidateSignatures));\n };\n var this_1 = this;\n for (var i = 0; i < this._nbHashes; i++) {\n _loop_1(i);\n }\n };\n /**\n * Estimate the Jaccard similarity coefficient with another MinHash signature\n * @param other - MinHash to compare with\n * @return The estimated Jaccard similarity coefficient between the two sets\n */\n MinHash.prototype.compareWith = function (other) {\n if (this.isEmpty() || other.isEmpty()) {\n throw new EmptyMinHashError('Cannot compute a Jaccard similairty with a MinHash that contains no values');\n }\n return lodash.intersection(this._signature, other._signature).length / this._nbHashes;\n };\n __decorate$6([\n exportable.Field(),\n __metadata$6(\"design:type\", Number)\n ], MinHash.prototype, \"_nbHashes\", void 0);\n __decorate$6([\n exportable.Field(),\n __metadata$6(\"design:type\", Array)\n ], MinHash.prototype, \"_hashFunctions\", void 0);\n __decorate$6([\n exportable.Field(),\n __metadata$6(\"design:type\", Array)\n ], MinHash.prototype, \"_signature\", void 0);\n MinHash = __decorate$6([\n exportable.AutoExportable('MinHash', ['_seed']),\n __param$6(0, exportable.Parameter('_nbHashes')), __param$6(1, exportable.Parameter('_hashFunctions')),\n __metadata$6(\"design:paramtypes\", [Number, Array])\n ], MinHash);\n return MinHash;\n }(base_filter_1$6.default));\n var MinHash_1 = MinHash;\n\n var minHash = /*#__PURE__*/Object.defineProperty({\n \tMinHash: MinHash_1\n }, '__esModule', {value: true});\n\n /* file: min-hash-factory.ts\n MIT License\n\n Copyright (c) 2019-2020 Thomas Minier\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the 'Software'), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n\n\n\n /**\n * Test if a number is a prime number\n * @param x - Number to test\n * @return True if the input is a prime number, False otherwise\n */\n function isPrime(x) {\n if (x !== 2 && x % 2 === 0) {\n return false;\n }\n for (var i = 2; i < Math.sqrt(x); i++) {\n if (x % i === 0) {\n return false;\n }\n }\n return true;\n }\n /**\n * Find the fist prime number superior to a number\n * @param x - Input number\n * @return The fist prime number superior to the input number\n */\n function closestPrime(x) {\n var i = 0;\n while (true) {\n if (isPrime(x + i)) {\n return x + i;\n }\n i++;\n }\n }\n /**\n * A factory to create MinHash sketches using the same set of hash functions.\n *\n * **WARNING**: Only the MinHash produced by the same factory can be compared between them.\n * @author Thomas Minier\n */\n var MinHashFactory = /** @class */ (function () {\n /**\n * Constructor\n * @param nbHashes - Number of hash functions to use for comouting the MinHash signature\n * @param maxValue - The highest value that can be found in the set to compare\n */\n function MinHashFactory(nbHashes, maxValue) {\n this._nbHashes = nbHashes;\n this._maxValue = maxValue;\n this._hashFunctions = [];\n // generate hash functions\n var c = closestPrime(this._maxValue);\n for (var i = 0; i < this._nbHashes; i++) {\n var a = lodash.random(0, this._maxValue, false);\n var b = lodash.random(0, this._maxValue, false);\n this._hashFunctions.push({ a: a, b: b, c: c });\n }\n }\n /**\n * Create a new MinHash set\n * @return A new MinHash set\n */\n MinHashFactory.prototype.create = function () {\n return new minHash.MinHash(this._nbHashes, this._hashFunctions);\n };\n return MinHashFactory;\n }());\n var _default$f = MinHashFactory;\n\n var minHashFactory = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$f\n }, '__esModule', {value: true});\n\n /**\n * lodash 4.0.0 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n /**\n * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'user': 'fred' };\n * var other = { 'user': 'fred' };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\n function eq(value, other) {\n return value === other || (value !== value && other !== other);\n }\n\n var lodash_eq = eq;\n\n /**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n /** Used as references for various `Number` constants. */\n var INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308,\n NAN = 0 / 0;\n\n /** `Object#toString` result references. */\n var symbolTag = '[object Symbol]';\n\n /** Used to match leading and trailing whitespace. */\n var reTrim = /^\\s+|\\s+$/g;\n\n /** Used to detect bad signed hexadecimal string values. */\n var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n /** Used to detect binary string values. */\n var reIsBinary = /^0b[01]+$/i;\n\n /** Used to detect octal string values. */\n var reIsOctal = /^0o[0-7]+$/i;\n\n /** Built-in method references without a dependency on `root`. */\n var freeParseInt = parseInt;\n\n /**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOf(array, value, fromIndex) {\n if (value !== value) {\n return baseFindIndex(array, baseIsNaN, fromIndex);\n }\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\n function baseIsNaN(value) {\n return value !== value;\n }\n\n /** Used for built-in method references. */\n var objectProto = Object.prototype;\n\n /**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\n var objectToString$1 = objectProto.toString;\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeMax = Math.max;\n\n /**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it's used as the\n * offset from the end of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // Search from the `fromIndex`.\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n */\n function indexOf(array, value, fromIndex) {\n var length = array ? array.length : 0;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseIndexOf(array, value, index);\n }\n\n /**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\n function isObject$2(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n }\n\n /**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\n function isObjectLike(value) {\n return !!value && typeof value == 'object';\n }\n\n /**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\n function isSymbol$1(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString$1.call(value) == symbolTag);\n }\n\n /**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\n function toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n }\n\n /**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\n function toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n }\n\n /**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\n function toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol$1(value)) {\n return NAN;\n }\n if (isObject$2(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject$2(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n }\n\n var lodash_indexof = indexOf;\n\n /* file : bucket.ts\n MIT License\n\n Copyright (c) 2017-2020 Thomas Minier & Arnaud Grall\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n var __decorate$7 = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata$7 = (commonjsGlobal && commonjsGlobal.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };\n var __importDefault$9 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n var __importStar$1 = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n };\n\n var lodash_eq_1 = __importDefault$9(lodash_eq);\n var lodash_indexof_1 = __importDefault$9(lodash_indexof);\n var utils$7 = __importStar$1(utils$5);\n\n var exportable_2 = exportable;\n /**\n * A Bucket is a container of a fixed number of values, used in various bloom filters.\n * @extends Exportable\n * @author Thomas Minier\n * @private\n */\n var Bucket = /** @class */ (function () {\n /**\n * Constructor\n * @param size - The maximum number of elements in the bucket\n */\n function Bucket(size) {\n this._elements = utils$7.allocateArray(size, null);\n this._size = size;\n this._length = 0;\n }\n Bucket_1 = Bucket;\n Object.defineProperty(Bucket.prototype, \"size\", {\n /**\n * Get the maximum number of element in the bucket\n */\n get: function () {\n return this._size;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Bucket.prototype, \"length\", {\n /**\n * Get the number of elements currenlty in the bucket\n */\n get: function () {\n return this._length;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Test if the bucket has any space available\n * @return True if te bucket has any space available, False if if its full\n */\n Bucket.prototype.isFree = function () {\n return this._length < this._size;\n };\n /**\n * Get the index of the first empty slot in the bucket\n * @return The index of the first empty slot, or -1 if the bucket is full\n */\n Bucket.prototype.nextEmptySlot = function () {\n return lodash_indexof_1.default(this._elements, null);\n };\n /**\n * Get the element at the given index in the bucket\n * @param index - The index to access\n * @return The element at the given index\n */\n Bucket.prototype.at = function (index) {\n return this._elements[index];\n };\n /**\n * Try to add an element to the bucket\n * @param element - The element to add in the bucket\n * @return True if the insertion is a success, False if the bucket is full\n */\n Bucket.prototype.add = function (element) {\n if (element === null || !this.isFree()) {\n return false;\n }\n this.set(this.nextEmptySlot(), element);\n this._length++;\n return true;\n };\n /**\n * Try to remove an element from the bucket\n * @param element - The element to remove from the bucket\n * @return True if the element has been successfully removed, False if it was not in the bucket\n */\n Bucket.prototype.remove = function (element) {\n var index = lodash_indexof_1.default(this._elements, element);\n if (index <= -1) {\n return false;\n }\n this.unset(index);\n return true;\n };\n /**\n * Test an element for membership\n * @param element - The element to look for in the bucket\n * @return True is the element is in the bucket, otherwise False\n */\n Bucket.prototype.has = function (element) {\n return lodash_indexof_1.default(this._elements, element) > -1;\n };\n /**\n * Set an element at the given index in the bucket\n * @param index - The index at where the element should be inserted\n * @param element - The element to insert\n */\n Bucket.prototype.set = function (index, element) {\n this._elements[index] = element;\n };\n /**\n * Unset the element at the given index\n * @param index - The index of the element that should be unset\n */\n Bucket.prototype.unset = function (index) {\n this._elements[index] = null;\n this._length--;\n };\n /**\n * Randomly swap an element of the bucket with a given element, then return the replaced element\n * @param element - The element to be inserted\n * @param random - Factory function used to generate random function\n * @return The element that have been swapped with the parameter\n */\n Bucket.prototype.swapRandom = function (element, random) {\n if (random === void 0) { random = Math.random; }\n var index = utils$7.randomInt(0, this._length - 1, random);\n var tmp = this._elements[index];\n this._elements[index] = element;\n return tmp;\n };\n /**\n * Swap an element of the bucket with a given index and element, then return the replaced element\n * @param index - The index at where the element should be inserted\n * @param element - The element to be inserted\n * @return The element that have been swapped with the parameter\n */\n Bucket.prototype.swap = function (index, element) {\n var tmp = this._elements[index];\n this._elements[index] = element;\n return tmp;\n };\n /**\n * Test if two buckets are equals: they have the same size, length and content\n * @param bucket - The other bucket with which to compare\n * @return True if the two buckets are equals, False otherwise\n */\n Bucket.prototype.equals = function (bucket) {\n if ((this._size !== bucket.size) || (this._length !== bucket.length))\n return false;\n return this._elements.every(function (elt, index) { return lodash_eq_1.default(bucket.at(index), elt); });\n };\n var Bucket_1;\n Bucket = Bucket_1 = __decorate$7([\n exportable.Exportable({\n export: exportable_2.cloneObject('Bucket', '_size', '_elements'),\n import: function (json) {\n if ((json.type !== 'Bucket') || !('_size' in json), !('_elements' in json)) {\n throw new Error('Cannot create a Bucket from a JSON export which does not represent a bucket');\n }\n var bucket = new Bucket_1(json._size);\n json._elements.forEach(function (elt, i) {\n if (elt !== null) {\n bucket._elements[i] = elt;\n bucket._length++;\n }\n });\n return bucket;\n }\n }),\n __metadata$7(\"design:paramtypes\", [Number])\n ], Bucket);\n return Bucket;\n }());\n var _default$g = Bucket;\n\n var bucket = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$g\n }, '__esModule', {value: true});\n\n /* file : cuckoo-filter.ts\n MIT License\n\n Copyright (c) 2017-2020 Thomas Minier & Arnaud Grall\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n var __extends$9 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var __decorate$8 = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata$8 = (commonjsGlobal && commonjsGlobal.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };\n var __importDefault$a = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n var base_filter_1$7 = __importDefault$a(baseFilter);\n var bucket_1 = __importDefault$a(bucket);\n\n\n /**\n * Compute the optimal fingerprint length in bytes for a given bucket size\n * and a false positive rate.\n * @param {int} size - The filter bucket size\n * @param {int} rate - The error rate, i.e. 'false positive' rate, targetted by the filter\n * @return {int} The optimal fingerprint length in bytes\n * @private\n */\n function computeFingerpintLength(size, rate) {\n var f = Math.ceil(Math.log2(1 / rate) + Math.log2(2 * size));\n return Math.ceil(f / 4); // because we use base 16 64-bits hashes\n }\n /**\n * Cuckoo filters improve on Bloom filters by supporting deletion, limited counting,\n * and bounded False positive rate with similar storage efficiency as a standard Bloom filter.\n *\n * Reference: Fan, B., Andersen, D. G., Kaminsky, M., & Mitzenmacher, M. D. (2014, December). Cuckoo filter: Practically better than bloom.\n * In Proceedings of the 10th ACM International on Conference on emerging Networking Experiments and Technologies (pp. 75-88). ACM.\n * @see {@link https://www.cs.cmu.edu/~dga/papers/cuckoo-conext2014.pdf} for more details about Cuckoo filters\n * @author Thomas Minier & Arnaud Grall\n */\n var CuckooFilter = /** @class */ (function (_super) {\n __extends$9(CuckooFilter, _super);\n /**\n * Constructor\n * @param size - The filter size\n * @param fLength - The length of the fingerprints\n * @param bucketSize - The size of the buckets in the filter\n * @param maxKicks - (optional) The max number of kicks when resolving collision at insertion, default to 1\n */\n function CuckooFilter(size, fLength, bucketSize, maxKicks) {\n if (maxKicks === void 0) { maxKicks = 500; }\n var _this = _super.call(this) || this;\n _this._filter = utils$5.allocateArray(size, function () { return new bucket_1.default(bucketSize); });\n _this._size = size;\n _this._bucketSize = bucketSize;\n _this._fingerprintLength = fLength;\n _this._length = 0;\n _this._maxKicks = maxKicks;\n return _this;\n }\n CuckooFilter_1 = CuckooFilter;\n /**\n * Return a new optimal CuckooFilter given the number of maximum elements to store and the error rate desired\n * @param size - The number of items to store\n * @param errorRate - The desired error rate\n * @param bucketSize - The number of buckets desired per cell\n * @param maxKicks - The number of kicks done when a collision occurs\n * @return A Cuckoo Filter optimal for these parameters\n */\n CuckooFilter.create = function (size, errorRate, bucketSize, maxKicks) {\n if (bucketSize === void 0) { bucketSize = 4; }\n if (maxKicks === void 0) { maxKicks = 500; }\n var fl = computeFingerpintLength(bucketSize, errorRate);\n var capacity = Math.ceil(size / bucketSize / 0.955);\n // const capacity = utils.power2(items)\n return new CuckooFilter_1(capacity, fl, bucketSize, maxKicks);\n };\n /**\n * Build a new optimal CuckooFilter from an iterable with a fixed error rate\n * @param items - Iterable used to populate the filter\n * @param errorRate - The error rate of the filter\n * @param bucketSize - The number of buckets desired per cell\n * @param maxKicks - The number of kicks done when a collision occurs\n * @return A new Cuckoo Filter filled with the iterable's elements\n */\n CuckooFilter.from = function (items, errorRate, bucketSize, maxKicks) {\n if (bucketSize === void 0) { bucketSize = 4; }\n if (maxKicks === void 0) { maxKicks = 500; }\n var array = Array.from(items);\n var filter = CuckooFilter_1.create(array.length, errorRate, bucketSize, maxKicks);\n array.forEach(function (item) { return filter.add(item); });\n return filter;\n };\n Object.defineProperty(CuckooFilter.prototype, \"size\", {\n /**\n * Get the filter size\n */\n get: function () {\n return this._size;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CuckooFilter.prototype, \"fullSize\", {\n /**\n * Get the filter full size, i.e., the total number of cells\n */\n get: function () {\n return this.size * this.bucketSize;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CuckooFilter.prototype, \"length\", {\n /**\n * Get the filter length, i.e. the current number of elements in the filter\n */\n get: function () {\n return this._length;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CuckooFilter.prototype, \"fingerprintLength\", {\n /**\n * Get the length of the fingerprints in the filter\n */\n get: function () {\n return this._fingerprintLength;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CuckooFilter.prototype, \"bucketSize\", {\n /**\n * Get the size of the buckets in the filter\n */\n get: function () {\n return this._bucketSize;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CuckooFilter.prototype, \"maxKicks\", {\n /**\n * Get the max number of kicks when resolving collision at insertion\n */\n get: function () {\n return this._maxKicks;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Add an element to the filter, if false is returned, it means that the filter is considered as full.\n * @param element - The element to add\n * @return True if the insertion is a success, False if the filter is full\n * @example\n * const filter = new CuckooFilter(15, 3, 2);\n * filter.add('alice');\n * filter.add('bob');\n */\n CuckooFilter.prototype.add = function (element, throwError, destructive) {\n if (throwError === void 0) { throwError = false; }\n if (destructive === void 0) { destructive = false; }\n // TODO do the recovery if return false or throw error because we altered values\n var locations = this._locations(element);\n // store fingerprint in an available empty bucket\n if (this._filter[locations.firstIndex].isFree()) {\n this._filter[locations.firstIndex].add(locations.fingerprint);\n }\n else if (this._filter[locations.secondIndex].isFree()) {\n this._filter[locations.secondIndex].add(locations.fingerprint);\n }\n else {\n // buckets are full, we must relocate one of them\n var index = this.random() < 0.5 ? locations.firstIndex : locations.secondIndex;\n var movedElement = locations.fingerprint;\n var logs = [];\n for (var nbTry = 0; nbTry < this._maxKicks; nbTry++) {\n var rndIndex = utils$5.randomInt(0, this._filter[index].length - 1, this.random);\n var tmp = this._filter[index].at(rndIndex);\n logs.push([index, rndIndex, tmp]);\n this._filter[index].set(rndIndex, movedElement);\n movedElement = tmp;\n // movedElement = this._filter[index].set(rndswapRandom(movedElement, this._rng)\n var newHash = utils$5.hashAsInt(movedElement, this.seed, 64);\n index = Math.abs((index ^ Math.abs(newHash))) % this._filter.length;\n // add the moved element to the bucket if possible\n if (this._filter[index].isFree()) {\n this._filter[index].add(movedElement);\n this._length++;\n return true;\n }\n }\n if (!destructive) {\n // rollback all modified entries to their initial states\n for (var i = logs.length - 1; i >= 0; i--) {\n var log = logs[i];\n this._filter[log[0]].set(log[1], log[2]);\n }\n }\n // considered full\n if (throwError) {\n // rollback all operations\n throw new Error(\"The Cuckoo Filter is full, cannot insert element \\\"\" + element + \"\\\"\");\n }\n else {\n return false;\n }\n }\n this._length++;\n return true;\n };\n /**\n * Remove an element from the filter\n * @param element - The element to remove\n * @return True if the element has been removed from the filter, False if it wasn't in the filter\n * @example\n * const filter = new CuckooFilter(15, 3, 2);\n * filter.add('alice');\n * filter.add('bob');\n *\n * // remove an element\n * filter.remove('bob');\n */\n CuckooFilter.prototype.remove = function (element) {\n var locations = this._locations(element);\n if (this._filter[locations.firstIndex].has(locations.fingerprint)) {\n this._filter[locations.firstIndex].remove(locations.fingerprint);\n this._length--;\n return true;\n }\n else if (this._filter[locations.secondIndex].has(locations.fingerprint)) {\n this._filter[locations.secondIndex].remove(locations.fingerprint);\n this._length--;\n return true;\n }\n return false;\n };\n /**\n * Test an element for membership\n * @param element - The element to look for in the filter\n * @return False if the element is definitively not in the filter, True is the element might be in the filter\n * @example\n * const filter = new CuckooFilter(15, 3, 2);\n * filter.add('alice');\n *\n * console.log(filter.has('alice')); // output: true\n * console.log(filter.has('bob')); // output: false\n */\n CuckooFilter.prototype.has = function (element) {\n var locations = this._locations(element);\n return this._filter[locations.firstIndex].has(locations.fingerprint) || this._filter[locations.secondIndex].has(locations.fingerprint);\n };\n /**\n * Return the false positive rate for this cuckoo filter\n * @return The false positive rate\n */\n CuckooFilter.prototype.rate = function () {\n var load = this._computeHashTableLoad();\n var c = this._fingerprintLength / load.load;\n return Math.pow(2, Math.log2(2 * this._bucketSize) - (load.load * c));\n };\n /**\n * Return the load of this filter\n * @return {Object} load: is the load, size is the number of entries, free is the free number of entries, used is the number of entry used\n */\n CuckooFilter.prototype._computeHashTableLoad = function () {\n var max = this._filter.length * this._bucketSize;\n var used = this._filter.reduce(function (acc, val) { return acc + val.length; }, 0);\n return {\n used: used,\n free: max - used,\n size: max,\n load: used / max\n };\n };\n /**\n * For a element, compute its fingerprint and the index of its two buckets\n * @param element - The element to hash\n * @return The fingerprint of the element and the index of its two buckets\n * @private\n */\n CuckooFilter.prototype._locations = function (element) {\n var hashes = utils$5.hashIntAndString(element, this.seed, 16, 64);\n var hash = hashes.int;\n if (this._fingerprintLength > hashes.string.length) {\n throw new Error(\"The fingerprint length (\" + this._fingerprintLength + \") is higher than the hash length (\" + hashes.string.length + \"). Please reduce the fingerprint length or report if it is an unexpected behavior.\");\n }\n var fingerprint = hashes.string.substring(0, this._fingerprintLength);\n var firstIndex = Math.abs(hash);\n var secondHash = Math.abs(utils$5.hashAsInt(fingerprint, this.seed, 64));\n var secondIndex = Math.abs(firstIndex ^ secondHash);\n var res = {\n fingerprint: fingerprint,\n firstIndex: firstIndex % this._size,\n secondIndex: secondIndex % this._size\n };\n return res;\n };\n /**\n * Check if another Cuckoo filter is equal to this one\n * @param filter - The cuckoo filter to compare to this one\n * @return True if they are equal, false otherwise\n */\n CuckooFilter.prototype.equals = function (filter) {\n var i = 0;\n var res = true;\n while (res && i < this._filter.length) {\n var bucket = this._filter[i];\n if (!filter._filter[i].equals(bucket)) {\n res = false;\n }\n i++;\n }\n return res;\n };\n var CuckooFilter_1;\n CuckooFilter = CuckooFilter_1 = __decorate$8([\n exportable.Exportable({\n export: exportable.cloneObject('CuckooFilter', '_size', '_fingerprintLength', '_length', '_maxKicks', '_filter', '_seed'),\n import: function (json) {\n if ((json.type !== 'CuckooFilter') || !('_size' in json) || !('_fingerprintLength' in json) || !('_length' in json) || !('_maxKicks' in json) || !('_filter' in json) || !('_seed' in json)) {\n throw new Error('Cannot create a CuckooFilter from a JSON export which does not represent a cuckoo filter');\n }\n var filter = new CuckooFilter_1(json._size, json._fingerprintLength, json._bucketSize, json._maxKicks);\n filter._length = json._length;\n filter._filter = json._filter.map(function (j) {\n var bucket = new bucket_1.default(j._size);\n j._elements.forEach(function (elt, i) {\n if (elt !== null) {\n bucket._elements[i] = elt;\n bucket._length++;\n }\n });\n return bucket;\n });\n filter.seed = json.seed;\n return filter;\n }\n }),\n __metadata$8(\"design:paramtypes\", [Number, Number, Number, Number])\n ], CuckooFilter);\n return CuckooFilter;\n }(base_filter_1$7.default));\n var _default$h = CuckooFilter;\n\n var cuckooFilter = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$h\n }, '__esModule', {value: true});\n\n var __extends$a = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var __decorate$9 = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata$9 = (commonjsGlobal && commonjsGlobal.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };\n var __param$7 = (commonjsGlobal && commonjsGlobal.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };\n var __importDefault$b = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n\n\n var base_filter_1$8 = __importDefault$b(baseFilter);\n var inspect$1 = Symbol.for('nodejs.util.inspect.custom');\n /**\n * A cell is an internal datastructure of an {@link InvertibleBloomFilter}.\n * It is composed of an idSum (the XOR of all element inserted in that cell), a hashSum (the XOR of all hashed element in that cell) and a counter (the number of elements inserted in that cell).\n * @author Arnaud Grall\n * @author Thomas Minier\n */\n var Cell = /** @class */ (function (_super) {\n __extends$a(Cell, _super);\n /**\n * Constructor.\n * To create an empty cell, you might want to use the static Cell#empty() method.\n * @param idSum - The XOR of all element inserted in that cell\n * @param hashSum - The XOR of all hashed element in that cell\n * @param count - The number of elements inserted in that cell\n */\n function Cell(idSum, hashSum, count) {\n var _this = _super.call(this) || this;\n _this._idSum = idSum;\n _this._hashSum = hashSum;\n _this._count = count;\n return _this;\n }\n Cell_1 = Cell;\n /**\n * Create an empty cell\n * @return An empty Cell\n */\n Cell.empty = function () {\n return new Cell_1(buffer.Buffer.allocUnsafe(0).fill(0), buffer.Buffer.allocUnsafe(0).fill(0), 0);\n };\n Cell.prototype[inspect$1] = function () {\n return \"Cell:<\" + JSON.stringify(this._idSum.toJSON().data) + \", \" + JSON.stringify(this._hashSum.toJSON().data) + \", \" + this._count + \">\";\n };\n Object.defineProperty(Cell.prototype, \"idSum\", {\n /**\n * Get the id sum of the Cell (The XOR of all element inserted in that cell)\n */\n get: function () {\n return this._idSum;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Cell.prototype, \"hashSum\", {\n /**\n * Get the hash sum of the Cell (The XOR of all hashed element in that cell)\n */\n get: function () {\n return this._hashSum;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Cell.prototype, \"count\", {\n /**\n * Get the number of elements inserted in that cell\n */\n get: function () {\n return this._count;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Add an element in this cell\n * @param idSum - The element to XOR in this cell\n * @param hashSum - The hash of the element to XOR in this cell\n */\n Cell.prototype.add = function (idSum, hashSum) {\n this._idSum = utils$5.xorBuffer(this._idSum, idSum);\n this._hashSum = utils$5.xorBuffer(this._hashSum, hashSum);\n this._count++;\n };\n /**\n * Perform the XOR operation between this Cell and another one and returns a resulting Cell.\n * A XOR between two cells is the XOR between their id sum and hash sum,\n * and the difference between their count.\n * @param cell - Cell to perform XOR with\n * @return A new Cell, resulting from the XOR operation\n */\n Cell.prototype.xorm = function (cell) {\n return new Cell_1(utils$5.xorBuffer(this._idSum, cell.idSum), utils$5.xorBuffer(this._hashSum, cell.hashSum), this._count - cell.count);\n };\n /**\n * Test if the Cell is empty\n * @return True if the Cell is empty, False otherwise\n */\n Cell.prototype.isEmpty = function () {\n return this._idSum.equals(buffer.Buffer.from('')) && this._hashSum.equals(buffer.Buffer.from('')) && this._count === 0;\n };\n /**\n * Test if another Cell is equals to this one\n * @param cell - The cell to compare with\n * @return True if the two Cells are equals, False otherwise\n */\n Cell.prototype.equals = function (cell) {\n return this._count === cell.count && this._idSum.equals(cell.idSum) && this._hashSum.equals(cell.hashSum);\n };\n /**\n * Test if the cell is \"Pure\".\n * A pure cell is a cell with a counter equal to 1 or -1, and with a hash sum equal to the id sum\n * @return True if the cell ius pure, False otherwise\n */\n Cell.prototype.isPure = function () {\n // A pure cell cannot be empty or must have a count equals to 1 or -1\n if (this.isEmpty() || (this._count !== 1 && this._count !== -1)) {\n return false;\n }\n // compare the hashes\n var hashes = utils$5.hashTwiceAsString(JSON.stringify(this._idSum.toJSON()), this.seed);\n return this._hashSum.equals(buffer.Buffer.from(hashes.first));\n };\n var Cell_1;\n __decorate$9([\n exportable.Field(function (elt) { return elt.toString(); }, buffer.Buffer.from),\n __metadata$9(\"design:type\", buffer.Buffer)\n ], Cell.prototype, \"_idSum\", void 0);\n __decorate$9([\n exportable.Field(function (elt) { return elt.toString(); }, buffer.Buffer.from),\n __metadata$9(\"design:type\", buffer.Buffer)\n ], Cell.prototype, \"_hashSum\", void 0);\n __decorate$9([\n exportable.Field(),\n __metadata$9(\"design:type\", Number)\n ], Cell.prototype, \"_count\", void 0);\n Cell = Cell_1 = __decorate$9([\n exportable.AutoExportable('Cell', ['_seed']),\n __param$7(0, exportable.Parameter('_idSum')), __param$7(1, exportable.Parameter('_hashSum')), __param$7(2, exportable.Parameter('_count')),\n __metadata$9(\"design:paramtypes\", [buffer.Buffer, buffer.Buffer, Number])\n ], Cell);\n return Cell;\n }(base_filter_1$8.default));\n var _default$i = Cell;\n\n var cell = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$i\n }, '__esModule', {value: true});\n\n var __extends$b = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var __decorate$a = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata$a = (commonjsGlobal && commonjsGlobal.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n };\n var __param$8 = (commonjsGlobal && commonjsGlobal.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n };\n var __generator$a = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n var __importDefault$c = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n\n var base_filter_1$9 = __importDefault$c(baseFilter);\n var cell_1 = __importDefault$c(cell);\n\n\n\n /**\n * An Invertible Bloom Lookup Table is a space-efficient and probabilistic data-structure for solving the set-difference problem efficiently without the use of logs or other prior context. It computes the set difference with communication proportional to the size of the difference between the sets being compared.\n * They can simultaneously calculate D(A−B) and D(B−A) using O(d) space. This data structure encodes sets in a fashion that is similar in spirit to Tornado codes’ construction [6], in that it randomly combines elements using the XOR function\n * Reference: Eppstein, D., Goodrich, M. T., Uyeda, F., & Varghese, G. (2011). What's the difference?: efficient set reconciliation without prior context. ACM SIGCOMM Computer Communication Review, 41(4), 218-229.\n * @see {@link http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.220.6282&rep=rep1&type=pdf} for more details about Invertible Bloom Lookup Tables\n * @author Arnaud Grall\n * @author Thomas Minier\n */\n var InvertibleBloomFilter = /** @class */ (function (_super) {\n __extends$b(InvertibleBloomFilter, _super);\n /**\n * Construct an Invertible Bloom Lookup Table\n * @param size - The number of cells in the InvertibleBloomFilter. It should be set to d * alpha, where d is the number of difference and alpha is a constant\n * @param hashCount - The number of hash functions used (empirically studied to be 3 or 4 in most cases)\n */\n function InvertibleBloomFilter(size, hashCount) {\n if (hashCount === void 0) { hashCount = 3; }\n var _this = _super.call(this) || this;\n if (buffer.Buffer === undefined) {\n throw new Error('No native Buffer implementation bound in your JavaScript env. If you are in a Web browser, consider importing the polyfill \"feross/buffer\" (https://github.com/feross/buffer).');\n }\n if (hashCount <= 0) {\n throw new Error('The hashCount must be a non-zero, positive integer');\n }\n _this._size = size;\n _this._hashCount = hashCount;\n // the number of elements in the array is n = alpha * size\n _this._elements = utils$5.allocateArray(_this._size, function () { return cell_1.default.empty(); });\n return _this;\n }\n InvertibleBloomFilter_1 = InvertibleBloomFilter;\n /**\n * Create an Invertible Bloom filter optimal for an expected size and error rate.\n * @param nbItems - Number of items expected to insert into the IBLT\n * @param errorRate - Expected error rate\n * @return A new Invertible Bloom filter optimal for the given parameters.\n */\n InvertibleBloomFilter.create = function (nbItems, errorRate) {\n var size = formulas.optimalFilterSize(nbItems, errorRate);\n var nbHashes = formulas.optimalHashes(size, nbItems);\n return new InvertibleBloomFilter_1(size, nbHashes);\n };\n /**\n * Create an Invertible Bloom filter from a set of Buffer and optimal for an error rate.\n * @param items - An iterable to yield Buffers to be inserted into the filter\n * @param errorRate - Expected error rate\n * @return A new Invertible Bloom filter filled with the iterable's items.\n */\n InvertibleBloomFilter.from = function (items, errorRate) {\n var array = Array.from(items);\n var filter = InvertibleBloomFilter_1.create(array.length, errorRate);\n array.forEach(function (item) { return filter.add(item); });\n return filter;\n };\n Object.defineProperty(InvertibleBloomFilter.prototype, \"hashCount\", {\n /**\n * Return the number of hash functions used\n * @return {Number}\n */\n get: function () {\n return this._hashCount;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(InvertibleBloomFilter.prototype, \"size\", {\n /**\n * Get the number of cells of the filter\n */\n get: function () {\n return this._size;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(InvertibleBloomFilter.prototype, \"length\", {\n /**\n * Get the number of elements added in the filter\n * Complexity in time: O(alpha*d)\n */\n get: function () {\n return this._elements.reduce(function (a, b) { return a + b.count; }, 0) / this._hashCount;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(InvertibleBloomFilter.prototype, \"elements\", {\n /**\n * Return the cells used to store elements in this InvertibleBloomFilter\n */\n get: function () {\n return this._elements;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Add an element to the InvertibleBloomFilter\n * @param element - The element to insert\n */\n InvertibleBloomFilter.prototype.add = function (element) {\n var hashes = utils$5.allInOneHashTwice(JSON.stringify(element.toJSON()), this.seed);\n var indexes = utils$5.getDistinctIndices(hashes.string.first, this._size, this._hashCount, this.seed);\n for (var i = 0; i < this._hashCount; ++i) {\n this._elements[indexes[i]].add(element, buffer.Buffer.from(hashes.string.first));\n }\n };\n /**\n * Remove an element from the filter\n * @param element - The element to remove\n * @return True if the element has been removed, False otheriwse\n */\n InvertibleBloomFilter.prototype.remove = function (element) {\n var hashes = utils$5.allInOneHashTwice(JSON.stringify(element.toJSON()), this.seed);\n var indexes = utils$5.getDistinctIndices(hashes.string.first, this.size, this._hashCount, this.seed);\n for (var i = 0; i < this._hashCount; ++i) {\n this._elements[indexes[i]] = this._elements[indexes[i]].xorm(new cell_1.default(buffer.Buffer.from(element), buffer.Buffer.from(hashes.string.first), 1));\n }\n return true;\n };\n /**\n * Test if an item is in the filter.\n * @param element - The element to test\n * @return False if the element is not in the filter, true if \"may be\" in the filter.\n */\n InvertibleBloomFilter.prototype.has = function (element) {\n var hashes = utils$5.allInOneHashTwice(JSON.stringify(element.toJSON()), this.seed);\n var indexes = utils$5.getDistinctIndices(hashes.string.first, this.size, this._hashCount, this.seed);\n for (var i = 0; i < this._hashCount; ++i) {\n if (this._elements[indexes[i]].count === 0) {\n return false;\n }\n else if (this._elements[indexes[i]].count === 1) {\n if (this._elements[indexes[i]].idSum.equals(element)) {\n return true;\n }\n else {\n return false;\n }\n }\n }\n return true;\n };\n /**\n * List all entries from the filter using a Generator.\n * The generator ends with True if the operation has not failed, False otheriwse.\n * It is not recommended to modify an IBLT while listing its entries!\n * @return A generator that yields all filter's entries.\n */\n InvertibleBloomFilter.prototype.listEntries = function () {\n var that = this;\n var seenBefore = [];\n return function () {\n var _loop_1, index, state_1;\n return __generator$a(this, function (_a) {\n switch (_a.label) {\n case 0:\n _loop_1 = function (index) {\n var localCell;\n return __generator$a(this, function (_a) {\n switch (_a.label) {\n case 0:\n localCell = that._elements[index];\n if (!(localCell.count > 0 && seenBefore.findIndex(function (b) { return b.equals(localCell.idSum); }) === -1)) return [3 /*break*/, 3];\n if (!that.has(localCell.idSum)) return [3 /*break*/, 2];\n seenBefore.push(localCell.idSum);\n return [4 /*yield*/, localCell.idSum];\n case 1:\n _a.sent();\n return [3 /*break*/, 3];\n case 2: return [2 /*return*/, { value: false }];\n case 3: return [2 /*return*/];\n }\n });\n };\n index = 0;\n _a.label = 1;\n case 1:\n if (!(index < that._elements.length - 1)) return [3 /*break*/, 4];\n return [5 /*yield**/, _loop_1(index)];\n case 2:\n state_1 = _a.sent();\n if (typeof state_1 === \"object\")\n return [2 /*return*/, state_1.value];\n _a.label = 3;\n case 3:\n index++;\n return [3 /*break*/, 1];\n case 4: return [2 /*return*/, true];\n }\n });\n }();\n };\n /**\n * Substract the filter with another {@link InvertibleBloomFilter}, and returns the resulting filter.\n * @param remote - The filter to substract with\n * @return A new InvertibleBloomFilter which is the XOR of the local and remote one\n */\n InvertibleBloomFilter.prototype.substract = function (iblt) {\n if (this.size !== iblt.size) {\n throw new Error('The two Invertible Bloom Filters must be of the same size');\n }\n var res = new InvertibleBloomFilter_1(iblt._size, iblt._hashCount);\n res.seed = this.seed;\n for (var i = 0; i < this.size; ++i) {\n res._elements[i] = this._elements[i].xorm(iblt._elements[i]);\n }\n return res;\n };\n /**\n * Test if two InvertibleBloomFilters are equals\n * @param iblt - The filter to compare with\n * @return True if the two filters are equals, False otherwise\n */\n InvertibleBloomFilter.prototype.equals = function (iblt) {\n if (iblt._size !== this._size || iblt._hashCount !== this._hashCount || iblt.seed !== this.seed) {\n return false;\n }\n else {\n for (var i = 0; i < iblt._elements.length; ++i) {\n if (!iblt._elements[i].equals(this._elements[i])) {\n return false;\n }\n }\n return true;\n }\n };\n /**\n * Decode an InvertibleBloomFilter based on its substracted version\n * @return The results of the deconding process\n */\n InvertibleBloomFilter.prototype.decode = function (additional, missing) {\n if (additional === void 0) { additional = []; }\n if (missing === void 0) { missing = []; }\n var pureList = [];\n var cell = null;\n // checking for all pure cells\n for (var i = 0; i < this._elements.length; ++i) {\n cell = this._elements[i];\n if (cell.isPure()) {\n pureList.push(i);\n }\n }\n while (pureList.length !== 0) {\n cell = this._elements[pureList.pop()];\n var id = cell.idSum;\n var c = cell.count;\n if (cell.isPure()) {\n if (c === 1) {\n additional.push(id);\n }\n else if (c === -1) {\n missing.push(id);\n }\n else {\n throw new Error('Please report, not possible');\n }\n var hashes = utils$5.allInOneHashTwice(JSON.stringify(id.toJSON()), this.seed);\n var indexes = utils$5.getDistinctIndices(hashes.string.first, this._size, this._hashCount, this.seed);\n for (var i = 0; i < indexes.length; ++i) {\n this._elements[indexes[i]] = this._elements[indexes[i]].xorm(new cell_1.default(id, buffer.Buffer.from(hashes.string.first), c));\n if (this._elements[indexes[i]].isPure()) {\n pureList.push(indexes[i]);\n }\n }\n }\n }\n if (this._elements.findIndex(function (e) { return !e.isEmpty(); }) > -1) {\n return {\n success: false,\n reason: {\n cell: cell,\n iblt: this\n },\n additional: additional,\n missing: missing\n };\n }\n else {\n return {\n success: true,\n additional: additional,\n missing: missing\n };\n }\n };\n var InvertibleBloomFilter_1;\n __decorate$a([\n exportable.Field(),\n __metadata$a(\"design:type\", Number)\n ], InvertibleBloomFilter.prototype, \"_size\", void 0);\n __decorate$a([\n exportable.Field(),\n __metadata$a(\"design:type\", Number)\n ], InvertibleBloomFilter.prototype, \"_hashCount\", void 0);\n __decorate$a([\n exportable.Field(undefined, function (json) {\n return json.map(function (elt) {\n var c = new cell_1.default(buffer.Buffer.from(elt._idSum), buffer.Buffer.from(elt._hashSum), elt._count);\n c.seed = elt._seed;\n return c;\n });\n }),\n __metadata$a(\"design:type\", Array)\n ], InvertibleBloomFilter.prototype, \"_elements\", void 0);\n InvertibleBloomFilter = InvertibleBloomFilter_1 = __decorate$a([\n exportable.AutoExportable('InvertibleBloomFilter', ['_seed']),\n __param$8(0, exportable.Parameter('_size')), __param$8(1, exportable.Parameter('_hashCount')),\n __metadata$a(\"design:paramtypes\", [Number, Number])\n ], InvertibleBloomFilter);\n return InvertibleBloomFilter;\n }(base_filter_1$9.default));\n var _default$j = InvertibleBloomFilter;\n\n var invertibleBloomLookupTables = /*#__PURE__*/Object.defineProperty({\n \tdefault: _default$j\n }, '__esModule', {value: true});\n\n /* file : api.ts\n MIT License\n\n Copyright (c) 2017-2020 Thomas Minier & Arnaud Grall\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n\n\n var BloomFilter$1 = bloomFilter.default;\n\n countingBloomFilter.default;\n\n partitionedBloomFilter.default;\n\n countMinSketch.default;\n\n hyperloglog.default;\n\n topk.default;\n\n minHash.MinHash;\n\n minHashFactory.default;\n\n cuckooFilter.default;\n\n invertibleBloomLookupTables.default;\n\n cell.default;\n\n // CONSTANTS\n var FILTER_SIZE = 1024;\n var HASH_COUNT = 16;\n var SATURATION_THRESHOLD = 320;\n // FUNCTIONS\n // create bare name filter with a single key\n var createBare = function (key) { return __awaiter(void 0, void 0, void 0, function () {\n var empty;\n return __generator(this, function (_a) {\n empty = \"0\".repeat(FILTER_SIZE / 4);\n return [2 /*return*/, addToBare(empty, key)];\n });\n }); };\n // add some string to a name filter\n var addToBare = function (bareFilter, toAdd) { return __awaiter(void 0, void 0, void 0, function () {\n var filter, hash$1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n filter = fromHex(bareFilter);\n return [4 /*yield*/, hash.sha256Str(toAdd)];\n case 1:\n hash$1 = _a.sent();\n filter.add(hash$1);\n return [4 /*yield*/, toHex$1(filter)];\n case 2: return [2 /*return*/, (_a.sent())];\n }\n });\n }); };\n // add the revision number to the name filter, salted with the AES key for the node\n var addRevision = function (bareFilter, key, revision) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, addToBare(bareFilter, \"\" + revision + key)];\n case 1: return [2 /*return*/, (_a.sent())];\n }\n });\n }); };\n // saturate the filter to 320 bits and hash it with sha256 to give the private name that a node will be stored in the MMPT with\n var toPrivateName = function (revisionFilter) { return __awaiter(void 0, void 0, void 0, function () {\n var saturated;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, saturateFilter(fromHex(revisionFilter))];\n case 1:\n saturated = _a.sent();\n return [2 /*return*/, toHash(saturated)];\n }\n });\n }); };\n // hash a filter with sha256\n var toHash = function (filter) { return __awaiter(void 0, void 0, void 0, function () {\n var filterBytes, hash$1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n filterBytes = new Uint8Array(filter.toBytes());\n return [4 /*yield*/, hash.sha256(filterBytes)];\n case 1:\n hash$1 = _a.sent();\n return [2 /*return*/, (fromBytes(hash$1))];\n }\n });\n }); };\n // saturate a filter to 320 bits\n var saturateFilter = function (filter, threshold) {\n if (threshold === void 0) { threshold = SATURATION_THRESHOLD; }\n return __awaiter(void 0, void 0, void 0, function () {\n var bits, before, toHash, hash$1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (threshold > filter.toBytes().byteLength * 8) {\n throw new Error(\"threshold is bigger than filter size\");\n }\n bits = countOnes(filter);\n if (bits >= threshold) {\n return [2 /*return*/, filter];\n }\n before = filter.toBytes();\n toHash = before;\n _a.label = 1;\n case 1: return [4 /*yield*/, hash.sha256(toHash)];\n case 2:\n hash$1 = _a.sent();\n filter.add(fromBytes(hash$1));\n toHash = hash$1;\n _a.label = 3;\n case 3:\n if (bufEquals(before, filter.toBytes())) return [3 /*break*/, 1];\n _a.label = 4;\n case 4: return [2 /*return*/, saturateFilter(filter, threshold)];\n }\n });\n });\n };\n // count the number of 1 bits in a filter\n var countOnes = function (filter) {\n var arr = new Uint32Array(filter.toBytes());\n var count = 0;\n for (var i = 0; i < arr.length; i++) {\n count += bitCount32(arr[i]);\n }\n return count;\n };\n // convert a filter to hex\n var toHex$1 = function (filter) {\n return fromBytes(filter.toBytes());\n };\n // convert hex to a BloomFilter object\n var fromHex = function (string) {\n var buf = toBytes(string);\n return BloomFilter$1.fromBytes(buf, HASH_COUNT);\n };\n var bufEquals = function (buf1, buf2) {\n if (buf1.byteLength !== buf2.byteLength)\n return false;\n var arr1 = new Uint8Array(buf1);\n var arr2 = new Uint8Array(buf2);\n for (var i = 0; i < arr1.length; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n };\n // counts the number of 1s in a uint32\n // from: https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel\n var bitCount32 = function (num) {\n var a = num - ((num >> 1) & 0x55555555);\n var b = (a & 0x33333333) + ((a >> 2) & 0x33333333);\n return ((b + (b >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;\n };\n\n var addNode = function (mmpt, node, key) { return __awaiter(void 0, void 0, void 0, function () {\n var _a, cid, size, filter, name, contentBareFilter, contentFilter, contentName, _b, skeleton, isFile;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0: return [4 /*yield*/, putEncryptedFile(node, key)];\n case 1:\n _a = _c.sent(), cid = _a.cid, size = _a.size;\n return [4 /*yield*/, addRevision(node.bareNameFilter, key, node.revision)];\n case 2:\n filter = _c.sent();\n return [4 /*yield*/, toPrivateName(filter)];\n case 3:\n name = _c.sent();\n return [4 /*yield*/, mmpt.add(name, cid)\n // if the node is a file, we also add the content to the MMPT\n ];\n case 4:\n _c.sent();\n if (!isPrivateFileInfo(node)) return [3 /*break*/, 9];\n return [4 /*yield*/, addToBare(node.bareNameFilter, node.key)];\n case 5:\n contentBareFilter = _c.sent();\n return [4 /*yield*/, addRevision(contentBareFilter, node.key, node.revision)];\n case 6:\n contentFilter = _c.sent();\n return [4 /*yield*/, toPrivateName(contentFilter)];\n case 7:\n contentName = _c.sent();\n return [4 /*yield*/, mmpt.add(contentName, node.content)];\n case 8:\n _c.sent();\n _c.label = 9;\n case 9:\n _b = isPrivateFileInfo(node) ? [{}, true] : [node.skeleton, false], skeleton = _b[0], isFile = _b[1];\n return [2 /*return*/, { cid: cid, name: name, key: key, size: size, isFile: isFile, skeleton: skeleton }];\n }\n });\n }); };\n var readNode = function (cid, key) { return __awaiter(void 0, void 0, void 0, function () {\n var content;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, catAndDecode(cid, key)];\n case 1:\n content = _a.sent();\n if (!isDecryptedNode(content)) {\n throw new Error(\"Could not parse a valid filesystem object, \" + cid);\n }\n return [2 /*return*/, content];\n }\n });\n }); };\n var getByName = function (mmpt, name, key) { return __awaiter(void 0, void 0, void 0, function () {\n var cid;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, mmpt.get(name)];\n case 1:\n cid = _a.sent();\n if (cid === null)\n return [2 /*return*/, null];\n return [2 /*return*/, getByCID(cid, key)];\n }\n });\n }); };\n var getByCID = function (cid, key) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, readNode(cid, key)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n }); };\n var getByLatestName = function (mmpt, name, key) { return __awaiter(void 0, void 0, void 0, function () {\n var cid;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, mmpt.get(name)];\n case 1:\n cid = _a.sent();\n if (cid === null)\n return [2 /*return*/, null];\n return [2 /*return*/, getLatestByCID(mmpt, cid, key)];\n }\n });\n }); };\n var getLatestByCID = function (mmpt, cid, key) { return __awaiter(void 0, void 0, void 0, function () {\n var node, latest, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, getByCID(cid, key)];\n case 1:\n node = _b.sent();\n return [4 /*yield*/, findLatestRevision(mmpt, node.bareNameFilter, key, node.revision)];\n case 2:\n latest = _b.sent();\n if (!(latest === null || latest === void 0 ? void 0 : latest.cid)) return [3 /*break*/, 4];\n return [4 /*yield*/, getByCID(latest === null || latest === void 0 ? void 0 : latest.cid, key)];\n case 3:\n _a = _b.sent();\n return [3 /*break*/, 5];\n case 4:\n _a = node;\n _b.label = 5;\n case 5: return [2 /*return*/, _a];\n }\n });\n }); };\n var getLatestByBareNameFilter = function (mmpt, bareName, key) { return __awaiter(void 0, void 0, void 0, function () {\n var revisionFilter, name;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, addRevision(bareName, key, 1)];\n case 1:\n revisionFilter = _a.sent();\n return [4 /*yield*/, toPrivateName(revisionFilter)];\n case 2:\n name = _a.sent();\n return [2 /*return*/, getByLatestName(mmpt, name, key)];\n }\n });\n }); };\n var findLatestRevision = function (mmpt, bareName, key, lastKnownRevision) { return __awaiter(void 0, void 0, void 0, function () {\n var lowerBound, upperBound, i, lastRevision, toCheck, thisRevision, midpoint, thisRevision;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n lowerBound = lastKnownRevision, upperBound = null;\n i = 0;\n lastRevision = null;\n _a.label = 1;\n case 1:\n if (!(upperBound === null)) return [3 /*break*/, 3];\n toCheck = lastKnownRevision + Math.pow(2, i);\n return [4 /*yield*/, getRevision(mmpt, bareName, key, toCheck)];\n case 2:\n thisRevision = _a.sent();\n if (thisRevision !== null) {\n lastRevision = thisRevision;\n lowerBound = toCheck;\n }\n else {\n upperBound = toCheck;\n }\n i++;\n return [3 /*break*/, 1];\n case 3:\n if (!(lowerBound < (upperBound - 1))) return [3 /*break*/, 5];\n midpoint = Math.floor((upperBound + lowerBound) / 2);\n return [4 /*yield*/, getRevision(mmpt, bareName, key, midpoint)];\n case 4:\n thisRevision = _a.sent();\n if (thisRevision !== null) {\n lastRevision = thisRevision;\n lowerBound = midpoint;\n }\n else {\n upperBound = midpoint;\n }\n return [3 /*break*/, 3];\n case 5: return [2 /*return*/, lastRevision];\n }\n });\n }); };\n var getRevision = function (mmpt, bareName, key, revision) { return __awaiter(void 0, void 0, void 0, function () {\n var filter, name, cid;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, addRevision(bareName, key, revision)];\n case 1:\n filter = _a.sent();\n return [4 /*yield*/, toPrivateName(filter)];\n case 2:\n name = _a.sent();\n return [4 /*yield*/, mmpt.get(name)];\n case 3:\n cid = _a.sent();\n return [2 /*return*/, cid ? { cid: cid, name: name, number: revision } : null];\n }\n });\n }); };\n\n // FUNCTIONS\n var encode$b = function (major, minor, patch) {\n return {\n major: major,\n minor: minor,\n patch: patch\n };\n };\n var toString$3 = function (version) {\n var major = version.major, minor = version.minor, patch = version.patch;\n return major + \".\" + minor + \".\" + patch;\n };\n // VERSIONS\n var v0 = encode$b(0, 0, 0);\n var v1 = encode$b(1, 0, 0);\n var latest = encode$b(1, 0, 0);\n\n /** @internal */\n var BaseFile = /** @class */ (function () {\n function BaseFile(content) {\n this.content = content;\n }\n BaseFile.prototype.put = function () {\n return __awaiter(this, void 0, void 0, function () {\n var cid;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.putDetailed()];\n case 1:\n cid = (_a.sent()).cid;\n return [2 /*return*/, cid];\n }\n });\n });\n };\n BaseFile.prototype.updateContent = function (content) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n this.content = content;\n return [2 /*return*/, this];\n });\n });\n };\n return BaseFile;\n }());\n\n var BareFile = /** @class */ (function (_super) {\n __extends(BareFile, _super);\n function BareFile() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BareFile.create = function (content) {\n return new BareFile(content);\n };\n BareFile.fromCID = function (cid) {\n return __awaiter(this, void 0, void 0, function () {\n var content;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getFile(cid)];\n case 1:\n content = _a.sent();\n return [2 /*return*/, new BareFile(content)];\n }\n });\n });\n };\n BareFile.instanceOf = function (obj) {\n return isObject(obj) && obj.content !== undefined;\n };\n BareFile.prototype.put = function () {\n return __awaiter(this, void 0, void 0, function () {\n var cid;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.putDetailed()];\n case 1:\n cid = (_a.sent()).cid;\n return [2 /*return*/, cid];\n }\n });\n });\n };\n BareFile.prototype.putDetailed = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, putFile(this.content)];\n });\n });\n };\n return BareFile;\n }(BaseFile));\n\n var BaseTree = /** @class */ (function () {\n function BaseTree(version) {\n this.version = version;\n }\n BaseTree.prototype.put = function () {\n return __awaiter(this, void 0, void 0, function () {\n var cid;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.putDetailed()];\n case 1:\n cid = (_a.sent()).cid;\n return [2 /*return*/, cid];\n }\n });\n });\n };\n BaseTree.prototype.ls = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n var dir;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.get(path)];\n case 1:\n dir = _a.sent();\n if (dir === null) {\n throw new Error(\"Path does not exist\");\n }\n else if (isFile$1(dir)) {\n throw new Error('Can not `ls` a file');\n }\n return [2 /*return*/, dir.getLinks()];\n }\n });\n });\n };\n BaseTree.prototype.cat = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n var file;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.get(path)];\n case 1:\n file = _a.sent();\n if (file === null) {\n throw new Error(\"Path does not exist\");\n }\n else if (!isFile$1(file)) {\n throw new Error('Can not `cat` a directory');\n }\n return [2 /*return*/, file.content];\n }\n });\n });\n };\n BaseTree.prototype.mkdir = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, this.mkdirRecurse(path, function () { return _this.put(); })];\n });\n });\n };\n BaseTree.prototype.mkdirRecurse = function (path, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var head, nextPath, child;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n head = path[0], nextPath = path.slice(1);\n if (!head) {\n throw new Error(\"Invalid path: empty\");\n }\n return [4 /*yield*/, this.getOrCreateDirectChild(head, onUpdate)];\n case 1:\n child = _a.sent();\n if (isFile$1(child)) {\n throw new Error(\"There is a file along the given path: \" + log(path));\n }\n if (!nextPath.length) return [3 /*break*/, 3];\n return [4 /*yield*/, child.mkdirRecurse(nextPath, function () { return _this.updateDirectChild(child, head, onUpdate); })];\n case 2:\n _a.sent();\n _a.label = 3;\n case 3: return [2 /*return*/, this];\n }\n });\n });\n };\n BaseTree.prototype.add = function (path, content) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.addRecurse(path, content, function () { return _this.put(); })];\n case 1:\n _a.sent();\n return [2 /*return*/, this];\n }\n });\n });\n };\n BaseTree.prototype.addRecurse = function (path, content, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var head, nextPath, child_1;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n head = path[0], nextPath = path.slice(1);\n if (!head) {\n throw new Error(\"Invalid path: empty\");\n }\n if (!(nextPath.length === 0)) return [3 /*break*/, 2];\n return [4 /*yield*/, this.createOrUpdateChildFile(content, head, onUpdate)];\n case 1:\n _a.sent();\n return [3 /*break*/, 5];\n case 2: return [4 /*yield*/, this.getOrCreateDirectChild(head, onUpdate)];\n case 3:\n child_1 = _a.sent();\n if (isFile$1(child_1)) {\n throw new Error(\"There is a file along the given path: \" + log(path));\n }\n return [4 /*yield*/, child_1.addRecurse(nextPath, content, function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.updateDirectChild(child_1, head, onUpdate)];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); })];\n case 4:\n _a.sent();\n _a.label = 5;\n case 5: return [2 /*return*/, this];\n }\n });\n });\n };\n BaseTree.prototype.rm = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.rmRecurse(path, function () { return _this.put(); })];\n case 1:\n _a.sent();\n return [2 /*return*/, this];\n }\n });\n });\n };\n BaseTree.prototype.rmRecurse = function (path, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var head, nextPath, _a, child_2;\n var _this = this;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n head = path[0], nextPath = path.slice(1);\n if (!head) {\n throw new Error(\"Invalid path: empty\");\n }\n if (!(nextPath.length === 0)) return [3 /*break*/, 3];\n this.removeDirectChild(head);\n _a = onUpdate;\n if (!_a) return [3 /*break*/, 2];\n return [4 /*yield*/, onUpdate()];\n case 1:\n _a = (_b.sent());\n _b.label = 2;\n case 2:\n return [3 /*break*/, 6];\n case 3: return [4 /*yield*/, this.getDirectChild(head)];\n case 4:\n child_2 = _b.sent();\n if (child_2 === null) {\n throw new Error(\"Invalid path: does not exist\");\n }\n else if (isFile$1(child_2)) {\n throw new Error(\"There is a file along the given path: \" + log(path));\n }\n return [4 /*yield*/, child_2.rmRecurse(nextPath, function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.updateDirectChild(child_2, head, onUpdate)];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); })];\n case 5:\n _b.sent();\n _b.label = 6;\n case 6: return [2 /*return*/, this];\n }\n });\n });\n };\n BaseTree.prototype.mv = function (from, to) {\n return __awaiter(this, void 0, void 0, function () {\n var node, parentPath, parent;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.get(from)];\n case 1:\n node = _a.sent();\n if (node === null) {\n throw new Error(\"Path does not exist: \" + log(from));\n }\n if (to.length < 1) {\n throw new Error(\"Path does not exist: \" + log(to));\n }\n parentPath = to.slice(0, -1);\n return [4 /*yield*/, this.get(parentPath)];\n case 2:\n parent = _a.sent();\n if (!!parent) return [3 /*break*/, 5];\n return [4 /*yield*/, this.mkdir(parentPath)];\n case 3:\n _a.sent();\n return [4 /*yield*/, this.get(parentPath)];\n case 4:\n parent = _a.sent();\n return [3 /*break*/, 6];\n case 5:\n if (isFile$1(parent)) {\n throw new Error(\"Can not `mv` to a file: \" + log(parentPath));\n }\n _a.label = 6;\n case 6: return [4 /*yield*/, this.rm(from)];\n case 7:\n _a.sent();\n return [4 /*yield*/, __spreadArrays(to).reverse().reduce(function (acc, part, idx) {\n return acc.then(function (child) { return __awaiter(_this, void 0, void 0, function () {\n var childParentParts, tree, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n childParentParts = to.slice(0, -(idx + 1));\n if (!childParentParts.length) return [3 /*break*/, 2];\n return [4 /*yield*/, this.get(childParentParts)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _a = this;\n _b.label = 3;\n case 3:\n tree = _a;\n if (!(tree && !isFile$1(tree))) return [3 /*break*/, 5];\n return [4 /*yield*/, tree.updateDirectChild(child, part, null)];\n case 4:\n _b.sent();\n return [2 /*return*/, tree];\n case 5: throw new Error(\"Failed to update tree while moving node\");\n }\n });\n }); });\n }, Promise.resolve(node))];\n case 8:\n _a.sent();\n return [2 /*return*/, this];\n }\n });\n });\n };\n BaseTree.prototype.exists = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n var node;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.get(path)];\n case 1:\n node = _a.sent();\n return [2 /*return*/, node !== null];\n }\n });\n });\n };\n BaseTree.prototype.read = function (path) {\n return this.get(path);\n };\n BaseTree.prototype.write = function (path, content) {\n return this.add(path, content);\n };\n BaseTree.prototype.getOrCreateDirectChild = function (name, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var node;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.getDirectChild(name)];\n case 1:\n node = _a.sent();\n return [2 /*return*/, node !== null\n ? node\n : this.createChildTree(name, onUpdate)];\n }\n });\n });\n };\n return BaseTree;\n }());\n\n var BareTree = /** @class */ (function (_super) {\n __extends(BareTree, _super);\n function BareTree(links) {\n var _this = _super.call(this, v0) || this;\n _this.links = links;\n _this.children = {};\n return _this;\n }\n BareTree.empty = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new BareTree({})];\n });\n });\n };\n BareTree.fromCID = function (cid) {\n return __awaiter(this, void 0, void 0, function () {\n var links;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getLinks(cid)];\n case 1:\n links = _a.sent();\n return [2 /*return*/, new BareTree(links)];\n }\n });\n });\n };\n BareTree.fromLinks = function (links) {\n return new BareTree(links);\n };\n BareTree.prototype.createChildTree = function (name, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var child, existing;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, BareTree.empty()];\n case 1:\n child = _a.sent();\n existing = this.children[name];\n if (existing) {\n if (BareFile.instanceOf(existing)) {\n throw new Error(\"There is a file at the given path: \" + name);\n }\n return [2 /*return*/, existing];\n }\n return [4 /*yield*/, this.updateDirectChild(child, name, onUpdate)];\n case 2:\n _a.sent();\n return [2 /*return*/, child];\n }\n });\n });\n };\n BareTree.prototype.createOrUpdateChildFile = function (content, name, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var existing, file;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.getDirectChild(name)];\n case 1:\n existing = _a.sent();\n if (!(existing === null)) return [3 /*break*/, 3];\n return [4 /*yield*/, BareFile.create(content)];\n case 2:\n file = _a.sent();\n return [3 /*break*/, 6];\n case 3:\n if (!BareFile.instanceOf(existing)) return [3 /*break*/, 5];\n return [4 /*yield*/, existing.updateContent(content)];\n case 4:\n file = _a.sent();\n return [3 /*break*/, 6];\n case 5: throw new Error(\"There is already a directory with that name: \" + name);\n case 6: return [4 /*yield*/, this.updateDirectChild(file, name, onUpdate)];\n case 7:\n _a.sent();\n return [2 /*return*/, file];\n }\n });\n });\n };\n BareTree.prototype.putDetailed = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, putLinks(this.links)];\n });\n });\n };\n BareTree.prototype.putAndUpdateLink = function (child, name, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var details, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, child.putDetailed()];\n case 1:\n details = _b.sent();\n this.updateLink(name, details);\n _a = onUpdate;\n if (!_a) return [3 /*break*/, 3];\n return [4 /*yield*/, onUpdate()];\n case 2:\n _a = (_b.sent());\n _b.label = 3;\n case 3:\n return [2 /*return*/, this];\n }\n });\n });\n };\n BareTree.prototype.updateDirectChild = function (child, name, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n this.children[name] = child;\n return [2 /*return*/, this.putAndUpdateLink(child, name, onUpdate)];\n });\n });\n };\n BareTree.prototype.removeDirectChild = function (name) {\n delete this.links[name];\n if (this.children[name]) {\n delete this.children[name];\n }\n return this;\n };\n BareTree.prototype.getDirectChild = function (name) {\n return __awaiter(this, void 0, void 0, function () {\n var link, child, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (this.children[name]) {\n return [2 /*return*/, this.children[name]];\n }\n link = this.links[name] || null;\n if (link === null)\n return [2 /*return*/, null];\n if (!link.isFile) return [3 /*break*/, 2];\n return [4 /*yield*/, BareFile.fromCID(link.cid)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 4];\n case 2: return [4 /*yield*/, BareTree.fromCID(link.cid)\n // check that the child wasn't added while retrieving the content from the network\n ];\n case 3:\n _a = _b.sent();\n _b.label = 4;\n case 4:\n child = _a;\n // check that the child wasn't added while retrieving the content from the network\n if (this.children[name]) {\n return [2 /*return*/, this.children[name]];\n }\n this.children[name] = child;\n return [2 /*return*/, child];\n }\n });\n });\n };\n // TODO\n BareTree.prototype.get = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n var head, nextPath, nextTree;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n head = path[0], nextPath = path.slice(1);\n if (!head)\n return [2 /*return*/, this];\n return [4 /*yield*/, this.getDirectChild(head)];\n case 1:\n nextTree = _a.sent();\n if (!nextPath.length) {\n return [2 /*return*/, nextTree];\n }\n else if (nextTree === null || isFile$1(nextTree)) {\n return [2 /*return*/, null];\n }\n return [2 /*return*/, nextTree.get(nextPath)];\n }\n });\n });\n };\n BareTree.prototype.updateLink = function (name, result) {\n var cid = result.cid, size = result.size, isFile = result.isFile;\n this.links[name] = make(name, cid, isFile, size);\n return this;\n };\n BareTree.prototype.getLinks = function () {\n return this.links;\n };\n return BareTree;\n }(BaseTree));\n\n var nibbles = {\n \"0\": true, \"1\": true, \"2\": true, \"3\": true, \"4\": true, \"5\": true, \"6\": true, \"7\": true,\n \"8\": true, \"9\": true, \"a\": true, \"b\": true, \"c\": true, \"d\": true, \"e\": true, \"f\": true,\n };\n var isNibble = function (str) { return nibbles[str] === true; };\n /**\n * Modified Merkle Patricia Tree\n * The tree has a node weight of 16\n * It stores items with hexidecimal keys and creates a new layer when a given layer has two keys that start with the same nibble\n */\n var MMPT = /** @class */ (function () {\n function MMPT(links) {\n this.links = links;\n this.children = {};\n }\n MMPT.create = function () {\n return new MMPT({});\n };\n MMPT.fromCID = function (cid) {\n return __awaiter(this, void 0, void 0, function () {\n var links;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getSimpleLinks(cid)];\n case 1:\n links = _a.sent();\n return [2 /*return*/, new MMPT(links)];\n }\n });\n });\n };\n MMPT.prototype.putDetailed = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, putLinks(this.links)];\n });\n });\n };\n MMPT.prototype.put = function () {\n return __awaiter(this, void 0, void 0, function () {\n var cid;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.putDetailed()];\n case 1:\n cid = (_a.sent()).cid;\n return [2 /*return*/, cid];\n }\n });\n });\n };\n MMPT.prototype.add = function (name, value) {\n return __awaiter(this, void 0, void 0, function () {\n var nextNameOrSib, nextTree, newTree, nextCID;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!isNibble(name[0])) {\n throw new Error(\"Not a valid name, must be hexadecimal\");\n }\n nextNameOrSib = this.nextTreeOrSiblingName(name);\n if (!(name === nextNameOrSib)) return [3 /*break*/, 1];\n return [3 /*break*/, 9];\n case 1:\n if (!(nextNameOrSib === null)) return [3 /*break*/, 2];\n this.links[name] = make(name, value, true, 0);\n return [3 /*break*/, 9];\n case 2:\n if (!(nextNameOrSib.length === 1)) return [3 /*break*/, 6];\n return [4 /*yield*/, this.getDirectChild(nextNameOrSib)];\n case 3:\n nextTree = _a.sent();\n return [4 /*yield*/, nextTree.add(name.slice(1), value)];\n case 4:\n _a.sent();\n return [4 /*yield*/, this.putAndUpdateChildLink(nextNameOrSib)];\n case 5:\n _a.sent();\n return [3 /*break*/, 9];\n case 6:\n newTree = this.addEmptyChild(name[0]);\n nextCID = this.links[nextNameOrSib].cid;\n this.removeChild(nextNameOrSib);\n return [4 /*yield*/, Promise.all([\n newTree.add(name.slice(1), value),\n newTree.add(nextNameOrSib.slice(1), nextCID)\n ])];\n case 7:\n _a.sent();\n return [4 /*yield*/, this.putAndUpdateChildLink(name[0])];\n case 8:\n _a.sent();\n _a.label = 9;\n case 9: return [2 /*return*/];\n }\n });\n });\n };\n MMPT.prototype.putAndUpdateChildLink = function (name) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function () {\n var cidBefore, _c, cid, size, cidNow;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n cidBefore = (_a = this.links[name]) === null || _a === void 0 ? void 0 : _a.cid;\n return [4 /*yield*/, this.children[name].putDetailed()];\n case 1:\n _c = _d.sent(), cid = _c.cid, size = _c.size;\n cidNow = (_b = this.links[name]) === null || _b === void 0 ? void 0 : _b.cid;\n if (!(cidBefore != cidNow)) return [3 /*break*/, 3];\n return [4 /*yield*/, this.putAndUpdateChildLink(name)];\n case 2: \n // If there are changes in-between, we have to\n // re-try updating. Otherwise we can overwrite changes that\n // a concurrent update made\n return [2 /*return*/, _d.sent()];\n case 3:\n this.links[name] = make(name, cid, false, size);\n return [2 /*return*/];\n }\n });\n });\n };\n MMPT.prototype.addEmptyChild = function (name) {\n var tree = MMPT.create();\n this.children[name] = tree;\n return tree;\n };\n MMPT.prototype.get = function (name) {\n return __awaiter(this, void 0, void 0, function () {\n var nextName, nextTree;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n nextName = this.nextTreeName(name);\n if (nextName === null)\n return [2 /*return*/, null];\n if (nextName.length > 1) {\n return [2 /*return*/, this.links[nextName].cid];\n }\n return [4 /*yield*/, this.getDirectChild(nextName)];\n case 1:\n nextTree = _a.sent();\n return [2 /*return*/, nextTree.get(name.slice(1))];\n }\n });\n });\n };\n MMPT.prototype.exists = function (name) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.get(name)];\n case 1: return [2 /*return*/, (_a.sent()) !== null];\n }\n });\n });\n };\n MMPT.prototype.members = function () {\n return __awaiter(this, void 0, void 0, function () {\n var children;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, Promise.all(Object.values(this.links).map(function (_a) {\n var name = _a.name, cid = _a.cid;\n return __awaiter(_this, void 0, void 0, function () {\n var child, childMembers;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (name.length > 1) {\n return [2 /*return*/, [{ name: name, cid: cid }]];\n }\n return [4 /*yield*/, MMPT.fromCID(cid)];\n case 1:\n child = _b.sent();\n return [4 /*yield*/, child.members()];\n case 2:\n childMembers = _b.sent();\n return [2 /*return*/, childMembers.map(function (mem) { return (__assign(__assign({}, mem), { name: name + mem.name })); })];\n }\n });\n });\n }))];\n case 1:\n children = _a.sent();\n return [2 /*return*/, children.reduce(function (acc, cur) { return acc.concat(cur); })];\n }\n });\n });\n };\n MMPT.prototype.getDirectChild = function (name) {\n return __awaiter(this, void 0, void 0, function () {\n var child;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.children[name]) {\n return [2 /*return*/, this.children[name]];\n }\n return [4 /*yield*/, MMPT.fromCID(this.links[name].cid)\n // check that the child wasn't added while retrieving the mmpt from the network\n ];\n case 1:\n child = _a.sent();\n // check that the child wasn't added while retrieving the mmpt from the network\n if (this.children[name]) {\n return [2 /*return*/, this.children[name]];\n }\n this.children[name] = child;\n return [2 /*return*/, child];\n }\n });\n });\n };\n MMPT.prototype.removeChild = function (name) {\n delete this.links[name];\n if (this.children[name]) {\n delete this.children[name];\n }\n };\n MMPT.prototype.directChildExists = function (name) {\n return this.links[name] !== undefined || this.children[name] !== undefined;\n };\n MMPT.prototype.nextTreeName = function (name) {\n if (this.directChildExists(name[0])) {\n return name[0];\n }\n else if (this.directChildExists(name)) {\n return name;\n }\n return null;\n };\n MMPT.prototype.nextTreeOrSiblingName = function (name) {\n var nibble = name[0];\n if (this.directChildExists(nibble)) {\n return nibble;\n }\n return Object.keys(this.links).find(function (child) { return nibble === child[0]; }) || null;\n };\n return MMPT;\n }());\n\n var PublicHistory = /** @class */ (function () {\n function PublicHistory(node) {\n this.node = node;\n }\n /**\n * Go back one or more versions.\n *\n * @param delta Optional negative number to specify how far to go back\n */\n PublicHistory.prototype.back = function (delta) {\n if (delta === void 0) { delta = -1; }\n var length = Math.abs(Math.min(delta, -1));\n return Array.from({ length: length }, function (_, i) { return i; }).reduce(function (promise) { return promise.then(function (n) { return n ? PublicHistory._getPreviousVersion(n) : null; }); }, Promise.resolve(this.node));\n };\n // async forward(delta: number = 1): Promise<Maybe<Node>> {}\n /**\n * Get a version before a given timestamp.\n *\n * @param timestamp Unix timestamp in seconds\n */\n PublicHistory.prototype.prior = function (timestamp) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, PublicHistory._prior(this.node, timestamp)];\n });\n });\n };\n /**\n * List earlier versions along with the timestamp they were created.\n */\n PublicHistory.prototype.list = function (amount) {\n if (amount === void 0) { amount = 5; }\n return __awaiter(this, void 0, void 0, function () {\n var acc;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, Array.from({ length: amount }, function (_, i) { return i; }).reduce(function (promise, i) { return promise.then(function (_a) {\n var node = _a.node, acc = _a.acc;\n if (!node)\n return Promise.resolve({ node: null, acc: acc });\n return PublicHistory\n ._getPreviousVersion(node)\n .then(function (n) { return ({\n node: n,\n acc: __spreadArrays(acc, [\n { delta: -(i + 1), timestamp: node.header.metadata.unixMeta.mtime }\n ])\n }); });\n }); }, PublicHistory\n ._getPreviousVersion(this.node)\n .then(function (n) { return ({ node: n, acc: [] }); }))];\n case 1:\n acc = (_a.sent()).acc;\n return [2 /*return*/, acc];\n }\n });\n });\n };\n /**\n * @internal\n */\n PublicHistory._getPreviousVersion = function (node) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (!node.header.previous)\n return [2 /*return*/, Promise.resolve(null)];\n return [2 /*return*/, node.constructor.fromCID(node.header.previous)];\n });\n });\n };\n /**\n * @internal\n */\n PublicHistory._prior = function (node, timestamp) {\n return __awaiter(this, void 0, void 0, function () {\n var previous;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (node.header.metadata.unixMeta.mtime < timestamp)\n return [2 /*return*/, node];\n return [4 /*yield*/, PublicHistory._getPreviousVersion(node)];\n case 1:\n previous = _a.sent();\n return [2 /*return*/, previous ? PublicHistory._prior(previous, timestamp) : null];\n }\n });\n });\n };\n return PublicHistory;\n }());\n\n var UnixNodeType;\n (function (UnixNodeType) {\n UnixNodeType[\"Raw\"] = \"raw\";\n UnixNodeType[\"Directory\"] = \"dir\";\n UnixNodeType[\"File\"] = \"file\";\n UnixNodeType[\"Metadata\"] = \"metadata\";\n UnixNodeType[\"Symlink\"] = \"symlink\";\n UnixNodeType[\"HAMTShard\"] = \"hamtShard\";\n })(UnixNodeType || (UnixNodeType = {}));\n var emptyUnix = function (isFile) { return ({\n mtime: Date.now(),\n ctime: Date.now(),\n mode: isFile ? 644 : 755,\n _type: isFile ? UnixNodeType.File : UnixNodeType.Directory,\n }); };\n var empty$2 = function (isFile) { return ({\n isFile: isFile,\n version: latest,\n unixMeta: emptyUnix(isFile)\n }); };\n var updateMtime = function (metadata) { return (__assign(__assign({}, metadata), { unixMeta: __assign(__assign({}, metadata.unixMeta), { mtime: Date.now() }) })); };\n\n var PublicFile = /** @class */ (function (_super) {\n __extends(PublicFile, _super);\n function PublicFile(_a) {\n var content = _a.content, header = _a.header, cid = _a.cid;\n var _this = _super.call(this, content) || this;\n _this.cid = cid;\n _this.header = header;\n _this.history = new PublicHistory(_this);\n return _this;\n }\n PublicFile.instanceOf = function (obj) {\n return isObject(obj)\n && obj.content !== undefined\n && isFileHeader(obj.header);\n };\n PublicFile.create = function (content) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new PublicFile({\n content: content,\n header: { metadata: empty$2(true) },\n cid: null\n })];\n });\n });\n };\n PublicFile.fromCID = function (cid) {\n return __awaiter(this, void 0, void 0, function () {\n var info;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, get$3(cid)];\n case 1:\n info = _a.sent();\n return [2 /*return*/, PublicFile.fromInfo(info, cid)];\n }\n });\n });\n };\n PublicFile.fromInfo = function (info, cid) {\n return __awaiter(this, void 0, void 0, function () {\n var userland, metadata, previous, content;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n userland = info.userland, metadata = info.metadata, previous = info.previous;\n return [4 /*yield*/, getFile(userland)];\n case 1:\n content = _a.sent();\n return [2 /*return*/, new PublicFile({\n content: content,\n header: { metadata: metadata, previous: previous },\n cid: cid\n })];\n }\n });\n });\n };\n PublicFile.prototype.putDetailed = function () {\n return __awaiter(this, void 0, void 0, function () {\n var details;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, putFile$1(this.content, updateMtime(this.header.metadata), this.cid)];\n case 1:\n details = _a.sent();\n this.cid = details.cid;\n return [2 /*return*/, details];\n }\n });\n });\n };\n return PublicFile;\n }(BaseFile));\n\n var getPath = function (skeleton, path) {\n var head = path[0];\n var child = skeleton[head] || null;\n var nextPath = nextNonEmpty(path);\n if (child === null || nextPath === null) {\n return child;\n }\n else {\n return getPath(child.subSkeleton, nextPath);\n }\n };\n function nextNonEmpty(parts) {\n var next = parts.slice(1);\n if (next.length < 1) {\n return null;\n }\n return next;\n }\n\n var PublicTree = /** @class */ (function (_super) {\n __extends(PublicTree, _super);\n function PublicTree(_a) {\n var links = _a.links, header = _a.header, cid = _a.cid;\n var _this = _super.call(this, header.metadata.version) || this;\n _this.children = {};\n _this.cid = cid;\n _this.links = links;\n _this.header = header;\n _this.history = new PublicHistory(_this);\n return _this;\n }\n PublicTree.empty = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new PublicTree({\n links: {},\n header: {\n metadata: empty$2(false),\n skeleton: {},\n },\n cid: null\n })];\n });\n });\n };\n PublicTree.fromCID = function (cid) {\n return __awaiter(this, void 0, void 0, function () {\n var info;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, get$3(cid)];\n case 1:\n info = _a.sent();\n if (!isTreeInfo(info)) {\n throw new Error(\"Could not parse a valid public tree at: \" + cid);\n }\n return [2 /*return*/, PublicTree.fromInfo(info, cid)];\n }\n });\n });\n };\n PublicTree.fromInfo = function (info, cid) {\n return __awaiter(this, void 0, void 0, function () {\n var userland, metadata, previous, skeleton, links;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n userland = info.userland, metadata = info.metadata, previous = info.previous, skeleton = info.skeleton;\n return [4 /*yield*/, getLinks(userland)];\n case 1:\n links = _a.sent();\n return [2 /*return*/, new PublicTree({\n links: links,\n header: { metadata: metadata, previous: previous, skeleton: skeleton },\n cid: cid\n })];\n }\n });\n });\n };\n PublicTree.instanceOf = function (obj) {\n return isLinks(obj.links) && isTreeHeader(obj.header);\n };\n PublicTree.prototype.createChildTree = function (name, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var child, existing;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, PublicTree.empty()];\n case 1:\n child = _a.sent();\n existing = this.children[name];\n if (existing) {\n if (PublicFile.instanceOf(existing)) {\n throw new Error(\"There is a file at the given path: \" + name);\n }\n else if (!PublicTree.instanceOf(existing)) {\n throw new Error(\"Not a public tree at the given path: \" + name);\n }\n else {\n return [2 /*return*/, existing];\n }\n }\n return [4 /*yield*/, this.updateDirectChild(child, name, onUpdate)];\n case 2:\n _a.sent();\n return [2 /*return*/, child];\n }\n });\n });\n };\n PublicTree.prototype.createOrUpdateChildFile = function (content, name, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var existing, file;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.getDirectChild(name)];\n case 1:\n existing = _a.sent();\n if (!(existing === null)) return [3 /*break*/, 3];\n return [4 /*yield*/, PublicFile.create(content)];\n case 2:\n file = _a.sent();\n return [3 /*break*/, 6];\n case 3:\n if (!PublicFile.instanceOf(existing)) return [3 /*break*/, 5];\n return [4 /*yield*/, existing.updateContent(content)];\n case 4:\n file = _a.sent();\n return [3 /*break*/, 6];\n case 5: throw new Error(\"There is already a directory with that name: \" + name);\n case 6: return [4 /*yield*/, this.updateDirectChild(file, name, onUpdate)];\n case 7:\n _a.sent();\n return [2 /*return*/, file];\n }\n });\n });\n };\n PublicTree.prototype.putDetailed = function () {\n return __awaiter(this, void 0, void 0, function () {\n var details;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, putTree(this.links, this.header.skeleton, this.header.metadata, this.cid)];\n case 1:\n details = _a.sent();\n this.header.previous = this.cid || undefined;\n this.cid = details.cid;\n return [2 /*return*/, details];\n }\n });\n });\n };\n PublicTree.prototype.updateDirectChild = function (child, name, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var details, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n this.children[name] = child;\n return [4 /*yield*/, child.putDetailed()];\n case 1:\n details = _b.sent();\n this.updateLink(name, details);\n _a = onUpdate;\n if (!_a) return [3 /*break*/, 3];\n return [4 /*yield*/, onUpdate()];\n case 2:\n _a = (_b.sent());\n _b.label = 3;\n case 3:\n return [2 /*return*/, this];\n }\n });\n });\n };\n PublicTree.prototype.removeDirectChild = function (name) {\n delete this.links[name];\n delete this.header.skeleton[name];\n if (this.children[name]) {\n delete this.children[name];\n }\n return this;\n };\n PublicTree.prototype.getDirectChild = function (name) {\n return __awaiter(this, void 0, void 0, function () {\n var childInfo, child, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (this.children[name]) {\n return [2 /*return*/, this.children[name]];\n }\n childInfo = this.header.skeleton[name] || null;\n if (childInfo === null)\n return [2 /*return*/, null];\n if (!childInfo.isFile) return [3 /*break*/, 2];\n return [4 /*yield*/, PublicFile.fromCID(childInfo.cid)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 4];\n case 2: return [4 /*yield*/, PublicTree.fromCID(childInfo.cid)\n // check that the child wasn't added while retrieving the content from the network\n ];\n case 3:\n _a = _b.sent();\n _b.label = 4;\n case 4:\n child = _a;\n // check that the child wasn't added while retrieving the content from the network\n if (this.children[name]) {\n return [2 /*return*/, this.children[name]];\n }\n this.children[name] = child;\n return [2 /*return*/, child];\n }\n });\n });\n };\n PublicTree.prototype.get = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n var skeletonInfo, info;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (path.length < 1)\n return [2 /*return*/, this];\n skeletonInfo = getPath(this.header.skeleton, path);\n if (skeletonInfo === null)\n return [2 /*return*/, null];\n return [4 /*yield*/, get$3(skeletonInfo.cid)];\n case 1:\n info = _a.sent();\n return [2 /*return*/, isFileInfo(info)\n ? PublicFile.fromInfo(info, skeletonInfo.cid)\n : PublicTree.fromInfo(info, skeletonInfo.cid)];\n }\n });\n });\n };\n PublicTree.prototype.getLinks = function () {\n var _this = this;\n // add missing metadata into links\n return Object.values(this.links).reduce(function (acc, cur) {\n var _a;\n var _b;\n return __assign(__assign({}, acc), (_a = {}, _a[cur.name] = __assign(__assign({}, cur), { isFile: (_b = _this.header.skeleton[cur.name]) === null || _b === void 0 ? void 0 : _b.isFile }), _a));\n }, {});\n };\n PublicTree.prototype.updateLink = function (name, result) {\n var cid = result.cid, metadata = result.metadata, userland = result.userland, size = result.size, isFile = result.isFile, skeleton = result.skeleton;\n this.links[name] = make(name, cid, false, size);\n this.header.skeleton[name] = {\n cid: cid,\n metadata: metadata,\n userland: userland,\n subSkeleton: skeleton,\n isFile: isFile\n };\n this.header.metadata.unixMeta.mtime = Date.now();\n return this;\n };\n return PublicTree;\n }(BaseTree));\n\n var PrivateHistory = /** @class */ (function () {\n function PrivateHistory(node) {\n this.node = node;\n }\n /**\n * Go back one or more versions.\n *\n * @param delta Optional negative number to specify how far to go back\n */\n PrivateHistory.prototype.back = function (delta) {\n var _a;\n if (delta === void 0) { delta = -1; }\n return __awaiter(this, void 0, void 0, function () {\n var n, revision, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n n = Math.min(delta, -1);\n revision = (_a = this.node.header) === null || _a === void 0 ? void 0 : _a.revision;\n _b = revision;\n if (!_b) return [3 /*break*/, 2];\n return [4 /*yield*/, this._getRevision(revision + n)];\n case 1:\n _b = (_c.sent());\n _c.label = 2;\n case 2: return [2 /*return*/, (_b) || null];\n }\n });\n });\n };\n // async forward(delta: number = 1): Promise<Maybe<Node>> {\n // const n = Math.max(delta, 1)\n // const revision = this.node.header?.revision\n // return (revision && await this._getRevision(revision + n)) || null\n // }\n /**\n * Get a version before a given timestamp.\n *\n * @param timestamp Unix timestamp in seconds\n */\n PrivateHistory.prototype.prior = function (timestamp) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (this.node.header.metadata.unixMeta.mtime < timestamp) {\n return [2 /*return*/, this.node];\n }\n else {\n return [2 /*return*/, this._prior(this.node.header.revision - 1, timestamp)];\n }\n });\n });\n };\n /**\n * List earlier versions along with the timestamp they were created.\n */\n PrivateHistory.prototype.list = function (amount) {\n if (amount === void 0) { amount = 5; }\n return __awaiter(this, void 0, void 0, function () {\n var max;\n var _this = this;\n return __generator(this, function (_a) {\n max = this.node.header.revision;\n return [2 /*return*/, Promise.all(Array.from({ length: amount }, function (_, i) {\n var n = i + 1;\n return _this._getRevisionInfoFromNumber(max - n).then(function (info) { return ({\n revisionInfo: info,\n delta: -n\n }); });\n })).then(function (list) { return list.filter(function (a) { return !!a.revisionInfo; }); }).then(function (list) { return list.map(function (a) {\n var mtime = a.revisionInfo.metadata.unixMeta.mtime;\n return { delta: a.delta, timestamp: mtime };\n }); })];\n });\n });\n };\n /**\n * @internal\n */\n PrivateHistory.prototype._getRevision = function (revision) {\n return __awaiter(this, void 0, void 0, function () {\n var info, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, this._getRevisionInfoFromNumber(revision)];\n case 1:\n info = _b.sent();\n _a = info;\n if (!_a) return [3 /*break*/, 3];\n return [4 /*yield*/, this.node.constructor.fromInfo(this.node.mmpt, this.node.key, info)];\n case 2:\n _a = (_b.sent());\n _b.label = 3;\n case 3: return [2 /*return*/, _a];\n }\n });\n });\n };\n /**\n * @internal\n */\n PrivateHistory.prototype._getRevisionInfo = function (revision) {\n return readNode(revision.cid, this.node.key);\n };\n /**\n * @internal\n */\n PrivateHistory.prototype._getRevisionInfoFromNumber = function (revision) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, key, mmpt, bareNameFilter, r;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _a = this.node, key = _a.key, mmpt = _a.mmpt;\n bareNameFilter = this.node.header.bareNameFilter;\n return [4 /*yield*/, getRevision(mmpt, bareNameFilter, key, revision)];\n case 1:\n r = _b.sent();\n return [2 /*return*/, r && this._getRevisionInfo(r)];\n }\n });\n });\n };\n /**\n * @internal\n */\n PrivateHistory.prototype._prior = function (revision, timestamp) {\n return __awaiter(this, void 0, void 0, function () {\n var info;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this._getRevisionInfoFromNumber(revision)];\n case 1:\n info = _a.sent();\n if (!(info === null || info === void 0 ? void 0 : info.revision))\n return [2 /*return*/, null];\n if (info.metadata.unixMeta.mtime < timestamp) {\n return [2 /*return*/, this._getRevision(info.revision)];\n }\n else {\n return [2 /*return*/, this._prior(info.revision - 1, timestamp)];\n }\n }\n });\n });\n };\n return PrivateHistory;\n }());\n\n var PrivateFile = /** @class */ (function (_super) {\n __extends(PrivateFile, _super);\n function PrivateFile(_a) {\n var content = _a.content, mmpt = _a.mmpt, key = _a.key, header = _a.header;\n var _this = _super.call(this, content) || this;\n _this.header = header;\n _this.history = new PrivateHistory(_this);\n _this.key = key;\n _this.mmpt = mmpt;\n return _this;\n }\n PrivateFile.instanceOf = function (obj) {\n return isObject(obj)\n && obj.content !== undefined\n && obj.mmpt !== undefined\n && isPrivateFileInfo(obj.header);\n };\n PrivateFile.create = function (mmpt, content, parentNameFilter, key) {\n return __awaiter(this, void 0, void 0, function () {\n var bareNameFilter, contentKey, contentInfo;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, addToBare(parentNameFilter, key)];\n case 1:\n bareNameFilter = _a.sent();\n return [4 /*yield*/, aes$2.genKeyStr()];\n case 2:\n contentKey = _a.sent();\n return [4 /*yield*/, putEncryptedFile(content, contentKey)];\n case 3:\n contentInfo = _a.sent();\n return [2 /*return*/, new PrivateFile({\n content: content,\n mmpt: mmpt,\n key: key,\n header: {\n bareNameFilter: bareNameFilter,\n key: contentKey,\n revision: 1,\n metadata: empty$2(true),\n content: contentInfo.cid\n }\n })];\n }\n });\n });\n };\n PrivateFile.fromBareNameFilter = function (mmpt, bareNameFilter, key) {\n return __awaiter(this, void 0, void 0, function () {\n var info;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getLatestByBareNameFilter(mmpt, bareNameFilter, key)];\n case 1:\n info = _a.sent();\n return [2 /*return*/, this.fromInfo(mmpt, key, info)];\n }\n });\n });\n };\n PrivateFile.fromLatestName = function (mmpt, name, key) {\n return __awaiter(this, void 0, void 0, function () {\n var info;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getByLatestName(mmpt, name, key)];\n case 1:\n info = _a.sent();\n return [2 /*return*/, PrivateFile.fromInfo(mmpt, key, info)];\n }\n });\n });\n };\n PrivateFile.fromName = function (mmpt, name, key) {\n return __awaiter(this, void 0, void 0, function () {\n var info;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getByName(mmpt, name, key)];\n case 1:\n info = _a.sent();\n return [2 /*return*/, PrivateFile.fromInfo(mmpt, key, info)];\n }\n });\n });\n };\n PrivateFile.fromInfo = function (mmpt, key, info) {\n return __awaiter(this, void 0, void 0, function () {\n var content;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!isPrivateFileInfo(info)) {\n throw new Error(\"Could not parse a valid private file using the given key\");\n }\n return [4 /*yield*/, getEncryptedFile(info.content, info.key)];\n case 1:\n content = _a.sent();\n return [2 /*return*/, new PrivateFile({\n content: content,\n key: key,\n mmpt: mmpt,\n header: info\n })];\n }\n });\n });\n };\n PrivateFile.prototype.getName = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _a, bareNameFilter, revision, revisionFilter;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _a = this.header, bareNameFilter = _a.bareNameFilter, revision = _a.revision;\n return [4 /*yield*/, addRevision(bareNameFilter, this.key, revision)];\n case 1:\n revisionFilter = _b.sent();\n return [2 /*return*/, toPrivateName(revisionFilter)];\n }\n });\n });\n };\n PrivateFile.prototype.updateParentNameFilter = function (parentNameFilter) {\n return __awaiter(this, void 0, void 0, function () {\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _a = this.header;\n return [4 /*yield*/, addToBare(parentNameFilter, this.header.key)];\n case 1:\n _a.bareNameFilter = _b.sent();\n return [2 /*return*/, this];\n }\n });\n });\n };\n PrivateFile.prototype.updateContent = function (content) {\n return __awaiter(this, void 0, void 0, function () {\n var contentInfo;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, putEncryptedFile(content, this.header.key)];\n case 1:\n contentInfo = _a.sent();\n this.content = content;\n this.header = __assign(__assign({}, this.header), { revision: this.header.revision + 1, content: contentInfo.cid });\n return [2 /*return*/, this];\n }\n });\n });\n };\n PrivateFile.prototype.putDetailed = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, addNode(this.mmpt, __assign(__assign({}, this.header), { metadata: updateMtime(this.header.metadata) }), this.key)];\n });\n });\n };\n return PrivateFile;\n }(BaseFile));\n\n var PrivateTree = /** @class */ (function (_super) {\n __extends(PrivateTree, _super);\n function PrivateTree(_a) {\n var mmpt = _a.mmpt, key = _a.key, header = _a.header;\n var _this = _super.call(this, v1) || this;\n _this.children = {};\n _this.header = header;\n _this.history = new PrivateHistory(_this);\n _this.key = key;\n _this.mmpt = mmpt;\n return _this;\n }\n PrivateTree.instanceOf = function (obj) {\n return isObject(obj)\n && obj.mmpt !== undefined\n && isPrivateTreeInfo(obj.header);\n };\n PrivateTree.create = function (mmpt, key, parentNameFilter) {\n return __awaiter(this, void 0, void 0, function () {\n var bareNameFilter, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!parentNameFilter) return [3 /*break*/, 2];\n return [4 /*yield*/, addToBare(parentNameFilter, key)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 4];\n case 2: return [4 /*yield*/, createBare(key)];\n case 3:\n _a = _b.sent();\n _b.label = 4;\n case 4:\n bareNameFilter = _a;\n return [2 /*return*/, new PrivateTree({\n mmpt: mmpt,\n key: key,\n header: {\n metadata: empty$2(false),\n bareNameFilter: bareNameFilter,\n revision: 1,\n links: {},\n skeleton: {},\n }\n })];\n }\n });\n });\n };\n PrivateTree.fromBaseKey = function (mmpt, key) {\n return __awaiter(this, void 0, void 0, function () {\n var bareNameFilter;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, createBare(key)];\n case 1:\n bareNameFilter = _a.sent();\n return [2 /*return*/, this.fromBareNameFilter(mmpt, bareNameFilter, key)];\n }\n });\n });\n };\n PrivateTree.fromBareNameFilter = function (mmpt, bareNameFilter, key) {\n return __awaiter(this, void 0, void 0, function () {\n var info;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getLatestByBareNameFilter(mmpt, bareNameFilter, key)];\n case 1:\n info = _a.sent();\n return [2 /*return*/, this.fromInfo(mmpt, key, info)];\n }\n });\n });\n };\n PrivateTree.fromLatestName = function (mmpt, name, key) {\n return __awaiter(this, void 0, void 0, function () {\n var info;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getByLatestName(mmpt, name, key)];\n case 1:\n info = _a.sent();\n return [2 /*return*/, this.fromInfo(mmpt, key, info)];\n }\n });\n });\n };\n PrivateTree.fromName = function (mmpt, name, key) {\n return __awaiter(this, void 0, void 0, function () {\n var info;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getByName(mmpt, name, key)];\n case 1:\n info = _a.sent();\n return [2 /*return*/, this.fromInfo(mmpt, key, info)];\n }\n });\n });\n };\n PrivateTree.fromInfo = function (mmpt, key, info) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (!isPrivateTreeInfo(info)) {\n throw new Error(\"Could not parse a valid private tree using the given key\");\n }\n return [2 /*return*/, new PrivateTree({ mmpt: mmpt, key: key, header: info })];\n });\n });\n };\n PrivateTree.prototype.createChildTree = function (name, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var key, child, existing;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, aes$2.genKeyStr()];\n case 1:\n key = _a.sent();\n return [4 /*yield*/, PrivateTree.create(this.mmpt, key, this.header.bareNameFilter)];\n case 2:\n child = _a.sent();\n existing = this.children[name];\n if (existing) {\n if (PrivateFile.instanceOf(existing)) {\n throw new Error(\"There is a file at the given path: \" + name);\n }\n return [2 /*return*/, existing];\n }\n return [4 /*yield*/, this.updateDirectChild(child, name, onUpdate)];\n case 3:\n _a.sent();\n return [2 /*return*/, child];\n }\n });\n });\n };\n PrivateTree.prototype.createOrUpdateChildFile = function (content, name, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var existing, file, key;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.getDirectChild(name)];\n case 1:\n existing = _a.sent();\n if (!(existing === null)) return [3 /*break*/, 4];\n return [4 /*yield*/, aes$2.genKeyStr()];\n case 2:\n key = _a.sent();\n return [4 /*yield*/, PrivateFile.create(this.mmpt, content, this.header.bareNameFilter, key)];\n case 3:\n file = _a.sent();\n return [3 /*break*/, 7];\n case 4:\n if (!PrivateFile.instanceOf(existing)) return [3 /*break*/, 6];\n return [4 /*yield*/, existing.updateContent(content)];\n case 5:\n file = _a.sent();\n return [3 /*break*/, 7];\n case 6: throw new Error(\"There is already a directory with that name: \" + name);\n case 7: return [4 /*yield*/, this.updateDirectChild(file, name, onUpdate)];\n case 8:\n _a.sent();\n return [2 /*return*/, file];\n }\n });\n });\n };\n PrivateTree.prototype.putDetailed = function () {\n return __awaiter(this, void 0, void 0, function () {\n var nodeCopy;\n return __generator(this, function (_a) {\n nodeCopy = Object.assign({}, this.header);\n return [2 /*return*/, addNode(this.mmpt, nodeCopy, this.key)];\n });\n });\n };\n PrivateTree.prototype.updateDirectChild = function (child, name, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var details, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, child.updateParentNameFilter(this.header.bareNameFilter)];\n case 1:\n _b.sent();\n this.children[name] = child;\n return [4 /*yield*/, child.putDetailed()];\n case 2:\n details = _b.sent();\n this.updateLink(name, details);\n _a = onUpdate;\n if (!_a) return [3 /*break*/, 4];\n return [4 /*yield*/, onUpdate()];\n case 3:\n _a = (_b.sent());\n _b.label = 4;\n case 4:\n return [2 /*return*/, this];\n }\n });\n });\n };\n PrivateTree.prototype.removeDirectChild = function (name) {\n this.header = __assign(__assign({}, this.header), { revision: this.header.revision + 1, links: removeKeyFromObj(this.header.links, name), skeleton: removeKeyFromObj(this.header.skeleton, name) });\n if (this.children[name]) {\n delete this.children[name];\n }\n return this;\n };\n PrivateTree.prototype.getDirectChild = function (name) {\n return __awaiter(this, void 0, void 0, function () {\n var childInfo, child, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (this.children[name]) {\n return [2 /*return*/, this.children[name]];\n }\n childInfo = this.header.links[name];\n if (childInfo === undefined)\n return [2 /*return*/, null];\n if (!childInfo.isFile) return [3 /*break*/, 2];\n return [4 /*yield*/, PrivateFile.fromLatestName(this.mmpt, childInfo.pointer, childInfo.key)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 4];\n case 2: return [4 /*yield*/, PrivateTree.fromLatestName(this.mmpt, childInfo.pointer, childInfo.key)\n // check that the child wasn't added while retrieving the content from the network\n ];\n case 3:\n _a = _b.sent();\n _b.label = 4;\n case 4:\n child = _a;\n // check that the child wasn't added while retrieving the content from the network\n if (this.children[name]) {\n return [2 /*return*/, this.children[name]];\n }\n this.children[name] = child;\n return [2 /*return*/, child];\n }\n });\n });\n };\n PrivateTree.prototype.getName = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _a, bareNameFilter, revision, revisionFilter;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _a = this.header, bareNameFilter = _a.bareNameFilter, revision = _a.revision;\n return [4 /*yield*/, addRevision(bareNameFilter, this.key, revision)];\n case 1:\n revisionFilter = _b.sent();\n return [2 /*return*/, toPrivateName(revisionFilter)];\n }\n });\n });\n };\n PrivateTree.prototype.updateParentNameFilter = function (parentNameFilter) {\n return __awaiter(this, void 0, void 0, function () {\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _a = this.header;\n return [4 /*yield*/, addToBare(parentNameFilter, this.key)];\n case 1:\n _a.bareNameFilter = _b.sent();\n return [2 /*return*/, this];\n }\n });\n });\n };\n PrivateTree.prototype.get = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n var head, rest, next, result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (path.length === 0)\n return [2 /*return*/, this];\n head = path[0], rest = path.slice(1);\n next = this.header.skeleton[head];\n if (next === undefined)\n return [2 /*return*/, null];\n return [4 /*yield*/, this.getRecurse(next, rest)];\n case 1:\n result = _a.sent();\n if (result === null)\n return [2 /*return*/, null];\n return [2 /*return*/, isPrivateFileInfo(result.node)\n ? PrivateFile.fromInfo(this.mmpt, result.key, result.node)\n : PrivateTree.fromInfo(this.mmpt, result.key, result.node)];\n }\n });\n });\n };\n PrivateTree.prototype.getRecurse = function (nodeInfo, parts) {\n return __awaiter(this, void 0, void 0, function () {\n var head, rest, nextChild, reloadedNode, reloadedNext;\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n head = parts[0], rest = parts.slice(1);\n if (!(head === undefined)) return [3 /*break*/, 2];\n _a = {\n key: nodeInfo.key\n };\n return [4 /*yield*/, getLatestByCID(this.mmpt, nodeInfo.cid, nodeInfo.key)];\n case 1: return [2 /*return*/, (_a.node = _b.sent(),\n _a)];\n case 2:\n nextChild = nodeInfo.subSkeleton[head];\n if (nextChild !== undefined) {\n return [2 /*return*/, this.getRecurse(nextChild, rest)];\n }\n return [4 /*yield*/, getLatestByCID(this.mmpt, nodeInfo.cid, nodeInfo.key)];\n case 3:\n reloadedNode = _b.sent();\n if (!isPrivateTreeInfo(reloadedNode)) {\n return [2 /*return*/, null];\n }\n reloadedNext = reloadedNode.skeleton[head];\n return [2 /*return*/, reloadedNext === undefined ? null : this.getRecurse(reloadedNext, rest)];\n }\n });\n });\n };\n PrivateTree.prototype.getLinks = function () {\n return mapObj(this.header.links, function (link) {\n link.key; var rest = __rest(link, [\"key\"]);\n return __assign({}, rest);\n });\n };\n PrivateTree.prototype.updateLink = function (name, result) {\n var cid = result.cid, size = result.size, key = result.key, isFile = result.isFile, skeleton = result.skeleton;\n var pointer = result.name;\n this.header.links[name] = { name: name, key: key, pointer: pointer, size: size, isFile: isFile, mtime: Date.now() };\n this.header.skeleton[name] = { cid: cid, key: key, subSkeleton: skeleton };\n this.header.revision = this.header.revision + 1;\n this.header.metadata.unixMeta.mtime = Date.now();\n return this;\n };\n return PrivateTree;\n }(BaseTree));\n\n var RootTree = /** @class */ (function () {\n function RootTree(_a) {\n var links = _a.links, mmpt = _a.mmpt, privateLog = _a.privateLog, publicTree = _a.publicTree, prettyTree = _a.prettyTree, privateNodes = _a.privateNodes;\n this.links = links;\n this.mmpt = mmpt;\n this.privateLog = privateLog;\n this.publicTree = publicTree;\n this.prettyTree = prettyTree;\n this.privateNodes = privateNodes;\n }\n // INITIALISATION\n // --------------\n RootTree.empty = function (_a) {\n var rootKey = _a.rootKey;\n return __awaiter(this, void 0, void 0, function () {\n var publicTree, prettyTree, mmpt, rootPath, rootTree, tree;\n var _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0: return [4 /*yield*/, PublicTree.empty()];\n case 1:\n publicTree = _c.sent();\n return [4 /*yield*/, BareTree.empty()];\n case 2:\n prettyTree = _c.sent();\n mmpt = MMPT.create();\n rootPath = toPosix(directory(Branch.Private));\n return [4 /*yield*/, PrivateTree.create(mmpt, rootKey, null)];\n case 3:\n rootTree = _c.sent();\n return [4 /*yield*/, rootTree.put()\n // Construct tree\n ];\n case 4:\n _c.sent();\n tree = new RootTree({\n links: {},\n mmpt: mmpt,\n privateLog: [],\n publicTree: publicTree,\n prettyTree: prettyTree,\n privateNodes: (_b = {},\n _b[rootPath] = rootTree,\n _b)\n });\n // Store root key\n return [4 /*yield*/, RootTree.storeRootKey(rootKey)\n // Set version and store new sub trees\n ];\n case 5:\n // Store root key\n _c.sent();\n // Set version and store new sub trees\n tree.setVersion(v1);\n return [4 /*yield*/, Promise.all([\n tree.updatePuttable(Branch.Public, publicTree),\n tree.updatePuttable(Branch.Pretty, prettyTree),\n tree.updatePuttable(Branch.Private, mmpt)\n ])\n // Fin\n ];\n case 6:\n _c.sent();\n // Fin\n return [2 /*return*/, tree];\n }\n });\n });\n };\n RootTree.fromCID = function (_a) {\n var _b, _c, _d;\n var cid = _a.cid, permissions = _a.permissions;\n return __awaiter(this, void 0, void 0, function () {\n var links, keys, _e, publicCID, publicTree, _f, prettyTree, _g, privateCID, mmpt, privateNodes, privateLogCid, privateLog, _h, tree;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0: return [4 /*yield*/, getLinks(cid)];\n case 1:\n links = _j.sent();\n if (!permissions) return [3 /*break*/, 3];\n return [4 /*yield*/, permissionKeys(permissions)];\n case 2:\n _e = _j.sent();\n return [3 /*break*/, 4];\n case 3:\n _e = [];\n _j.label = 4;\n case 4:\n keys = _e;\n publicCID = ((_b = links[Branch.Public]) === null || _b === void 0 ? void 0 : _b.cid) || null;\n if (!(publicCID === null)) return [3 /*break*/, 6];\n return [4 /*yield*/, PublicTree.empty()];\n case 5:\n _f = _j.sent();\n return [3 /*break*/, 8];\n case 6: return [4 /*yield*/, PublicTree.fromCID(publicCID)];\n case 7:\n _f = _j.sent();\n _j.label = 8;\n case 8:\n publicTree = _f;\n if (!links[Branch.Pretty]) return [3 /*break*/, 10];\n return [4 /*yield*/, BareTree.fromCID(links[Branch.Pretty].cid)];\n case 9:\n _g = _j.sent();\n return [3 /*break*/, 12];\n case 10: return [4 /*yield*/, BareTree.empty()\n // Load private bits\n ];\n case 11:\n _g = _j.sent();\n _j.label = 12;\n case 12:\n prettyTree = _g;\n privateCID = ((_c = links[Branch.Private]) === null || _c === void 0 ? void 0 : _c.cid) || null;\n if (!(privateCID === null)) return [3 /*break*/, 14];\n return [4 /*yield*/, MMPT.create()];\n case 13:\n mmpt = _j.sent();\n privateNodes = {};\n return [3 /*break*/, 17];\n case 14: return [4 /*yield*/, MMPT.fromCID(privateCID)];\n case 15:\n mmpt = _j.sent();\n return [4 /*yield*/, loadPrivateNodes(keys, mmpt)];\n case 16:\n privateNodes = _j.sent();\n _j.label = 17;\n case 17:\n privateLogCid = (_d = links[Branch.PrivateLog]) === null || _d === void 0 ? void 0 : _d.cid;\n if (!privateLogCid) return [3 /*break*/, 19];\n return [4 /*yield*/, dagGet(privateLogCid)\n .then(function (dagNode) { return dagNode.Links.map(fromDAGLink); })\n .then(function (links) { return links.sort(function (a, b) {\n return parseInt(a.name, 10) - parseInt(b.name, 10);\n }); })];\n case 18:\n _h = _j.sent();\n return [3 /*break*/, 20];\n case 19:\n _h = [];\n _j.label = 20;\n case 20:\n privateLog = _h;\n tree = new RootTree({\n links: links,\n mmpt: mmpt,\n privateLog: privateLog,\n publicTree: publicTree,\n prettyTree: prettyTree,\n privateNodes: privateNodes\n });\n // Fin\n return [2 /*return*/, tree];\n }\n });\n });\n };\n // MUTATIONS\n // ---------\n RootTree.prototype.put = function () {\n return __awaiter(this, void 0, void 0, function () {\n var cid;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.putDetailed()];\n case 1:\n cid = (_a.sent()).cid;\n return [2 /*return*/, cid];\n }\n });\n });\n };\n RootTree.prototype.putDetailed = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, putLinks(this.links)];\n });\n });\n };\n RootTree.prototype.updateLink = function (name, result) {\n var cid = result.cid, size = result.size, isFile = result.isFile;\n this.links[name] = make(name, cid, isFile, size);\n return this;\n };\n RootTree.prototype.updatePuttable = function (name, puttable) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _a = this.updateLink;\n _b = [name];\n return [4 /*yield*/, puttable.putDetailed()];\n case 1: return [2 /*return*/, _a.apply(this, _b.concat([_c.sent()]))];\n }\n });\n });\n };\n // PRIVATE TREES\n // -------------\n RootTree.storeRootKey = function (rootKey) {\n return __awaiter(this, void 0, void 0, function () {\n var path, rootKeyId;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n path = directory(Branch.Private);\n return [4 /*yield*/, readKey({ path: path })];\n case 1:\n rootKeyId = _a.sent();\n return [4 /*yield*/, keystore$2.importSymmKey(rootKey, rootKeyId)];\n case 2:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n RootTree.prototype.findPrivateNode = function (path) {\n return findPrivateNode(this.privateNodes, path);\n };\n RootTree.prototype.addPrivateLogEntry = function (cid) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var log, idx, lastChunk, _b, needsNewChunk, hashedCid, updatedChunk, updatedChunkDeposit, logDeposit, _c, _d;\n var _e;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n log = __spreadArrays(this.privateLog);\n idx = Math.max(0, log.length - 1);\n if (!((_a = log[idx]) === null || _a === void 0 ? void 0 : _a.cid)) return [3 /*break*/, 2];\n return [4 /*yield*/, cat(log[idx].cid)];\n case 1:\n _b = (_f.sent()).split(\",\");\n return [3 /*break*/, 3];\n case 2:\n _b = [];\n _f.label = 3;\n case 3:\n lastChunk = _b;\n needsNewChunk = lastChunk.length + 1 > RootTree.LOG_CHUNK_SIZE;\n if (needsNewChunk) {\n idx = idx + 1;\n lastChunk = [];\n }\n return [4 /*yield*/, hash.sha256Str(cid)];\n case 4:\n hashedCid = _f.sent();\n updatedChunk = __spreadArrays(lastChunk, [hashedCid]);\n return [4 /*yield*/, putFile(updatedChunk.join(\",\"))];\n case 5:\n updatedChunkDeposit = _f.sent();\n log[idx] = {\n name: idx.toString(),\n cid: updatedChunkDeposit.cid,\n size: updatedChunkDeposit.size\n };\n return [4 /*yield*/, dagPutLinks(log.map(toDAGLink$1))];\n case 6:\n logDeposit = _f.sent();\n _c = this.updateLink;\n _d = [Branch.PrivateLog];\n _e = {\n cid: logDeposit.cid,\n isFile: false\n };\n return [4 /*yield*/, size(logDeposit.cid)];\n case 7:\n _c.apply(this, _d.concat([(_e.size = _f.sent(),\n _e)]));\n this.privateLog = log;\n return [2 /*return*/];\n }\n });\n });\n };\n // VERSION\n // -------\n RootTree.prototype.setVersion = function (version) {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, putFile(toString$3(version))];\n case 1:\n result = _a.sent();\n return [2 /*return*/, this.updateLink(Branch.Version, result)];\n }\n });\n });\n };\n // PRIVATE LOG\n // -----------\n // CBOR array containing chunks.\n //\n // Chunk size is based on the default IPFS block size,\n // which is 1024 * 256 bytes. 1 log chunk should fit in 1 block.\n // We'll use the CSV format for the data in the chunks.\n RootTree.LOG_CHUNK_SIZE = 1020; // Math.floor((1024 * 256) / (256 + 1))\n return RootTree;\n }());\n function findBareNameFilter(map, path) {\n return __awaiter(this, void 0, void 0, function () {\n var bareNameFilterId, bareNameFilter$1, _a, nodePath, node, unwrappedPath, relativePath;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, bareNameFilter({ path: path })];\n case 1:\n bareNameFilterId = _b.sent();\n return [4 /*yield*/, getItem$1(bareNameFilterId)];\n case 2:\n bareNameFilter$1 = _b.sent();\n if (bareNameFilter$1)\n return [2 /*return*/, bareNameFilter$1];\n _a = findPrivateNode(map, path), nodePath = _a[0], node = _a[1];\n if (!node)\n return [2 /*return*/, null];\n unwrappedPath = unwrap(path);\n relativePath = unwrappedPath.slice(unwrap(nodePath).length);\n if (PrivateFile.instanceOf(node)) {\n return [2 /*return*/, relativePath.length === 0 ? node.header.bareNameFilter : null];\n }\n if (!!node.exists(relativePath)) return [3 /*break*/, 6];\n if (!isDirectory(path)) return [3 /*break*/, 4];\n return [4 /*yield*/, node.mkdir(relativePath)];\n case 3:\n _b.sent();\n return [3 /*break*/, 6];\n case 4: return [4 /*yield*/, node.add(relativePath, \"\")];\n case 5:\n _b.sent();\n _b.label = 6;\n case 6: return [2 /*return*/, node.get(relativePath).then(function (t) { return t ? t.header.bareNameFilter : null; })];\n }\n });\n });\n }\n function findPrivateNode(map, path) {\n var t = map[toPosix(path)];\n if (t)\n return [path, t];\n var parent$1 = parent(path);\n return parent$1\n ? findPrivateNode(map, parent$1)\n : [path, null];\n }\n function loadPrivateNodes(pathKeys, mmpt) {\n var _this = this;\n return sortedPathKeys(pathKeys).reduce(function (acc, _a) {\n var path = _a.path, key = _a.key;\n return acc.then(function (map) { return __awaiter(_this, void 0, void 0, function () {\n var privateNode, unwrappedPath, bareNameFilter, posixPath;\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n unwrappedPath = unwrap(path);\n if (!(unwrappedPath.length === 1 && unwrappedPath[0] === Branch.Private)) return [3 /*break*/, 2];\n return [4 /*yield*/, PrivateTree.fromBaseKey(mmpt, key)];\n case 1:\n privateNode = _b.sent();\n return [3 /*break*/, 7];\n case 2: return [4 /*yield*/, findBareNameFilter(map, path)];\n case 3:\n bareNameFilter = _b.sent();\n if (!bareNameFilter)\n throw new Error(\"Was trying to load the PrivateTree for the path `\" + path + \"`, but couldn't find the bare name filter for it.\");\n if (!isDirectory(path)) return [3 /*break*/, 5];\n return [4 /*yield*/, PrivateTree.fromBareNameFilter(mmpt, bareNameFilter, key)];\n case 4:\n privateNode = _b.sent();\n return [3 /*break*/, 7];\n case 5: return [4 /*yield*/, PrivateFile.fromBareNameFilter(mmpt, bareNameFilter, key)];\n case 6:\n privateNode = _b.sent();\n _b.label = 7;\n case 7:\n posixPath = toPosix(path);\n return [2 /*return*/, __assign(__assign({}, map), (_a = {}, _a[posixPath] = privateNode, _a))];\n }\n });\n }); });\n }, Promise.resolve({}));\n }\n function permissionKeys(permissions) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, paths(permissions).reduce(function (acc, path) { return __awaiter(_this, void 0, void 0, function () {\n var name, key, pk;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (isBranch(Branch.Public, path))\n return [2 /*return*/, acc];\n return [4 /*yield*/, readKey({ path: path })];\n case 1:\n name = _a.sent();\n return [4 /*yield*/, keystore$2.exportSymmKey(name)];\n case 2:\n key = _a.sent();\n pk = { path: path, key: key };\n return [2 /*return*/, acc.then(function (list) { return __spreadArrays(list, [pk]); })];\n }\n });\n }); }, Promise.resolve([]))];\n });\n });\n }\n /**\n * Sort keys alphabetically by path.\n * This is used to sort paths by parent first.\n */\n function sortedPathKeys(list) {\n return list.sort(function (a, b) { return toPosix(a.path).localeCompare(toPosix(b.path)); });\n }\n\n var FS_CID_LOG_PREFIX = \"webnative.wnfs_cid_log\";\n function key() {\n return FS_CID_LOG_PREFIX + \"-\" + setup.endpoints.lobby;\n }\n // QUERYING\n function get$4() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getItem$1(key())];\n case 1: return [2 /*return*/, (_a.sent()) || []];\n }\n });\n });\n }\n function index$4(cid) {\n return __awaiter(this, void 0, void 0, function () {\n var log;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, get$4()];\n case 1:\n log = _a.sent();\n return [2 /*return*/, [log.indexOf(cid), log.length]];\n }\n });\n });\n }\n function newest() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, get$4()];\n case 1: return [2 /*return*/, (_a.sent())[0]];\n }\n });\n });\n }\n // MUTATION\n function add$2(cid) {\n return __awaiter(this, void 0, void 0, function () {\n var log, newLog;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, get$4()];\n case 1:\n log = _a.sent();\n newLog = __spreadArrays([cid], log).slice(0, 1000);\n return [4 /*yield*/, setItem$1(key(), newLog)];\n case 2:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n }\n function clear$3() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, removeItem$1(key())];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n }\n\n function log$2() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (setup.debug)\n console.log.apply(console, args);\n }\n\n /**\n * CID representing an empty string. We use to to speed up DNS propagation\n * However, we treat that as a null value in the code\n */\n var EMPTY_CID = 'Qmc5m94Gu7z62RC8waSKkZUrCCBJPyHbkpmGzEePxy2oXJ';\n /**\n * Get the CID of a user's data root.\n * First check Fission server, then check DNS\n *\n * @param username The username of the user that we want to get the data root of.\n */\n function lookup$1(username) {\n return __awaiter(this, void 0, void 0, function () {\n var maybeRoot, cid, err_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, lookupOnFisson(username)];\n case 1:\n maybeRoot = _a.sent();\n if (maybeRoot === EMPTY_CID)\n return [2 /*return*/, null];\n if (maybeRoot !== null)\n return [2 /*return*/, maybeRoot];\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, lookupDnsLink(username + '.files.' + setup.endpoints.user)];\n case 3:\n cid = _a.sent();\n return [2 /*return*/, cid === EMPTY_CID ? null : cid];\n case 4:\n err_1 = _a.sent();\n console.error(err_1);\n throw new Error('Could not locate user root in dns');\n case 5: return [2 /*return*/];\n }\n });\n });\n }\n /**\n * Get the CID of a user's data root from the Fission server.\n *\n * @param username The username of the user that we want to get the data root of.\n */\n function lookupOnFisson(username) {\n return __awaiter(this, void 0, void 0, function () {\n var resp, cid, err_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 3, , 4]);\n return [4 /*yield*/, fetch(setup.endpoints.api + \"/user/data/\" + username, { cache: 'reload' } // don't use cache\n )];\n case 1:\n resp = _a.sent();\n return [4 /*yield*/, resp.json()];\n case 2:\n cid = _a.sent();\n if (!isCID(cid)) {\n throw new Error(\"Did not receive a CID\");\n }\n return [2 /*return*/, cid];\n case 3:\n err_2 = _a.sent();\n log$2('Could not locate user root on Fission server: ', err_2.toString());\n return [2 /*return*/, null];\n case 4: return [2 /*return*/];\n }\n });\n });\n }\n /**\n * Update a user's data root.\n *\n * @param cid The CID of the data root.\n * @param proof The proof to use in the UCAN sent to the API.\n */\n function update(cid, proof) {\n return __awaiter(this, void 0, void 0, function () {\n var apiEndpoint;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n apiEndpoint = setup.endpoints.api;\n // Debug\n log$2(\"🌊 Updating your DNSLink:\", cid);\n return [4 /*yield*/, fetchWithRetry(apiEndpoint + \"/user/data/\" + cid, {\n headers: function () { return __awaiter(_this, void 0, void 0, function () {\n var jwt, _a, _b, _c, _d;\n var _e;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n _b = (_a = ucan).encode;\n _d = (_c = ucan).build;\n _e = {};\n return [4 /*yield*/, did()];\n case 1:\n _e.audience = _f.sent();\n return [4 /*yield*/, write$1()];\n case 2: return [4 /*yield*/, _d.apply(_c, [(_e.issuer = _f.sent(),\n _e.potency = \"APPEND\",\n _e.proof = proof,\n // TODO: Waiting on API change.\n // Should be `username.fission.name/*`\n _e.resource = decode$a(proof).payload.rsc,\n _e)])];\n case 3:\n jwt = _b.apply(_a, [_f.sent()]);\n return [2 /*return*/, { 'authorization': \"Bearer \" + jwt }];\n }\n });\n }); },\n retries: 100,\n retryDelay: 5000,\n retryOn: [502, 503, 504],\n }, {\n method: 'PATCH'\n }).then(function (response) {\n if (response.status < 300)\n log$2(\"🪴 DNSLink updated:\", cid);\n else\n log$2(\"🔥 Failed to update DNSLink for:\", cid);\n return { success: response.status < 300 };\n }).catch(function (err) {\n log$2(\"🔥 Failed to update DNSLink for:\", cid);\n console.error(err);\n return { success: false };\n })];\n case 1: \n // Make API call\n return [2 /*return*/, _a.sent()];\n }\n });\n });\n }\n function fetchWithRetry(url, retryOptions, fetchOptions, retry) {\n if (retry === void 0) { retry = 0; }\n return __awaiter(this, void 0, void 0, function () {\n var headers, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, retryOptions.headers()];\n case 1:\n headers = _a.sent();\n return [4 /*yield*/, fetch(url, __assign(__assign({}, fetchOptions), { headers: __assign(__assign({}, fetchOptions.headers), headers) }))];\n case 2:\n response = _a.sent();\n if (!retryOptions.retryOn.includes(response.status)) return [3 /*break*/, 5];\n if (!(retry < retryOptions.retries)) return [3 /*break*/, 4];\n return [4 /*yield*/, new Promise(function (resolve, reject) { return setTimeout(function () { return fetchWithRetry(url, retryOptions, fetchOptions, retry + 1).then(resolve, reject); }, retryOptions.retryDelay); })];\n case 3: return [2 /*return*/, _a.sent()];\n case 4: throw new Error(\"Too many retries for fetch\");\n case 5: return [2 /*return*/, response];\n }\n });\n });\n }\n\n var dataRoot = /*#__PURE__*/Object.freeze({\n __proto__: null,\n lookup: lookup$1,\n lookupOnFisson: lookupOnFisson,\n update: update\n });\n\n var NoPermissionError = /** @class */ (function (_super) {\n __extends(NoPermissionError, _super);\n function NoPermissionError(message) {\n var _this = _super.call(this, message) || this;\n _this.name = \"NoPermissionError\";\n return _this;\n }\n return NoPermissionError;\n }(Error));\n\n var errors$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n NoPermissionError: NoPermissionError\n });\n\n // CLASS\n var FileSystem = /** @class */ (function () {\n function FileSystem(_a) {\n var _this = this;\n var root = _a.root, permissions = _a.permissions, localOnly = _a.localOnly;\n this.localOnly = localOnly || false;\n this.proofs = {};\n this.publishHooks = [];\n this.root = root;\n this._publishWhenOnline = [];\n this._publishing = false;\n this._whenOnline = this._whenOnline.bind(this);\n this._beforeLeaving = this._beforeLeaving.bind(this);\n var globe = globalThis;\n globe.filesystems = globe.filesystems || [];\n globe.filesystems.push(this);\n if (permissions &&\n permissions.app &&\n permissions.app.creator &&\n permissions.app.name) {\n this.appPath = appPath(permissions);\n }\n // Add the root CID of the file system to the CID log\n // (reverse list, newest cid first)\n var logCid = function (cid) {\n add$2(cid);\n log$2(\"📓 Adding to the CID ledger:\", cid);\n };\n // Update the user's data root when making changes\n var updateDataRootWhenOnline = index_umd$1.throttle(3000, false, function (cid, proof) {\n if (globalThis.navigator.onLine) {\n _this._publishing = [cid, true];\n return update(cid, proof).then(function () {\n if (_this._publishing && _this._publishing[0] === cid) {\n _this._publishing = false;\n }\n });\n }\n _this._publishWhenOnline.push([cid, proof]);\n }, false);\n this.publishHooks.push(logCid);\n this.publishHooks.push(updateDataRootWhenOnline);\n // Publish when coming back online\n globalThis.addEventListener('online', this._whenOnline);\n // Show an alert when leaving the page while updating the data root\n globalThis.addEventListener('beforeunload', this._beforeLeaving);\n }\n // INITIALISATION\n // --------------\n /**\n * Creates a file system with an empty public tree & an empty private tree at the root.\n */\n FileSystem.empty = function (opts) {\n if (opts === void 0) { opts = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var permissions, localOnly, rootKey, _a, root, fs;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n permissions = opts.permissions, localOnly = opts.localOnly;\n _a = opts.rootKey;\n if (_a) return [3 /*break*/, 2];\n return [4 /*yield*/, aes$2.genKeyStr()];\n case 1:\n _a = (_b.sent());\n _b.label = 2;\n case 2:\n rootKey = _a;\n return [4 /*yield*/, RootTree.empty({ rootKey: rootKey })];\n case 3:\n root = _b.sent();\n fs = new FileSystem({\n root: root,\n permissions: permissions,\n localOnly: localOnly\n });\n return [2 /*return*/, fs];\n }\n });\n });\n };\n /**\n * Loads an existing file system from a CID.\n */\n FileSystem.fromCID = function (cid, opts) {\n if (opts === void 0) { opts = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var permissions, localOnly, root, fs;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n permissions = opts.permissions, localOnly = opts.localOnly;\n return [4 /*yield*/, RootTree.fromCID({ cid: cid, permissions: permissions })];\n case 1:\n root = _a.sent();\n fs = new FileSystem({\n root: root,\n permissions: permissions,\n localOnly: localOnly\n });\n return [2 /*return*/, fs];\n }\n });\n });\n };\n // DEACTIVATE\n // ----------\n /**\n * Deactivate a file system.\n *\n * Use this when a user signs out.\n * The only function of this is to stop listing to online/offline events.\n */\n FileSystem.prototype.deactivate = function () {\n var _this = this;\n var globe = globalThis;\n globe.filesystems = globe.filesystems.filter(function (a) { return a !== _this; });\n globe.removeEventListener('online', this._whenOnline);\n globe.removeEventListener('beforeunload', this._beforeLeaving);\n };\n // POSIX INTERFACE (DIRECTORIES)\n // -----------------------------\n FileSystem.prototype.ls = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (isFile(path))\n throw new Error(\"`ls` only accepts directory paths\");\n return [2 /*return*/, this.runOnNode(path, false, function (node, relPath) {\n if (isFile$1(node)) {\n throw new Error(\"Tried to `ls` a file\");\n }\n else {\n return node.ls(relPath);\n }\n })];\n });\n });\n };\n FileSystem.prototype.mkdir = function (path, options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (isFile(path))\n throw new Error(\"`mkdir` only accepts directory paths\");\n return [4 /*yield*/, this.runOnNode(path, true, function (node, relPath) {\n if (isFile$1(node)) {\n throw new Error(\"Tried to `mkdir` a file\");\n }\n else {\n return node.mkdir(relPath);\n }\n })];\n case 1:\n _a.sent();\n if (!options.publish) return [3 /*break*/, 3];\n return [4 /*yield*/, this.publish()];\n case 2:\n _a.sent();\n _a.label = 3;\n case 3: return [2 /*return*/, this];\n }\n });\n });\n };\n // POSIX INTERFACE (FILES)\n // -----------------------\n FileSystem.prototype.add = function (path, content, options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (isDirectory(path))\n throw new Error(\"`add` only accepts file paths\");\n return [4 /*yield*/, this.runOnNode(path, true, function (node, relPath) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, isFile$1(node)\n ? node.updateContent(content)\n : node.add(relPath, content)];\n });\n }); })];\n case 1:\n _a.sent();\n if (!options.publish) return [3 /*break*/, 3];\n return [4 /*yield*/, this.publish()];\n case 2:\n _a.sent();\n _a.label = 3;\n case 3: return [2 /*return*/, this];\n }\n });\n });\n };\n FileSystem.prototype.cat = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n if (isDirectory(path))\n throw new Error(\"`cat` only accepts file paths\");\n return [2 /*return*/, this.runOnNode(path, false, function (node, relPath) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, isFile$1(node)\n ? node.content\n : node.cat(relPath)];\n });\n }); })];\n });\n });\n };\n FileSystem.prototype.read = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (isDirectory(path))\n throw new Error(\"`read` only accepts file paths\");\n return [2 /*return*/, this.cat(path)];\n });\n });\n };\n FileSystem.prototype.write = function (path, content, options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (isDirectory(path))\n throw new Error(\"`write` only accepts file paths\");\n return [2 /*return*/, this.add(path, content, options)];\n });\n });\n };\n // POSIX INTERFACE (GENERAL)\n // -------------------------\n FileSystem.prototype.exists = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, this.runOnNode(path, false, function (node, relPath) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, isFile$1(node)\n ? true // tried to check the existance of itself\n : node.exists(relPath)];\n });\n }); })];\n });\n });\n };\n FileSystem.prototype.get = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, this.runOnNode(path, false, function (node, relPath) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, isFile$1(node)\n ? node // tried to get itself\n : node.get(relPath)];\n });\n }); })];\n });\n });\n };\n // This is only implemented on the same tree for now and will error otherwise\n FileSystem.prototype.mv = function (from, to) {\n return __awaiter(this, void 0, void 0, function () {\n var sameTree, kindFrom, kindTo;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n sameTree = isSameBranch(from, to);\n if (!isSameKind(from, to)) {\n kindFrom = kind(from);\n kindTo = kind(to);\n throw new Error(\"Can't move to a different kind of path, from is a \" + kindFrom + \" and to is a \" + kindTo);\n }\n if (!sameTree) {\n throw new Error(\"`mv` is only supported on the same tree for now\");\n }\n return [4 /*yield*/, this.exists(to)];\n case 1:\n if (_a.sent()) {\n throw new Error(\"Destination already exists\");\n }\n return [4 /*yield*/, this.runOnNode(from, true, function (node, relPath) {\n if (isFile$1(node)) {\n throw new Error(\"Tried to `mv` within a file\");\n }\n var _a = unwrap(to); _a[0]; var nextPath = _a.slice(1);\n return node.mv(relPath, nextPath);\n })];\n case 2:\n _a.sent();\n return [2 /*return*/, this];\n }\n });\n });\n };\n FileSystem.prototype.rm = function (path) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.runOnNode(path, true, function (node, relPath) {\n if (isFile$1(node)) {\n throw new Error(\"Cannot `rm` a file you've asked permission for\");\n }\n else {\n return node.rm(relPath);\n }\n })];\n case 1:\n _a.sent();\n return [2 /*return*/, this];\n }\n });\n });\n };\n // PUBLISH\n // -------\n /**\n * Ensures the latest version of the file system is added to IPFS,\n * updates your data root, and returns the root CID.\n */\n FileSystem.prototype.publish = function () {\n return __awaiter(this, void 0, void 0, function () {\n var proofs, cid;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n proofs = Array.from(Object.entries(this.proofs));\n this.proofs = {};\n return [4 /*yield*/, this.root.put()];\n case 1:\n cid = _a.sent();\n proofs.forEach(function (_a) {\n _a[0]; var proof = _a[1];\n _this.publishHooks.forEach(function (hook) { return hook(cid, proof); });\n });\n return [2 /*return*/, cid];\n }\n });\n });\n };\n // INTERNAL\n // --------\n /** @internal */\n FileSystem.prototype.runOnNode = function (path, isMutation, fn) {\n return __awaiter(this, void 0, void 0, function () {\n var parts, head, relPath, operation, proof, decodedProof, result, resultPretty, _a, nodePath, node, cid;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n parts = unwrap(path);\n head = parts[0];\n relPath = parts.slice(1);\n operation = isMutation\n ? \"make changes to\"\n : \"query\";\n if (!!this.localOnly) return [3 /*break*/, 2];\n return [4 /*yield*/, lookupFilesystemUcan(path)];\n case 1:\n proof = _b.sent();\n decodedProof = proof && decode$a(proof);\n if (!proof || !decodedProof || isExpired(decodedProof) || !decodedProof.signature) {\n throw new NoPermissionError(\"I don't have the necessary permissions to \" + operation + \" the file system at \\\"\" + toPosix(path) + \"\\\"\");\n }\n this.proofs[decodedProof.signature] = proof;\n _b.label = 2;\n case 2:\n if (!(head === Branch.Public)) return [3 /*break*/, 7];\n return [4 /*yield*/, fn(this.root.publicTree, relPath)];\n case 3:\n result = _b.sent();\n if (!(isMutation && PublicTree.instanceOf(result))) return [3 /*break*/, 6];\n return [4 /*yield*/, fn(this.root.prettyTree, relPath)];\n case 4:\n resultPretty = _b.sent();\n this.root.publicTree = result;\n this.root.prettyTree = resultPretty;\n return [4 /*yield*/, Promise.all([\n this.root.updatePuttable(Branch.Public, this.root.publicTree),\n this.root.updatePuttable(Branch.Pretty, this.root.prettyTree)\n ])];\n case 5:\n _b.sent();\n _b.label = 6;\n case 6: return [3 /*break*/, 18];\n case 7:\n if (!(head === Branch.Private)) return [3 /*break*/, 14];\n _a = this.root.findPrivateNode(path), nodePath = _a[0], node = _a[1];\n if (!node) {\n throw new NoPermissionError(\"I don't have the necessary permissions to \" + operation + \" the file system at \\\"\" + toPosix(path) + \"\\\"\");\n }\n return [4 /*yield*/, fn(node, parts.slice(unwrap(nodePath).length))];\n case 8:\n result = _b.sent();\n if (!(isMutation &&\n (PrivateTree.instanceOf(result) || PrivateFile.instanceOf(result)))) return [3 /*break*/, 13];\n this.root.privateNodes[toPosix(nodePath)] = result;\n return [4 /*yield*/, result.put()];\n case 9:\n _b.sent();\n return [4 /*yield*/, this.root.updatePuttable(Branch.Private, this.root.mmpt)];\n case 10:\n _b.sent();\n return [4 /*yield*/, this.root.mmpt.put()];\n case 11:\n cid = _b.sent();\n return [4 /*yield*/, this.root.addPrivateLogEntry(cid)];\n case 12:\n _b.sent();\n _b.label = 13;\n case 13: return [3 /*break*/, 18];\n case 14:\n if (!(head === Branch.Pretty && isMutation)) return [3 /*break*/, 15];\n throw new Error(\"The pretty path is read only\");\n case 15:\n if (!(head === Branch.Pretty)) return [3 /*break*/, 17];\n return [4 /*yield*/, fn(this.root.prettyTree, relPath)];\n case 16:\n result = _b.sent();\n return [3 /*break*/, 18];\n case 17: throw new Error(\"Not a valid FileSystem path\");\n case 18: return [2 /*return*/, result];\n }\n });\n });\n };\n /** @internal */\n FileSystem.prototype._whenOnline = function () {\n var _this = this;\n var toPublish = __spreadArrays(this._publishWhenOnline);\n this._publishWhenOnline = [];\n toPublish.forEach(function (_a) {\n var cid = _a[0], proof = _a[1];\n _this.publishHooks.forEach(function (hook) { return hook(cid, proof); });\n });\n };\n /** @internal */\n FileSystem.prototype._beforeLeaving = function (e) {\n var msg = \"Are you sure you want to leave? We don't control the browser so you may lose your data.\";\n if (this._publishing || this._publishWhenOnline.length) {\n (e || globalThis.event).returnValue = msg;\n return msg;\n }\n };\n return FileSystem;\n }());\n // ㊙️\n function appPath(permissions) {\n if (!permissions.app)\n throw Error(\"Only works with app permissions\");\n var base = appDataPath(permissions.app);\n return function (path) {\n if (path)\n return combine(base, path);\n return base;\n };\n }\n\n /**\n * Load a user's file system.\n *\n * @param permissions The permissions from initialise.\n * Pass `null` if working without permissions\n * @param username Optional, username of the user to load the file system from.\n * Will try to load the file system of the authenticated user\n * by default. Throws an error if there's no authenticated user.\n * @param rootKey Optional, AES key to be the root key of a new filesystem.\n * Will be used if a filesystem hasn't been created yet.\n */\n function loadFileSystem(permissions, username, rootKey) {\n return __awaiter(this, void 0, void 0, function () {\n var cid, fs, _a, dataCid, _b, _c, logIdx, _d, idxLog, p, _e;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n _a = username;\n if (_a) return [3 /*break*/, 2];\n return [4 /*yield*/, authenticatedUsername()];\n case 1:\n _a = ((_f.sent()) || undefined);\n _f.label = 2;\n case 2:\n // Look for username\n username = _a;\n if (!username)\n throw new Error(\"User hasn't authenticated yet\");\n // Ensure internal UCAN dictionary\n return [4 /*yield*/, store([])\n // Determine the correct CID of the file system to load\n ];\n case 3:\n // Ensure internal UCAN dictionary\n _f.sent();\n if (!navigator.onLine) return [3 /*break*/, 5];\n return [4 /*yield*/, lookup$1(username)];\n case 4:\n _b = _f.sent();\n return [3 /*break*/, 6];\n case 5:\n _b = null;\n _f.label = 6;\n case 6:\n dataCid = _b;\n if (!dataCid) return [3 /*break*/, 8];\n return [4 /*yield*/, index$4(dataCid)];\n case 7:\n _d = _f.sent();\n return [3 /*break*/, 9];\n case 8:\n _d = [-1, 0];\n _f.label = 9;\n case 9:\n _c = _d, logIdx = _c[0], _c[1];\n if (!!navigator.onLine) return [3 /*break*/, 11];\n return [4 /*yield*/, newest()];\n case 10:\n // Offline, use local CID\n cid = _f.sent();\n return [3 /*break*/, 18];\n case 11:\n if (!!dataCid) return [3 /*break*/, 13];\n return [4 /*yield*/, newest()];\n case 12:\n // No DNS CID yet\n cid = _f.sent();\n if (cid)\n log$2(\"📓 No DNSLink, using local CID:\", cid);\n else\n log$2(\"📓 Creating a new file system\");\n return [3 /*break*/, 18];\n case 13:\n if (!(logIdx === 0)) return [3 /*break*/, 14];\n // DNS is up to date\n cid = dataCid;\n log$2(\"📓 DNSLink is up to date:\", cid);\n return [3 /*break*/, 18];\n case 14:\n if (!(logIdx > 0)) return [3 /*break*/, 16];\n return [4 /*yield*/, newest()];\n case 15:\n // DNS is outdated\n cid = _f.sent();\n idxLog = logIdx === 1 ? \"1 newer local entry\" : logIdx + \" newer local entries\";\n log$2(\"📓 DNSLink is outdated (\" + idxLog + \"), using local CID:\", cid);\n return [3 /*break*/, 18];\n case 16:\n // DNS is newer\n cid = dataCid;\n return [4 /*yield*/, add$2(cid)];\n case 17:\n _f.sent();\n log$2(\"📓 DNSLink is newer:\", cid);\n _f.label = 18;\n case 18:\n p = permissions || undefined;\n if (!cid) return [3 /*break*/, 20];\n return [4 /*yield*/, FileSystem.fromCID(cid, { permissions: p })];\n case 19:\n _e = _f.sent();\n return [3 /*break*/, 21];\n case 20:\n _e = null;\n _f.label = 21;\n case 21:\n fs = _e;\n if (fs)\n return [2 /*return*/, fs\n // Otherwise make a new one\n ];\n // Otherwise make a new one\n if (!rootKey)\n throw new Error(\"Can't make new filesystem without a root AES key\");\n return [4 /*yield*/, FileSystem.empty({ permissions: p, rootKey: rootKey })];\n case 22:\n fs = _f.sent();\n return [4 /*yield*/, addSampleData(fs)\n // Fin\n ];\n case 23:\n _f.sent();\n // Fin\n return [2 /*return*/, fs];\n }\n });\n });\n }\n // ㊙️\n function addSampleData(fs) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, fs.mkdir({ directory: [Branch.Private, \"Apps\"] })];\n case 1:\n _a.sent();\n return [4 /*yield*/, fs.mkdir({ directory: [Branch.Private, \"Audio\"] })];\n case 2:\n _a.sent();\n return [4 /*yield*/, fs.mkdir({ directory: [Branch.Private, \"Documents\"] })];\n case 3:\n _a.sent();\n return [4 /*yield*/, fs.mkdir({ directory: [Branch.Private, \"Photos\"] })];\n case 4:\n _a.sent();\n return [4 /*yield*/, fs.mkdir({ directory: [Branch.Private, \"Video\"] })];\n case 5:\n _a.sent();\n return [4 /*yield*/, fs.publish()];\n case 6:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n }\n\n // FUNCTIONS\n /**\n * Retrieve the authenticated username.\n */\n function authenticatedUsername$1() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, authenticatedUsername()];\n });\n });\n }\n /**\n * Leave.\n *\n * Removes any trace of the user and redirects to the lobby.\n */\n function leave(_a) {\n var _b = _a === void 0 ? {} : _a, withoutRedirect = _b.withoutRedirect;\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0: return [4 /*yield*/, removeItem$1(USERNAME_STORAGE_KEY)];\n case 1:\n _c.sent();\n return [4 /*yield*/, clearStorage()];\n case 2:\n _c.sent();\n return [4 /*yield*/, clear$3()];\n case 3:\n _c.sent();\n return [4 /*yield*/, keystore$2.clear()];\n case 4:\n _c.sent();\n (globalThis.filesystems || []).forEach(function (f) { return f.deactivate(); });\n if (!withoutRedirect && globalThis.location) {\n globalThis.location.href = setup.endpoints.lobby;\n }\n return [2 /*return*/];\n }\n });\n });\n }\n /**\n * Redirects to a lobby.\n *\n * NOTE: Only works on the main thread, as it uses `window.location`.\n *\n * @param permissions The permissions from `initialise`.\n * Pass `null` if working without permissions.\n * @param redirectTo Specify the URL you want users to return to.\n * Uses the current url by default.\n */\n function redirectToLobby(permissions, redirectTo) {\n return __awaiter(this, void 0, void 0, function () {\n var app, fs, platform, exchangeDid, writeDid, sharedRepo, params;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n app = permissions === null || permissions === void 0 ? void 0 : permissions.app;\n fs = permissions === null || permissions === void 0 ? void 0 : permissions.fs;\n platform = permissions === null || permissions === void 0 ? void 0 : permissions.platform;\n return [4 /*yield*/, exchange()];\n case 1:\n exchangeDid = _a.sent();\n return [4 /*yield*/, write$1()];\n case 2:\n writeDid = _a.sent();\n sharedRepo = !!document.body.querySelector(\"iframe#webnative-ipfs\") && typeof SharedWorker === \"function\";\n redirectTo = redirectTo || window.location.href;\n params = [\n [\"didExchange\", exchangeDid],\n [\"didWrite\", writeDid],\n [\"redirectTo\", redirectTo],\n [\"sdk\", VERSION.toString()],\n [\"sharedRepo\", sharedRepo ? \"t\" : \"f\"]\n ].concat(app ? [[\"appFolder\", app.creator + \"/\" + app.name]] : [], (fs === null || fs === void 0 ? void 0 : fs.private) ? fs.private.map(function (p) { return [\"privatePath\", toPosix(p, { absolute: true })]; }) : [], (fs === null || fs === void 0 ? void 0 : fs.public) ? fs.public.map(function (p) { return [\"publicPath\", toPosix(p, { absolute: true })]; }) : []).concat((function () {\n var apps = platform === null || platform === void 0 ? void 0 : platform.apps;\n switch (typeof apps) {\n case \"string\": return [[\"app\", apps]];\n case \"object\": return apps.map(function (a) { return [\"app\", a]; });\n default: return [];\n }\n })());\n // And, go!\n window.location.href = setup.endpoints.lobby + \"?\" +\n params\n .map(function (_a) {\n var k = _a[0], v = _a[1];\n return encodeURIComponent(k) + \"=\" + encodeURIComponent(v);\n })\n .join(\"&\");\n return [2 /*return*/];\n }\n });\n });\n }\n\n /**\n * Get A list of all of your apps and their associated domain names\n */\n function index$5() {\n return __awaiter(this, void 0, void 0, function () {\n var apiEndpoint, localUcan, jwt, _a, _b, _c, _d, response, data;\n var _e;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n apiEndpoint = setup.endpoints.api;\n return [4 /*yield*/, lookupAppUcan(\"*\")];\n case 1:\n localUcan = _f.sent();\n if (localUcan === null) {\n throw \"Could not find your local UCAN\";\n }\n _b = (_a = ucan).encode;\n _d = (_c = ucan).build;\n _e = {};\n return [4 /*yield*/, did()];\n case 2:\n _e.audience = _f.sent();\n return [4 /*yield*/, write$1()];\n case 3: return [4 /*yield*/, _d.apply(_c, [(_e.issuer = _f.sent(),\n _e.proof = localUcan,\n _e.potency = null,\n _e)])];\n case 4:\n jwt = _b.apply(_a, [_f.sent()]);\n return [4 /*yield*/, fetch(apiEndpoint + \"/app\", {\n method: 'GET',\n headers: {\n 'authorization': \"Bearer \" + jwt\n }\n })];\n case 5:\n response = _f.sent();\n return [4 /*yield*/, response.json()];\n case 6:\n data = _f.sent();\n return [2 /*return*/, Object\n .values(data)\n .filter(function (v) { return v.length > 0; })\n .map(function (v) { return ({ domain: v[0] }); })];\n }\n });\n });\n }\n /**\n * Creates a new app, assigns an initial subdomain, and sets an asset placeholder\n *\n * @param subdomain Subdomain to create the fission app with\n */\n function create$1(subdomain) {\n return __awaiter(this, void 0, void 0, function () {\n var apiEndpoint, localUcan, jwt, _a, _b, _c, _d, url, response, data;\n var _e;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n apiEndpoint = setup.endpoints.api;\n return [4 /*yield*/, lookupAppUcan(\"*\")];\n case 1:\n localUcan = _f.sent();\n if (localUcan === null) {\n throw \"Could not find your local UCAN\";\n }\n _b = (_a = ucan).encode;\n _d = (_c = ucan).build;\n _e = {};\n return [4 /*yield*/, did()];\n case 2:\n _e.audience = _f.sent();\n return [4 /*yield*/, write$1()];\n case 3: return [4 /*yield*/, _d.apply(_c, [(_e.issuer = _f.sent(),\n _e.proof = localUcan,\n _e.potency = null,\n _e)])];\n case 4:\n jwt = _b.apply(_a, [_f.sent()]);\n url = isString(subdomain)\n ? apiEndpoint + \"/app?subdomain=\" + encodeURIComponent(subdomain)\n : apiEndpoint + \"/app\";\n return [4 /*yield*/, fetch(url, {\n method: 'POST',\n headers: {\n 'authorization': \"Bearer \" + jwt\n }\n })];\n case 5:\n response = _f.sent();\n return [4 /*yield*/, response.json()];\n case 6:\n data = _f.sent();\n return [2 /*return*/, { domain: data }];\n }\n });\n });\n }\n /**\n * Destroy app by any associated domain\n *\n * @param domain The domain associated with the app we want to delete\n */\n function deleteByDomain(domain) {\n return __awaiter(this, void 0, void 0, function () {\n var apiEndpoint, localUcan, jwt, _a, _b, _c, _d, appIndexResponse, index, appToDelete;\n var _e;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n apiEndpoint = setup.endpoints.api;\n return [4 /*yield*/, lookupAppUcan(domain)];\n case 1:\n localUcan = _f.sent();\n if (localUcan === null) {\n throw new Error(\"Could not find your local UCAN\");\n }\n _b = (_a = ucan).encode;\n _d = (_c = ucan).build;\n _e = {};\n return [4 /*yield*/, did()];\n case 2:\n _e.audience = _f.sent();\n return [4 /*yield*/, write$1()];\n case 3: return [4 /*yield*/, _d.apply(_c, [(_e.issuer = _f.sent(),\n _e.proof = localUcan,\n _e.potency = null,\n _e)])];\n case 4:\n jwt = _b.apply(_a, [_f.sent()]);\n return [4 /*yield*/, fetch(apiEndpoint + \"/app\", {\n method: 'GET',\n headers: {\n 'authorization': \"Bearer \" + jwt\n }\n })];\n case 5:\n appIndexResponse = _f.sent();\n return [4 /*yield*/, appIndexResponse.json()];\n case 6:\n index = _f.sent();\n appToDelete = Object.entries(index).find(function (_a) {\n _a[0]; var domains = _a[1];\n return domains.includes(domain);\n });\n if (appToDelete == null) {\n throw new Error(\"Couldn't find an app with domain \" + domain);\n }\n return [4 /*yield*/, fetch(apiEndpoint + \"/app/\" + encodeURIComponent(appToDelete[0]), {\n method: 'DELETE',\n headers: {\n 'authorization': \"Bearer \" + jwt\n }\n })];\n case 7:\n _f.sent();\n return [2 /*return*/];\n }\n });\n });\n }\n /**\n * Updates an app by CID\n *\n * @param subdomain Subdomain to create the fission app with\n */\n function publish(domain, cid) {\n return __awaiter(this, void 0, void 0, function () {\n var apiEndpoint, localUcan, jwt, _a, _b, _c, _d, url;\n var _e;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n apiEndpoint = setup.endpoints.api;\n return [4 /*yield*/, lookupAppUcan(domain)];\n case 1:\n localUcan = _f.sent();\n if (localUcan === null) {\n throw \"Could not find your local UCAN\";\n }\n _b = (_a = ucan).encode;\n _d = (_c = ucan).build;\n _e = {};\n return [4 /*yield*/, did()];\n case 2:\n _e.audience = _f.sent();\n return [4 /*yield*/, write$1()];\n case 3: return [4 /*yield*/, _d.apply(_c, [(_e.issuer = _f.sent(),\n _e.proof = localUcan,\n _e.potency = null,\n _e)])];\n case 4:\n jwt = _b.apply(_a, [_f.sent()]);\n url = apiEndpoint + \"/app/\" + domain + \"/\" + cid;\n return [4 /*yield*/, fetch(url, {\n method: 'PATCH',\n headers: {\n 'authorization': \"Bearer \" + jwt\n }\n })];\n case 5:\n _f.sent();\n return [2 /*return*/];\n }\n });\n });\n }\n\n var index$6 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n index: index$5,\n create: create$1,\n deleteByDomain: deleteByDomain,\n publish: publish\n });\n\n /**\n * Blocklist for usernames.\n *\n * Keep in sync with the Fission API.\n * https://github.com/fission-suite/fission/blob/master/library/Fission/User/Username/Validation.hs\n */\n var USERNAME_BLOCKLIST = [\"fission\",\n \"ipfs\",\n \"ipns\",\n \"did\",\n \"id\",\n \"identity\",\n \".htaccess\",\n \"htaccess\",\n \".htpasswd\",\n \"htpasswd\",\n \".well-known\",\n \"well-known\",\n \"400\",\n \"401\",\n \"403\",\n \"404\",\n \"405\",\n \"406\",\n \"407\",\n \"408\",\n \"409\",\n \"410\",\n \"411\",\n \"412\",\n \"413\",\n \"414\",\n \"415\",\n \"416\",\n \"417\",\n \"421\",\n \"422\",\n \"423\",\n \"424\",\n \"426\",\n \"428\",\n \"429\",\n \"431\",\n \"500\",\n \"501\",\n \"502\",\n \"503\",\n \"504\",\n \"505\",\n \"506\",\n \"507\",\n \"508\",\n \"509\",\n \"510\",\n \"511\",\n \"_domainkey\",\n \"about\",\n \"about-us\",\n \"abuse\",\n \"access\",\n \"account\",\n \"accounts\",\n \"ad\",\n \"add\",\n \"admin\",\n \"administration\",\n \"administrator\",\n \"ads\",\n \"ads.txt\",\n \"advertise\",\n \"advertising\",\n \"aes128-ctr\",\n \"aes128-gcm\",\n \"aes192-ctr\",\n \"aes256-ctr\",\n \"aes256-gcm\",\n \"affiliate\",\n \"affiliates\",\n \"ajax\",\n \"alert\",\n \"alerts\",\n \"alpha\",\n \"amp\",\n \"analytics\",\n \"api\",\n \"app\",\n \"app-ads.txt\",\n \"apps\",\n \"asc\",\n \"assets\",\n \"atom\",\n \"auth\",\n \"authentication\",\n \"authorize\",\n \"autoconfig\",\n \"autodiscover\",\n \"avatar\",\n \"backup\",\n \"banner\",\n \"banners\",\n \"bbs\",\n \"beta\",\n \"billing\",\n \"billings\",\n \"blog\",\n \"blogs\",\n \"board\",\n \"bookmark\",\n \"bookmarks\",\n \"broadcasthost\",\n \"business\",\n \"buy\",\n \"cache\",\n \"calendar\",\n \"campaign\",\n \"captcha\",\n \"careers\",\n \"cart\",\n \"cas\",\n \"categories\",\n \"category\",\n \"cdn\",\n \"cgi\",\n \"cgi-bin\",\n \"chacha20-poly1305\",\n \"change\",\n \"channel\",\n \"channels\",\n \"chart\",\n \"chat\",\n \"checkout\",\n \"clear\",\n \"client\",\n \"close\",\n \"cloud\",\n \"cms\",\n \"com\",\n \"comment\",\n \"comments\",\n \"community\",\n \"compare\",\n \"compose\",\n \"config\",\n \"connect\",\n \"contact\",\n \"contest\",\n \"cookies\",\n \"copy\",\n \"copyright\",\n \"count\",\n \"cp\",\n \"cpanel\",\n \"create\",\n \"crossdomain.xml\",\n \"css\",\n \"curve25519-sha256\",\n \"customer\",\n \"customers\",\n \"customize\",\n \"dashboard\",\n \"db\",\n \"deals\",\n \"debug\",\n \"delete\",\n \"desc\",\n \"destroy\",\n \"dev\",\n \"developer\",\n \"developers\",\n \"diffie-hellman-group-exchange-sha256\",\n \"diffie-hellman-group14-sha1\",\n \"disconnect\",\n \"discuss\",\n \"dns\",\n \"dns0\",\n \"dns1\",\n \"dns2\",\n \"dns3\",\n \"dns4\",\n \"docs\",\n \"documentation\",\n \"domain\",\n \"download\",\n \"downloads\",\n \"downvote\",\n \"draft\",\n \"drop\",\n \"ecdh-sha2-nistp256\",\n \"ecdh-sha2-nistp384\",\n \"ecdh-sha2-nistp521\",\n \"edit\",\n \"editor\",\n \"email\",\n \"enterprise\",\n \"error\",\n \"errors\",\n \"event\",\n \"events\",\n \"example\",\n \"exception\",\n \"exit\",\n \"explore\",\n \"export\",\n \"extensions\",\n \"false\",\n \"family\",\n \"faq\",\n \"faqs\",\n \"favicon.ico\",\n \"features\",\n \"feed\",\n \"feedback\",\n \"feeds\",\n \"file\",\n \"files\",\n \"filter\",\n \"follow\",\n \"follower\",\n \"followers\",\n \"following\",\n \"fonts\",\n \"forgot\",\n \"forgot-password\",\n \"forgotpassword\",\n \"form\",\n \"forms\",\n \"forum\",\n \"forums\",\n \"friend\",\n \"friends\",\n \"ftp\",\n \"get\",\n \"git\",\n \"go\",\n \"graphql\",\n \"group\",\n \"groups\",\n \"guest\",\n \"guidelines\",\n \"guides\",\n \"head\",\n \"header\",\n \"help\",\n \"hide\",\n \"hmac-sha\",\n \"hmac-sha1\",\n \"hmac-sha1-etm\",\n \"hmac-sha2-256\",\n \"hmac-sha2-256-etm\",\n \"hmac-sha2-512\",\n \"hmac-sha2-512-etm\",\n \"home\",\n \"host\",\n \"hosting\",\n \"hostmaster\",\n \"htpasswd\",\n \"http\",\n \"httpd\",\n \"https\",\n \"humans.txt\",\n \"icons\",\n \"images\",\n \"imap\",\n \"img\",\n \"import\",\n \"index\",\n \"info\",\n \"insert\",\n \"investors\",\n \"invitations\",\n \"invite\",\n \"invites\",\n \"invoice\",\n \"is\",\n \"isatap\",\n \"issues\",\n \"it\",\n \"jobs\",\n \"join\",\n \"js\",\n \"json\",\n \"keybase.txt\",\n \"learn\",\n \"legal\",\n \"license\",\n \"licensing\",\n \"like\",\n \"limit\",\n \"live\",\n \"load\",\n \"local\",\n \"localdomain\",\n \"localhost\",\n \"lock\",\n \"login\",\n \"logout\",\n \"lost-password\",\n \"m\",\n \"mail\",\n \"mail0\",\n \"mail1\",\n \"mail2\",\n \"mail3\",\n \"mail4\",\n \"mail5\",\n \"mail6\",\n \"mail7\",\n \"mail8\",\n \"mail9\",\n \"mailer-daemon\",\n \"mailerdaemon\",\n \"map\",\n \"marketing\",\n \"marketplace\",\n \"master\",\n \"me\",\n \"media\",\n \"member\",\n \"members\",\n \"message\",\n \"messages\",\n \"metrics\",\n \"mis\",\n \"mobile\",\n \"moderator\",\n \"modify\",\n \"more\",\n \"mx\",\n \"mx1\",\n \"my\",\n \"net\",\n \"network\",\n \"new\",\n \"news\",\n \"newsletter\",\n \"newsletters\",\n \"next\",\n \"nil\",\n \"no-reply\",\n \"nobody\",\n \"noc\",\n \"none\",\n \"noreply\",\n \"notification\",\n \"notifications\",\n \"ns\",\n \"ns0\",\n \"ns1\",\n \"ns2\",\n \"ns3\",\n \"ns4\",\n \"ns5\",\n \"ns6\",\n \"ns7\",\n \"ns8\",\n \"ns9\",\n \"null\",\n \"oauth\",\n \"oauth2\",\n \"offer\",\n \"offers\",\n \"online\",\n \"openid\",\n \"order\",\n \"orders\",\n \"overview\",\n \"owa\",\n \"owner\",\n \"page\",\n \"pages\",\n \"partners\",\n \"passwd\",\n \"password\",\n \"pay\",\n \"payment\",\n \"payments\",\n \"photo\",\n \"photos\",\n \"pixel\",\n \"plans\",\n \"plugins\",\n \"policies\",\n \"policy\",\n \"pop\",\n \"pop3\",\n \"popular\",\n \"portal\",\n \"portfolio\",\n \"post\",\n \"postfix\",\n \"postmaster\",\n \"poweruser\",\n \"preferences\",\n \"premium\",\n \"press\",\n \"previous\",\n \"pricing\",\n \"print\",\n \"privacy\",\n \"privacy-policy\",\n \"private\",\n \"prod\",\n \"product\",\n \"production\",\n \"profile\",\n \"profiles\",\n \"project\",\n \"projects\",\n \"public\",\n \"purchase\",\n \"put\",\n \"quota\",\n \"recover\",\n \"recovery\",\n \"redirect\",\n \"reduce\",\n \"refund\",\n \"refunds\",\n \"register\",\n \"registration\",\n \"remove\",\n \"replies\",\n \"reply\",\n \"report\",\n \"request\",\n \"request-password\",\n \"reset\",\n \"reset-password\",\n \"response\",\n \"return\",\n \"returns\",\n \"review\",\n \"reviews\",\n \"robots.txt\",\n \"root\",\n \"rootuser\",\n \"rsa-sha2-2\",\n \"rsa-sha2-512\",\n \"rss\",\n \"rules\",\n \"sales\",\n \"save\",\n \"script\",\n \"sdk\",\n \"search\",\n \"secure\",\n \"security\",\n \"select\",\n \"services\",\n \"session\",\n \"sessions\",\n \"settings\",\n \"setup\",\n \"share\",\n \"shift\",\n \"shop\",\n \"signin\",\n \"signup\",\n \"site\",\n \"sitemap\",\n \"sites\",\n \"smtp\",\n \"sort\",\n \"source\",\n \"sql\",\n \"ssh\",\n \"ssh-rsa\",\n \"ssl\",\n \"ssladmin\",\n \"ssladministrator\",\n \"sslwebmaster\",\n \"stage\",\n \"staging\",\n \"stat\",\n \"static\",\n \"statistics\",\n \"stats\",\n \"status\",\n \"store\",\n \"style\",\n \"styles\",\n \"stylesheet\",\n \"stylesheets\",\n \"subdomain\",\n \"subscribe\",\n \"sudo\",\n \"super\",\n \"superuser\",\n \"support\",\n \"survey\",\n \"sync\",\n \"sysadmin\",\n \"system\",\n \"tablet\",\n \"tag\",\n \"tags\",\n \"team\",\n \"telnet\",\n \"terms\",\n \"terms-of-use\",\n \"test\",\n \"testimonials\",\n \"theme\",\n \"themes\",\n \"today\",\n \"tools\",\n \"topic\",\n \"topics\",\n \"tour\",\n \"training\",\n \"translate\",\n \"translations\",\n \"trending\",\n \"trial\",\n \"true\",\n \"umac-128\",\n \"umac-128-etm\",\n \"umac-64\",\n \"umac-64-etm\",\n \"undefined\",\n \"unfollow\",\n \"unlike\",\n \"unsubscribe\",\n \"update\",\n \"upgrade\",\n \"usenet\",\n \"user\",\n \"username\",\n \"users\",\n \"uucp\",\n \"var\",\n \"verify\",\n \"video\",\n \"view\",\n \"void\",\n \"vote\",\n \"vpn\",\n \"webmail\",\n \"webmaster\",\n \"website\",\n \"widget\",\n \"widgets\",\n \"wiki\",\n \"wpad\",\n \"write\",\n \"www\",\n \"www-data\",\n \"www1\",\n \"www2\",\n \"www3\",\n \"www4\",\n \"you\",\n \"yourname\",\n \"yourusername\",\n \"zlib\"\n ];\n\n /**\n * Check if a username is available.\n */\n function isUsernameAvailable(username) {\n return __awaiter(this, void 0, void 0, function () {\n var resp;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, fetch(setup.endpoints.api + \"/user/data/\" + username)];\n case 1:\n resp = _a.sent();\n return [2 /*return*/, !resp.ok];\n }\n });\n });\n }\n /**\n * Check if a username is valid.\n */\n function isUsernameValid(username) {\n return !username.startsWith(\"-\") &&\n !username.endsWith(\"-\") &&\n !username.startsWith(\"_\") &&\n /^[a-zA-Z0-9_-]+$/.test(username) &&\n !USERNAME_BLOCKLIST.includes(username.toLowerCase());\n }\n\n /**\n * Create a user account.\n */\n function createAccount(userProps) {\n return __awaiter(this, void 0, void 0, function () {\n var apiEndpoint, jwt, _a, _b, _c, _d, response;\n var _e;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n apiEndpoint = setup.endpoints.api;\n _b = (_a = ucan).encode;\n _d = (_c = ucan).build;\n _e = {};\n return [4 /*yield*/, did()];\n case 1:\n _e.audience = _f.sent();\n return [4 /*yield*/, write$1()];\n case 2: return [4 /*yield*/, _d.apply(_c, [(_e.issuer = _f.sent(),\n _e)])];\n case 3:\n jwt = _b.apply(_a, [_f.sent()]);\n return [4 /*yield*/, fetch(apiEndpoint + \"/user\", {\n method: 'PUT',\n headers: {\n 'authorization': \"Bearer \" + jwt,\n 'content-type': 'application/json'\n },\n body: JSON.stringify(userProps)\n })];\n case 4:\n response = _f.sent();\n return [2 /*return*/, {\n success: response.status < 300\n }];\n }\n });\n });\n }\n /**\n * Ask the fission server to send another verification email to the\n * user currently logged in.\n *\n * Throws if the user is not logged in.\n */\n function resendVerificationEmail() {\n return __awaiter(this, void 0, void 0, function () {\n var apiEndpoint, localUcan, jwt, _a, _b, response;\n var _c;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n apiEndpoint = setup.endpoints.api;\n return [4 /*yield*/, lookupFilesystemUcan(\"*\")];\n case 1:\n localUcan = _d.sent();\n if (localUcan === null) {\n throw \"Could not find your local UCAN\";\n }\n _b = (_a = ucan).build;\n _c = {};\n return [4 /*yield*/, did()];\n case 2:\n _c.audience = _d.sent();\n return [4 /*yield*/, write$1()];\n case 3: return [4 /*yield*/, _b.apply(_a, [(_c.issuer = _d.sent(),\n _c.proof = localUcan,\n _c.potency = null,\n _c)])];\n case 4:\n jwt = _d.sent();\n return [4 /*yield*/, fetch(apiEndpoint + \"/user/email/resend\", {\n method: 'POST',\n headers: {\n 'authorization': \"Bearer \" + jwt\n }\n })];\n case 5:\n response = _d.sent();\n return [2 /*return*/, {\n success: response.status < 300\n }];\n }\n });\n });\n }\n /**\n * Store the read key for the root `PrivateTree` (ie. `/private`)\n */\n function storeFileSystemRootKey(key) {\n return RootTree.storeRootKey(key);\n }\n\n var index$7 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n createAccount: createAccount,\n resendVerificationEmail: resendVerificationEmail,\n storeFileSystemRootKey: storeFileSystemRootKey,\n isUsernameAvailable: isUsernameAvailable,\n isUsernameValid: isUsernameValid\n });\n\n /**\n * Toggle debug mode.\n *\n * Only adds a few `console.log`s at this moment.\n */\n function debug(_a) {\n var enabled = _a.enabled;\n setup.debug = enabled;\n return setup.debug;\n }\n /**\n * Override endpoints.\n *\n * You can override each of these,\n * no need to provide them all here.\n *\n * `api` Location of the Fission API\n * (default `https://runfission.com`)\n * `lobby` Location of the authentication lobby.\n * (default `https://auth.fission.codes`)\n * `user` User's domain to use, will be prefixed by username.\n * (default `fission.name`)\n */\n function endpoints(e) {\n setup.endpoints = __assign(__assign({}, setup.endpoints), e);\n return __assign({}, setup.endpoints);\n }\n\n var setup$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n debug: debug,\n endpoints: endpoints,\n setDependencies: setDependencies\n });\n\n (function (Scenario) {\n Scenario[\"NotAuthorised\"] = \"NOT_AUTHORISED\";\n Scenario[\"AuthSucceeded\"] = \"AUTH_SUCCEEDED\";\n Scenario[\"AuthCancelled\"] = \"AUTH_CANCELLED\";\n Scenario[\"Continuation\"] = \"CONTINUATION\";\n })(exports.Scenario || (exports.Scenario = {}));\n (function (InitialisationError) {\n InitialisationError[\"InsecureContext\"] = \"INSECURE_CONTEXT\";\n InitialisationError[\"UnsupportedBrowser\"] = \"UNSUPPORTED_BROWSER\";\n })(exports.InitialisationError || (exports.InitialisationError = {}));\n // INTIALISE\n /**\n * Check if we're authenticated, process any lobby query-parameters present in the URL,\n * and initiate the user's file system if authenticated (can be disabled).\n *\n * See `loadFileSystem` if you want to load the user's file system yourself.\n * NOTE: Only works on the main/ui thread, as it uses `window.location`.\n */\n function initialise(options) {\n return __awaiter(this, void 0, void 0, function () {\n var permissions, _a, autoRemoveUrlParams, rootKey, _b, maybeLoadFs, url, authorised, cancellation, newUser, username, _c, _d, _e, _f, _g, c, authedUsername, validSecrets, validUcans, _h, _j, _k, _l;\n var _this = this;\n return __generator(this, function (_m) {\n switch (_m.label) {\n case 0:\n options = options || {};\n permissions = options.permissions || null;\n _a = options.autoRemoveUrlParams, autoRemoveUrlParams = _a === void 0 ? true : _a, rootKey = options.rootKey;\n _b = permissions || {}, _b.app, _b.fs;\n maybeLoadFs = function (username) { return __awaiter(_this, void 0, void 0, function () {\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!(options.loadFileSystem === false)) return [3 /*break*/, 1];\n _a = undefined;\n return [3 /*break*/, 3];\n case 1: return [4 /*yield*/, loadFileSystem(permissions, username, rootKey)];\n case 2:\n _a = _b.sent();\n _b.label = 3;\n case 3: return [2 /*return*/, _a];\n }\n });\n }); };\n // Check if browser is supported\n if (globalThis.isSecureContext === false)\n throw exports.InitialisationError.InsecureContext;\n return [4 /*yield*/, isSupported()];\n case 1:\n if ((_m.sent()) === false)\n throw exports.InitialisationError.UnsupportedBrowser;\n url = new URL(window.location.href);\n authorised = url.searchParams.get(\"authorised\");\n cancellation = url.searchParams.get(\"cancelled\");\n if (!authorised) return [3 /*break*/, 11];\n newUser = url.searchParams.get(\"newUser\") === \"t\";\n username = url.searchParams.get(\"username\") || \"\";\n _c = importClassifiedInfo;\n if (!(authorised === \"via-postmessage\")) return [3 /*break*/, 3];\n return [4 /*yield*/, getClassifiedViaPostMessage()];\n case 2:\n _d = _m.sent();\n return [3 /*break*/, 5];\n case 3: return [4 /*yield*/, cat(authorised)]; // in any other case we expect it to be a CID\n case 4:\n _d = _m.sent(); // in any other case we expect it to be a CID\n _m.label = 5;\n case 5: return [4 /*yield*/, _c.apply(void 0, [_d])];\n case 6:\n _m.sent();\n return [4 /*yield*/, setItem$1(USERNAME_STORAGE_KEY, username)];\n case 7:\n _m.sent();\n if (autoRemoveUrlParams) {\n url.searchParams.delete(\"authorised\");\n url.searchParams.delete(\"newUser\");\n url.searchParams.delete(\"username\");\n history.replaceState(null, document.title, url.toString());\n }\n _e = permissions;\n if (!_e) return [3 /*break*/, 9];\n return [4 /*yield*/, validateSecrets(permissions)];\n case 8:\n _e = (_m.sent()) === false;\n _m.label = 9;\n case 9:\n if (_e) {\n console.warn(\"Unable to validate filesystem secrets\");\n return [2 /*return*/, scenarioNotAuthorised(permissions)];\n }\n if (permissions && validatePermissions(permissions) === false) {\n console.warn(\"Unable to validate UCAN permissions\");\n return [2 /*return*/, scenarioNotAuthorised(permissions)];\n }\n _f = scenarioAuthSucceeded;\n _g = [permissions,\n newUser,\n username];\n return [4 /*yield*/, maybeLoadFs(username)];\n case 10: return [2 /*return*/, _f.apply(void 0, _g.concat([_m.sent()]))];\n case 11:\n if (cancellation) {\n c = (function (_) {\n switch (cancellation) {\n case \"DENIED\": return \"User denied authorisation\";\n default: return \"Unknown reason\";\n }\n })();\n return [2 /*return*/, scenarioAuthCancelled(permissions, c)];\n }\n else {\n // trigger build for internal ucan dictionary\n store([]);\n }\n _m.label = 12;\n case 12: return [4 /*yield*/, authenticatedUsername()];\n case 13:\n authedUsername = _m.sent();\n if (!(authedUsername && permissions)) return [3 /*break*/, 18];\n return [4 /*yield*/, validateSecrets(permissions)];\n case 14:\n validSecrets = _m.sent();\n validUcans = validatePermissions(permissions);\n if (!(validSecrets && validUcans)) return [3 /*break*/, 16];\n _h = scenarioContinuation;\n _j = [permissions, authedUsername];\n return [4 /*yield*/, maybeLoadFs(authedUsername)];\n case 15: return [2 /*return*/, _h.apply(void 0, _j.concat([_m.sent()]))];\n case 16: return [2 /*return*/, scenarioNotAuthorised(permissions)];\n case 17: return [3 /*break*/, 21];\n case 18:\n if (!authedUsername) return [3 /*break*/, 20];\n _k = scenarioContinuation;\n _l = [permissions, authedUsername];\n return [4 /*yield*/, maybeLoadFs(authedUsername)];\n case 19: return [2 /*return*/, _k.apply(void 0, _l.concat([_m.sent()]))];\n case 20: return [2 /*return*/, scenarioNotAuthorised(permissions)];\n case 21: return [2 /*return*/];\n }\n });\n });\n }\n // SUPPORTED\n function isSupported() {\n return __awaiter(this, void 0, void 0, function () {\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _a = localforage.supports(localforage.INDEXEDDB);\n if (!_a) return [3 /*break*/, 2];\n return [4 /*yield*/, (function () { return new Promise(function (resolve) {\n var db = indexedDB.open(\"testDatabase\");\n db.onsuccess = function () { return resolve(true); };\n db.onerror = function () { return resolve(false); };\n }); })()];\n case 1:\n _a = (_b.sent());\n _b.label = 2;\n case 2: return [2 /*return*/, _a];\n }\n });\n });\n }\n var fs = FileSystem;\n // ㊙️ ⚛ SCENARIOS\n function scenarioAuthSucceeded(permissions, newUser, username, fs) {\n return {\n scenario: exports.Scenario.AuthSucceeded,\n permissions: permissions,\n authenticated: true,\n throughLobby: true,\n fs: fs,\n newUser: newUser,\n username: username\n };\n }\n function scenarioAuthCancelled(permissions, cancellationReason) {\n return {\n scenario: exports.Scenario.AuthCancelled,\n permissions: permissions,\n authenticated: false,\n throughLobby: true,\n cancellationReason: cancellationReason\n };\n }\n function scenarioContinuation(permissions, username, fs) {\n return {\n scenario: exports.Scenario.Continuation,\n permissions: permissions,\n authenticated: true,\n newUser: false,\n throughLobby: false,\n fs: fs,\n username: username\n };\n }\n function scenarioNotAuthorised(permissions) {\n return {\n scenario: exports.Scenario.NotAuthorised,\n permissions: permissions,\n authenticated: false\n };\n }\n function importClassifiedInfo(classified) {\n return __awaiter(this, void 0, void 0, function () {\n var info, rawSessionKey, secretsStr, secrets, fsSecrets, ucans;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n info = JSON.parse(classified);\n return [4 /*yield*/, keystore$2.decrypt(info.sessionKey)\n // Decrypt secrets\n ];\n case 1:\n rawSessionKey = _a.sent();\n return [4 /*yield*/, aes$2.decryptGCM(info.secrets, rawSessionKey, info.iv)];\n case 2:\n secretsStr = _a.sent();\n secrets = JSON.parse(secretsStr);\n fsSecrets = secrets.fs;\n ucans = secrets.ucans;\n // Import read keys and bare name filters\n return [4 /*yield*/, Promise.all(Object.entries(fsSecrets).map(function (_a) {\n var posixPath = _a[0], _b = _a[1], bareNameFilter$1 = _b.bareNameFilter, key = _b.key;\n return __awaiter(_this, void 0, void 0, function () {\n var path, readKeyId, bareNameFilterId;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n path = fromPosix(posixPath);\n return [4 /*yield*/, readKey({ path: path })];\n case 1:\n readKeyId = _c.sent();\n return [4 /*yield*/, bareNameFilter({ path: path })];\n case 2:\n bareNameFilterId = _c.sent();\n return [4 /*yield*/, keystore$2.importSymmKey(key, readKeyId)];\n case 3:\n _c.sent();\n return [4 /*yield*/, setItem$1(bareNameFilterId, bareNameFilter$1)];\n case 4:\n _c.sent();\n return [2 /*return*/];\n }\n });\n });\n }))\n // Add UCANs to the storage\n ];\n case 3:\n // Import read keys and bare name filters\n _a.sent();\n // Add UCANs to the storage\n return [4 /*yield*/, store(ucans)];\n case 4:\n // Add UCANs to the storage\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n }\n function getClassifiedViaPostMessage() {\n return __awaiter(this, void 0, void 0, function () {\n var iframe, answer, message;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {\n var iframe = document.createElement(\"iframe\");\n iframe.id = \"webnative-secret-exchange\";\n iframe.style.width = \"0\";\n iframe.style.height = \"0\";\n iframe.style.border = \"none\";\n iframe.style.display = \"none\";\n document.body.appendChild(iframe);\n iframe.onload = function () {\n resolve(iframe);\n };\n iframe.src = setup.endpoints.lobby + \"/exchange.html\";\n })];\n case 1:\n iframe = _a.sent();\n _a.label = 2;\n case 2:\n _a.trys.push([2, , 4, 5]);\n answer = new Promise(function (resolve, reject) {\n window.addEventListener(\"message\", listen);\n function listen(event) {\n window.removeEventListener(\"message\", listen);\n if (event.data) {\n resolve(event.data);\n }\n else {\n reject(new Error(\"Can't import UCANs & readKey(s): Missing data\"));\n }\n }\n });\n if (iframe.contentWindow == null)\n throw new Error(\"Can't import UCANs & readKey(s): No access to its contentWindow\");\n message = { webnative: \"exchange-secrets\" };\n iframe.contentWindow.postMessage(message, iframe.src);\n return [4 /*yield*/, answer];\n case 3: return [2 /*return*/, _a.sent()];\n case 4:\n document.body.removeChild(iframe);\n return [7 /*endfinally*/];\n case 5: return [2 /*return*/];\n }\n });\n });\n }\n function validateSecrets(permissions) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, paths(permissions).reduce(function (acc, path) { return acc.then(function (bool) { return __awaiter(_this, void 0, void 0, function () {\n var keyName;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (bool === false)\n return [2 /*return*/, bool];\n if (isBranch(Branch.Public, path))\n return [2 /*return*/, bool];\n return [4 /*yield*/, readKey({ path: path })];\n case 1:\n keyName = _a.sent();\n return [4 /*yield*/, keystore$2.keyExists(keyName)];\n case 2: return [2 /*return*/, _a.sent()];\n }\n });\n }); }); }, Promise.resolve(true))];\n });\n });\n }\n\n exports.VERSION = VERSION;\n exports.apps = index$6;\n exports.authenticatedUsername = authenticatedUsername$1;\n exports.crypto = index$2;\n exports.dataRoot = dataRoot;\n exports.did = did$1;\n exports.dns = index;\n exports.errors = errors$1;\n exports.fs = fs;\n exports.initialise = initialise;\n exports.initialize = initialise;\n exports.ipfs = index$3;\n exports.isSupported = isSupported;\n exports.keystore = keystore$1;\n exports.leave = leave;\n exports.loadFileSystem = loadFileSystem;\n exports.lobby = index$7;\n exports.machinery = index$1;\n exports.path = pathing;\n exports.redirectToLobby = redirectToLobby;\n exports.setup = setup$1;\n exports.ucan = ucan;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n",
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/tiddlywiki-on-fission/webnative.js",
"module-type": "library"
}
}
}