[
  {
    "path": ".gitignore",
    "content": "dist/\nnode_modules/\n"
  },
  {
    "path": "Changelog.md",
    "content": "# 0.6.0\n\n## Features\n\n* Added a timeout when closing a group to restore a group when closed by accident (PR [34](https://github.com/denschub/firefox-tabgroups/pull/34))\n\n## Bug fixes\n\n* Show the correct icon when using the dark compact theme\n* Fix invalid group selection after closing tabs (PR [51](https://github.com/denschub/firefox-tabgroups/pull/51))\n\n# 0.5.1\n\nSet `multiprocessCompatible` to `true`!\n\n# 0.5.0\n\n## Bug fixes\n\n* Use the inverted toolbar icon if needed on high resolutions.\n\n## Refactorings\n\n* Use the default favicon instead of no favicon at all. (PR [35](https://github.com/denschub/firefox-tabgroups/pull/35))\n* Removed the Panorama migration to avoid breakage in Firefox 52\n\n# 0.4.0\n\n## Features\n\n* You can now drag and drop tabs in the panel to move them between groups. Dragging a tab onto the \"Create new group\" button will create a new group with that tab. (PR [32](https://github.com/denschub/firefox-tabgroups/pull/32))\n\n# 0.3.0\n\n## Bug fixes\n\n* Clicking the input field while renaming will no longer select the group. (PR [28](https://github.com/denschub/firefox-tabgroups/pull/28))\n* Use `label` instead of `visibleLabel` since the latter was removed in bug 1247920.\n\n# 0.2.1\n\n* Don't try to set the groups active tab if an app tab is active. (Issue [#27](https://github.com/denschub/firefox-tabgroups/issues/27))\n\n# 0.2.0\n\n## Features\n\n* Added a migration override so tab groups won't be migrated away.\n* Added compatiblity with Quicksavers Tab Groups add-on.\n* Added keyboard shortcuts to switch between groups. (PR [#23](https://github.com/denschub/firefox-tabgroups/pull/23))\n* Added option for alphabetic tab group sorting. (PR [#24](https://github.com/denschub/firefox-tabgroups/pull/24))\n\n## Refactorings\n\n* `minVersion` is now set to 44 so people have a chance to install the addon before the migration kicks in.\n* `Tab Groups` was renamed to `Simplified Tab Groups` to avoid confusion and conflicts with other add-ons.\n* Simpilified development by adding `jake` and some basic scripts.\n\n# 0.1.1\n\nThis was the first public release.\n"
  },
  {
    "path": "Jakefile",
    "content": "/* global desc, task, jake, complete */\n/* vim: set fdl=0: */\n\"use strict\";\n\nconst SRC_DIR = \"./src\";\nconst DIST_DIR = \"./dist\";\n\ndesc(\"Builds the source\");\ntask(\"build\", [\"cleanup\"], () => {\n  jake.cpR(SRC_DIR, DIST_DIR);\n});\n\ndesc(\"Removes all build-related files\");\ntask(\"cleanup\", () => {\n  jake.rmRf(DIST_DIR);\n});\n\ndesc(\"runs wslint on the built source\");\ntask(\"lint\", [\"build\"], {async: true}, () => {\n  jake.exec([`cd ${DIST_DIR}; eslint .`], {\n    interactive: true\n  }, complete);\n});\n\ndesc(\"Builds the source and starts a test installation. You can specify jpm parameters with 'JPM_PARAMS=\\\"...\\\" jake run'\");\ntask(\"run\", [\"build\"], {async: true}, () => {\n  jake.exec([`cd ${DIST_DIR}; jpm run ${process.env.JPM_PARAMS}`], {\n    interactive: true\n  }, complete);\n});\n\ndesc(\"Builds the source and generates a XPI\");\ntask(\"xpi\", [\"build\"], {async: true}, () => {\n  jake.exec([\n    `cd ${DIST_DIR}; jpm xpi`,\n    `cd ${DIST_DIR}; find . -not -name \"*.xpi\" -delete`\n  ], {printStderr: true}, () => {\n    console.log(`.xpi was created in ${DIST_DIR}`);\n    complete();\n  });\n});\n"
  },
  {
    "path": "LICENSE",
    "content": "NOTE: The menu button icons were imported from Firefox. Please see\ndata/assets/images/LICENSE for further information!\n\n--------------------------------------------------------------------------------\n\nCopyright (c) 2015 Dennis Schubert\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\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject 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,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "Simplified Tab Groups for Firefox\n=================================\n\n**NOTE**: This project is currently unmaintained. If someone wants to take over, [check this discussion](https://github.com/denschub/firefox-tabgroups/issues/60#issuecomment-388541616) and drop me a note.\n\n---\n\nThis project aims to provide a simple add-on to replace some functionalities\nfrom TabView/Tab Groups/Panorama which were removed from Firefox due to a lot\nof open bugs and a very low overall usage.\n\nInstallation\n------------\n\nThe add-on is available at [addons.mozilla.org][amo] and should be installed\nthere to ensure the add-on stays updated.\n\nWarning\n-------\n\nPlease note that this extension is currently in a very unstable and untested\nstate and may kill your tabs or small kittens. While it may get improved and\nsecured in the future, I strongly advise you to make a backup of your important\ntabs...\n\nBuilding\n--------\n\nAssuming you have Node.js v5 installed on your machine, building this project\nis rather easy.\n\n1. Install the dependencies: `npm install`.\n2. Run `./node_modules/.bin/jake build` to build all source files into the\n   `dist/` directory or run `./node_modules/.bin/jake run` to build the add-on\n   and start a Firefox instance for testing.\n\n`jake run` uses `jpm` and you can pass additional parameters to it by setting\nan environment variable, for example: `JPM_PARAMS=\"-b nightly\" jake run`\n\nContributing\n------------\n\nFeel free to [fix some open issues][issues] and submit a pull request. Please\nmake sure to file the pull request against the `develop` branch, which should\nbe the default. Please make sure your code passes the coding styleguides by\nrunning `jake lint` before submitting the PR.\n\nIf you want to help translating this add-on, feel free to alter or add new\nfiles in `src/locale`. The extensions name and descriptions have to be changed\nin `src/install.rdf`.\n\nLicense\n-------\n\nMIT.\n\n[amo]: https://addons.mozilla.org/en-US/firefox/addon/tab-groups/\n[issues]: https://github.com/denschub/firefox-tabgroups/issues\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"tabgroups\",\n  \"author\": \"\",\n  \"license\": \"MIT\",\n  \"private\": true,\n  \"devDependencies\": {\n    \"jake\": \"^8.0.12\",\n    \"jpm\": \"^1.0.3\"\n  }\n}\n"
  },
  {
    "path": "src/.eslintignore",
    "content": "data/vendor/\nbootstrap.js\n"
  },
  {
    "path": "src/.eslintrc.json",
    "content": "{\n  \"parserOptions\": {\n    \"ecmaVersion\": 6,\n    \"sourceType\": \"module\"\n  },\n  \"env\": {\n    \"browser\": true,\n    \"es6\": true,\n    \"mocha\": true,\n    \"node\": true\n  },\n  \"globals\": {\n    \"Cc\": true,\n    \"Ci\": true,\n    \"Components\": true,\n    \"Cr\": true,\n    \"Cu\": true,\n    \"EventEmitter\": true,\n    \"Services\": true,\n    \"Task\": true,\n    \"XPCNativeWrapper\": true,\n    \"XPCOMUtils\": true,\n    \"console\": true,\n    \"console\": true,\n    \"devtools\": true,\n    \"dump\": true,\n    \"exports\": true,\n    \"exports\": true,\n    \"loader\": true,\n    \"module\": true,\n    \"require\": true,\n    \"require\": true,\n\n    \"addon\": true,\n    \"ActionCreators\": true,\n    \"App\": true,\n    \"classNames\": true,\n    \"Group\": true,\n    \"GroupAddButton\": true,\n    \"GroupControls\": true,\n    \"GroupList\": true,\n    \"Immutable\": true,\n    \"React\": true,\n    \"ReactDOM\": true,\n    \"ReactRedux\": true,\n    \"Reducer\": true,\n    \"Redux\": true,\n    \"Tab\": true,\n\t\t\"TabList\": true\n  },\n  \"rules\": {\n    \"block-scoped-var\": 0,\n    \"brace-style\": [2, \"1tbs\", {\"allowSingleLine\": false}],\n    \"camelcase\": 2,\n    \"comma-dangle\": 1,\n    \"comma-spacing\": [2, {\"before\": false, \"after\": true}],\n    \"comma-style\": [2, \"last\"],\n    \"complexity\": 1,\n    \"consistent-return\": 2,\n    \"consistent-this\": 0,\n    \"curly\": 2,\n    \"default-case\": 0,\n    \"dot-location\": [1, \"property\"],\n    \"dot-notation\": 2,\n    \"eol-last\": 2,\n    \"eqeqeq\": 0,\n    \"func-names\": 0,\n    \"func-style\": 0,\n    \"generator-star\": 0,\n    \"generator-star-spacing\": [1, \"after\"],\n    \"global-strict\": 0,\n    \"guard-for-in\": 0,\n    \"handle-callback-err\": 0,\n    \"indent\": [2, 2, {\"SwitchCase\": 1}],\n    \"key-spacing\": [1, {\"beforeColon\": false, \"afterColon\": true}],\n    \"keyword-spacing\": 1,\n    \"linebreak-style\": 0,\n    \"max-depth\": 0,\n    \"max-len\": [1, 80],\n    \"max-nested-callbacks\": [2, 3],\n    \"max-params\": 0,\n    \"max-statements\": 0,\n    \"new-cap\": [2, {\"capIsNew\": false}],\n    \"new-parens\": 2,\n    \"newline-after-var\": 0,\n    \"no-alert\": 0,\n    \"no-array-constructor\": 2,\n    \"no-bitwise\": 0,\n    \"no-caller\": 2,\n    \"no-catch-shadow\": 1,\n    \"no-comma-dangle\": 0,\n    \"no-cond-assign\": 2,\n    \"no-console\": 0,\n    \"no-constant-condition\": 0,\n    \"no-continue\": 0,\n    \"no-control-regex\": 2,\n    \"no-debugger\": 2,\n    \"no-delete-var\": 2,\n    \"no-div-regex\": 0,\n    \"no-dupe-args\": 2,\n    \"no-dupe-keys\": 2,\n    \"no-duplicate-case\": 2,\n    \"no-else-return\": 2,\n    \"no-empty\": 2,\n    \"no-empty-character-class\": 2,\n    \"no-eq-null\": 0,\n    \"no-eval\": 2,\n    \"no-ex-assign\": 2,\n    \"no-extend-native\": 2,\n    \"no-extra-bind\": 2,\n    \"no-extra-boolean-cast\": 2,\n    \"no-extra-parens\": 0,\n    \"no-extra-semi\": 2,\n    \"no-extra-strict\": 0,\n    \"no-fallthrough\": 2,\n    \"no-floating-decimal\": 0,\n    \"no-func-assign\": 0,\n    \"no-implied-eval\": 0,\n    \"no-inline-comments\": 1,\n    \"no-inner-declarations\": 0,\n    \"no-invalid-regexp\": 0,\n    \"no-irregular-whitespace\": 0,\n    \"no-iterator\": 0,\n    \"no-label-var\": 0,\n    \"no-labels\": 0,\n    \"no-lone-blocks\": 0,\n    \"no-lonely-if\": 2,\n    \"no-loop-func\": 0,\n    \"no-mixed-requires\": 0,\n    \"no-mixed-spaces-and-tabs\": 2,\n    \"no-multi-spaces\": 1,\n    \"no-multi-str\": 1,\n    \"no-multiple-empty-lines\": [1, {\"max\": 1}],\n    \"no-native-reassign\": 2,\n    \"no-negated-in-lhs\": 0,\n    \"no-nested-ternary\": 2,\n    \"no-new\": 0,\n    \"no-new-func\": 0,\n    \"no-new-object\": 0,\n    \"no-new-require\": 0,\n    \"no-new-wrappers\": 0,\n    \"no-obj-calls\": 0,\n    \"no-octal\": 1,\n    \"no-octal-escape\": 0,\n    \"no-param-reassign\": 0,\n    \"no-path-concat\": 0,\n    \"no-plusplus\": 0,\n    \"no-process-env\": 0,\n    \"no-process-exit\": 0,\n    \"no-proto\": 2,\n    \"no-redeclare\": 2,\n    \"no-regex-spaces\": 2,\n    \"no-reserved-keys\": 0,\n    \"no-restricted-modules\": 0,\n    \"no-return-assign\": 2,\n    \"no-script-url\": 0,\n    \"no-self-compare\": 2,\n    \"no-sequences\": 2,\n    \"no-shadow\": 1,\n    \"no-shadow-restricted-names\": 2,\n    \"no-space-before-semi\": 0,\n    \"no-spaced-func\": 1,\n    \"no-sparse-arrays\": 2,\n    \"no-sync\": 0,\n    \"no-ternary\": 0,\n    \"no-throw-literal\": 2,\n    \"no-trailing-spaces\": 2,\n    \"no-undef\": 2,\n    \"no-undef-init\": 0,\n    \"no-undefined\": 0,\n    \"no-underscore-dangle\": 0,\n    \"no-unneeded-ternary\": 2,\n    \"no-unreachable\": 2,\n    \"no-unused-expressions\": 0,\n    \"no-unused-vars\": 1,\n    \"no-use-before-define\": 0,\n    \"no-var\": 0,\n    \"no-void\": 0,\n    \"no-warning-comments\": 0,\n    \"no-with\": 2,\n    \"no-wrap-func\": 0,\n    \"object-shorthand\": 0,\n    \"one-var\": 0,\n    \"operator-assignment\": 0,\n    \"operator-linebreak\": 0,\n    \"padded-blocks\": [1, \"never\"],\n    \"quote-props\": 0,\n    \"quotes\": [1, \"double\", \"avoid-escape\"],\n    \"radix\": 2,\n    \"semi\": [1, \"always\"],\n    \"semi-spacing\": [1, {\"before\": false, \"after\": true}],\n    \"sort-vars\": 0,\n    \"space-before-blocks\": [1, \"always\"],\n    \"space-before-function-paren\": [1, \"never\"],\n    \"space-before-function-parentheses\": 0,\n    \"space-in-brackets\": 0,\n    \"space-in-parens\": [1, \"never\"],\n    \"space-infix-ops\": [1, {\"int32Hint\": true}],\n    \"space-unary-ops\": [1, { \"words\": true, \"nonwords\": false }],\n    \"space-unary-word-ops\": 0,\n    \"spaced-comment\": [1, \"always\"],\n    \"strict\": [2, \"global\"],\n    \"use-isnan\": 2,\n    \"valid-jsdoc\": 0,\n    \"valid-typeof\": 2,\n    \"vars-on-top\": 0,\n    \"wrap-iife\": 0,\n    \"wrap-regex\": 0,\n    \"yoda\": 2\n  }\n}\n"
  },
  {
    "path": "src/bootstrap.js",
    "content": "/**\n * This Source Code is based on the original bootstrap.js generated by the\n * add-on sdk which is subject to the terms of the Mozilla Public License, v.\n * 2.0. You can obtain a copy of this license at http://mozilla.org/MPL/2.0/.\n */\n\n\"use strict\";\n\nconst { utils: Cu } = Components;\nconst rootURI = __SCRIPT_URI_SPEC__.replace(\"bootstrap.js\", \"\");\nconst COMMONJS_URI = \"resource://gre/modules/commonjs\";\nconst { require } = Cu.import(COMMONJS_URI + \"/toolkit/require.js\", {});\nconst { Bootstrap } = require(COMMONJS_URI + \"/sdk/addon/bootstrap.js\");\n\nvar { startup, shutdown, install, uninstall } = new Bootstrap(rootURI);\n"
  },
  {
    "path": "src/chrome.manifest",
    "content": "content simplified-tabgroups content/\n"
  },
  {
    "path": "src/content/icons/togglebutton/LICENSE",
    "content": "NOTE: Icons were imported from Firefox as the original TabView was\nremoved and those icons are no longer needed.\n\n--------------------------------------------------------------------------------\n\nMozilla Public License Version 2.0\n==================================\n\n1. Definitions\n--------------\n\n1.1. \"Contributor\"\n    means each individual or legal entity that creates, contributes to\n    the creation of, or owns Covered Software.\n\n1.2. \"Contributor Version\"\n    means the combination of the Contributions of others (if any) used\n    by a Contributor and that particular Contributor's Contribution.\n\n1.3. \"Contribution\"\n    means Covered Software of a particular Contributor.\n\n1.4. \"Covered Software\"\n    means Source Code Form to which the initial Contributor has attached\n    the notice in Exhibit A, the Executable Form of such Source Code\n    Form, and Modifications of such Source Code Form, in each case\n    including portions thereof.\n\n1.5. \"Incompatible With Secondary Licenses\"\n    means\n\n    (a) that the initial Contributor has attached the notice described\n        in Exhibit B to the Covered Software; or\n\n    (b) that the Covered Software was made available under the terms of\n        version 1.1 or earlier of the License, but not also under the\n        terms of a Secondary License.\n\n1.6. \"Executable Form\"\n    means any form of the work other than Source Code Form.\n\n1.7. \"Larger Work\"\n    means a work that combines Covered Software with other material, in \n    a separate file or files, that is not Covered Software.\n\n1.8. \"License\"\n    means this document.\n\n1.9. \"Licensable\"\n    means having the right to grant, to the maximum extent possible,\n    whether at the time of the initial grant or subsequently, any and\n    all of the rights conveyed by this License.\n\n1.10. \"Modifications\"\n    means any of the following:\n\n    (a) any file in Source Code Form that results from an addition to,\n        deletion from, or modification of the contents of Covered\n        Software; or\n\n    (b) any new file in Source Code Form that contains any Covered\n        Software.\n\n1.11. \"Patent Claims\" of a Contributor\n    means any patent claim(s), including without limitation, method,\n    process, and apparatus claims, in any patent Licensable by such\n    Contributor that would be infringed, but for the grant of the\n    License, by the making, using, selling, offering for sale, having\n    made, import, or transfer of either its Contributions or its\n    Contributor Version.\n\n1.12. \"Secondary License\"\n    means either the GNU General Public License, Version 2.0, the GNU\n    Lesser General Public License, Version 2.1, the GNU Affero General\n    Public License, Version 3.0, or any later versions of those\n    licenses.\n\n1.13. \"Source Code Form\"\n    means the form of the work preferred for making modifications.\n\n1.14. \"You\" (or \"Your\")\n    means an individual or a legal entity exercising rights under this\n    License. For legal entities, \"You\" includes any entity that\n    controls, is controlled by, or is under common control with You. For\n    purposes of this definition, \"control\" means (a) the power, direct\n    or indirect, to cause the direction or management of such entity,\n    whether by contract or otherwise, or (b) ownership of more than\n    fifty percent (50%) of the outstanding shares or beneficial\n    ownership of such entity.\n\n2. License Grants and Conditions\n--------------------------------\n\n2.1. Grants\n\nEach Contributor hereby grants You a world-wide, royalty-free,\nnon-exclusive license:\n\n(a) under intellectual property rights (other than patent or trademark)\n    Licensable by such Contributor to use, reproduce, make available,\n    modify, display, perform, distribute, and otherwise exploit its\n    Contributions, either on an unmodified basis, with Modifications, or\n    as part of a Larger Work; and\n\n(b) under Patent Claims of such Contributor to make, use, sell, offer\n    for sale, have made, import, and otherwise transfer either its\n    Contributions or its Contributor Version.\n\n2.2. Effective Date\n\nThe licenses granted in Section 2.1 with respect to any Contribution\nbecome effective for each Contribution on the date the Contributor first\ndistributes such Contribution.\n\n2.3. Limitations on Grant Scope\n\nThe licenses granted in this Section 2 are the only rights granted under\nthis License. No additional rights or licenses will be implied from the\ndistribution or licensing of Covered Software under this License.\nNotwithstanding Section 2.1(b) above, no patent license is granted by a\nContributor:\n\n(a) for any code that a Contributor has removed from Covered Software;\n    or\n\n(b) for infringements caused by: (i) Your and any other third party's\n    modifications of Covered Software, or (ii) the combination of its\n    Contributions with other software (except as part of its Contributor\n    Version); or\n\n(c) under Patent Claims infringed by Covered Software in the absence of\n    its Contributions.\n\nThis License does not grant any rights in the trademarks, service marks,\nor logos of any Contributor (except as may be necessary to comply with\nthe notice requirements in Section 3.4).\n\n2.4. Subsequent Licenses\n\nNo Contributor makes additional grants as a result of Your choice to\ndistribute the Covered Software under a subsequent version of this\nLicense (see Section 10.2) or under the terms of a Secondary License (if\npermitted under the terms of Section 3.3).\n\n2.5. Representation\n\nEach Contributor represents that the Contributor believes its\nContributions are its original creation(s) or it has sufficient rights\nto grant the rights to its Contributions conveyed by this License.\n\n2.6. Fair Use\n\nThis License is not intended to limit any rights You have under\napplicable copyright doctrines of fair use, fair dealing, or other\nequivalents.\n\n2.7. Conditions\n\nSections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted\nin Section 2.1.\n\n3. Responsibilities\n-------------------\n\n3.1. Distribution of Source Form\n\nAll distribution of Covered Software in Source Code Form, including any\nModifications that You create or to which You contribute, must be under\nthe terms of this License. You must inform recipients that the Source\nCode Form of the Covered Software is governed by the terms of this\nLicense, and how they can obtain a copy of this License. You may not\nattempt to alter or restrict the recipients' rights in the Source Code\nForm.\n\n3.2. Distribution of Executable Form\n\nIf You distribute Covered Software in Executable Form then:\n\n(a) such Covered Software must also be made available in Source Code\n    Form, as described in Section 3.1, and You must inform recipients of\n    the Executable Form how they can obtain a copy of such Source Code\n    Form by reasonable means in a timely manner, at a charge no more\n    than the cost of distribution to the recipient; and\n\n(b) You may distribute such Executable Form under the terms of this\n    License, or sublicense it under different terms, provided that the\n    license for the Executable Form does not attempt to limit or alter\n    the recipients' rights in the Source Code Form under this License.\n\n3.3. Distribution of a Larger Work\n\nYou may create and distribute a Larger Work under terms of Your choice,\nprovided that You also comply with the requirements of this License for\nthe Covered Software. If the Larger Work is a combination of Covered\nSoftware with a work governed by one or more Secondary Licenses, and the\nCovered Software is not Incompatible With Secondary Licenses, this\nLicense permits You to additionally distribute such Covered Software\nunder the terms of such Secondary License(s), so that the recipient of\nthe Larger Work may, at their option, further distribute the Covered\nSoftware under the terms of either this License or such Secondary\nLicense(s).\n\n3.4. Notices\n\nYou may not remove or alter the substance of any license notices\n(including copyright notices, patent notices, disclaimers of warranty,\nor limitations of liability) contained within the Source Code Form of\nthe Covered Software, except that You may alter any license notices to\nthe extent required to remedy known factual inaccuracies.\n\n3.5. Application of Additional Terms\n\nYou may choose to offer, and to charge a fee for, warranty, support,\nindemnity or liability obligations to one or more recipients of Covered\nSoftware. However, You may do so only on Your own behalf, and not on\nbehalf of any Contributor. You must make it absolutely clear that any\nsuch warranty, support, indemnity, or liability obligation is offered by\nYou alone, and You hereby agree to indemnify every Contributor for any\nliability incurred by such Contributor as a result of warranty, support,\nindemnity or liability terms You offer. You may include additional\ndisclaimers of warranty and limitations of liability specific to any\njurisdiction.\n\n4. Inability to Comply Due to Statute or Regulation\n---------------------------------------------------\n\nIf it is impossible for You to comply with any of the terms of this\nLicense with respect to some or all of the Covered Software due to\nstatute, judicial order, or regulation then You must: (a) comply with\nthe terms of this License to the maximum extent possible; and (b)\ndescribe the limitations and the code they affect. Such description must\nbe placed in a text file included with all distributions of the Covered\nSoftware under this License. Except to the extent prohibited by statute\nor regulation, such description must be sufficiently detailed for a\nrecipient of ordinary skill to be able to understand it.\n\n5. Termination\n--------------\n\n5.1. The rights granted under this License will terminate automatically\nif You fail to comply with any of its terms. However, if You become\ncompliant, then the rights granted under this License from a particular\nContributor are reinstated (a) provisionally, unless and until such\nContributor explicitly and finally terminates Your grants, and (b) on an\nongoing basis, if such Contributor fails to notify You of the\nnon-compliance by some reasonable means prior to 60 days after You have\ncome back into compliance. Moreover, Your grants from a particular\nContributor are reinstated on an ongoing basis if such Contributor\nnotifies You of the non-compliance by some reasonable means, this is the\nfirst time You have received notice of non-compliance with this License\nfrom such Contributor, and You become compliant prior to 30 days after\nYour receipt of the notice.\n\n5.2. If You initiate litigation against any entity by asserting a patent\ninfringement claim (excluding declaratory judgment actions,\ncounter-claims, and cross-claims) alleging that a Contributor Version\ndirectly or indirectly infringes any patent, then the rights granted to\nYou by any and all Contributors for the Covered Software under Section\n2.1 of this License shall terminate.\n\n5.3. In the event of termination under Sections 5.1 or 5.2 above, all\nend user license agreements (excluding distributors and resellers) which\nhave been validly granted by You or Your distributors under this License\nprior to termination shall survive termination.\n\n************************************************************************\n*                                                                      *\n*  6. Disclaimer of Warranty                                           *\n*  -------------------------                                           *\n*                                                                      *\n*  Covered Software is provided under this License on an \"as is\"       *\n*  basis, without warranty of any kind, either expressed, implied, or  *\n*  statutory, including, without limitation, warranties that the       *\n*  Covered Software is free of defects, merchantable, fit for a        *\n*  particular purpose or non-infringing. The entire risk as to the     *\n*  quality and performance of the Covered Software is with You.        *\n*  Should any Covered Software prove defective in any respect, You     *\n*  (not any Contributor) assume the cost of any necessary servicing,   *\n*  repair, or correction. This disclaimer of warranty constitutes an   *\n*  essential part of this License. No use of any Covered Software is   *\n*  authorized under this License except under this disclaimer.         *\n*                                                                      *\n************************************************************************\n\n************************************************************************\n*                                                                      *\n*  7. Limitation of Liability                                          *\n*  --------------------------                                          *\n*                                                                      *\n*  Under no circumstances and under no legal theory, whether tort      *\n*  (including negligence), contract, or otherwise, shall any           *\n*  Contributor, or anyone who distributes Covered Software as          *\n*  permitted above, be liable to You for any direct, indirect,         *\n*  special, incidental, or consequential damages of any character      *\n*  including, without limitation, damages for lost profits, loss of    *\n*  goodwill, work stoppage, computer failure or malfunction, or any    *\n*  and all other commercial damages or losses, even if such party      *\n*  shall have been informed of the possibility of such damages. This   *\n*  limitation of liability shall not apply to liability for death or   *\n*  personal injury resulting from such party's negligence to the       *\n*  extent applicable law prohibits such limitation. Some               *\n*  jurisdictions do not allow the exclusion or limitation of           *\n*  incidental or consequential damages, so this exclusion and          *\n*  limitation may not apply to You.                                    *\n*                                                                      *\n************************************************************************\n\n8. Litigation\n-------------\n\nAny litigation relating to this License may be brought only in the\ncourts of a jurisdiction where the defendant maintains its principal\nplace of business and such litigation shall be governed by laws of that\njurisdiction, without reference to its conflict-of-law provisions.\nNothing in this Section shall prevent a party's ability to bring\ncross-claims or counter-claims.\n\n9. Miscellaneous\n----------------\n\nThis License represents the complete agreement concerning the subject\nmatter hereof. If any provision of this License is held to be\nunenforceable, such provision shall be reformed only to the extent\nnecessary to make it enforceable. Any law or regulation which provides\nthat the language of a contract shall be construed against the drafter\nshall not be used to construe this License against a Contributor.\n\n10. Versions of the License\n---------------------------\n\n10.1. New Versions\n\nMozilla Foundation is the license steward. Except as provided in Section\n10.3, no one other than the license steward has the right to modify or\npublish new versions of this License. Each version will be given a\ndistinguishing version number.\n\n10.2. Effect of New Versions\n\nYou may distribute the Covered Software under the terms of the version\nof the License under which You originally received the Covered Software,\nor under the terms of any subsequent version published by the license\nsteward.\n\n10.3. Modified Versions\n\nIf you create software not governed by this License, and you want to\ncreate a new license for such software, you may create and use a\nmodified version of this License if you rename the license and remove\nany references to the name of the license steward (except to note that\nsuch modified license differs from this License).\n\n10.4. Distributing Source Code Form that is Incompatible With Secondary\nLicenses\n\nIf You choose to distribute Source Code Form that is Incompatible With\nSecondary Licenses under the terms of this version of the License, the\nnotice described in Exhibit B of this License must be attached.\n\nExhibit A - Source Code Form License Notice\n-------------------------------------------\n\n  This Source Code Form is subject to the terms of the Mozilla Public\n  License, v. 2.0. If a copy of the MPL was not distributed with this\n  file, You can obtain one at http://mozilla.org/MPL/2.0/.\n\nIf it is not possible or desirable to put the notice in a particular\nfile, then You may include the notice in a location (such as a LICENSE\nfile in a relevant directory) where a recipient would be likely to look\nfor such a notice.\n\nYou may add additional accurate notices of copyright ownership.\n\nExhibit B - \"Incompatible With Secondary Licenses\" Notice\n---------------------------------------------------------\n\n  This Source Code Form is \"Incompatible With Secondary Licenses\", as\n  defined by the Mozilla Public License, v. 2.0.\n\n"
  },
  {
    "path": "src/data/action_creators.js",
    "content": "const ActionCreators = {\n  setTabgroups: function(tabgroups) {\n    return {\n      type: \"TABGROUPS_RECEIVE\",\n      tabgroups: tabgroups\n    };\n  },\n\n  setGroupCloseTimeout: function(timeout) {\n    return {\n      type: \"GROUP_CLOSE_TIMEOUT_RECIEVE\",\n      closeTimeout: timeout\n    };\n  }\n};\n"
  },
  {
    "path": "src/data/assets/css/groupspanel.css",
    "content": "ul, li {\n  display: block;\n  margin: 0;\n  padding: 0;\n}\n\n  li {\n    list-style-type: none;\n    cursor: move;\n  }\n\n.group-title {\n  display: block;\n  overflow: hidden;\n  padding-right: 16px;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n\n  .group.active .group-title, .tab.active {\n    font-weight: bold;\n  }\n\n  .group:hover .group-title {\n    padding-right: 15px;\n  }\n\n.group-title input {\n  background: transparent;\n  border: 1px solid rgba(0, 0, 0, 0.12);\n  margin: 0;\n  padding: 1px;\n  width: calc(100% - 25px);\n}\n\n.group, .tab {\n  border-radius: 3px;\n  border: 1px solid transparent;\n  cursor: pointer;\n  padding: 5px;\n  position: relative;\n}\n\n  .tab {\n    padding: 0;\n  }\n\n  .group:hover, .tab:hover {\n    background-color: rgba(0, 0, 0, 0.06);\n    border-color: rgba(0, 0, 0, 0.12);\n  }\n\n  .group.dragSourceGroup {\n    border: inherit;\n    background-color : inherit;\n  }\n\n   .group.draggingOver, .draggingOver {\n    border: 1px dashed #ccc;\n    background-color: rgba(0, 0, 0, 0.04);\n  }\n\n.tab-list {\n  display: none;\n  margin-top: 5px;\n}\n\n  .expanded .tab-list {\n    display: block;\n  }\n\n.tab-title {\n  display: inline-block;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n  max-width: calc(100% - 32px);\n  padding: 5px 5px 1px;\n  margin-bottom: 1px;\n}\n\n.tab-icon {\n  height: 16px;\n  width: 16px;\n  margin-right: 1px;\n  margin-bottom: 1px;\n  margin-left: 4px;\n}\n\n.tab-icon:-moz-broken {\n  background: url(\"chrome://mozapps/skin/places/defaultFavicon.png\");\n  background-size: contain;\n  display: inline-block;\n}\n\n@media (min-resolution: 1.1dppx) {\n  .tab-icon:-moz-broken {\n    background-image: url(\"chrome://mozapps/skin/places/defaultFavicon@2x.png\");\n  }\n}\n\n.expanded .group-title {\n  border-bottom: 1px solid rgba(0, 0, 0, 0.12);\n  padding-bottom: 5px;\n}\n\n.group-controls {\n  display: inline-block;\n  font-size: 120%;\n  opacity: 0.7;\n  position: absolute;\n  right: 5px;\n  top: 4px;\n}\n\n  .group.editing .group-controls {\n    top: 6px;\n  }\n\n  .group.closing .group-controls .group-close,\n  .group.closing:hover .group-controls .group-close,\n  .group.closing .group-controls .fa-chevron-down,\n  .group.closing .group-controls .group-edit {\n    display: none;\n  }\n\n  .group.closing .group-title {\n    color: #ccc;\n    text-decoration: line-through;\n  }\n\n.group:hover .group-title {\n  padding-right: 55px;\n}\n\n  .group .group-controls .group-close,\n  .group .group-controls .group-edit {\n    display: none;\n  }\n\n    .group:hover .group-controls .group-close,\n    .group:hover .group-controls .group-edit {\n      display: inline-block;\n    }\n"
  },
  {
    "path": "src/data/components/app.js",
    "content": "const App = React.createClass({\n  propTypes: {\n    onGroupAddClick: React.PropTypes.func,\n    onGroupAddDrop: React.PropTypes.func,\n    onGroupClick: React.PropTypes.func,\n    onGroupDrop: React.PropTypes.func,\n    onGroupCloseClick: React.PropTypes.func,\n    onGroupTitleChange: React.PropTypes.func,\n    onTabClick: React.PropTypes.func,\n    onTabDrag: React.PropTypes.func,\n    onTabDragStart: React.PropTypes.func,\n    uiHeightChanged: React.PropTypes.func\n  },\n\n  render: function() {\n    return React.createElement(GroupList, this.props);\n  }\n});\n"
  },
  {
    "path": "src/data/components/group.js",
    "content": "const Group = React.createClass({\n  propTypes: {\n    closeTimeout: React.PropTypes.number,\n    group: React.PropTypes.object.isRequired,\n    onGroupClick: React.PropTypes.func,\n    onGroupDrop: React.PropTypes.func,\n    onGroupCloseClick: React.PropTypes.func,\n    onGroupTitleChange: React.PropTypes.func,\n    onTabClick: React.PropTypes.func,\n    onTabDrag: React.PropTypes.func,\n    onTabDragStart: React.PropTypes.func,\n    uiHeightChanged: React.PropTypes.func\n  },\n\n  getInitialState: function() {\n    return {\n      closing: false,\n      editing: false,\n      expanded: false,\n      draggingOverCounter: 0,\n      dragSourceGroup: false,\n      newTitle: this.getTitle()\n    };\n  },\n\n  componentDidUpdate: function() {\n    this.props.uiHeightChanged && this.props.uiHeightChanged();\n  },\n\n  getTitle: function() {\n    return this.props.group.title || (\n        addon.options.l10n.unnamed_group + \" \" + this.props.group.id\n      );\n  },\n\n  render: function() {\n    let titleElement;\n    if (this.state.editing) {\n      titleElement = React.DOM.input(\n        {\n          type: \"text\",\n          defaultValue: this.getTitle(),\n          onChange: (event) => {\n            this.setState({newTitle: event.target.value});\n          },\n          onClick: (event) => {\n            event.stopPropagation();\n          },\n          onKeyUp: this.handleGroupTitleInputKey\n        }\n      );\n    } else {\n      titleElement = React.DOM.span({}, this.getTitle());\n    }\n\n    let groupClasses = classNames({\n      active: this.props.group.active,\n      editing: this.state.editing,\n      closing: this.state.closing,\n      draggingOver: this.state.draggingOverCounter !== 0,\n      dragSourceGroup: this.state.dragSourceGroup,\n      expanded: this.state.expanded,\n      group: true\n    });\n\n    return (\n      React.DOM.li(\n        {\n          className: groupClasses,\n          onClick: this.handleGroupClick,\n          onDragOver: this.handleGroupDragOver,\n          onDragEnter: this.handleGroupDragEnter,\n          onDragLeave: this.handleGroupDragLeave,\n          onDrop: this.handleGroupDrop\n        },\n        React.DOM.span(\n          {\n            className: \"group-title\"\n          },\n          titleElement,\n          React.createElement(\n            GroupControls,\n            {\n              closing: this.state.closing,\n              editing: this.state.editing,\n              expanded: this.state.expanded,\n              onClose: this.handleGroupCloseClick,\n              onEdit: this.handleGroupEditClick,\n              onEditAbort: this.handleGroupEditAbortClick,\n              onEditSave: this.handleGroupEditSaveClick,\n              onExpand: this.handleGroupExpandClick,\n              onUndoCloseClick: this.handleGroupCloseAbortClick\n            }\n          )\n        ),\n        this.state.expanded && React.createElement(\n          TabList,\n          {\n            tabs: this.props.group.tabs,\n            onTabClick: this.props.onTabClick,\n            onTabDrag: this.props.onTabDrag,\n            onTabDragStart: this.props.onTabDragStart,\n            onTabDragEnd: this.props.onTabDragEnd\n          }\n        )\n      )\n    );\n  },\n\n  handleGroupCloseClick: function(event) {\n    event.stopPropagation();\n    this.setState({editing: false});\n    this.setState({closing: true});\n\n    let group = this;\n\n    if (this.props.closeTimeout == 0) {\n      group.props.onGroupCloseClick(group.props.group.id);\n      return;\n    }\n\n    setTimeout(function() {\n      group.props.onGroupCloseClick(group.props.group.id);\n    }, this.props.closeTimeout * 1000);\n  },\n\n  handleGroupClick: function(event) {\n    event.stopPropagation();\n    this.props.onGroupClick(this.props.group.id);\n  },\n\n  handleGroupEditClick: function(event) {\n    event.stopPropagation();\n    this.setState({editing: !this.state.editing});\n  },\n\n  handleGroupEditAbortClick: function(event) {\n    event.stopPropagation();\n    this.setState({editing: false});\n  },\n\n  handleGroupEditSaveClick: function(event) {\n    event.stopPropagation();\n    this.setState({editing: false});\n    this.props.onGroupTitleChange(this.props.group.id, this.state.newTitle);\n  },\n\n  handleGroupExpandClick: function(event) {\n    event.stopPropagation();\n    this.setState({expanded: !this.state.expanded});\n  },\n\n  handleGroupTitleInputKey: function(event) {\n    if (event.keyCode == 13) {\n      this.setState({editing: false});\n      this.props.onGroupTitleChange(this.props.group.id, this.state.newTitle);\n    }\n  },\n\n  handleGroupDrop: function(event) {\n    event.stopPropagation();\n\n    this.setState({draggingOverCounter: 0});\n\n    let sourceGroup = event.dataTransfer.getData(\"tab/group\");\n    let tabIndex = event.dataTransfer.getData(\"tab/index\");\n\n    this.props.onGroupDrop(\n      sourceGroup,\n      tabIndex,\n      this.props.group.id\n    );\n  },\n\n  handleGroupDragOver: function(event) {\n    event.stopPropagation();\n    event.preventDefault();\n    return false;\n  },\n\n  handleGroupDragEnter: function(event) {\n    event.stopPropagation();\n    event.preventDefault();\n\n    let sourceGroupId = event.dataTransfer.getData(\"tab/group\");\n    let isSourceGroup = sourceGroupId == this.props.group.id;\n    this.setState({dragSourceGroup: isSourceGroup});\n\n    let draggingCounterValue = (this.state.draggingOverCounter == 1) ? 2 : 1;\n    this.setState({draggingOverCounter: draggingCounterValue});\n  },\n\n  handleGroupDragLeave: function(event) {\n    event.stopPropagation();\n    event.preventDefault();\n\n    if (this.state.draggingOverCounter == 2) {\n      this.setState({draggingOverCounter: 1});\n    } else if (this.state.draggingOverCounter == 1) {\n      this.setState({draggingOverCounter: 0});\n    }\n\n    return false;\n  },\n\n  handleGroupCloseAbortClick: function(event) {\n    event.stopPropagation();\n\n    this.setState({closing: false});\n  }\n});\n"
  },
  {
    "path": "src/data/components/groupaddbutton.js",
    "content": "const GroupAddButton = React.createClass({\n  propTypes: {\n    onClick: React.PropTypes.func,\n    onDrop: React.PropTypes.func\n  },\n\n  getInitialState: function() {\n    return {\n      draggingOverCounter: 0\n    };\n  },\n\n  render: function() {\n    let buttonClasses = classNames({\n      draggingOver: this.state.draggingOverCounter !== 0,\n      group: true\n    });\n\n    return (\n      React.DOM.li(\n        {\n          className: buttonClasses,\n          onClick: this.handleClick,\n          onDrop: this.handleDrop,\n          onDragOver: this.handleGroupDragOver,\n          onDragEnter: this.handleDragEnter,\n          onDragLeave: this.handleDragLeave\n        },\n        React.DOM.span(\n          {className: \"group-title\"},\n          addon.options.l10n.add_group\n        )\n      )\n    );\n  },\n\n  handleClick: function(event) {\n    event.stopPropagation();\n    this.props.onClick();\n  },\n\n  handleGroupDragOver: function(event) {\n    event.stopPropagation();\n    event.preventDefault();\n  },\n\n  handleDragEnter: function(event) {\n    event.stopPropagation();\n    event.preventDefault();\n\n    let draggingCounterValue = (this.state.draggingOverCounter == 1) ? 2 : 1;\n    this.setState({draggingOverCounter: draggingCounterValue});\n  },\n\n  handleDragLeave: function(event) {\n    event.stopPropagation();\n    event.preventDefault();\n\n    if (this.state.draggingOverCounter == 2) {\n      this.setState({draggingOverCounter: 1});\n    } else if (this.state.draggingOverCounter == 1) {\n      this.setState({draggingOverCounter: 0});\n    }\n  },\n\n  handleDrop: function(event) {\n    event.stopPropagation();\n\n    this.setState({draggingOverCounter: 0});\n\n    let sourceGroup = event.dataTransfer.getData(\"tab/group\");\n    let tabIndex = event.dataTransfer.getData(\"tab/index\");\n\n    this.props.onDrop(\n      sourceGroup,\n      tabIndex\n    );\n  }\n});\n"
  },
  {
    "path": "src/data/components/groupcontrols.js",
    "content": "const GroupControls = React.createClass({\n  propTypes: {\n    expanded: React.PropTypes.bool.isRequired,\n    onClose: React.PropTypes.func,\n    onEdit: React.PropTypes.func,\n    onEditAbort: React.PropTypes.func,\n    onEditSave: React.PropTypes.func,\n    onExpand: React.PropTypes.func,\n    onUndoCloseClick: React.PropTypes.func\n  },\n\n  getEditControls: function() {\n    let controls;\n    if (this.props.editing) {\n      controls = [\n        React.DOM.i({\n          className: \"group-edit fa fa-fw fa-check\",\n          onClick: this.props.onEditSave\n        }),\n        React.DOM.i({\n          className: \"group-edit fa fa-fw fa-ban\",\n          onClick: this.props.onEditAbort\n        })\n      ];\n    } else {\n      controls = React.DOM.i({\n        className: \"group-edit fa fa-fw fa-pencil\",\n        onClick: this.props.onEdit\n      });\n    }\n\n    return controls;\n  },\n\n  getClosingControls: function() {\n    return [\n      React.DOM.i({\n        className: \"group-close-undo fa fa-fw fa-undo\",\n        onClick: this.props.onUndoCloseClick\n      })\n    ];\n  },\n\n  render: function() {\n    let groupControls;\n    if (this.props.closing) {\n      groupControls = this.getClosingControls();\n    } else {\n      groupControls = this.getEditControls();\n    }\n\n    let expanderClasses = classNames({\n      \"group-expand\": true,\n      \"fa\": true,\n      \"fa-fw\": true,\n      \"fa-chevron-down\": !this.props.expanded,\n      \"fa-chevron-up\": this.props.expanded\n    });\n\n    return React.DOM.span(\n      {\n        className: \"group-controls\"\n      },\n      groupControls,\n      React.DOM.i({\n        className: \"group-close fa fa-fw fa-times\",\n        onClick: this.props.onClose\n      }),\n      React.DOM.i({\n        className: expanderClasses,\n        onClick: this.props.onExpand\n      })\n    );\n  }\n});\n"
  },
  {
    "path": "src/data/components/grouplist.js",
    "content": "const GroupList = (() => {\n  const GroupListStandalone = React.createClass({\n    propTypes: {\n      groups: React.PropTypes.object.isRequired,\n      closeTimeout: React.PropTypes.number,\n      onGroupAddClick: React.PropTypes.func,\n      onGroupAddDrop: React.PropTypes.func,\n      onGroupClick: React.PropTypes.func,\n      onGroupDrop: React.PropTypes.func,\n      onGroupCloseClick: React.PropTypes.func,\n      onGroupTitleChange: React.PropTypes.func,\n      onTabClick: React.PropTypes.func,\n      onTabDrag: React.PropTypes.func,\n      onTabDragStart: React.PropTypes.func,\n      uiHeightChanged: React.PropTypes.func\n    },\n\n    componentDidUpdate: function() {\n      this.props.uiHeightChanged && this.props.uiHeightChanged();\n    },\n\n    render: function() {\n      return React.DOM.ul(\n        {className: \"group-list\"},\n        this.props.groups.map((group) => {\n          return React.createElement(Group, {\n            key: group.id,\n            group: group,\n            closeTimeout: this.props.closeTimeout,\n            onGroupClick: this.props.onGroupClick,\n            onGroupDrop: this.props.onGroupDrop,\n            onGroupCloseClick: this.props.onGroupCloseClick,\n            onGroupTitleChange: this.props.onGroupTitleChange,\n            onTabClick: this.props.onTabClick,\n            onTabDrag: this.props.onTabDrag,\n            onTabDragStart: this.props.onTabDragStart,\n            uiHeightChanged: this.props.uiHeightChanged\n          });\n        }),\n        React.createElement(\n          GroupAddButton,\n          {\n            onClick: this.props.onGroupAddClick,\n            onDrop: this.props.onGroupAddDrop\n          }\n        )\n      );\n    }\n  });\n\n  return ReactRedux.connect((state) => {\n    return {\n      groups: state.get(\"tabgroups\"),\n      closeTimeout: state.get(\"closeTimeout\")\n    };\n  }, ActionCreators)(GroupListStandalone);\n})();\n"
  },
  {
    "path": "src/data/components/tab.js",
    "content": "const Tab = React.createClass({\n  propTypes: {\n    onTabClick: React.PropTypes.func,\n    onTabDrag: React.PropTypes.func,\n    onTabDragStart: React.PropTypes.func,\n    tab: React.PropTypes.object.isRequired\n  },\n\n  render: function() {\n    let favicon = React.DOM.img({\n      alt: \"\",\n      className: \"tab-icon\",\n      src: this.props.tab.icon\n    });\n\n    let tabClasses = classNames({\n      active: this.props.tab.active,\n      tab: true\n    });\n\n    return (\n      React.DOM.li(\n        {\n          className: tabClasses,\n          onClick: this.handleTabClick,\n          onDrag: this.handleTabDrag,\n          onDragStart: this.handleTabDragStart,\n          draggable: true\n        },\n        favicon,\n        React.DOM.span({className: \"tab-title\"}, this.props.tab.title)\n      )\n    );\n  },\n\n  handleTabClick: function(event) {\n    event.stopPropagation();\n\n    let tab = this.props.tab;\n    this.props.onTabClick(\n      tab.group,\n      tab.index\n    );\n  },\n\n  handleTabDrag: function(event) {\n    event.stopPropagation();\n\n    let tab = this.props.tab;\n    event.dataTransfer.setData(\"tab/index\", tab.index);\n    event.dataTransfer.setData(\"tab/group\", tab.group);\n\n    this.props.onTabDrag(\n      tab.group,\n      tab.index\n    );\n  },\n\n  handleTabDragStart: function(event) {\n    event.stopPropagation();\n\n    let tab = this.props.tab;\n    event.dataTransfer.setData(\"tab/index\", tab.index);\n    event.dataTransfer.setData(\"tab/group\", tab.group);\n\n    this.props.onTabDragStart(\n      tab.group,\n      tab.index\n    );\n  }\n});\n"
  },
  {
    "path": "src/data/components/tablist.js",
    "content": "const TabList = React.createClass({\n  propTypes: {\n    onTabClick: React.PropTypes.func,\n    onTabDrag: React.PropTypes.func,\n    onTabDragStart: React.PropTypes.func,\n    tabs: React.PropTypes.array.isRequired\n  },\n\n  render: function() {\n    return (\n      React.DOM.ul(\n        {className: \"tab-list\"},\n        this.props.tabs.map((tab) => {\n          return React.createElement(Tab, {\n            key: tab.index,\n            tab: tab,\n            onTabClick: this.props.onTabClick,\n            onTabDrag: this.props.onTabDrag,\n            onTabDragStart: this.props.onTabDragStart,\n            uiHeightChanged: this.props.uiHeightChanged\n          });\n        })\n      )\n    );\n  }\n});\n"
  },
  {
    "path": "src/data/groupspanel.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n\n    <script src=\"vendor/js/classnames.min.js\"></script>\n    <script src=\"vendor/js/immutable.min.js\"></script>\n    <script src=\"vendor/js/react.min.js\"></script>\n    <script src=\"vendor/js/react-dom.min.js\"></script>\n    <script src=\"vendor/js/redux.min.js\"></script>\n    <script src=\"vendor/js/react-redux.min.js\"></script>\n\n    <script src=\"action_creators.js\"></script>\n    <script src=\"reducer.js\"></script>\n    <script src=\"components/app.js\"></script>\n    <script src=\"components/group.js\"></script>\n    <script src=\"components/groupaddbutton.js\"></script>\n    <script src=\"components/groupcontrols.js\"></script>\n    <script src=\"components/grouplist.js\"></script>\n    <script src=\"components/tab.js\"></script>\n    <script src=\"components/tablist.js\"></script>\n    <script src=\"groupspanel.js\"></script>\n\n    <link rel=\"stylesheet\" href=\"vendor/css/font-awesome.css\">\n    <link rel=\"stylesheet\" href=\"assets/css/groupspanel.css\">\n  </head>\n  <body>\n    <div id=\"content\"></div>\n  </body>\n</html>\n"
  },
  {
    "path": "src/data/groupspanel.js",
    "content": "const store = Redux.createStore(Reducer);\n\nconst Actions = {\n  addGroup: function() {\n    addon.port.emit(\"Group:Add\");\n  },\n\n  addGroupWithTab: function(sourceGroupID, tabIndex) {\n    addon.port.emit(\"Group:AddWithTab\", {sourceGroupID, tabIndex});\n  },\n\n  closeGroup: function(groupID) {\n    addon.port.emit(\"Group:Close\", {groupID});\n  },\n\n  uiHeightChanged: function() {\n    addon.port.emit(\"UI:Resize\", {\n      width: document.body.clientWidth,\n      height: document.body.clientHeight\n    });\n  },\n\n  renameGroup: function(groupID, title) {\n    addon.port.emit(\"Group:Rename\", {groupID, title});\n  },\n\n  selectGroup: function(groupID) {\n    addon.port.emit(\"Group:Select\", {groupID});\n  },\n\n  moveTabToGroup: function(sourceGroupID, tabIndex, targetGroupID) {\n    addon.port.emit(\"Group:Drop\", {sourceGroupID, tabIndex, targetGroupID});\n  },\n\n  selectTab: function(groupID, tabIndex) {\n    addon.port.emit(\"Tab:Select\", {groupID, tabIndex});\n  },\n\n  dragTab: function(groupID, tabIndex) {\n    addon.port.emit(\"Tab:Drag\", {groupID, tabIndex});\n  },\n\n  dragTabStart: function(groupID, tabIndex) {\n    addon.port.emit(\"Tab:DragStart\", {groupID, tabIndex});\n  }\n};\n\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n  ReactDOM.render(\n    React.createElement(\n      ReactRedux.Provider,\n      {store: store},\n      React.createElement(App, {\n        onGroupAddClick: Actions.addGroup,\n        onGroupAddDrop: Actions.addGroupWithTab,\n        onGroupClick: Actions.selectGroup,\n        onGroupDrop: Actions.moveTabToGroup,\n        onGroupCloseClick: Actions.closeGroup,\n        onGroupTitleChange: Actions.renameGroup,\n        onTabClick: Actions.selectTab,\n        onTabDrag: Actions.dragTab,\n        onTabDragStart: Actions.dragTabStart,\n        uiHeightChanged: Actions.uiHeightChanged\n      })\n    ),\n    document.getElementById(\"content\")\n  );\n});\n\naddon.port.on(\"Groups:Changed\", (tabgroups) => {\n  store.dispatch(ActionCreators.setTabgroups(tabgroups));\n});\n\naddon.port.on(\"Groups:CloseTimeoutChanged\", (timeout) => {\n  store.dispatch(ActionCreators.setGroupCloseTimeout(timeout));\n});\n"
  },
  {
    "path": "src/data/reducer.js",
    "content": "const INITIAL_STATE = Immutable.fromJS({\n  tabgroups: [],\n  closeTimeout: 0\n});\n\nconst Reducer = function(state = INITIAL_STATE, action) {\n  switch (action.type) {\n    case \"TABGROUPS_RECEIVE\":\n      return state.set(\"tabgroups\", Immutable.fromJS(action.tabgroups));\n    case \"GROUP_CLOSE_TIMEOUT_RECIEVE\":\n      return state.set(\"closeTimeout\", action.closeTimeout);\n  }\n  return state;\n};\n"
  },
  {
    "path": "src/data/vendor/css/font-awesome.css",
    "content": "/*!\n *  Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome\n *  License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)\n */\n/* FONT PATH\n * -------------------------- */\n@font-face {\n  font-family: 'FontAwesome';\n  src: url('../fonts/fontawesome.eot?v=4.4.0');\n  src: url('../fonts/fontawesome.eot?#iefix&v=4.4.0') format('embedded-opentype'), url('../fonts/fontawesome.woff?v=4.4.0') format('woff'), url('../fonts/fontawesome.ttf?v=4.4.0') format('truetype'), url('../fonts/fontawesome.svg?v=4.4.0#fontawesomeregular') format('svg');\n  font-weight: normal;\n  font-style: normal;\n}\n.fa {\n  display: inline-block;\n  font: normal normal normal 14px/1 FontAwesome;\n  font-size: inherit;\n  text-rendering: auto;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n/* makes the font 33% larger relative to the icon container */\n.fa-lg {\n  font-size: 1.33333333em;\n  line-height: 0.75em;\n  vertical-align: -15%;\n}\n.fa-2x {\n  font-size: 2em;\n}\n.fa-3x {\n  font-size: 3em;\n}\n.fa-4x {\n  font-size: 4em;\n}\n.fa-5x {\n  font-size: 5em;\n}\n.fa-fw {\n  width: 1.28571429em;\n  text-align: center;\n}\n\n.fa-check:before { content: \"\\f00c\"; }\n.fa-remove:before, .fa-close:before, .fa-times:before { content: \"\\f00d\"; }\n.fa-pencil:before { content: \"\\f040\"; }\n.fa-ban:before { content: \"\\f05e\"; }\n.fa-plus:before { content: \"\\f067\"; }\n.fa-minus:before { content: \"\\f068\"; }\n.fa-chevron-up:before { content: \"\\f077\"; }\n.fa-chevron-down:before { content: \"\\f078\"; }\n.fa-undo:before { content: \"\\f079\"; }\n"
  },
  {
    "path": "src/index.js",
    "content": "const self = require(\"sdk/self\");\nconst _ = require(\"sdk/l10n\").get;\n\nconst {Hotkey} = require(\"sdk/hotkeys\");\nconst {Panel} = require(\"sdk/panel\");\nconst Prefs = require(\"sdk/simple-prefs\");\nconst TabsUtils = require(\"sdk/tabs/utils\");\nconst Tabs = require(\"sdk/tabs\");\nconst {ToggleButton} = require(\"sdk/ui/button/toggle\");\nconst WindowUtils = require(\"sdk/window/utils\");\n\nconst Utils = require(\"lib/utils\");\nconst {SessionStorage} = require(\"lib/storage/session\");\nconst {TabManager} = require(\"lib/tabmanager\");\n\nfunction TabGroups() {\n  this._groupsPanel = null;\n  this._hotkeyOpen = null;\n  this._hotkeyNextGroup = null;\n  this._hotkeyPrevGroup = null;\n\n  this._panelButton = null;\n\n  this._tabs = new TabManager(new SessionStorage());\n\n  this.init();\n  this.bindEvents();\n}\n\nTabGroups.prototype = {\n  init: function() {\n    this.createPanelButton();\n    this.createGroupsPanel();\n    this.createOpenHotkey();\n    this.createNavigationHotkey();\n  },\n\n  bindEvents: function() {\n    this.bindHotkeyPreference();\n    this.bindGroupPreference();\n    this.bindPanelButtonEvents();\n    this.bindPanelEvents();\n    this.bindTabEvents();\n  },\n\n  createGroupsPanel: function() {\n    this._groupsPanel = Panel({\n      height: 1,\n      contentURL: self.data.url(\"groupspanel.html\"),\n      contentScriptOptions: {\n        l10n: Utils.getL10nStrings([\n          \"add_group\",\n          \"unnamed_group\"\n        ]),\n        groupCloseTimeout: Prefs.prefs.groupCloseTimeout\n      }\n    });\n  },\n\n  createPanelButton: function() {\n    let iconBase = \"chrome://simplified-tabgroups/content/icons/togglebutton/\";\n    let toolBarButton = Utils.themeSwitch({\n      dark: iconBase + \"icon-inverted-32.png\",\n      light: iconBase + \"icon-32.png\"\n    });\n\n    this._panelButton = ToggleButton({\n      id: \"tabgroups-show\",\n      icon: {\n        \"16\": toolBarButton,\n        \"32\": toolBarButton,\n        \"64\": iconBase + \"icon-64.png\"\n      },\n      label: _(\"panelButton_label\")\n    });\n  },\n\n  createOpenHotkey: function() {\n    if (!Prefs.prefs.bindPanoramaShortcut) {\n      return;\n    }\n\n    /**\n     * Note: since this is intended to be released after 1222490 has landed,\n     * it is perfectly save to assume accel-shift-e is not used by anything\n     * else.\n     */\n    this._hotkeyOpen = Hotkey({\n      combo: \"accel-shift-e\",\n      onPress: () => {\n        if (this._groupsPanel.isShowing) {\n          this._groupsPanel.hide();\n        } else {\n          this._groupsPanel.show({position: this._panelButton});\n          this._panelButton.state(\"window\", {checked: true});\n        }\n      }\n    });\n  },\n\n  createNavigationHotkey: function() {\n    if (!Prefs.prefs.bindNavigationShortcut) {\n      return;\n    }\n\n    this._hotkeyNextGroup = Hotkey({\n      combo: \"control-`\",\n      onPress: () => {\n        this._tabs.selectNextPrevGroup(\n          this._getWindow(),\n          this._getTabBrowser(),\n          1\n        );\n      }\n    });\n    this._hotkeyPrevGroup = Hotkey({\n      combo: \"control-shift-`\",\n      onPress: () => {\n        this._tabs.selectNextPrevGroup(\n          this._getWindow(),\n          this._getTabBrowser(),\n          -1\n        );\n      }\n    });\n  },\n\n  bindHotkeyPreference: function() {\n    if (Prefs.prefs.bindPanoramaShortcut) {\n      this.createOpenHotkey();\n    }\n\n    if (Prefs.prefs.bindNavigationShortcut) {\n      this.createNavigationHotkey();\n    }\n\n    Prefs.on(\"bindPanoramaShortcut\", () => {\n      if (Prefs.prefs.bindPanoramaShortcut) {\n        if (!this._hotkeyOpen) {\n          this.createOpenHotkey();\n        }\n      } else if (this._hotkeyOpen) {\n        this._hotkeyOpen.destroy();\n        this._hotkeyOpen = null;\n      }\n    });\n\n    Prefs.on(\"bindNavigationShortcut\", () => {\n      if (Prefs.prefs.bindNavigationShortcut) {\n        if (!this._hotkeyNextGroup) {\n          this.createNavigationHotkey();\n        }\n      } else {\n        if (this._hotkeyNextGroup) {\n          this._hotkeyNextGroup.destroy();\n          this._hotkeyNextGroup = null;\n        }\n        if (this._hotkeyPrevGroup) {\n          this._hotkeyPrevGroup.destroy();\n          this._hotkeyPrevGroup = null;\n        }\n      }\n    });\n  },\n\n  bindGroupPreference: function() {\n    let emitCloseTimeoutChange = () => {\n      this._groupsPanel.port.emit(\"Groups:CloseTimeoutChanged\", Prefs.prefs.groupCloseTimeout);\n    };\n\n    Prefs.on(\"groupCloseTimeout\", emitCloseTimeoutChange);\n\n    emitCloseTimeoutChange();\n  },\n\n  bindPanelButtonEvents: function() {\n    this._panelButton.on(\"change\", (state) => {\n      if (!state.checked) {\n        this._groupsPanel.hide();\n      } else {\n        if (this._groupsPanel.isShowing) {\n          this._groupsPanel.hide();\n        }\n\n        this._groupsPanel.show({position: this._panelButton});\n      }\n    });\n  },\n\n  bindPanelEvents: function() {\n    this._groupsPanel.on(\"hide\", () => {\n      this._panelButton.state(\"window\", {checked: false});\n    });\n\n    this._groupsPanel.on(\"show\", this.refreshUi.bind(this));\n\n    this._groupsPanel.port.on(\"Group:Add\", this.onGroupAdd.bind(this));\n    this._groupsPanel.port.on(\"Group:AddWithTab\", this.onGroupAddWithTab.bind(this));\n    this._groupsPanel.port.on(\"Group:Close\", this.onGroupClose.bind(this));\n    this._groupsPanel.port.on(\"Group:Rename\", this.onGroupRename.bind(this));\n    this._groupsPanel.port.on(\"Group:Select\", this.onGroupSelect.bind(this));\n    this._groupsPanel.port.on(\"Group:Drop\", this.onGroupDrop.bind(this));\n    this._groupsPanel.port.on(\"Tab:Select\", this.onTabSelect.bind(this));\n    this._groupsPanel.port.on(\"UI:Resize\", this.resizePanel.bind(this));\n  },\n\n  bindTabEvents: function() {\n    Tabs.on(\"activate\", () => {\n      let window = this._getWindow();\n      this._tabs.updateCurrentSelectedTab(window);\n      this._tabs.updateCurrentSelectedGroup(window);\n    });\n    Tabs.on(\"open\", () => {\n      this._tabs.updateCurrentSelectedTab(this._getWindow());\n    });\n  },\n\n  refreshUi: function() {\n    let groups = this._tabs.getGroupsWithTabs(this._getWindow(), Prefs.prefs.enableAlphabeticSort);\n\n    this._groupsPanel.port.emit(\"Groups:Changed\", groups);\n  },\n\n  resizePanel: function(dimensions) {\n    this._groupsPanel.resize(\n      this._groupsPanel.width,\n      dimensions.height + 18\n    );\n  },\n\n  onGroupAdd: function() {\n    this._tabs.addGroup(\n      this._getWindow()\n    );\n    this.refreshUi();\n  },\n\n  onGroupAddWithTab: function(event) {\n    this._tabs.addGroupWithTab(\n      this._getWindow(),\n      this._getTabBrowser(),\n      event.tabIndex\n    );\n    this.refreshUi();\n  },\n\n  onGroupClose: function(event) {\n    this._tabs.closeGroup(\n      this._getWindow(),\n      this._getTabBrowser(),\n      event.groupID\n    );\n    this.refreshUi();\n  },\n\n  onGroupRename: function(event) {\n    this._tabs.renameGroup(\n      this._getWindow(),\n      event.groupID,\n      event.title\n    );\n    this.refreshUi();\n  },\n\n  onGroupSelect: function(event) {\n    this._tabs.selectGroup(\n      this._getWindow(),\n      this._getTabBrowser(),\n      event.groupID\n    );\n    this.refreshUi();\n  },\n\n  onTabSelect: function(event) {\n    this._tabs.selectTab(\n      this._getWindow(),\n      this._getTabBrowser(),\n      event.tabIndex,\n      event.groupID\n    );\n    this.refreshUi();\n  },\n\n  onGroupDrop: function(event) {\n    this._tabs.moveTabToGroup(\n      this._getWindow(),\n      this._getTabBrowser(),\n      event.tabIndex,\n      event.targetGroupID\n    );\n    this.refreshUi();\n  },\n\n  _getWindow: function() {\n    return WindowUtils.getMostRecentBrowserWindow();\n  },\n\n  _getTabBrowser: function() {\n    return TabsUtils.getTabBrowser(this._getWindow());\n  }\n};\n\nnew TabGroups();\n"
  },
  {
    "path": "src/install.rdf",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RDF xmlns=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:em=\"http://www.mozilla.org/2004/em-rdf#\">\n  <Description about=\"urn:mozilla:install-manifest\">\n    <em:id>tabgroups@schub.io</em:id>\n    <em:type>2</em:type>\n    <em:bootstrap>true</em:bootstrap>\n    <em:version>0.6.0-dev</em:version>\n    <em:optionsURL>data:text/xml,&lt;placeholder/&gt;</em:optionsURL>\n    <em:optionsType>2</em:optionsType>\n\n    <em:targetApplication>\n      <Description>\n        <!-- Firefox -->\n        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>\n        <em:minVersion>44.0a1</em:minVersion>\n        <em:maxVersion>*</em:maxVersion>\n      </Description>\n    </em:targetApplication>\n\n    <em:name>Simplified Tab Groups</em:name>\n    <em:description>Provides tab grouping features similar to the removed TabView/TabGroups/Panorama features.</em:description>\n    <em:creator>Dennis Schubert &lt;mozilla@dennis-schubert.de&gt;</em:creator>\n    <em:homepageURL>https://github.com/denschub/firefox-tabgroups</em:homepageURL>\n    <em:iconURL>chrome://simplified-tabgroups/content/icons/extension-32.png</em:iconURL>\n    <em:icon64URL>chrome://simplified-tabgroups/content/icons/extension-32.png</em:icon64URL>\n    <em:multiprocessCompatible>true</em:multiprocessCompatible>\n\n    <em:localized>\n      <Description>\n        <em:locale>de-DE</em:locale>\n        <em:name>Einfache Tab-Gruppen</em:name>\n        <em:description>Ermöglicht die Gruppierung von Tabs ähnlich den entfernten Panorama-Funktionen</em:description>\n        <em:creator>Dennis Schubert &lt;mozilla@dennis-schubert.de&gt;</em:creator>\n        <em:homepageURL>https://github.com/denschub/firefox-tabgroups</em:homepageURL>\n      </Description>\n    </em:localized>\n    <em:localized>\n      <Description>\n        <em:locale>fr-FR</em:locale>\n        <em:name>Simplified Tab Groups</em:name>\n        <em:description>Permet de remplacer la gestion des groupes d'onglets supprimée suite à l'abandon de Panorama.</em:description>\n        <em:creator>Dennis Schubert &lt;mozilla@dennis-schubert.de&gt;</em:creator>\n        <em:homepageURL>https://github.com/denschub/firefox-tabgroups</em:homepageURL>\n      </Description>\n    </em:localized>\n    <em:localized>\n      <Description>\n        <em:locale>es-AR</em:locale>\n        <em:name>Grupos de pestañas simplificados</em:name>\n        <em:description>Provee la funcionalidad de gestionar grupos de pestañas similar a la funcionalidad removida de TabView/TabGroups/Panorama.</em:description>\n        <em:creator>Dennis Schubert &lt;mozilla@dennis-schubert.de&gt;</em:creator>\n        <em:homepageURL>https://github.com/denschub/firefox-tabgroups</em:homepageURL>\n      </Description>\n    </em:localized>\n    <em:localized>\n      <Description>\n        <em:locale>es-ES</em:locale>\n        <em:name>Grupos de pestañas simplificados</em:name>\n        <em:description>Provee la funcionalidad de gestionar grupos de pestañas similar a la funcionalidad removida de TabView/TabGroups/Panorama.</em:description>\n        <em:creator>Dennis Schubert &lt;mozilla@dennis-schubert.de&gt;</em:creator>\n        <em:homepageURL>https://github.com/denschub/firefox-tabgroups</em:homepageURL>\n      </Description>\n    </em:localized>\n\n  </Description>\n</RDF>\n"
  },
  {
    "path": "src/lib/storage/session.js",
    "content": "const {Cc, Ci} = require(\"chrome\");\nconst TabsUtils = require(\"sdk/tabs/utils\");\n\nfunction SessionStorage() {\n  this._store = Cc[\"@mozilla.org/browser/sessionstore;1\"]\n    .getService(Ci.nsISessionStore);\n}\n\n/**\n * Note: This is an implementation of the existing Panorama storage using\n * SessionStore so we are able to reuse the existing groups.\n *\n * This will eventually get replaced by the SDKs simple-storage or something\n * similar.\n */\nSessionStorage.prototype = {\n  /**\n   * Returns an array of available groups.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @returns {Array}\n   */\n  getGroups: function(chromeWindow) {\n    let groupsData = this._getGroupsData(chromeWindow);\n    let currentGroup = this._getCurrentGroupData(chromeWindow);\n\n    if (Object.keys(groupsData).length == 0) {\n      this.addGroup(chromeWindow);\n      groupsData = this._getGroupsData(chromeWindow);\n    }\n\n    let groups = [];\n    for (let groupIndex in groupsData) {\n      let group = groupsData[groupIndex];\n\n      groups.push({\n        active: group.id == currentGroup.activeGroupId,\n        id: group.id,\n        title: group.title,\n        selectedIndex: group.selectedIndex\n      });\n    }\n\n    return groups;\n  },\n\n  /**\n   * Returns all tabs.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @returns {Array}\n   */\n  getTabs: function(chromeWindow) {\n    let browser = TabsUtils.getTabBrowser(chromeWindow);\n    let tabs = [];\n    let currentGroup = this.getCurrentGroup(chromeWindow);\n\n    for (let tabIndex = 0; tabIndex < browser.tabs.length; tabIndex++) {\n      let tab = browser.tabs[tabIndex];\n      let tabData = this._getTabData(tab);\n      let tabState = this._getTabState(tab);\n\n      if (tabState.pinned) {\n        continue;\n      }\n\n      let group = currentGroup;\n      if (tabData && tabData.groupID) {\n        group = tabData.groupID;\n      } else {\n        this.setTabGroup(tab, group);\n      }\n\n      tabs.push({\n        active: tab.selected,\n        group: group,\n        icon: browser.getIcon(tab),\n        index: tabIndex,\n        title: tab.label\n      });\n    }\n\n    return tabs;\n  },\n\n  /**\n   * Returns all tab indexes in the specified group.\n   *\n   * @param {TabBrowser} tabBrowser\n   * @param {Number} groupID\n   * @returns {Array}\n   */\n  getTabIndexesByGroup: function(tabBrowser, targetGroupId) {\n    let tabs = [];\n\n    for (let tabIndex = 0; tabIndex < tabBrowser.tabs.length; tabIndex++) {\n      let tab = tabBrowser.tabs[tabIndex];\n      let tabData = this._getTabData(tab);\n      let tabState = this._getTabState(tab);\n\n      let group = 0;\n      if (tabData && tabData.groupID) {\n        group = tabData.groupID;\n      }\n\n      if (tabState.pinned || group != targetGroupId) {\n        continue;\n      }\n\n      tabs.push(tabIndex);\n    }\n\n    return tabs;\n  },\n\n  /**\n   * Returns the ID of the current group.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @returns {Number}\n   */\n  getCurrentGroup: function(chromeWindow) {\n    let groupData = this._getCurrentGroupData(chromeWindow);\n    return groupData.activeGroupId || 0;\n  },\n\n  /**\n   * Returns the ID of the current group.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {Number} groupID\n   */\n  setCurrentGroup: function(chromeWindow, groupID) {\n    let groupData = this._getCurrentGroupData(chromeWindow);\n    groupData.activeGroupId = groupID;\n    this._setCurrentGroupData(chromeWindow, groupData);\n  },\n\n  /**\n   * Assigns a tab to a group.\n   *\n   * @param {XULElement} tab\n   * @param {Number} groupID\n   */\n  setTabGroup: function(tab, groupID) {\n    this._setTabData(\n      tab,\n      Object.assign({}, this._getTabData(tab), {groupID})\n    );\n  },\n\n  /**\n   * Returns the next possible GroupID.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @returns {Number}\n   */\n  getNextGroupID: function(chromeWindow) {\n    let groupData = this._getCurrentGroupData(chromeWindow);\n    let id = groupData.nextID;\n    groupData.nextID++;\n    this._setCurrentGroupData(chromeWindow, groupData);\n    return id;\n  },\n\n  /**\n   * Creates a new tab group.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {String} title - defaults to an empty string\n   */\n  addGroup: function(chromeWindow, title = \"\") {\n    let groups = this._getGroupsData(chromeWindow);\n    let groupID = this.getNextGroupID(chromeWindow);\n    groups[groupID] = {\n      id: groupID,\n      title: title,\n      selectedIndex: 0\n    };\n\n    let currentGroups = this._getCurrentGroupData(chromeWindow);\n    currentGroups.totalNumber++;\n\n    this._setGroupsData(chromeWindow, groups);\n    this._setCurrentGroupData(chromeWindow, currentGroups);\n  },\n\n  /**\n   * Removes tabs from a specified group.\n   *\n   * @param {TabBrowser} tabBrowser\n   * @param {Number} groupID\n   */\n  removeGroupTabs: function(tabBrowser, groupID) {\n    let tabsToRemove = [];\n    for (let tabIndex = 0; tabIndex < tabBrowser.tabs.length; tabIndex++) {\n      let tab = tabBrowser.tabs[tabIndex];\n      let tabData = this._getTabData(tab);\n\n      if (tabData && tabData.groupID && tabData.groupID == groupID) {\n        tabsToRemove.push(tab);\n      }\n    }\n\n    tabsToRemove.forEach((tab) => {\n      tabBrowser.removeTab(tab);\n    });\n  },\n\n  /**\n   * Removes a tab group from the storage.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {Number} groupID\n   */\n  removeGroup: function(chromeWindow, groupID) {\n    let groups = this._getGroupsData(chromeWindow);\n    delete groups[groupID];\n\n    let currentGroups = this._getCurrentGroupData(chromeWindow);\n    currentGroups.totalNumber -= 1;\n\n    this._setGroupsData(chromeWindow, groups);\n    this._setCurrentGroupData(chromeWindow, currentGroups);\n  },\n\n  /**\n   * Renames a group.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {Number} groupID - the groupID\n   * @param {String} title - the new title\n   */\n  renameGroup: function(chromeWindow, groupID, title) {\n    let groupsData = this._getGroupsData(chromeWindow);\n    groupsData[groupID].title = title;\n    this._setGroupsData(chromeWindow, groupsData);\n  },\n\n  /**\n   * Get the selected tab index for a group.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {Number} groupID - the groupID\n   */\n  getGroupSelectedIndex: function(chromeWindow, groupID) {\n    let groupsData = this._getGroupsData(chromeWindow);\n    let currentGroup = groupsData[groupID];\n    return currentGroup == null ? 0 : currentGroup.selectedIndex;\n  },\n\n  /**\n   * Set the selected tab index for a group.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {Number} groupID - the groupID\n   * @param {Number} index - the new selected index\n   */\n  setGroupSelectedIndex: function(chromeWindow, groupID, index) {\n    let groupsData = this._getGroupsData(chromeWindow);\n    let currentGroup = groupsData[groupID];\n    if (currentGroup != null) {\n      currentGroup.selectedIndex = index;\n      this._setGroupsData(chromeWindow, groupsData);\n    }\n  },\n\n  /**\n   * Returns the data for a tab.\n   *\n   * @param {XULElement} tab\n   * @returns {Object}\n   */\n  _getTabData: function(tab) {\n    return this._parseOptionalJson(\n      this._store.getTabValue(tab, \"tabview-tab\")\n    );\n  },\n\n  /**\n   * Stores the data for a tab.\n   *\n   * @param {XULElement} tab\n   * @param {Object} data\n   * @returns {Object}\n   */\n  _setTabData: function(tab, data) {\n    this._stopTabView(tab.ownerDocument.defaultView);\n    this._store.setTabValue(\n      tab,\n      \"tabview-tab\",\n      JSON.stringify(data)\n    );\n  },\n\n  /**\n   * Returns the data for the current tab state.\n   *\n   * @param {XULElement} tab\n   * @returns {Object}\n   */\n  _getTabState: function(tab) {\n    return this._parseOptionalJson(\n      this._store.getTabState(tab)\n    );\n  },\n\n  /**\n   * Returns all tab groups with additional information.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @returns {Object}\n   */\n  _getGroupsData: function(chromeWindow) {\n    return this._parseOptionalJson(\n      this._store.getWindowValue(chromeWindow, \"tabview-group\")\n    );\n  },\n\n  /**\n   * Set group information for the given window.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {Object} data\n   * @returns {Object}\n   */\n  _setGroupsData: function(chromeWindow, data) {\n    this._stopTabView(chromeWindow);\n    this._store.setWindowValue(\n      chromeWindow,\n      \"tabview-group\",\n      JSON.stringify(data)\n    );\n  },\n\n  /**\n   * Returns the current group as well as the next group ID and the total\n   * number of groups.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @returns {Object}\n   */\n  _getCurrentGroupData: function(chromeWindow) {\n    let data = this._parseOptionalJson(\n      this._store.getWindowValue(chromeWindow, \"tabview-groups\")\n    );\n\n    if (Object.keys(data).length == 0) {\n      data = {\n        activeGroupId: 1,\n        nextID: 1,\n        totalNumber: 0\n      };\n    }\n\n    return data;\n  },\n\n  /**\n   * Stores information about the current session.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {Object} data\n   * @returns {Object}\n   */\n  _setCurrentGroupData: function(chromeWindow, data) {\n    this._stopTabView(chromeWindow);\n    this._store.setWindowValue(\n      chromeWindow,\n      \"tabview-groups\",\n      JSON.stringify(data)\n    );\n  },\n\n  /**\n   * Deinitializes the TabView frame from the Tab Groups add-on, so that it\n   * reconstructs any changed data by us properly when it is accessed again.\n   * The _deinitFrame method only exists with that add-on enabled, and it\n   * will no-op if the frame isn't already initialized.\n   *\n   * @param {ChromeWindow} chromeWindow\n   */\n  _stopTabView: function(chromeWindow) {\n    if (chromeWindow.TabView && chromeWindow.TabView._deinitFrame) {\n      chromeWindow.TabView._deinitFrame();\n    }\n  },\n\n  /**\n   * Safely parses a JSON string.\n   *\n   * @param {String} jsonString - JSON encoded data\n   * @returns {Object} decoded JSON data or an empty object if something failed\n   */\n  _parseOptionalJson: function(jsonString) {\n    if (jsonString) {\n      try {\n        return JSON.parse(jsonString);\n      } catch (e) {\n        return {};\n      }\n    }\n    return {};\n  }\n};\n\nexports.SessionStorage = SessionStorage;\n"
  },
  {
    "path": "src/lib/tabmanager.js",
    "content": "const TabsUtils = require(\"sdk/tabs/utils\");\n\nfunction TabManager(storage) {\n  this._storage = storage;\n}\n\nTabManager.prototype = {\n  /**\n   * Returns all groups with their tabs.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @returns {Object}\n   */\n  getGroupsWithTabs: function(chromeWindow, sort) {\n    let groups = this._storage.getGroups(chromeWindow);\n    let tabs = this._storage.getTabs(chromeWindow);\n\n    let retGroups = groups.map((group) => {\n      return Object.assign({}, group, {\n        tabs: tabs.filter((tab) => {\n          return tab.group == group.id;\n        })\n      });\n    });\n\n    if (sort) {\n      retGroups.sort((a, b) => {\n        if (a.title.toLowerCase() == b.title.toLowerCase()) {\n          return 0;\n        }\n\n        return a.title.toLowerCase() < b.title.toLowerCase() ? -1 : 1;\n      });\n    }\n\n    return retGroups;\n  },\n\n  /**\n   * Selects a given tab.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {TabBrowser} tabBrowser\n   * @param {Number} index - the tabs index\n   * @param {Number} groupID - the tabs groupID\n   */\n  selectTab: function(chromeWindow, tabBrowser, index, groupID) {\n    let currentGroup = this._storage.getCurrentGroup(chromeWindow);\n\n    if (currentGroup == groupID) {\n      tabBrowser.selectedTab = tabBrowser.tabs[index];\n    } else {\n      this.selectGroup(chromeWindow, tabBrowser, groupID, index);\n    }\n  },\n\n  /**\n   * Move tab beetwen groups\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {TabBrowser} tabBrowser\n   * @param {Number} tabIndex - the tabs index\n   * @param {Number} targetGroupID - target groupID (where to move tab)\n   */\n  moveTabToGroup: function(chromeWindow, tabBrowser, tabIndex, targetGroupID) {\n    let tab = tabBrowser.tabs[tabIndex];\n    if (tab.groupID === targetGroupID) {\n      return;\n    }\n    this._storage.setTabGroup(tab, targetGroupID);\n    if (tab.selected) {\n      this.selectGroup(chromeWindow, tabBrowser, targetGroupID);\n    }\n  },\n\n  /**\n   * Selects a given group.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {TabBrowser} tabBrowser\n   * @param {Number} groupID - the groupID\n   * @param {Number} tabIndex - the tab to activate\n   */\n  selectGroup: function(chromeWindow, tabBrowser, groupID, tabIndex = 0) {\n    let currentGroup = this._storage.getCurrentGroup(chromeWindow);\n    if (currentGroup == groupID) {\n      return;\n    }\n\n    this.updateCurrentSelectedTab(chromeWindow);\n\n    let lastSelected = this._storage.getGroupSelectedIndex(chromeWindow, groupID);\n    let tabs = this._storage.getTabIndexesByGroup(tabBrowser, groupID);\n\n    let selectedTab;\n    if (tabs.length == 0) {\n      selectedTab = tabBrowser.addTab(\"about:newtab\");\n      this._storage.setTabGroup(selectedTab, groupID);\n      tabs.push(selectedTab);\n    } else if (tabIndex) {\n      selectedTab = tabBrowser.tabs[tabIndex];\n    } else {\n      selectedTab = tabBrowser.tabs[lastSelected < tabs.length ? tabs[lastSelected] : tabs[0]];\n    }\n\n    this._storage.setCurrentGroup(chromeWindow, groupID);\n    tabBrowser.selectedTab = selectedTab;\n\n    tabBrowser.showOnlyTheseTabs(tabs.map((tab) => {\n      return tabBrowser.tabs[tab];\n    }));\n  },\n\n  /**\n   * Selects the next or previous group in the list\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {Number} direction\n   */\n  selectNextPrevGroup: function(chromeWindow, tabBrowser, direction) {\n    let currentGroup = this._storage.getCurrentGroup(chromeWindow);\n    let groups = this._storage.getGroups(chromeWindow);\n    if (groups.length == 0) {\n      return;\n    }\n\n    let index = groups.findIndex((group) => {\n      return group.id == currentGroup;\n    });\n\n    if (index == -1) {\n      return;\n    }\n\n    index = (index + direction + groups.length) % groups.length;\n    this.selectGroup(chromeWindow, tabBrowser, groups[index].id);\n  },\n\n  /**\n   * Updates the currently selected index for the given window\n   *\n   * @param {ChromeWindow} chromeWindow\n   */\n  updateCurrentSelectedTab: function(chromeWindow) {\n    let tabs = this._storage.getTabs(chromeWindow);\n    let curtab = tabs.find((tab) => {\n      return tab.active;\n    });\n\n    if (curtab) {\n      let curindex = tabs.filter((tab) => {\n        return tab.group == curtab.group;\n      }).indexOf(curtab);\n\n      this._storage.setGroupSelectedIndex(chromeWindow, curtab.group, curindex);\n    }\n  },\n\n  /**\n   * Updates the currently selected group based on the active tab\n   *\n   * @param {ChromwWindow} chromeWindow\n   */\n  updateCurrentSelectedGroup: function(chromeWindow) {\n    let tabs = this._storage.getTabs(chromeWindow);\n    let curtab = tabs.find((tab) => {\n      return tab.active;\n    });\n\n    if (curtab) {\n      let currentGroupID = this._storage.getCurrentGroup(chromeWindow);\n      if (currentGroupID && curtab.group !== currentGroupID) {\n        this.selectGroup(chromeWindow, TabsUtils.getTabBrowser(chromeWindow), curtab.group, tabs.indexOf(curtab));\n      }\n    }\n  },\n\n  /**\n   * Renames a given group.\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {Number} groupID - the groupID\n   * @param {String} title - the new title\n   */\n  renameGroup: function(chromeWindow, groupID, title) {\n    this._storage.renameGroup(chromeWindow, groupID, title);\n  },\n\n  /**\n   * Adds a blank group\n   *\n   * @param {ChromeWindow} chromeWindow\n   */\n  addGroup: function(chromeWindow) {\n    this._storage.addGroup(chromeWindow);\n  },\n\n  /**\n   * Adds a group with associated tab\n   *\n   * @param {ChromeWindow} chromeWindow\n   * @param {TabBrowser} tabBrowser\n   * @param {Number} tabIndex - the tab to place into group\n   */\n  addGroupWithTab: function(chromeWindow, tabBrowser, tabIndex) {\n    this._storage.addGroup(chromeWindow);\n    let group = this.getRecentlyAddedGroup(chromeWindow);\n    this.moveTabToGroup(\n      chromeWindow,\n      tabBrowser,\n      tabIndex,\n      group.id\n    );\n  },\n\n  /**\n   * Return recently added group\n   *\n   * @param {ChromeWindow} chromeWindow\n   */\n  getRecentlyAddedGroup: function(chromeWindow) {\n    let currentGoups = this._storage.getGroups(chromeWindow);\n    let recentlyAddedGroup = null;\n    if (currentGoups.length > 0) {\n      recentlyAddedGroup = currentGoups[currentGoups.length - 1];\n    }\n    return recentlyAddedGroup;\n  },\n\n  /**\n   * Closes a group and all attached tabs\n   *\n   * @param {Number} groupID - the groupID\n   */\n  closeGroup: function(chromeWindow, tabBrowser, groupID) {\n    this._storage.removeGroup(chromeWindow, groupID);\n\n    let currentGroup = this._storage.getCurrentGroup(chromeWindow);\n    if (currentGroup == groupID) {\n      let remainingGroups = this._storage.getGroups(chromeWindow);\n      this.selectGroup(chromeWindow, tabBrowser, remainingGroups[0].id);\n    }\n\n    this._storage.removeGroupTabs(tabBrowser, groupID);\n  }\n};\n\nexports.TabManager = TabManager;\n"
  },
  {
    "path": "src/lib/utils.js",
    "content": "const _ = require(\"sdk/l10n\").get;\nconst PrefService = require(\"sdk/preferences/service\");\n\n/**\n * Returns an object of translated strings for the use in the frontend.\n *\n * @param {Array} keys - l10n keys\n * @returns {Object}\n */\nexports.getL10nStrings = function(keys) {\n  let returnStrings = {};\n\n  for (let key of keys) {\n    returnStrings[key] = _(key);\n  }\n\n  return returnStrings;\n};\n\nfunction isDarkTheme() {\n  let currentTheme = PrefService.get(\"lightweightThemes.selectedThemeID\");\n  switch (currentTheme) {\n    case \"firefox-compact-dark@mozilla.org\":\n      return true;\n    case \"firefox-devedition@mozilla.org\":\n      let devtoolsTheme = PrefService.get(\"devtools.theme\");\n      return devtoolsTheme == \"dark\";\n    default:\n      return false;\n  }\n}\n\n/**\n * Used to switch stuff by the current design.\n *\n * @param {Object} object - object with .light and .dark\n * @returns {Object} input.dark if a dark theme is used, .light otherwise\n */\nexports.themeSwitch = function(object) {\n  return isDarkTheme() ? object.dark : object.light;\n};\n"
  },
  {
    "path": "src/locale/de-DE.properties",
    "content": "bindPanoramaShortcut_title = Strg/Cmd-Umschalt-E verwenden\nenableAlphabeticSort_title = Alphabetische Sortierung\n\nadd_group = Neue Gruppe anlegen\npanelButton_label = Tabs gruppieren\nunnamed_group = Unbenannte Gruppe\n"
  },
  {
    "path": "src/locale/en-US.properties",
    "content": "bindPanoramaShortcut_title = Listen to Ctrl/Cmd-Shift-E\nenableAlphabeticSort_title = Enable alphabetic sorting\ngroupUndoCloseTimeout_title = Closing group delay\ngroupUndoCloseTimeout_description = Delay in seconds to wait before the group gets actually closed.\n\nadd_group = Create new group\npanelButton_label = Group Tabs\nunnamed_group = Unnamed Group\nclose_group_prompt_title = Close group\nclose_group_prompt_message = Do you want to close this group?\n"
  },
  {
    "path": "src/locale/es-AR.properties",
    "content": "bindPanoramaShortcut_title = Escuchar el atajo de teclado Ctrl/Cmd-Shift-E\nenableAlphabeticSort_title = Habilitar orden alfabético\ngroupUndoCloseTimeout_title = Retardo al cerrar un grupo\ngroupUndoCloseTimeout_description = Tiempo de espera en segundos antes de cerrar el grupo.\n\nadd_group = Crear nuevo grupo\npanelButton_label = Grupos de Pestañas\nunnamed_group = Grupo sin nombre\nclose_group_prompt_title = Cerrar grupo\nclose_group_prompt_message = ¿Está seguro de querer cerrar este grupo?\n"
  },
  {
    "path": "src/locale/es-ES.properties",
    "content": "bindPanoramaShortcut_title = Escuchar el atajo de teclado Ctrl/Cmd-Shift-E\nenableAlphabeticSort_title = Habilitar orden alfabético\ngroupUndoCloseTimeout_title = Retardo al cerrar un grupo\ngroupUndoCloseTimeout_description = Tiempo de espera en segundos antes de cerrar el grupo.\n\nadd_group = Crear nuevo grupo\npanelButton_label = Grupos de Pestañas\nunnamed_group = Grupo sin nombre\nclose_group_prompt_title = Cerrar grupo\nclose_group_prompt_message = ¿Quieres cerrar este grupo?\n"
  },
  {
    "path": "src/locale/fr-FR.properties",
    "content": "bindPanoramaShortcut_title = Utiliser le raccourci Ctrl/Cmd-Maj-E\nenableAlphabeticSort_title = Activer le tri alphabétique\ngroupUndoCloseTimeout_title = Délai de fermeture du groupe\ngroupUndoCloseTimeout_description = Délai d'attente (en secondes) avant la fermeture effective du groupe.\n\nadd_group = Ajouter un groupe\npanelButton_label = Groupes d'onglets\nunnamed_group = Groupe sans nom\nclose_group_prompt_title = Fermer le groupe\nclose_group_prompt_message = Voulez-vous fermer ce groupe ?\n"
  },
  {
    "path": "src/locale/nl-NL.properties",
    "content": "bindPanoramaShortcut_title = Sneltoets Ctrl/Cmd-Shift-E activeren\nenableAlphabeticSort_title = Alfabetische sortering activeren\ngroupUndoCloseTimeout_title = Vertraging op sluiten van groepen\ngroupUndoCloseTimeout_description = Vertraging in seconden waarna de groep gesloten zal worden\n\nadd_group = Nieuwe groep toevoegen\npanelButton_label = Tabbladen groeperen\nunnamed_group = Niet-benoemde groep\nclose_group_prompt_title = Groep sluiten\nclose_group_prompt_message = Wilt u deze groep sluiten?\n"
  },
  {
    "path": "src/package.json",
    "content": "{\n  \"id\": \"tabgroups@schub.io\",\n  \"name\": \"tabgroups\",\n  \"version\": \"0.6.0-dev\",\n  \"title\": \"Simplified Tab Groups\",\n  \"description\": \"An add-on to replace the removed TabView/TabGroups/Panorama.\",\n  \"author\": \"Dennis Schubert <mozilla@dennis-schubert.de>\",\n  \"license\": \"MIT\",\n  \"main\": \"index.js\",\n  \"icon\": \"chrome://simplified-tabgroups/content/icons/extension-32.png\",\n  \"permissions\": {\n    \"private-browsing\": true\n  },\n  \"preferences\": [\n    {\n      \"name\": \"bindPanoramaShortcut\",\n      \"title\": \"Listen to Ctrl/Cmd-Shift-E\",\n      \"type\": \"bool\",\n      \"value\": true\n    },\n    {\n      \"name\": \"bindNavigationShortcut\",\n      \"title\": \"Listen to Ctrl-~ and Ctrl-Shift-~\",\n      \"type\": \"bool\",\n      \"value\": true\n    },\n    {\n      \"name\": \"enableAlphabeticSort\",\n      \"title\": \"Enable alphabetic sorting\",\n      \"type\": \"bool\",\n      \"value\": false\n    },\n    {\n      \"name\": \"groupCloseTimeout\",\n      \"title\": \"Closing group delay\",\n      \"description\": \"Delay in seconds to wait before the group gets actually closed.\",\n      \"type\": \"integer\",\n      \"value\": 3\n    }\n  ]\n}\n"
  }
]