summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis')
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/CHANGELOG.md144
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/LICENSE.txt357
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/SECURITY.md38
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/babel.config.js10
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.asset.php1
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.css1
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.js8
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.js.LICENSE.txt5
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.rtl.css1
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/admin-bar.scss28
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/admin.jsx58
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/style.scss4
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-identity-crisis.php1219
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-rest-endpoints.php188
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-ui.php151
15 files changed, 2213 insertions, 0 deletions
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/CHANGELOG.md b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/CHANGELOG.md
new file mode 100644
index 00000000..3039161a
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/CHANGELOG.md
@@ -0,0 +1,144 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [0.6.1] - 2022-01-11
+### Fixed
+- Do not add IDC query args to authenticated request when in offline or staging mode.
+
+## [0.6.0] - 2022-01-04
+### Added
+- Build and display the new RNA IDC banner.
+
+### Changed
+- Switch to pcov for code coverage.
+- Updated package dependencies.
+- Updated package textdomain from `jetpack` to `jetpack-idc`.
+- Updated references to '.jp-recommendations__app-badge' to its new name '.apps-badge'
+
+## [0.5.0] - 2021-12-14
+### Added
+- Add a method to determine the safe mode status.
+
+### Changed
+- Updated package dependencies.
+
+## [0.4.4] - 2021-11-30
+### Changed
+- Colors: update Jetpack Primary color to match latest brand book.
+- Remove now-redundant `output.filename` from Webpack config.
+
+## [0.4.3] - 2021-11-23
+### Changed
+- Updated package dependencies.
+
+## [0.4.2] - 2021-11-17
+
+## [0.4.1] - 2021-11-16
+### Added
+- Use monorepo `validate-es` script to validate Webpack builds.
+
+### Changed
+- Updated package dependencies
+
+## [0.4.0] - 2021-11-09
+### Added
+- Add a method to unambiguously determine whether the site is experiencing identity crisis.
+
+### Changed
+- Updated package dependencies.
+- Update webpack build config. Removes IE 11 support in the JavaScript.
+
+## [0.3.1] - 2021-11-02
+### Changed
+- Add the idc url query args to remote requests
+- Set `convertDeprecationsToExceptions` true in PHPUnit config.
+- Update PHPUnit configs to include just what needs coverage rather than include everything then try to exclude stuff that doesn't.
+
+## [0.3.0] - 2021-10-26
+### Added
+- Add redirect_uri parameter for IDC Start Fresh endpoint.
+- Delete the migrate_for_idc option when a remote request returns migrated_for_idc
+
+### Changed
+- Updated package dependencies
+
+## [0.2.8] - 2021-10-13
+### Changed
+- Updated package dependencies.
+
+## [0.2.7] - 2021-10-12
+### Added
+- Add the new check_response_for_idc method to the Identity_Crisis class
+
+### Changed
+- Updated package dependencies
+
+## [0.2.6] - 2021-09-28
+### Changed
+- Allow Node ^14.17.6 to be used in this project. This shouldn't change the behavior of the code itself.
+- IDC: Rename the Identity_Crisis::sync_idc_optin method to Identity_Crisis:should_handle_idc. Add a new filter and constant that use the new name.
+- Updated package dependencies.
+
+## [0.2.5] - 2021-08-31
+### Changed
+- Updated package dependencies.
+
+## [0.2.4] - 2021-08-30
+### Changed
+- Bump changelogger version
+- Tests: update PHPUnit polyfills dependency (yoast/phpunit-polyfills).
+- update annotations versions
+- Update to latest webpack, webpack-cli and calypso-build
+- Use Node 16.7.0 in tooling. This shouldn't change the behavior of the code itself.
+
+## [0.2.3] - 2021-08-12
+### Changed
+- Updated package dependencies
+
+## [0.2.2] - 2021-07-27
+### Added
+- Add jetpack_connection_disconnect_site_wpcom filter.
+
+## [0.2.1] - 2021-07-13
+### Changed
+- Updated package dependencies.
+
+## [0.2.0] - 2021-06-29
+### Added
+- Add jetpack_idc_disconnect hook to properly disconnect based on IDC settings and clear IDC options.
+
+### Changed
+- Migrate jetpack/v4/identity-crisis endpoints into package.
+- Update node version requirement to 14.16.1
+
+## 0.1.0 - 2021-06-15
+### Added
+- Sync: Adding the Identity_Crisis package.
+
+### Changed
+- Updated package dependencies.
+- Use Connection/Urls for home_url and site_url functions migrated from Sync.
+
+[0.6.1]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.6.0...v0.6.1
+[0.6.0]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.5.0...v0.6.0
+[0.5.0]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.4.4...v0.5.0
+[0.4.4]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.4.3...v0.4.4
+[0.4.3]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.4.2...v0.4.3
+[0.4.2]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.4.1...v0.4.2
+[0.4.1]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.4.0...v0.4.1
+[0.4.0]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.3.1...v0.4.0
+[0.3.1]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.3.0...v0.3.1
+[0.3.0]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.2.8...v0.3.0
+[0.2.8]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.2.7...v0.2.8
+[0.2.7]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.2.6...v0.2.7
+[0.2.6]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.2.5...v0.2.6
+[0.2.5]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.2.4...v0.2.5
+[0.2.4]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.2.3...v0.2.4
+[0.2.3]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.2.2...v0.2.3
+[0.2.2]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.2.1...v0.2.2
+[0.2.1]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.2.0...v0.2.1
+[0.2.0]: https://github.com/Automattic/jetpack-identity-crisis/compare/v0.1.0...v0.2.0
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/LICENSE.txt b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/LICENSE.txt
new file mode 100644
index 00000000..e82774c1
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/LICENSE.txt
@@ -0,0 +1,357 @@
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+===================================
+
+
+GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+ Preamble
+
+The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices
+stating that you changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in
+whole or in part contains or is derived from the Program or any
+part thereof, to be licensed as a whole at no charge to all third
+parties under the terms of this License.
+
+c) If the modified program normally reads commands interactively
+when run, you must cause it, when started running for such
+interactive use in the most ordinary way, to print or display an
+announcement including an appropriate copyright notice and a
+notice that there is no warranty (or else, saying that you provide
+a warranty) and that users may redistribute the program under
+these conditions, and telling the user how to view a copy of this
+License. (Exception: if the Program itself is interactive but
+does not normally print such an announcement, your work based on
+the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable
+source code, which must be distributed under the terms of Sections
+1 and 2 above on a medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three
+years, to give any third party, for a charge no more than your
+cost of physically performing source distribution, a complete
+machine-readable copy of the corresponding source code, to be
+distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange; or,
+
+c) Accompany it with the information you received as to the offer
+to distribute corresponding source code. (This alternative is
+allowed only for noncommercial distribution and only if you
+received the program in object code or executable form with such
+an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+<one line to give the program's name and a brief idea of what it does.>
+Copyright (C) <year> <name of author>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+`Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+<signature of Ty Coon>, 1 April 1989
+Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/SECURITY.md b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/SECURITY.md
new file mode 100644
index 00000000..b4b46c0e
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/SECURITY.md
@@ -0,0 +1,38 @@
+# Security Policy
+
+Full details of the Automattic Security Policy can be found on [automattic.com](https://automattic.com/security/).
+
+## Supported Versions
+
+Generally, only the latest version of Jetpack has continued support. If a critical vulnerability is found in the current version of Jetpack, we may opt to backport any patches to previous versions.
+
+## Reporting a Vulnerability
+
+[Jetpack](https://jetpack.com/) is an open-source plugin for WordPress. Our HackerOne program covers the plugin software, as well as a variety of related projects and infrastructure.
+
+**For responsible disclosure of security issues and to be eligible for our bug bounty program, please submit your report via the [HackerOne](https://hackerone.com/automattic) portal.**
+
+Our most critical targets are:
+
+* Jetpack and the Jetpack composer packages (all within this repo)
+* Jetpack.com -- the primary marketing site.
+* cloud.jetpack.com -- a management site.
+* wordpress.com -- the shared management site for both Jetpack and WordPress.com sites.
+
+For more targets, see the `In Scope` section on [HackerOne](https://hackerone.com/automattic).
+
+_Please note that the **WordPress software is a separate entity** from Automattic. Please report vulnerabilities for WordPress through [the WordPress Foundation's HackerOne page](https://hackerone.com/wordpress)._
+
+## Guidelines
+
+We're committed to working with security researchers to resolve the vulnerabilities they discover. You can help us by following these guidelines:
+
+* Follow [HackerOne's disclosure guidelines](https://www.hackerone.com/disclosure-guidelines).
+* Pen-testing Production:
+ * Please **setup a local environment** instead whenever possible. Most of our code is open source (see above).
+ * If that's not possible, **limit any data access/modification** to the bare minimum necessary to reproduce a PoC.
+ * **_Don't_ automate form submissions!** That's very annoying for us, because it adds extra work for the volunteers who manage those systems, and reduces the signal/noise ratio in our communication channels.
+ * To be eligible for a bounty, all of these guidelines must be followed.
+* Be Patient - Give us a reasonable time to correct the issue before you disclose the vulnerability.
+
+We also expect you to comply with all applicable laws. You're responsible to pay any taxes associated with your bounties.
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/babel.config.js b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/babel.config.js
new file mode 100644
index 00000000..d730e3e8
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/babel.config.js
@@ -0,0 +1,10 @@
+const config = {
+ presets: [
+ [
+ '@automattic/jetpack-webpack-config/babel/preset',
+ { pluginReplaceTextdomain: { textdomain: 'jetpack-idc' } },
+ ],
+ ],
+};
+
+module.exports = config;
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.asset.php b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.asset.php
new file mode 100644
index 00000000..4ed4784a
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.asset.php
@@ -0,0 +1 @@
+<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '472c28cf4d566875562ae0cb3c2e44b1'); \ No newline at end of file
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.css b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.css
new file mode 100644
index 00000000..ea21ba25
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.css
@@ -0,0 +1 @@
+#wp-admin-bar-jetpack-idc.hide{display:none}#wp-admin-bar-jetpack-idc .jp-idc-admin-bar{background:#fff;border-radius:2px;color:#1d2327;font-size:12px;padding:4px 8px}#wpadminbar #wp-admin-bar-jetpack-idc .dashicons{color:#1d2327;font-family:dashicons}#wpadminbar #wp-admin-bar-jetpack-idc .dashicons:before{font-size:16px}#wpadminbar #wp-admin-bar-jetpack-idc:hover .ab-item{background:inherit}#wpadminbar #wp-admin-bar-jetpack-idc:hover .jp-idc-admin-bar{background:#f0f0f1}#jp-identity-crisis-container .jp-idc__idc-screen{margin-bottom:40px;margin-top:40px}.jp-idc__idc-screen{background:#fff;border-left:4px solid #e68b28;border-radius:4px;box-shadow:0 0 40px rgba(0,0,0,.04);box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;margin:0 auto;max-width:1128px;padding:10px}.jp-idc__idc-screen.jp-idc__idc-screen__success{border-color:#069e08}@media(min-width:600px){.jp-idc__idc-screen{padding:48px}}.jp-idc__idc-screen .jp-idc__idc-screen__header{align-items:center;display:flex}.jp-idc__idc-screen .jp-idc__idc-screen__header .jp-idc__idc-screen__logo-image{max-height:100px;max-width:100px}.jp-idc__idc-screen .jp-idc__idc-screen__header .jp-idc__idc-screen__logo-label{font-size:14px;line-height:22px;margin:-7px 0 0 8px}.jp-idc__idc-screen h2{font-size:24px;font-weight:600;line-height:28px;margin:32px 0 0}.jp-idc__idc-screen h3{font-size:20px;font-weight:600;line-height:28px;margin:24px 0 0}.jp-idc__idc-screen p{color:#2c3338;font-size:16px;line-height:24px;margin:16px 0 0;max-width:710px}.jp-idc__idc-screen a{color:#2c3338}.jp-idc__idc-screen .jp-idc__idc-screen__cards{align-items:center;display:flex;flex-direction:column;flex-wrap:wrap}@media only screen and (min-width:1403px){.jp-idc__idc-screen .jp-idc__idc-screen__cards{align-items:normal;flex-direction:row}}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__cards-separator{align-self:center;color:#23282d;font-size:20px;font-weight:600;line-height:28px;margin:0 24px}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base{border:1px solid #c3c4c7;border-radius:4px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:space-between;margin:24px 0;max-width:100%;padding:10px;width:480px}@media(min-width:600px){.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base{padding:24px}}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base h4{font-size:20px;font-weight:400;line-height:28px;margin:0 0 8px}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base p{margin:0 0 24px}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base .jp-idc__idc-screen__card-action-sitename{background:#f9f9f6;border-radius:33px;box-sizing:border-box;color:#2c3338;font-size:16px;font-weight:700;line-height:24px;overflow-wrap:anywhere;padding:16px;text-align:center;width:100%}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base .jp-idc__idc-screen__card-action-separator{display:block;margin:12px auto}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base .jp-idc__idc-screen__card-action-button{padding:8px 24px;width:100%}.jp-idc__idc-screen .jp-idc__idc-screen__card-action-button{background:#000;border-radius:4px;color:#fff;font-size:16px;font-weight:600;height:auto;justify-content:center;line-height:24px;margin-top:24px;min-height:40px;padding:8px}.jp-idc__idc-screen .jp-idc__idc-screen__card-action-button-migrated{margin-top:64px;width:141px}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated{align-items:center;display:flex;flex-direction:column;flex-wrap:wrap;margin-top:24px;width:100%}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-hostname{border:1px solid #c3c4c7;border-radius:4px;color:#2c3338;flex-grow:1;font-size:16px;font-weight:700;line-height:24px;padding:24px;width:100%}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator-wide{display:none}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator{display:block}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator,.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator-wide{margin:28px}@media only screen and (min-width:1400px){.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated{flex-direction:row;width:auto}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator{display:none}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator-wide{display:block}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-hostname{width:auto}}@keyframes rotate-spinner{to{transform:rotate(1turn)}}.jp-components-spinner{align-items:center;display:flex}.jp-components-spinner__inner,.jp-components-spinner__outer{animation:3s linear infinite;animation-name:rotate-spinner;border:.1em solid transparent;border-radius:50%;box-sizing:border-box;margin:auto}.jp-components-spinner__outer{border-top-color:#fff}.jp-components-spinner__inner{border-right-color:#fff;border-top-color:#fff;height:100%;opacity:.4;width:100%}:root{--font-title-large:36px;--font-title-small:24px;--font-body:16px;--font-label:12px;--jp-black:#000;--jp-black-80:#2c3338;--jp-white:#fff;--jp-white-off:#f9f9f6;--jp-gray:#dcdcde;--jp-gray-0:#f6f7f7;--jp-gray-20:#a7aaad;--jp-gray-40:#787c82;--jp-gray-50:#646970;--jp-gray-60:#50575e;--jp-gray-80:#8a2424;--jp-gray-off:#e2e2df;--jp-red-0:#f7ebec;--jp-red-50:#d63638;--jp-red-60:#b32d2e;--jp-red-80:#8a2424;--jp-red:#d63639;--jp-pink:#c9356e;--jp-green-0:#f0f2eb;--jp-green-5:#d0e6b8;--jp-green-10:#9dd977;--jp-green-20:#64ca43;--jp-green-30:#2fb41f;--jp-green-40:#069e08;--jp-green-50:#008710;--jp-green-60:#007117;--jp-green-70:#005b18;--jp-green-80:#004515;--jp-green-90:#003010;--jp-green-100:#001c09;--jp-green:#069e08;--jp-green-primary:var( --jp-green-40 );--jp-green-secondary:var( --jp-green-30 );--jp-border-radius:4px;--jp-menu-border-height:1px;--jp-underline-thickness:2px}*{box-sizing:border-box}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;margin:0;min-height:100%;padding:0}.jp-wrap{align-items:center;display:flex;flex-wrap:wrap;margin:0 auto;max-width:1128px}.jp-row{grid-gap:24px;display:grid;grid-template-columns:repeat(4,1fr);margin:0 16px;width:100%}@media(min-width:600px){.jp-row{grid-template-columns:repeat(8,1fr);margin:0 18px}}@media(min-width:960px){.jp-row{grid-template-columns:repeat(12,1fr);margin:0 24px;max-width:1128px}}.sm-col-span-1{grid-column-end:span 1}.sm-col-span-2{grid-column-end:span 2}.sm-col-span-3{grid-column-end:span 3}.sm-col-span-4{grid-column-end:span 4}@media(min-width:600px){.md-col-span-1{grid-column-end:span 1}.md-col-span-2{grid-column-end:span 2}.md-col-span-3{grid-column-end:span 3}.md-col-span-4{grid-column-end:span 4}.md-col-span-5{grid-column-end:span 5}.md-col-span-6{grid-column-end:span 6}.md-col-span-7{grid-column-end:span 7}.md-col-span-8{grid-column-end:span 8}}@media(min-width:960px){.lg-col-span-1{grid-column-end:span 1}.lg-col-span-2{grid-column-end:span 2}.lg-col-span-3{grid-column-end:span 3}.lg-col-span-4{grid-column-end:span 4}.lg-col-span-5{grid-column-end:span 5}.lg-col-span-6{grid-column-end:span 6}.lg-col-span-7{grid-column-end:span 7}.lg-col-span-8{grid-column-end:span 8}.lg-col-span-9{grid-column-end:span 9}.lg-col-span-10{grid-column-end:span 10}.lg-col-span-11{grid-column-end:span 11}.lg-col-span-12{grid-column-end:span 12}}@media(max-width:960px){.md-col-span-0{display:none}}@media(max-width:600px){.sm-col-span-0{display:none}}.jp-cut{border:2px solid var(--jp-green-primary);border-radius:var(--jp-border-radius);margin:32px 0;padding:16px 64px 16px 24px;position:relative;text-decoration:none}.jp-cut,.jp-cut span{display:block}.jp-cut span:last-of-type{font-weight:600}.jp-cut:focus span:last-of-type,.jp-cut:hover span:last-of-type{text-decoration:underline;text-decoration-thickness:var(--jp-underline-thickness)}.jp-cut:focus:after,.jp-cut:hover:after{transform:translateY(-50%) translateX(8px)}.jp-cut:after{color:var(--jp-green-primary);content:"→";font-size:24px;font-weight:600;position:absolute;right:24px;top:50%;transform:translateY(-50%);transition:transform .15s ease-out}.jp-idc__idc-screen .jp-idc__error-message{align-items:center;color:var(--jp-red);display:flex;flex-direction:row;justify-content:center;margin:15px 0}.jp-idc__idc-screen .jp-idc__error-message .error-gridicon{fill:var(--jp-red);margin-right:8px}.jp-idc__idc-screen .jp-idc__error-message a,.jp-idc__idc-screen .jp-idc__error-message span{color:var(--jp-red);font-size:var(--font-body)}.jp-idc__idc-screen .jp-idc__safe-mode .jp-idc__error-message{margin-top:5px}.jp-idc__idc-screen .jp-idc__idc-screen__cards.jp-idc__idc-screen__cards-error .jp-idc__idc-screen__card-action-base{padding-bottom:75px}.jp-idc__idc-screen .jp-idc__idc-screen__cards.jp-idc__idc-screen__cards-error .jp-idc__idc-screen__card-action-base.jp-idc__idc-screen__card-action-error{padding-bottom:5px}.jp-idc__idc-screen .jp-idc__idc-screen__cards.jp-idc__idc-screen__cards-error .jp-idc__idc-screen__card-action-base .jp-idc__error-message{height:40px}.jp-idc__idc-screen .jp-idc__safe-mode{text-align:center}.jp-idc__idc-screen .jp-idc__safe-mode .jp-idc__safe-mode__staying-safe{display:flex;justify-content:center;padding:6px}.jp-idc__idc-screen .jp-idc__safe-mode .jp-idc__safe-mode__staying-safe .jp-components-spinner{margin:0 10px}.jp-idc__idc-screen .jp-idc__safe-mode,.jp-idc__idc-screen .jp-idc__safe-mode button{color:#2c3338;font-size:16px;line-height:24px}.jp-idc__idc-screen .jp-idc__safe-mode button{padding:0;text-decoration:underline} \ No newline at end of file
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.js b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.js
new file mode 100644
index 00000000..7e9ca216
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.js
@@ -0,0 +1,8 @@
+/*! For license information please see index.js.LICENSE.txt */
+!function(){var e={7538:function(e){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},9183:function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,t.apply(this,arguments)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0},9105:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function s(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var o=s.apply(null,n);o&&e.push(o)}}else if("object"===i)if(n.toString===Object.prototype.toString)for(var a in n)r.call(n,a)&&n[a]&&e.push(a);else e.push(n.toString())}}return e.join(" ")}e.exports?(s.default=s,e.exports=s):void 0===(n=function(){return s}.apply(t,[]))||(e.exports=n)}()},5771:function(e,t,n){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))})),t.splice(s,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(1244)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},1244:function(e,t,n){e.exports=function(e){function t(e){let n,s,i,o=null;function a(...e){if(!a.enabled)return;const r=a,s=Number(new Date),i=s-(n||s);r.diff=i,r.prev=n,r.curr=s,n=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,s)=>{if("%%"===n)return"%";o++;const i=t.formatters[s];if("function"==typeof i){const t=e[o];n=i.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(s!==t.namespaces&&(s=t.namespaces,i=t.enabled(e)),i),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(s),...t.skips.map(s).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(n=0;n<s;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(2002),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},6212:function(){},4943:function(){},8911:function(){},2780:function(){},2002:function(e){var t=1e3,n=60*t,r=60*n,s=24*r,i=7*s,o=365.25*s;function a(e,t,n,r){var s=t>=1.5*n;return Math.round(e/n)+" "+r+(s?"s":"")}e.exports=function(e,c){c=c||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*s;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return c.long?function(e){var i=Math.abs(e);if(i>=s)return a(e,i,s,"day");if(i>=r)return a(e,i,r,"hour");if(i>=n)return a(e,i,n,"minute");if(i>=t)return a(e,i,t,"second");return e+" ms"}(e):function(e){var i=Math.abs(e);if(i>=s)return Math.round(e/s)+"d";if(i>=r)return Math.round(e/r)+"h";if(i>=n)return Math.round(e/n)+"m";if(i>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},9587:function(e,t,n){"use strict";var r=n(5843);function s(){}function i(){}i.resetWarningCache=s,e.exports=function(){function e(e,t,n,s,i,o){if(o!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:s};return n.PropTypes=n,n}},1268:function(e,t,n){e.exports=n(9587)()},5843:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},816:function(e,t,n){"use strict";var r=n(5771),s=n.n(r),i=n(2819);const o=s()("dops:analytics");let a,c;window._tkq=window._tkq||[],window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;const l={initialize:function(e,t,n){l.setUser(e,t),l.setSuperProps(n),l.identifyUser()},setGoogleAnalyticsEnabled:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.googleAnalyticsEnabled=e,this.googleAnalyticsKey=t},setMcAnalyticsEnabled:function(e){this.mcAnalyticsEnabled=e},setUser:function(e,t){c={ID:e,username:t}},setSuperProps:function(e){a=e},mc:{bumpStat:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&x_"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);o("Bumping stats %o",e)}else n="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(t),o('Bumping stat "%s" in group "%s"',t,e);return n}(e,t);this.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+n+"&t="+Math.random())},bumpStatWithPageView:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);o("Built stats %o",e)}else n="&"+encodeURIComponent(e)+"="+encodeURIComponent(t),o('Built stat "%s" in group "%s"',t,e);return n}(e,t);this.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom"+n+"&t="+Math.random())}},pageView:{record:function(e,t){l.tracks.recordPageView(e),l.ga.recordPageView(e,t)}},purchase:{record:function(e,t,n,r,s,i,o){l.ga.recordPurchase(e,t,n,r,s,i,o)}},tracks:{recordEvent:function(e,t){t=t||{},0===e.indexOf("akismet_")||0===e.indexOf("jetpack_")?(a&&(o("- Super Props: %o",a),t=(0,i.assign)(t,a)),o('Record event "%s" called with props %s',e,JSON.stringify(t)),window._tkq.push(["recordEvent",e,t])):o('- Event name must be prefixed by "akismet_" or "jetpack_"')},recordJetpackClick:function(e){const t="object"==typeof e?e:{target:e};l.tracks.recordEvent("jetpack_wpa_click",t)},recordPageView:function(e){l.tracks.recordEvent("akismet_page_view",{path:e})},setOptOut:function(e){o("Pushing setOptOut: %o",e),window._tkq.push(["setOptOut",e])}},ga:{initialized:!1,initialize:function(){let e={};l.ga.initialized||(c&&(e={userId:"u-"+c.ID}),window.ga("create",this.googleAnalyticsKey,"auto",e),l.ga.initialized=!0)},recordPageView:function(e,t){l.ga.initialize(),o("Recording Page View ~ [URL: "+e+"] [Title: "+t+"]"),this.googleAnalyticsEnabled&&(window.ga("set","page",e),window.ga("send",{hitType:"pageview",page:e,title:t}))},recordEvent:function(e,t,n,r){l.ga.initialize();let s="Recording Event ~ [Category: "+e+"] [Action: "+t+"]";void 0!==n&&(s+=" [Option Label: "+n+"]"),void 0!==r&&(s+=" [Option Value: "+r+"]"),o(s),this.googleAnalyticsEnabled&&window.ga("send","event",e,t,n,r)},recordPurchase:function(e,t,n,r,s,i,o){window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",{id:e,revenue:r,currency:o}),window.ga("ecommerce:addItem",{id:e,name:t,sku:n,price:s,quantity:i}),window.ga("ecommerce:send")}},identifyUser:function(){c&&window._tkq.push(["identifyUser",c.ID,c.username])},setProperties:function(e){window._tkq.push(["setProperties",e])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}};t.Z=l},9570:function(e,t,n){"use strict";var r=n(2819),s=n(6483),i=n(6251);function o(e){class t extends Error{constructor(){super(...arguments),this.name=e}}return t}const a=o("JsonParseError"),c=o("JsonParseAfterRedirectError"),l=o("Api404Error"),u=o("Api404AfterRedirectError"),d=o("FetchNetworkError");const p=new function(e,t){let n=e,o={"X-WP-Nonce":t},a={credentials:"same-origin",headers:o},c={method:"post",credentials:"same-origin",headers:(0,r.assign)({},o,{"Content-type":"application/json"})},l=function(e){const t=e.split("?"),n=t.length>1?t[1]:"",r=n.length?n.split("&"):[];return r.push("_cacheBuster="+(new Date).getTime()),t[0]+"?"+r.join("&")};const u={setApiRoot(e){n=e},setApiNonce(e){o={"X-WP-Nonce":e},a={credentials:"same-origin",headers:o},c={method:"post",credentials:"same-origin",headers:(0,r.assign)({},o,{"Content-type":"application/json"})}},setCacheBusterCallback:e=>{l=e},registerSite:(e,t)=>{const r={registration_nonce:e,no_iframe:!0};return(0,i.jetpackConfigHas)("consumer_slug")&&(r.plugin_slug=(0,i.jetpackConfigGet)("consumer_slug")),null!==t&&(r.redirect_uri=t),p(`${n}jetpack/v4/connection/register`,c,{body:JSON.stringify(r)}).then(h).then(m)},fetchAuthorizationUrl:e=>d((0,s.addQueryArgs)(`${n}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:e}),a).then(h).then(m),fetchSiteConnectionData:()=>d(`${n}jetpack/v4/connection/data`,a).then(m),fetchSiteConnectionStatus:()=>d(`${n}jetpack/v4/connection`,a).then(m),fetchSiteConnectionTest:()=>d(`${n}jetpack/v4/connection/test`,a).then(h).then(m),fetchUserConnectionData:()=>d(`${n}jetpack/v4/connection/data`,a).then(m),fetchUserTrackingSettings:()=>d(`${n}jetpack/v4/tracking/settings`,a).then(h).then(m),updateUserTrackingSettings:e=>p(`${n}jetpack/v4/tracking/settings`,c,{body:JSON.stringify(e)}).then(h).then(m),disconnectSite:()=>p(`${n}jetpack/v4/connection`,c,{body:JSON.stringify({isActive:!1})}).then(h).then(m),fetchConnectUrl:()=>d(`${n}jetpack/v4/connection/url`,a).then(h).then(m),unlinkUser:()=>p(`${n}jetpack/v4/connection/user`,c,{body:JSON.stringify({linked:!1})}).then(h).then(m),reconnect:()=>p(`${n}jetpack/v4/connection/reconnect`,c).then(h).then(m),fetchConnectedPlugins:()=>d(`${n}jetpack/v4/connection/plugins`,a).then(h).then(m),setHasSeenWCConnectionModal:()=>p(`${n}jetpack/v4/seen-wc-connection-modal`,c).then(h).then(m),fetchModules:()=>d(`${n}jetpack/v4/module/all`,a).then(h).then(m),fetchModule:e=>d(`${n}jetpack/v4/module/${e}`,a).then(h).then(m),activateModule:e=>p(`${n}jetpack/v4/module/${e}/active`,c,{body:JSON.stringify({active:!0})}).then(h).then(m),deactivateModule:e=>p(`${n}jetpack/v4/module/${e}/active`,c,{body:JSON.stringify({active:!1})}),updateModuleOptions:(e,t)=>p(`${n}jetpack/v4/module/${e}`,c,{body:JSON.stringify(t)}).then(h).then(m),updateSettings:e=>p(`${n}jetpack/v4/settings`,c,{body:JSON.stringify(e)}).then(h).then(m),getProtectCount:()=>d(`${n}jetpack/v4/module/protect/data`,a).then(h).then(m),resetOptions:e=>p(`${n}jetpack/v4/options/${e}`,c,{body:JSON.stringify({reset:!0})}).then(h).then(m),activateVaultPress:()=>p(`${n}jetpack/v4/plugins`,c,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(h).then(m),getVaultPressData:()=>d(`${n}jetpack/v4/module/vaultpress/data`,a).then(h).then(m),installPlugin:(e,t)=>{const r={slug:e,status:"active"};return t&&(r.source=t),p(`${n}jetpack/v4/plugins`,c,{body:JSON.stringify(r)}).then(h).then(m)},activateAkismet:()=>p(`${n}jetpack/v4/plugins`,c,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(h).then(m),getAkismetData:()=>d(`${n}jetpack/v4/module/akismet/data`,a).then(h).then(m),checkAkismetKey:()=>d(`${n}jetpack/v4/module/akismet/key/check`,a).then(h).then(m),checkAkismetKeyTyped:e=>p(`${n}jetpack/v4/module/akismet/key/check`,c,{body:JSON.stringify({api_key:e})}).then(h).then(m),fetchStatsData:e=>d(function(e){let t=`${n}jetpack/v4/module/stats/data`;-1!==t.indexOf("?")?t+=`&range=${encodeURIComponent(e)}`:t+=`?range=${encodeURIComponent(e)}`;return t}(e),a).then(h).then(m).then(g),getPluginUpdates:()=>d(`${n}jetpack/v4/updates/plugins`,a).then(h).then(m),getPlans:()=>d(`${n}jetpack/v4/plans`,a).then(h).then(m),fetchSettings:()=>d(`${n}jetpack/v4/settings`,a).then(h).then(m),updateSetting:e=>p(`${n}jetpack/v4/settings`,c,{body:JSON.stringify(e)}).then(h).then(m),fetchSiteData:()=>d(`${n}jetpack/v4/site`,a).then(h).then(m).then((e=>JSON.parse(e.data))),fetchSiteFeatures:()=>d(`${n}jetpack/v4/site/features`,a).then(h).then(m).then((e=>JSON.parse(e.data))),fetchSiteProducts:()=>d(`${n}jetpack/v4/site/products`,a).then(h).then(m),fetchSitePurchases:()=>d(`${n}jetpack/v4/site/purchases`,a).then(h).then(m).then((e=>JSON.parse(e.data))),fetchSiteBenefits:()=>d(`${n}jetpack/v4/site/benefits`,a).then(h).then(m).then((e=>JSON.parse(e.data))),fetchSetupQuestionnaire:()=>d(`${n}jetpack/v4/setup/questionnaire`,a).then(h).then(m),fetchRecommendationsData:()=>d(`${n}jetpack/v4/recommendations/data`,a).then(h).then(m),fetchRecommendationsProductSuggestions:()=>d(`${n}jetpack/v4/recommendations/product-suggestions`,a).then(h).then(m),fetchRecommendationsUpsell:()=>d(`${n}jetpack/v4/recommendations/upsell`,a).then(h).then(m),saveRecommendationsData:e=>p(`${n}jetpack/v4/recommendations/data`,c,{body:JSON.stringify({data:e})}).then(h),fetchProducts:()=>d(`${n}jetpack/v4/products`,a).then(h).then(m),fetchRewindStatus:()=>d(`${n}jetpack/v4/rewind`,a).then(h).then(m).then((e=>JSON.parse(e.data))),fetchScanStatus:()=>d(`${n}jetpack/v4/scan`,a).then(h).then(m).then((e=>JSON.parse(e.data))),dismissJetpackNotice:e=>p(`${n}jetpack/v4/notice/${e}`,c,{body:JSON.stringify({dismissed:!0})}).then(h).then(m),fetchPluginsData:()=>d(`${n}jetpack/v4/plugins`,a).then(h).then(m),fetchVerifySiteGoogleStatus:e=>d(null!==e?`${n}jetpack/v4/verify-site/google/${e}`:`${n}jetpack/v4/verify-site/google`,a).then(h).then(m),verifySiteGoogle:e=>p(`${n}jetpack/v4/verify-site/google`,c,{body:JSON.stringify({keyring_id:e})}).then(h).then(m),sendMobileLoginEmail:()=>p(`${n}jetpack/v4/mobile/send-login-email`,c).then(h).then(m),submitSurvey:e=>p(`${n}jetpack/v4/marketing/survey`,c,{body:JSON.stringify(e)}).then(h).then(m),saveSetupQuestionnaire:e=>p(`${n}jetpack/v4/setup/questionnaire`,c,{body:JSON.stringify(e)}).then(h).then(m),updateLicensingError:e=>p(`${n}jetpack/v4/licensing/error`,c,{body:JSON.stringify(e)}).then(h).then(m),updateLicenseKey:e=>p(`${n}jetpack/v4/licensing/set-license`,c,{body:JSON.stringify({license:e})}).then(h).then(m),getUserLicensesCounts:()=>d(`${n}jetpack/v4/licensing/user/counts`,a).then(h).then(m),updateLicensingActivationNoticeDismiss:e=>p(`${n}jetpack/v4/licensing/user/activation-notice-dismiss`,c,{body:JSON.stringify({last_detached_count:e})}).then(h).then(m),updateRecommendationsStep:e=>p(`${n}jetpack/v4/recommendations/step`,c,{body:JSON.stringify({step:e})}).then(h),confirmIDCSafeMode:()=>p(`${n}jetpack/v4/identity-crisis/confirm-safe-mode`,c).then(h),startIDCFresh:e=>p(`${n}jetpack/v4/identity-crisis/start-fresh`,c,{body:JSON.stringify({redirect_uri:e})}).then(h).then(m),migrateIDC:()=>p(`${n}jetpack/v4/identity-crisis/migrate`,c).then(h),attachLicenses:e=>p(`${n}jetpack/v4/licensing/attach-licenses`,c,{body:JSON.stringify({licenses:e})}).then(h).then(m),fetchSearchPlanInfo:()=>d(`${n}jetpack/v4/search/plan`,a).then(h).then(m),fetchSearchSettings:()=>d(`${n}jetpack/v4/search/settings`,a).then(h).then(m),updateSearchSettings:e=>p(`${n}jetpack/v4/search/settings`,c,{body:JSON.stringify(e)}).then(h).then(m)};function d(e,t){return fetch(l(e),t)}function p(e,t,n){return fetch(e,(0,r.assign)({},t,n)).catch(f)}function g(e){return e.general&&void 0===e.general.response||e.week&&void 0===e.week.response||e.month&&void 0===e.month.response?e:{}}(0,r.assign)(this,u)};function h(e){return e.status>=200&&e.status<300?e:404===e.status?new Promise((()=>{throw e.redirected?new u(e.redirected):new l})):e.json().catch((e=>g(e))).then((t=>{const n=new Error(`${t.message} (Status ${e.status})`);throw n.response=t,n.name="ApiError",n}))}function m(e){return e.json().catch((t=>g(t,e.redirected,e.url)))}function g(e,t,n){throw t?new c(n):new a}function f(){throw new d}t.ZP=p},1546:function(e,t,n){"use strict";var r=n(9183),s=n.n(r),i=n(7538),o=n.n(i),a=n(1268),c=n.n(a),l=n(9196),u=n.n(l),d=n(9105),p=n.n(d),h=n(5736);const __=h.__;class m extends u().Component{render(){const{logoColor:e,showText:t,className:n,...r}=this.props,i=t?"0 0 118 32":"0 0 32 32";return u().createElement("svg",s()({xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:i,className:p()("jetpack-logo",n),"aria-labelledby":"jetpack-logo-title"},r),u().createElement("title",{id:"jetpack-logo-title"},__("Jetpack Logo","jetpack-idc")),u().createElement("path",{fill:e,d:"M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"}),t&&u().createElement(l.Fragment,null,u().createElement("path",{d:"M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z"}),u().createElement("path",{d:"M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z"}),u().createElement("path",{d:"M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z"}),u().createElement("path",{d:"M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z"}),u().createElement("path",{d:"M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z"}),u().createElement("path",{d:"M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z"}),u().createElement("path",{d:"M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z"})))}}o()(m,"propTypes",{className:c().string,width:c().number,height:c().number,showText:c().bool,logoColor:c().string}),o()(m,"defaultProps",{className:"",height:32,showText:!0,logoColor:"#069e08"}),t.Z=m},7262:function(e,t,n){"use strict";var r=n(9196),s=n.n(r),i=n(1268),o=n.n(i);n(6212);const a=e=>{const t=e.className+" jp-components-spinner",n={width:e.size,height:e.size,fontSize:e.size,borderTopColor:e.color},r={borderTopColor:e.color,borderRightColor:e.color};return s().createElement("div",{className:t},s().createElement("div",{className:"jp-components-spinner__outer",style:n},s().createElement("div",{className:"jp-components-spinner__inner",style:r})))};a.propTypes={color:o().string,className:o().string,size:o().number},a.defaultProps={color:"#FFFFFF",className:"",size:20},t.Z=a},1415:function(e,t,n){"use strict";function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={};let r;if("undefined"!=typeof window&&(r=window.Initial_State?.calypsoEnv),0===e.search("https://")){const t=new URL(e);e=`https://${t.host}${t.pathname}`,n.url=encodeURIComponent(e)}else n.source=encodeURIComponent(e);Object.keys(t).map((e=>{n[e]=encodeURIComponent(t[e])})),!Object.keys(n).includes("site")&&"undefined"!=typeof jetpack_redirects&&jetpack_redirects.hasOwnProperty("currentSiteRawUrl")&&(n.site=jetpack_redirects.currentSiteRawUrl),r&&(n.calypso_env=r);const s=Object.keys(n).map((e=>e+"="+n[e])).join("&");return"https://jetpack.com/redirect/?"+s}n.d(t,{Z:function(){return r}})},6251:function(e,t,n){let r={};try{r=n(8510)}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),r={missingConfig:!0}}const s=e=>r.hasOwnProperty(e);e.exports={jetpackConfigHas:s,jetpackConfigGet:e=>{if(!s(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return r[e]}}},7226:function(e,t,n){"use strict";var r=n(9196),s=n.n(r),i=n(1268),o=n.n(i),a=n(5609),c=n(9818),l=n(9307),u=n(5736),d=n(1415),p=n(7262),h=n(7619),m=n(2690),g=n(2665),f=n(8086);const __=u.__,C=e=>{const{isStartingFresh:t,startFreshCallback:n,customContent:r,hasError:i}=e,o=(0,m.Z)(e.wpcomHomeUrl),g=(0,m.Z)(e.currentUrl),C=(0,c.useSelect)((e=>e(h.t).getIsActionInProgress()),[]),y=__("Create a fresh connection","jetpack-idc");return s().createElement("div",{className:"jp-idc__idc-screen__card-action-base"+(i?" jp-idc__idc-screen__card-action-error":"")},s().createElement("div",{className:"jp-idc__idc-screen__card-action-top"},s().createElement("h4",null,r.startFreshCardTitle||__("Treat each site as independent sites","jetpack-idc")),s().createElement("p",null,r.startFreshCardBodyText||(0,l.createInterpolateElement)((0,u.sprintf)(
+/* translators: %1$s: The current site domain name. %2$s: The original site domain name. */
+__("<hostname>%1$s</hostname> settings, stats, and subscribers will start fresh. <hostname>%2$s</hostname> will keep its data as is.","jetpack-idc"),g,o),{hostname:s().createElement("strong",null)}))),s().createElement("div",{className:"jp-idc__idc-screen__card-action-bottom"},s().createElement("div",{className:"jp-idc__idc-screen__card-action-sitename"},o),s().createElement(a.Dashicon,{icon:"minus",className:"jp-idc__idc-screen__card-action-separator"}),s().createElement("div",{className:"jp-idc__idc-screen__card-action-sitename"},g),s().createElement(a.Button,{className:"jp-idc__idc-screen__card-action-button",label:y,onClick:n,disabled:C},t?s().createElement(p.Z,null):y),i&&s().createElement(f.Z,null,(0,l.createInterpolateElement)(__("Could not create the connection. Retry or find out more <a>here</a>.","jetpack-idc"),{a:s().createElement("a",{href:(0,d.Z)("jetpack-support-safe-mode"),rel:"noopener noreferrer",target:"_blank"})}))))};C.propTypes={wpcomHomeUrl:o().string.isRequired,currentUrl:o().string.isRequired,isStartingFresh:o().bool.isRequired,startFreshCallback:o().func.isRequired,customContent:o().shape(g.Z),hasError:o().bool.isRequired},C.defaultProps={isStartingFresh:!1,startFreshCallback:()=>{},customContent:{},hasError:!1},t.Z=C},3023:function(e,t,n){"use strict";var r=n(9196),s=n.n(r),i=n(1268),o=n.n(i),a=n(5609),c=n(9818),l=n(9307),u=n(5736),d=n(1415),p=n(7262),h=n(7619),m=n(2690),g=n(2665),f=n(8086);const __=u.__,C=e=>{const t=(0,m.Z)(e.wpcomHomeUrl),n=(0,m.Z)(e.currentUrl),r=(0,c.useSelect)((e=>e(h.t).getIsActionInProgress()),[]),{isMigrating:i,migrateCallback:o,customContent:g,hasError:C}=e,y=__("Move your settings","jetpack-idc");return s().createElement("div",{className:"jp-idc__idc-screen__card-action-base"+(C?" jp-idc__idc-screen__card-action-error":"")},s().createElement("div",{className:"jp-idc__idc-screen__card-action-top"},s().createElement("h4",null,g.migrateCardTitle||__("Move Jetpack data","jetpack-idc")),s().createElement("p",null,g.migrateCardBodyText||(0,l.createInterpolateElement)((0,u.sprintf)(
+/* translators: %1$s: The current site domain name. %2$s: The original site domain name. */
+__("Move all your settings, stats and subscribers to your other URL, <hostname>%1$s</hostname>. <hostname>%2$s</hostname> will be disconnected from Jetpack.","jetpack-idc"),n,t),{hostname:s().createElement("strong",null)}))),s().createElement("div",{className:"jp-idc__idc-screen__card-action-bottom"},s().createElement("div",{className:"jp-idc__idc-screen__card-action-sitename"},t),s().createElement(a.Dashicon,{icon:"arrow-down-alt",className:"jp-idc__idc-screen__card-action-separator"}),s().createElement("div",{className:"jp-idc__idc-screen__card-action-sitename"},n),s().createElement(a.Button,{className:"jp-idc__idc-screen__card-action-button",label:y,onClick:o,disabled:r},i?s().createElement(p.Z,null):y),C&&s().createElement(f.Z,null,(0,l.createInterpolateElement)(__("Could not move your settings. Retry or find out more <a>here</a>.","jetpack-idc"),{a:s().createElement("a",{href:(0,d.Z)("jetpack-support-safe-mode"),rel:"noopener noreferrer",target:"_blank"})}))))};C.propTypes={wpcomHomeUrl:o().string.isRequired,currentUrl:o().string.isRequired,isMigrating:o().bool.isRequired,migrateCallback:o().func.isRequired,customContent:o().shape(g.Z),hasError:o().bool.isRequired},C.defaultProps={isMigrating:!1,migrateCallback:()=>{},customContent:{},hasError:!1},t.Z=C},7090:function(e,t,n){"use strict";var r=n(9196),s=n.n(r);t.Z=()=>s().createElement("svg",{className:"error-gridicon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",height:24},s().createElement("rect",{x:"0",fill:"none",width:"24",height:"24"}),s().createElement("g",null,s().createElement("path",{d:"M12 4c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 13h-2v2h2v-2zm-2-2h2l.5-6h-3l.5 6z"})))},8086:function(e,t,n){"use strict";var r=n(9196),s=n.n(r),i=n(7090);n(4943);t.Z=e=>{const{children:t}=e;return s().createElement("div",{className:"jp-idc__error-message"},s().createElement(i.Z,null),s().createElement("span",null,t))}},5643:function(e,t,n){"use strict";var r=n(9196),s=n.n(r),i=n(1268),o=n.n(i),a=n(816),c=n(9570),l=n(9818),u=n(7436),d=n(5853),p=n(463),h=n(8970),m=n(1517),g=n(2665),f=n(7619);const C=e=>{const{logo:t,customContent:n,wpcomHomeUrl:i,currentUrl:o,apiNonce:g,apiRoot:C,redirectUri:y,tracksUserData:k,tracksEventData:_,isAdmin:v}=e,[w,b]=(0,r.useState)(!1),E=(0,l.useSelect)((e=>e(f.t).getErrorType()),[]),{isMigrating:j,migrateCallback:S}=(0,p.Z)((0,r.useCallback)((()=>{b(!0)}),[b])),{isStartingFresh:F,startFreshCallback:I}=(0,m.Z)(y),{isFinishingMigration:R,finishMigrationCallback:P}=(0,h.Z)();return(0,r.useEffect)((()=>{c.ZP.setApiRoot(C),c.ZP.setApiNonce(g),k&&k.hasOwnProperty("userid")&&k.hasOwnProperty("username")&&a.Z.initialize(k.userid,k.username),_&&(_.hasOwnProperty("isAdmin")&&_.isAdmin?(0,d.Z)("notice_view"):(0,d.Z)("non_admin_notice_view",{page:!!_.hasOwnProperty("currentScreen")&&_.currentScreen}))}),[C,g,k,_]),s().createElement(u.Z,{logo:t,customContent:n,wpcomHomeUrl:i,currentUrl:o,redirectUri:y,isMigrating:j,migrateCallback:S,isMigrated:w,finishMigrationCallback:P,isFinishingMigration:R,isStartingFresh:F,startFreshCallback:I,isAdmin:v,hasStaySafeError:"safe-mode"===E,hasFreshError:"start-fresh"===E,hasMigrateError:"migrate"===E})};C.propTypes={logo:o().object,customContent:o().shape(g.Z),wpcomHomeUrl:o().string.isRequired,currentUrl:o().string.isRequired,redirectUri:o().string.isRequired,apiRoot:o().string.isRequired,apiNonce:o().string.isRequired,tracksUserData:o().object,tracksEventData:o().object,isAdmin:o().bool.isRequired},C.defaultProps={customContent:{}},t.Z=C},2027:function(e,t,n){"use strict";var r=n(9196),s=n.n(r),i=n(1268),o=n.n(i),a=n(9307),c=n(5736),l=n(1415),u=n(3023),d=n(7226),p=n(1693),h=n(2665);const __=c.__,m=e=>{const{wpcomHomeUrl:t,currentUrl:n,isMigrating:r,migrateCallback:i,isStartingFresh:o,startFreshCallback:c,customContent:h,hasMigrateError:m,hasFreshError:g,hasStaySafeError:f}=e;return s().createElement(s().Fragment,null,s().createElement("h2",null,h.mainTitle||__("Safe Mode has been activated","jetpack-idc")),s().createElement("p",null,h.mainBodyText||(0,a.createInterpolateElement)(__("Your site is in Safe Mode because you have 2 Jetpack-powered sites that appear to be duplicates. 2 sites that are telling Jetpack they’re the same site. <safeModeLink>Learn more about safe mode.</safeModeLink>","jetpack-idc"),{safeModeLink:s().createElement("a",{href:(0,l.Z)("jetpack-support-safe-mode"),rel:"noopener noreferrer",target:"_blank"})})),s().createElement("h3",null,__("Please select an option","jetpack-idc")),s().createElement("div",{className:"jp-idc__idc-screen__cards"+(m||g?" jp-idc__idc-screen__cards-error":"")},s().createElement(u.Z,{wpcomHomeUrl:t,currentUrl:n,isMigrating:r,migrateCallback:i,customContent:h,hasError:m}),s().createElement("div",{className:"jp-idc__idc-screen__cards-separator"},"or"),s().createElement(d.Z,{wpcomHomeUrl:t,currentUrl:n,isStartingFresh:o,startFreshCallback:c,customContent:h,hasError:g})),s().createElement(p.Z,{hasError:f}))};m.propTypes={wpcomHomeUrl:o().string.isRequired,currentUrl:o().string.isRequired,isMigrating:o().bool.isRequired,migrateCallback:o().func,isStartingFresh:o().bool.isRequired,startFreshCallback:o().func,customContent:o().shape(h.Z),hasMigrateError:o().bool.isRequired,hasFreshError:o().bool.isRequired,hasStaySafeError:o().bool.isRequired},m.defaultProps={isMigrating:!1,isStartingFresh:!1,customContent:{},hasMigrateError:!1,hasFreshError:!1,hasStaySafeError:!1},t.Z=m},4642:function(e,t,n){"use strict";var r=n(9196),s=n.n(r),i=n(1268),o=n.n(i),a=n(5609),c=n(9307),l=n(5736),u=n(7262),d=n(2690),p=n(2665);const __=l.__,h=e=>{const{finishCallback:t,isFinishing:n,customContent:r}=e,i=(0,d.Z)(e.wpcomHomeUrl),o=(0,d.Z)(e.currentUrl),p=__("Got it, thanks","jetpack-idc");return s().createElement(s().Fragment,null,s().createElement("h2",null,r.migratedTitle||__("Your Jetpack settings have migrated successfully","jetpack-idc")),s().createElement("p",null,r.migratedBodyText||(0,c.createInterpolateElement)((0,l.sprintf)(
+/* translators: %1$s: The current site domain name. */
+__("Safe Mode has been switched off for <hostname>%1$s</hostname> website and Jetpack is fully functional.","jetpack-idc"),o),{hostname:s().createElement("strong",null)})),s().createElement("div",{className:"jp-idc__idc-screen__card-migrated"},s().createElement("div",{className:"jp-idc__idc-screen__card-migrated-hostname"},i),s().createElement(a.Dashicon,{icon:"arrow-down-alt",className:"jp-idc__idc-screen__card-migrated-separator"}),s().createElement(a.Dashicon,{icon:"arrow-right-alt",className:"jp-idc__idc-screen__card-migrated-separator-wide"}),s().createElement("div",{className:"jp-idc__idc-screen__card-migrated-hostname"},o)),s().createElement(a.Button,{className:"jp-idc__idc-screen__card-action-button jp-idc__idc-screen__card-action-button-migrated",onClick:t,label:p},n?s().createElement(u.Z,null):p))};h.propTypes={wpcomHomeUrl:o().string.isRequired,currentUrl:o().string.isRequired,finishCallback:o().func,isFinishing:o().bool.isRequired,customContent:o().shape(p.Z)},h.defaultProps={finishCallback:()=>{},isFinishing:!1,customContent:{}},t.Z=h},4523:function(e,t,n){"use strict";var r=n(9196),s=n.n(r),i=n(1268),o=n.n(i),a=n(9307),c=n(5736),l=n(1415),u=n(2665);const __=c.__,d=e=>{const{customContent:t}=e;return s().createElement(s().Fragment,null,s().createElement("h2",null,t.nonAdminTitle||__("Safe Mode has been activated","jetpack-idc")),s().createElement("p",null,t.nonAdminBodyText||(0,a.createInterpolateElement)(__("This site is in Safe Mode because there are 2 Jetpack-powered sites that appear to be duplicates. 2 sites that are telling Jetpack they’re the same site. <safeModeLink>Learn more about safe mode.</safeModeLink>","jetpack-idc"),{safeModeLink:s().createElement("a",{href:(0,l.Z)("jetpack-support-safe-mode"),rel:"noopener noreferrer",target:"_blank"})})),t.nonAdminBodyText?"":s().createElement("p",null,__("An administrator of this site can take Jetpack out of Safe Mode.","jetpack-idc")))};d.propTypes={customContent:o().shape(u.Z)},d.defaultProps={customContent:{}},t.Z=d},7436:function(e,t,n){"use strict";var r=n(9196),s=n.n(r),i=n(1268),o=n.n(i),a=n(5736),c=n(1546),l=n(2027),u=n(4523),d=n(4642),p=n(2665);n(8911);const __=a.__,h=e=>{const{logo:t,customContent:n,wpcomHomeUrl:r,currentUrl:i,redirectUri:o,isMigrating:a,migrateCallback:c,isMigrated:p,finishMigrationCallback:h,isFinishingMigration:m,isStartingFresh:g,startFreshCallback:f,isAdmin:C,hasMigrateError:y,hasFreshError:k,hasStaySafeError:_}=e,v=C?"":s().createElement(u.Z,{customContent:n});let w="";return C&&(w=p?s().createElement(d.Z,{wpcomHomeUrl:r,currentUrl:i,finishCallback:h,isFinishing:m,customContent:n}):s().createElement(l.Z,{wpcomHomeUrl:r,currentUrl:i,redirectUri:o,customContent:n,isMigrating:a,migrateCallback:c,isStartingFresh:g,startFreshCallback:f,hasMigrateError:y,hasFreshError:k,hasStaySafeError:_})),s().createElement("div",{className:"jp-idc__idc-screen"+(p?" jp-idc__idc-screen__success":"")},s().createElement("div",{className:"jp-idc__idc-screen__header"},s().createElement("div",{className:"jp-idc__idc-screen__logo"},((e,t)=>"string"==typeof e||e instanceof String?s().createElement("img",{src:e,alt:t,className:"jp-idc__idc-screen__logo-image"}):e)(t,n.logoAlt||"")),s().createElement("div",{className:"jp-idc__idc-screen__logo-label"},n.headerText||__("Safe Mode","jetpack-idc"))),v,w)};h.propTypes={logo:o().object.isRequired,customContent:o().shape(p.Z),wpcomHomeUrl:o().string.isRequired,currentUrl:o().string.isRequired,redirectUri:o().string.isRequired,isMigrating:o().bool.isRequired,migrateCallback:o().func,isMigrated:o().bool.isRequired,finishMigrationCallback:o().func,isFinishingMigration:o().bool.isRequired,isStartingFresh:o().bool.isRequired,startFreshCallback:o().func,isAdmin:o().bool.isRequired,hasMigrateError:o().bool.isRequired,hasFreshError:o().bool.isRequired,hasStaySafeError:o().bool.isRequired},h.defaultProps={logo:s().createElement(c.Z,{height:24}),isMigrated:!1,isFinishingMigration:!1,isMigrating:!1,isStartingFresh:!1,customContent:{},hasMigrateError:!1,hasFreshError:!1,hasStaySafeError:!1},t.Z=h},1693:function(e,t,n){"use strict";var r=n(9196),s=n.n(r),i=n(1268),o=n.n(i),a=n(4333),c=n(9818),l=n(9307),u=n(5609),d=n(5736),p=n(6483),h=n(9570),m=n(7262),g=n(1415),f=n(7619),C=n(5853),y=n(8086);n(2780);const __=d.__,k=e=>{const{isActionInProgress:t,setIsActionInProgress:n,setErrorType:i,clearErrorType:o,hasError:a}=e,[c,d]=(0,r.useState)(!1),f=(0,r.useCallback)((()=>{t||(d(!0),n(!0),o(),(0,C.Z)("confirm_safe_mode"),h.ZP.confirmIDCSafeMode().then((()=>{window.location.href=(0,p.removeQueryArgs)(window.location.href,"jetpack_idc_clear_confirmation","_wpnonce")})).catch((e=>{throw n(!1),d(!1),i("safe-mode"),e})))}),[t,n,i,o]);return s().createElement("div",{className:"jp-idc__safe-mode"},c?s().createElement("div",{className:"jp-idc__safe-mode__staying-safe"},s().createElement(m.Z,{color:"black"}),s().createElement("span",null,__("Finishing setting up Safe mode…","jetpack-idc"))):(k=f,_=t,(0,l.createInterpolateElement)(__("Or decide later and stay in <button>Safe mode</button>","jetpack-idc"),{button:s().createElement(u.Button,{label:__("Safe mode","jetpack-idc"),variant:"link",onClick:k,disabled:_})})),a&&s().createElement(y.Z,null,(0,l.createInterpolateElement)(__("Could not stay in safe mode. Retry or find out more <a>here</a>.","jetpack-idc"),{a:s().createElement("a",{href:(0,g.Z)("jetpack-support-safe-mode"),rel:"noopener noreferrer",target:"_blank"})})));var k,_};k.propTypes={isActionInProgress:o().bool,setIsActionInProgress:o().func.isRequired,setErrorType:o().func.isRequired,clearErrorType:o().func.isRequired,hasError:o().bool.isRequired},k.defaultProps={hasError:!1},t.Z=(0,a.compose)([(0,c.withSelect)((e=>({isActionInProgress:e(f.t).getIsActionInProgress()}))),(0,c.withDispatch)((e=>({setIsActionInProgress:e(f.t).setIsActionInProgress,setErrorType:e(f.t).setErrorType,clearErrorType:e(f.t).clearErrorType})))])(k)},8970:function(e,t,n){"use strict";var r=n(9196);t.Z=()=>{const[e,t]=(0,r.useState)(!1),n=(0,r.useCallback)((()=>{e||(t(!0),window.location.reload())}),[e,t]);return{isFinishingMigration:e,finishMigrationCallback:n}}},463:function(e,t,n){"use strict";var r=n(9196),s=n(9818),i=n(9570),o=n(5853),a=n(7619);t.Z=e=>{const[t,n]=(0,r.useState)(!1),c=(0,s.useSelect)((e=>e(a.t).getIsActionInProgress()),[]),{setIsActionInProgress:l,setErrorType:u,clearErrorType:d}=(0,s.useDispatch)(a.t);return{isMigrating:t,migrateCallback:(0,r.useCallback)((()=>{c||((0,o.Z)("migrate"),l(!0),n(!0),d(),i.ZP.migrateIDC().then((()=>{n(!1),e&&"[object Function]"==={}.toString.call(e)&&e()})).catch((e=>{throw l(!1),n(!1),u("migrate"),e})))}),[n,e,c,l,u,d])}}},1517:function(e,t,n){"use strict";var r=n(9196),s=n(9818),i=n(9570),o=n(5853),a=n(7619);t.Z=e=>{const[t,n]=(0,r.useState)(!1),c=(0,s.useSelect)((e=>e(a.t).getIsActionInProgress()),[]),{setIsActionInProgress:l,setErrorType:u,clearErrorType:d}=(0,s.useDispatch)(a.t);return{isStartingFresh:t,startFreshCallback:(0,r.useCallback)((()=>{c||((0,o.Z)("start_fresh"),l(!0),n(!0),d(),i.ZP.startIDCFresh(e).then((e=>{window.location.href=e+"&from=idc-notice"})).catch((e=>{throw l(!1),n(!1),u("start-fresh"),e})))}),[n,c,l,e,u,d])}}},8401:function(e,t,n){"use strict";n.d(t,{hG:function(){return r},vC:function(){return s},jk:function(){return i},ZP:function(){return o}});const r="SET_IS_ACTION_IN_PROGRESS",s="SET_ERROR_TYPE",i="CLEAR_ERROR_TYPE",o={setIsActionInProgress:e=>({type:r,isInProgress:e}),setErrorType:e=>({type:s,errorType:e}),clearErrorType:()=>({type:i})}},2944:function(e,t,n){"use strict";var r=n(9818),s=n(8401);const i=(0,r.combineReducers)({isActionInProgress:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return t.type===s.hG?t.isInProgress:e},errorType:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case s.vC:return t.errorType;case s.jk:return null}return e}});t.Z=i},3642:function(e,t){"use strict";t.Z={getIsActionInProgress:e=>e.isActionInProgress||!1,getErrorType:e=>e.errorType||null}},9520:function(e,t,n){"use strict";var r=n(7538),s=n.n(r),i=n(9818);class o{static mayBeInit(e,t){null===o.store&&(o.store=(0,i.createReduxStore)(e,t),(0,i.register)(o.store))}}s()(o,"store",null),t.Z=o},7619:function(e,t,n){"use strict";n.d(t,{t:function(){return a}});var r=n(2944),s=n(8401),i=n(3642),o=n(9520);const a="jetpack-idc";o.Z.mayBeInit(a,{reducer:r.Z,actions:s.ZP,selectors:i.Z})},2665:function(e,t,n){"use strict";var r=n(1268),s=n.n(r);t.Z={headerText:s().string,logoAlt:s().string,mainTitle:s().string,mainBodyText:s().string,migratedTitle:s().string,migratedBodyText:s().string,migrateCardTitle:s().string,migrateCardBodyText:s().string,startFreshCardTitle:s().string,startFreshCardBodyText:s().string,nonAdminTitle:s().string,nonAdminBodyText:s().string}},2690:function(e,t){"use strict";t.Z=e=>/^https?:\/\//.test(e)?new URL(e).hostname:e.replace(/\/$/,"")},5853:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(816);function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0!==t&&"object"==typeof t||(t={}),e&&e.length&&void 0!==r.Z&&r.Z.tracks&&r.Z.mc&&(e=0!==(e=e.replace(/-/g,"_")).indexOf("jetpack_idc_")?"jetpack_idc_"+e:e,r.Z.tracks.recordEvent(e,t),e=(e=e.replace("jetpack_idc_","")).replace(/_/g,"-"),r.Z.mc.bumpStat("jetpack-idc",e))}},8510:function(e){"use strict";if(void 0==={consumer_slug:"identity_crisis"}){var t=new Error('Cannot find module \'{"consumer_slug":"identity_crisis"}\'');throw t.code="MODULE_NOT_FOUND",t}e.exports={consumer_slug:"identity_crisis"}},9196:function(e){"use strict";e.exports=window.React},1850:function(e){"use strict";e.exports=window.ReactDOM},2819:function(e){"use strict";e.exports=window.lodash},5609:function(e){"use strict";e.exports=window.wp.components},4333:function(e){"use strict";e.exports=window.wp.compose},9818:function(e){"use strict";e.exports=window.wp.data},9307:function(e){"use strict";e.exports=window.wp.element},5736:function(e){"use strict";e.exports=window.wp.i18n},6483:function(e){"use strict";e.exports=window.wp.url}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=n(1850),t=n.n(e),r=n(9196),s=n.n(r),i=n(5643);!function(){const e=document.getElementById("jp-identity-crisis-container");if(null===e||!window.hasOwnProperty("JP_IDENTITY_CRISIS__INITIAL_STATE"))return;const{WP_API_root:n,WP_API_nonce:r,wpcomHomeUrl:o,currentUrl:a,redirectUri:c,tracksUserData:l,tracksEventData:u,isSafeModeConfirmed:d,consumerData:p,isAdmin:h}=window.JP_IDENTITY_CRISIS__INITIAL_STATE;d||t().render(s().createElement(i.Z,{wpcomHomeUrl:o,currentUrl:a,apiRoot:n,apiNonce:r,redirectUri:c,tracksUserData:l,tracksEventData:u,customContent:p.hasOwnProperty("customContent")?p.customContent:{},isAdmin:h,logo:p.hasOwnProperty("logo")?p.logo:void 0}),e)}()}()}(); \ No newline at end of file
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.js.LICENSE.txt b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.js.LICENSE.txt
new file mode 100644
index 00000000..0c20a875
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.js.LICENSE.txt
@@ -0,0 +1,5 @@
+/*!
+ Copyright (c) 2018 Jed Watson.
+ Licensed under the MIT License (MIT), see
+ http://jedwatson.github.io/classnames
+*/
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.rtl.css b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.rtl.css
new file mode 100644
index 00000000..5c2ffd77
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/build/index.rtl.css
@@ -0,0 +1 @@
+#wp-admin-bar-jetpack-idc.hide{display:none}#wp-admin-bar-jetpack-idc .jp-idc-admin-bar{background:#fff;border-radius:2px;color:#1d2327;font-size:12px;padding:4px 8px}#wpadminbar #wp-admin-bar-jetpack-idc .dashicons{color:#1d2327;font-family:dashicons}#wpadminbar #wp-admin-bar-jetpack-idc .dashicons:before{font-size:16px}#wpadminbar #wp-admin-bar-jetpack-idc:hover .ab-item{background:inherit}#wpadminbar #wp-admin-bar-jetpack-idc:hover .jp-idc-admin-bar{background:#f0f0f1}#jp-identity-crisis-container .jp-idc__idc-screen{margin-bottom:40px;margin-top:40px}.jp-idc__idc-screen{background:#fff;border-radius:4px;border-right:4px solid #e68b28;box-shadow:0 0 40px rgba(0,0,0,.04);box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;margin:0 auto;max-width:1128px;padding:10px}.jp-idc__idc-screen.jp-idc__idc-screen__success{border-color:#069e08}@media(min-width:600px){.jp-idc__idc-screen{padding:48px}}.jp-idc__idc-screen .jp-idc__idc-screen__header{align-items:center;display:flex}.jp-idc__idc-screen .jp-idc__idc-screen__header .jp-idc__idc-screen__logo-image{max-height:100px;max-width:100px}.jp-idc__idc-screen .jp-idc__idc-screen__header .jp-idc__idc-screen__logo-label{font-size:14px;line-height:22px;margin:-7px 8px 0 0}.jp-idc__idc-screen h2{font-size:24px;font-weight:600;line-height:28px;margin:32px 0 0}.jp-idc__idc-screen h3{font-size:20px;font-weight:600;line-height:28px;margin:24px 0 0}.jp-idc__idc-screen p{color:#2c3338;font-size:16px;line-height:24px;margin:16px 0 0;max-width:710px}.jp-idc__idc-screen a{color:#2c3338}.jp-idc__idc-screen .jp-idc__idc-screen__cards{align-items:center;display:flex;flex-direction:column;flex-wrap:wrap}@media only screen and (min-width:1403px){.jp-idc__idc-screen .jp-idc__idc-screen__cards{align-items:normal;flex-direction:row}}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__cards-separator{align-self:center;color:#23282d;font-size:20px;font-weight:600;line-height:28px;margin:0 24px}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base{border:1px solid #c3c4c7;border-radius:4px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:space-between;margin:24px 0;max-width:100%;padding:10px;width:480px}@media(min-width:600px){.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base{padding:24px}}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base h4{font-size:20px;font-weight:400;line-height:28px;margin:0 0 8px}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base p{margin:0 0 24px}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base .jp-idc__idc-screen__card-action-sitename{background:#f9f9f6;border-radius:33px;box-sizing:border-box;color:#2c3338;font-size:16px;font-weight:700;line-height:24px;overflow-wrap:anywhere;padding:16px;text-align:center;width:100%}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base .jp-idc__idc-screen__card-action-separator{display:block;margin:12px auto}.jp-idc__idc-screen .jp-idc__idc-screen__cards .jp-idc__idc-screen__card-action-base .jp-idc__idc-screen__card-action-button{padding:8px 24px;width:100%}.jp-idc__idc-screen .jp-idc__idc-screen__card-action-button{background:#000;border-radius:4px;color:#fff;font-size:16px;font-weight:600;height:auto;justify-content:center;line-height:24px;margin-top:24px;min-height:40px;padding:8px}.jp-idc__idc-screen .jp-idc__idc-screen__card-action-button-migrated{margin-top:64px;width:141px}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated{align-items:center;display:flex;flex-direction:column;flex-wrap:wrap;margin-top:24px;width:100%}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-hostname{border:1px solid #c3c4c7;border-radius:4px;color:#2c3338;flex-grow:1;font-size:16px;font-weight:700;line-height:24px;padding:24px;width:100%}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator-wide{display:none}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator{display:block}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator,.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator-wide{margin:28px}@media only screen and (min-width:1400px){.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated{flex-direction:row;width:auto}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator{display:none}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-separator-wide{display:block}.jp-idc__idc-screen .jp-idc__idc-screen__card-migrated .jp-idc__idc-screen__card-migrated-hostname{width:auto}}@keyframes rotate-spinner{to{transform:rotate(-1turn)}}.jp-components-spinner{align-items:center;display:flex}.jp-components-spinner__inner,.jp-components-spinner__outer{animation:3s linear infinite;animation-name:rotate-spinner;border:.1em solid transparent;border-radius:50%;box-sizing:border-box;margin:auto}.jp-components-spinner__outer{border-top-color:#fff}.jp-components-spinner__inner{border-left-color:#fff;border-top-color:#fff;height:100%;opacity:.4;width:100%}:root{--font-title-large:36px;--font-title-small:24px;--font-body:16px;--font-label:12px;--jp-black:#000;--jp-black-80:#2c3338;--jp-white:#fff;--jp-white-off:#f9f9f6;--jp-gray:#dcdcde;--jp-gray-0:#f6f7f7;--jp-gray-20:#a7aaad;--jp-gray-40:#787c82;--jp-gray-50:#646970;--jp-gray-60:#50575e;--jp-gray-80:#8a2424;--jp-gray-off:#e2e2df;--jp-red-0:#f7ebec;--jp-red-50:#d63638;--jp-red-60:#b32d2e;--jp-red-80:#8a2424;--jp-red:#d63639;--jp-pink:#c9356e;--jp-green-0:#f0f2eb;--jp-green-5:#d0e6b8;--jp-green-10:#9dd977;--jp-green-20:#64ca43;--jp-green-30:#2fb41f;--jp-green-40:#069e08;--jp-green-50:#008710;--jp-green-60:#007117;--jp-green-70:#005b18;--jp-green-80:#004515;--jp-green-90:#003010;--jp-green-100:#001c09;--jp-green:#069e08;--jp-green-primary:var( --jp-green-40 );--jp-green-secondary:var( --jp-green-30 );--jp-border-radius:4px;--jp-menu-border-height:1px;--jp-underline-thickness:2px}*{box-sizing:border-box}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;margin:0;min-height:100%;padding:0}.jp-wrap{align-items:center;display:flex;flex-wrap:wrap;margin:0 auto;max-width:1128px}.jp-row{grid-gap:24px;display:grid;grid-template-columns:repeat(4,1fr);margin:0 16px;width:100%}@media(min-width:600px){.jp-row{grid-template-columns:repeat(8,1fr);margin:0 18px}}@media(min-width:960px){.jp-row{grid-template-columns:repeat(12,1fr);margin:0 24px;max-width:1128px}}.sm-col-span-1{grid-column-end:span 1}.sm-col-span-2{grid-column-end:span 2}.sm-col-span-3{grid-column-end:span 3}.sm-col-span-4{grid-column-end:span 4}@media(min-width:600px){.md-col-span-1{grid-column-end:span 1}.md-col-span-2{grid-column-end:span 2}.md-col-span-3{grid-column-end:span 3}.md-col-span-4{grid-column-end:span 4}.md-col-span-5{grid-column-end:span 5}.md-col-span-6{grid-column-end:span 6}.md-col-span-7{grid-column-end:span 7}.md-col-span-8{grid-column-end:span 8}}@media(min-width:960px){.lg-col-span-1{grid-column-end:span 1}.lg-col-span-2{grid-column-end:span 2}.lg-col-span-3{grid-column-end:span 3}.lg-col-span-4{grid-column-end:span 4}.lg-col-span-5{grid-column-end:span 5}.lg-col-span-6{grid-column-end:span 6}.lg-col-span-7{grid-column-end:span 7}.lg-col-span-8{grid-column-end:span 8}.lg-col-span-9{grid-column-end:span 9}.lg-col-span-10{grid-column-end:span 10}.lg-col-span-11{grid-column-end:span 11}.lg-col-span-12{grid-column-end:span 12}}@media(max-width:960px){.md-col-span-0{display:none}}@media(max-width:600px){.sm-col-span-0{display:none}}.jp-cut{border:2px solid var(--jp-green-primary);border-radius:var(--jp-border-radius);margin:32px 0;padding:16px 24px 16px 64px;position:relative;text-decoration:none}.jp-cut,.jp-cut span{display:block}.jp-cut span:last-of-type{font-weight:600}.jp-cut:focus span:last-of-type,.jp-cut:hover span:last-of-type{text-decoration:underline;text-decoration-thickness:var(--jp-underline-thickness)}.jp-cut:focus:after,.jp-cut:hover:after{transform:translateY(-50%) translateX(-8px)}.jp-cut:after{color:var(--jp-green-primary);content:"→";font-size:24px;font-weight:600;left:24px;position:absolute;top:50%;transform:translateY(-50%);transition:transform .15s ease-out}.jp-idc__idc-screen .jp-idc__error-message{align-items:center;color:var(--jp-red);display:flex;flex-direction:row;justify-content:center;margin:15px 0}.jp-idc__idc-screen .jp-idc__error-message .error-gridicon{fill:var(--jp-red);margin-left:8px}.jp-idc__idc-screen .jp-idc__error-message a,.jp-idc__idc-screen .jp-idc__error-message span{color:var(--jp-red);font-size:var(--font-body)}.jp-idc__idc-screen .jp-idc__safe-mode .jp-idc__error-message{margin-top:5px}.jp-idc__idc-screen .jp-idc__idc-screen__cards.jp-idc__idc-screen__cards-error .jp-idc__idc-screen__card-action-base{padding-bottom:75px}.jp-idc__idc-screen .jp-idc__idc-screen__cards.jp-idc__idc-screen__cards-error .jp-idc__idc-screen__card-action-base.jp-idc__idc-screen__card-action-error{padding-bottom:5px}.jp-idc__idc-screen .jp-idc__idc-screen__cards.jp-idc__idc-screen__cards-error .jp-idc__idc-screen__card-action-base .jp-idc__error-message{height:40px}.jp-idc__idc-screen .jp-idc__safe-mode{text-align:center}.jp-idc__idc-screen .jp-idc__safe-mode .jp-idc__safe-mode__staying-safe{display:flex;justify-content:center;padding:6px}.jp-idc__idc-screen .jp-idc__safe-mode .jp-idc__safe-mode__staying-safe .jp-components-spinner{margin:0 10px}.jp-idc__idc-screen .jp-idc__safe-mode,.jp-idc__idc-screen .jp-idc__safe-mode button{color:#2c3338;font-size:16px;line-height:24px}.jp-idc__idc-screen .jp-idc__safe-mode button{padding:0;text-decoration:underline} \ No newline at end of file
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/admin-bar.scss b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/admin-bar.scss
new file mode 100644
index 00000000..cd2008cf
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/admin-bar.scss
@@ -0,0 +1,28 @@
+#wp-admin-bar-jetpack-idc.hide {
+ display: none;
+}
+
+#wp-admin-bar-jetpack-idc .jp-idc-admin-bar {
+ background: #fff;
+ border-radius: 2px;
+ color: #1d2327;
+ padding: 4px 8px;
+ font-size: 12px;
+}
+
+#wpadminbar #wp-admin-bar-jetpack-idc .dashicons {
+ color: #1d2327;
+ font-family: 'dashicons';
+}
+
+#wpadminbar #wp-admin-bar-jetpack-idc .dashicons:before {
+ font-size: 16px;
+}
+
+#wpadminbar #wp-admin-bar-jetpack-idc:hover .ab-item {
+ background: inherit;
+}
+
+#wpadminbar #wp-admin-bar-jetpack-idc:hover .jp-idc-admin-bar {
+ background: #f0f0f1;
+}
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/admin.jsx b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/admin.jsx
new file mode 100644
index 00000000..296b1898
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/admin.jsx
@@ -0,0 +1,58 @@
+/**
+ * External dependencies
+ */
+import ReactDOM from 'react-dom';
+import React from 'react';
+import { IDCScreen } from '@automattic/jetpack-idc';
+
+/**
+ * Internal dependencies
+ */
+import './admin-bar.scss';
+import './style.scss';
+
+/**
+ * The initial renderer function.
+ */
+function render() {
+ const container = document.getElementById( 'jp-identity-crisis-container' );
+
+ if ( null === container || ! window.hasOwnProperty( 'JP_IDENTITY_CRISIS__INITIAL_STATE' ) ) {
+ return;
+ }
+
+ const {
+ WP_API_root,
+ WP_API_nonce,
+ wpcomHomeUrl,
+ currentUrl,
+ redirectUri,
+ tracksUserData,
+ tracksEventData,
+ isSafeModeConfirmed,
+ consumerData,
+ isAdmin,
+ } = window.JP_IDENTITY_CRISIS__INITIAL_STATE;
+
+ if ( ! isSafeModeConfirmed ) {
+ ReactDOM.render(
+ <IDCScreen
+ wpcomHomeUrl={ wpcomHomeUrl }
+ currentUrl={ currentUrl }
+ apiRoot={ WP_API_root }
+ apiNonce={ WP_API_nonce }
+ redirectUri={ redirectUri }
+ tracksUserData={ tracksUserData }
+ tracksEventData={ tracksEventData }
+ customContent={
+ consumerData.hasOwnProperty( 'customContent' ) ? consumerData.customContent : {}
+ }
+ isAdmin={ isAdmin }
+ logo={ consumerData.hasOwnProperty( 'logo' ) ? consumerData.logo : undefined }
+ />,
+ container
+ );
+ }
+}
+
+render();
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/style.scss b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/style.scss
new file mode 100644
index 00000000..0b9ccb86
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/_inc/style.scss
@@ -0,0 +1,4 @@
+#jp-identity-crisis-container .jp-idc__idc-screen {
+ margin-top: 40px;
+ margin-bottom: 40px;
+}
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-identity-crisis.php b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-identity-crisis.php
new file mode 100644
index 00000000..cae3ed16
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-identity-crisis.php
@@ -0,0 +1,1219 @@
+<?php
+/**
+ * Identity_Crisis package.
+ *
+ * @package automattic/jetpack-identity-crisis
+ */
+
+namespace Automattic\Jetpack;
+
+use Automattic\Jetpack\Assets\Logo as Jetpack_Logo;
+use Automattic\Jetpack\Connection\Manager as Connection_Manager;
+use Automattic\Jetpack\Connection\Urls;
+use Automattic\Jetpack\Constants as Constants;
+use Automattic\Jetpack\IdentityCrisis\UI;
+use Automattic\Jetpack\Status as Status;
+use Automattic\Jetpack\Tracking as Tracking;
+use Jetpack_Options;
+use WP_Error;
+
+/**
+ * This class will handle everything involved with fixing an Identity Crisis.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+class Identity_Crisis {
+
+ /**
+ * Package Version
+ */
+ const PACKAGE_VERSION = '0.6.1';
+
+ /**
+ * Instance of the object.
+ *
+ * @var Identity_Crisis
+ **/
+ private static $instance = null;
+
+ /**
+ * The wpcom value of the home URL.
+ *
+ * @var string
+ */
+ public static $wpcom_home_url;
+
+ /**
+ * Has safe mode been confirmed?
+ * Beware, it never contains `true` for non-admins, so doesn't always reflect the actual value.
+ *
+ * @var bool
+ */
+ public static $is_safe_mode_confirmed;
+
+ /**
+ * The current screen, which is set if the current user is a non-admin and this is an admin page.
+ *
+ * @var WP_Screen
+ */
+ public static $current_screen;
+
+ /**
+ * Initializer.
+ *
+ * @return object
+ */
+ public static function init() {
+ if ( is_null( self::$instance ) ) {
+ self::$instance = new Identity_Crisis();
+ }
+
+ return self::$instance;
+ }
+
+ /**
+ * Class constructor.
+ *
+ * @return void
+ */
+ private function __construct() {
+ add_action( 'jetpack_sync_processed_actions', array( $this, 'maybe_clear_migrate_option' ) );
+ add_action( 'rest_api_init', array( 'Automattic\\Jetpack\\IdentityCrisis\\REST_Endpoints', 'initialize_rest_api' ) );
+ add_action( 'jetpack_idc_disconnect', array( __CLASS__, 'do_jetpack_idc_disconnect' ) );
+ add_action( 'jetpack_received_remote_request_response', array( $this, 'check_http_response_for_idc_detected' ) );
+
+ add_filter( 'jetpack_connection_disconnect_site_wpcom', array( __CLASS__, 'jetpack_connection_disconnect_site_wpcom_filter' ) );
+
+ add_filter( 'jetpack_remote_request_url', array( $this, 'add_idc_query_args_to_url' ) );
+
+ $urls_in_crisis = self::check_identity_crisis();
+ if ( false === $urls_in_crisis ) {
+ return;
+ }
+
+ self::$wpcom_home_url = $urls_in_crisis['wpcom_home'];
+ add_action( 'init', array( $this, 'wordpress_init' ) );
+ }
+
+ /**
+ * Disconnect current connection and clear IDC options.
+ */
+ public static function do_jetpack_idc_disconnect() {
+ $connection = new Connection_Manager();
+
+ // If the site is in an IDC because sync is not allowed,
+ // let's make sure to not disconnect the production site.
+ if ( ! self::validate_sync_error_idc_option() ) {
+ $connection->disconnect_site( true );
+ } else {
+ $connection->disconnect_site( false );
+ }
+
+ // Clear IDC options.
+ self::clear_all_idc_options();
+ }
+
+ /**
+ * Filter to prevent site from disconnecting from WPCOM if it's in an IDC.
+ *
+ * @see jetpack_connection_disconnect_site_wpcom filter.
+ *
+ * @return bool False if the site is in IDC, true otherwise.
+ */
+ public static function jetpack_connection_disconnect_site_wpcom_filter() {
+ return ! self::validate_sync_error_idc_option();
+ }
+
+ /**
+ * Gets the link to the support document used to explain Safe Mode to users.
+ *
+ * @return string
+ */
+ public static function get_safe_mod_doc_url() {
+ return Redirect::get_url( 'jetpack-support-safe-mode' );
+ }
+
+ /**
+ * This method loops through the array of processed items from sync and checks if one of the items was the
+ * home_url or site_url callable. If so, then we delete the jetpack_migrate_for_idc option.
+ *
+ * @param array $processed_items Array of processed items that were synced to WordPress.com.
+ */
+ public function maybe_clear_migrate_option( $processed_items ) {
+ foreach ( (array) $processed_items as $item ) {
+
+ // First, is this item a jetpack_sync_callable action? If so, then proceed.
+ $callable_args = ( is_array( $item ) && isset( $item[0], $item[1] ) && 'jetpack_sync_callable' === $item[0] )
+ ? $item[1]
+ : null;
+
+ // Second, if $callable_args is set, check if the callable was home_url or site_url. If so,
+ // clear the migrate option.
+ if (
+ isset( $callable_args, $callable_args[0] )
+ && ( 'home_url' === $callable_args[0] || 'site_url' === $callable_args[1] )
+ ) {
+ Jetpack_Options::delete_option( 'migrate_for_idc' );
+ break;
+ }
+ }
+ }
+
+ /**
+ * WordPress init.
+ *
+ * @return void
+ */
+ public function wordpress_init() {
+ if ( current_user_can( 'jetpack_disconnect' ) ) {
+ if (
+ isset( $_GET['jetpack_idc_clear_confirmation'], $_GET['_wpnonce'] ) &&
+ wp_verify_nonce( $_GET['_wpnonce'], 'jetpack_idc_clear_confirmation' )
+ ) {
+ Jetpack_Options::delete_option( 'safe_mode_confirmed' );
+ self::$is_safe_mode_confirmed = false;
+ } else {
+ self::$is_safe_mode_confirmed = (bool) Jetpack_Options::get_option( 'safe_mode_confirmed' );
+ }
+ }
+
+ // 121 Priority so that it's the most inner Jetpack item in the admin bar.
+ add_action( 'admin_bar_menu', array( $this, 'display_admin_bar_button' ), 121 );
+
+ UI::init();
+ }
+
+ /**
+ * Add the idc query arguments to the url.
+ *
+ * @param string $url The remote request url.
+ */
+ public function add_idc_query_args_to_url( $url ) {
+ $status = new Status();
+ if ( ! is_string( $url )
+ || $status->is_offline_mode()
+ || $status->is_staging_site()
+ || self::validate_sync_error_idc_option() ) {
+ return $url;
+ }
+
+ $query_args = array(
+ 'home' => Urls::home_url(),
+ 'siteurl' => Urls::site_url(),
+ );
+
+ if ( self::should_handle_idc() ) {
+ $query_args['idc'] = true;
+ }
+
+ if ( \Jetpack_Options::get_option( 'migrate_for_idc', false ) ) {
+ $query_args['migrate_for_idc'] = true;
+ }
+
+ return add_query_arg( $query_args, $url );
+ }
+
+ /**
+ * Non-admins current screen check.
+ *
+ * @param object $current_screen Current screen.
+ *
+ * @return null
+ * @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
+ */
+ public function non_admins_current_screen_check( $current_screen ) {
+ _deprecated_function( __METHOD__, '0.5.0' );
+
+ self::$current_screen = $current_screen;
+ if ( isset( $current_screen->id ) && 'toplevel_page_jetpack' === $current_screen->id ) {
+ return null;
+ }
+
+ return null;
+ }
+
+ /**
+ * Renders the admin bar button.
+ *
+ * @return void
+ */
+ public function display_admin_bar_button() {
+ global $wp_admin_bar;
+
+ $href = is_admin()
+ ? add_query_arg( 'jetpack_idc_clear_confirmation', '1' )
+ : add_query_arg( 'jetpack_idc_clear_confirmation', '1', admin_url() );
+
+ $href = wp_nonce_url( $href, 'jetpack_idc_clear_confirmation' );
+
+ $title = sprintf(
+ '<span class="jp-idc-admin-bar">%s %s</span>',
+ '<span class="dashicons dashicons-warning"></span>',
+ esc_html__( 'Jetpack Safe Mode', 'jetpack-idc' )
+ );
+
+ $menu = array(
+ 'id' => 'jetpack-idc',
+ 'title' => $title,
+ 'href' => esc_url( $href ),
+ 'parent' => 'top-secondary',
+ );
+
+ if ( ! self::$is_safe_mode_confirmed ) {
+ $menu['meta'] = array(
+ 'class' => 'hide',
+ );
+ }
+
+ $wp_admin_bar->add_node( $menu );
+ }
+
+ /**
+ * Checks if the site is currently in an identity crisis.
+ *
+ * @return array|bool Array of options that are in a crisis, or false if everything is OK.
+ */
+ public static function check_identity_crisis() {
+ $connection = new Connection_Manager( 'jetpack' );
+
+ if ( ! $connection->is_connected() || ( new Status() )->is_offline_mode() || ! self::validate_sync_error_idc_option() ) {
+ return false;
+ }
+
+ return Jetpack_Options::get_option( 'sync_error_idc' );
+ }
+
+ /**
+ * Checks the HTTP response body for the 'idc_detected' key. If the key exists,
+ * checks the idc_detected value for a valid idc error.
+ *
+ * @param array|WP_Error $http_response The HTTP response.
+ *
+ * @return bool Whether the site is in an identity crisis.
+ */
+ public function check_http_response_for_idc_detected( $http_response ) {
+ if ( ! is_array( $http_response ) ) {
+ return false;
+ }
+ $response_body = json_decode( wp_remote_retrieve_body( $http_response ), true );
+
+ if ( isset( $response_body['idc_detected'] ) ) {
+ return $this->check_response_for_idc( $response_body['idc_detected'] );
+ }
+
+ if ( isset( $response_body['migrated_for_idc'] ) ) {
+ Jetpack_Options::delete_option( 'migrate_for_idc' );
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks the WPCOM response to determine if the site is in an identity crisis. Updates the
+ * sync_error_idc option if it is.
+ *
+ * @param array $response The response data.
+ *
+ * @return bool Whether the site is in an identity crisis.
+ */
+ public function check_response_for_idc( $response ) {
+ if ( ! is_array( $response ) ) {
+ return false;
+ }
+
+ if ( is_array( $response ) && isset( $response['error_code'] ) ) {
+ $error_code = $response['error_code'];
+ $allowed_idc_error_codes = array(
+ 'jetpack_url_mismatch',
+ 'jetpack_home_url_mismatch',
+ 'jetpack_site_url_mismatch',
+ );
+
+ if ( in_array( $error_code, $allowed_idc_error_codes, true ) ) {
+ \Jetpack_Options::update_option(
+ 'sync_error_idc',
+ self::get_sync_error_idc_option( $response )
+ );
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Prepare URL for display.
+ *
+ * @param string $url URL to display.
+ *
+ * @return string
+ */
+ public static function prepare_url_for_display( $url ) {
+ return untrailingslashit( self::normalize_url_protocol_agnostic( $url ) );
+ }
+
+ /**
+ * Clears all IDC specific options. This method is used on disconnect and reconnect.
+ *
+ * @return void
+ */
+ public static function clear_all_idc_options() {
+ // If the site is currently in IDC, let's also clear the VaultPress connection options.
+ // We have to check if the site is in IDC, otherwise we'd be clearing the VaultPress
+ // connection any time the Jetpack connection is cycled.
+ if ( self::validate_sync_error_idc_option() ) {
+ delete_option( 'vaultpress' );
+ delete_option( 'vaultpress_auto_register' );
+ }
+
+ Jetpack_Options::delete_option(
+ array(
+ 'sync_error_idc',
+ 'safe_mode_confirmed',
+ 'migrate_for_idc',
+ )
+ );
+ }
+
+ /**
+ * Checks whether the sync_error_idc option is valid or not, and if not, will do cleanup.
+ *
+ * @return bool
+ * @since-jetpack 5.4.0 Do not call get_sync_error_idc_option() unless site is in IDC
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ public static function validate_sync_error_idc_option() {
+ $is_valid = false;
+
+ // Is the site opted in and does the stored sync_error_idc option match what we now generate?
+ $sync_error = Jetpack_Options::get_option( 'sync_error_idc' );
+ if ( $sync_error && self::should_handle_idc() ) {
+ $local_options = self::get_sync_error_idc_option();
+
+ // Ensure all values are set.
+ if ( isset( $sync_error['home'] ) && isset( $local_options['home'] ) && isset( $sync_error['siteurl'] ) && isset( $local_options['siteurl'] ) ) {
+ // If the WP.com expected home and siteurl match local home and siteurl it is not valid IDC.
+ if (
+ isset( $sync_error['wpcom_home'] ) &&
+ isset( $sync_error['wpcom_siteurl'] ) &&
+ $sync_error['wpcom_home'] === $local_options['home'] &&
+ $sync_error['wpcom_siteurl'] === $local_options['siteurl']
+ ) {
+ $is_valid = false;
+ // Enable migrate_for_idc so that sync actions are accepted.
+ Jetpack_Options::update_option( 'migrate_for_idc', true );
+ } elseif ( $sync_error['home'] === $local_options['home'] && $sync_error['siteurl'] === $local_options['siteurl'] ) {
+ $is_valid = true;
+ }
+ }
+ }
+
+ /**
+ * Filters whether the sync_error_idc option is valid.
+ *
+ * @param bool $is_valid If the sync_error_idc is valid or not.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ $is_valid = (bool) apply_filters( 'jetpack_sync_error_idc_validation', $is_valid );
+
+ if ( ! $is_valid && $sync_error ) {
+ // Since the option exists, and did not validate, delete it.
+ Jetpack_Options::delete_option( 'sync_error_idc' );
+ }
+
+ return $is_valid;
+ }
+
+ /**
+ * Normalizes a url by doing three things:
+ * - Strips protocol
+ * - Strips www
+ * - Adds a trailing slash
+ *
+ * @param string $url URL to parse.
+ *
+ * @return WP_Error|string
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ public static function normalize_url_protocol_agnostic( $url ) {
+ $parsed_url = wp_parse_url( trailingslashit( esc_url_raw( $url ) ) );
+ if ( ! $parsed_url || empty( $parsed_url['host'] ) || empty( $parsed_url['path'] ) ) {
+ return new WP_Error(
+ 'cannot_parse_url',
+ sprintf(
+ /* translators: %s: URL to parse. */
+ esc_html__( 'Cannot parse URL %s', 'jetpack-idc' ),
+ $url
+ )
+ );
+ }
+
+ // Strip www and protocols.
+ $url = preg_replace( '/^www\./i', '', $parsed_url['host'] . $parsed_url['path'] );
+
+ return $url;
+ }
+
+ /**
+ * Gets the value that is to be saved in the jetpack_sync_error_idc option.
+ *
+ * @param array $response HTTP response.
+ *
+ * @return array Array of the local urls, wpcom urls, and error code.
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ * @since-jetpack 5.4.0 Add transient since home/siteurl retrieved directly from DB.
+ */
+ public static function get_sync_error_idc_option( $response = array() ) {
+ // Since the local options will hit the database directly, store the values
+ // in a transient to allow for autoloading and caching on subsequent views.
+ $local_options = get_transient( 'jetpack_idc_local' );
+ if ( false === $local_options ) {
+ $local_options = array(
+ 'home' => Urls::home_url(),
+ 'siteurl' => Urls::site_url(),
+ );
+ set_transient( 'jetpack_idc_local', $local_options, MINUTE_IN_SECONDS );
+ }
+
+ $options = array_merge( $local_options, $response );
+
+ $returned_values = array();
+ foreach ( $options as $key => $option ) {
+ if ( 'error_code' === $key ) {
+ $returned_values[ $key ] = $option;
+ continue;
+ }
+
+ $normalized_url = self::normalize_url_protocol_agnostic( $option );
+ if ( is_wp_error( $normalized_url ) ) {
+ continue;
+ }
+
+ $returned_values[ $key ] = $normalized_url;
+ }
+
+ return $returned_values;
+ }
+
+ /**
+ * Returns the value of the jetpack_sync_idc_optin filter, or constant.
+ * If set to true, the site will be put into staging mode.
+ *
+ * @return bool
+ * @since 0.2.0
+ * @since-jetpack 4.3.2
+ * @deprecated 0.2.6 Use should_handle_idc()
+ * @see Automattic\Jetpack\Identity_Crisis::should_handle_idc
+ */
+ public static function sync_idc_optin() {
+ _deprecated_function( __METHOD__, '0.2.6', 'Automattic\\Jetpack\\Identity_Crisis::should_handle_idc' );
+ return self::should_handle_idc();
+ }
+
+ /**
+ * Returns the value of the jetpack_should_handle_idc filter or constant.
+ * If set to true, the site will be put into staging mode.
+ *
+ * This method uses both the current jetpack_should_handle_idc filter and constant and the
+ * legacy jetpack_sync_idc_optin filter and constant to determine whether an IDC should be
+ * handled.
+ *
+ * @return bool
+ * @since 0.2.6
+ */
+ public static function should_handle_idc() {
+ if ( Constants::is_defined( 'JETPACK_SHOULD_HANDLE_IDC' ) ) {
+ $default = Constants::get_constant( 'JETPACK_SHOULD_HANDLE_IDC' );
+ } elseif ( Constants::is_defined( 'JETPACK_SYNC_IDC_OPTIN' ) ) {
+ // Check the legacy constant. This constant should be considered deprecated as of version 0.2.6.
+ $default = Constants::get_constant( 'JETPACK_SYNC_IDC_OPTIN' );
+ } else {
+ $default = ! Constants::is_defined( 'SUNRISE' ) && ! is_multisite();
+ }
+
+ // Add a callback which uses the legacy filter 'jetpack_sync_idc_optin'.
+ add_filter( 'jetpack_should_handle_idc', array( __CLASS__, 'legacy_jetpack_sync_idc_optin_filter' ) );
+
+ /**
+ * Allows sites to opt in for IDC mitigation which blocks the site from syncing to WordPress.com when the home
+ * URL or site URL do not match what WordPress.com expects. The default value is either true, or the value of
+ * JETPACK_SHOULD_HANDLE_IDC constant if set.
+ *
+ * @param bool $default Whether the site is opted in to IDC mitigation.
+ *
+ * @since 0.2.6
+ */
+ return (bool) apply_filters( 'jetpack_should_handle_idc', $default );
+ }
+
+ /**
+ * Returns the value for the deprecated filter, 'jetpack_sync_idc_optin'. That filter has been replaced with the
+ * 'jetpack_should_handle_idc' filter.
+ *
+ * @since 0.2.6
+ *
+ * @param bool $default Whether the site is opted in to IDC mitigation.
+ */
+ public static function legacy_jetpack_sync_idc_optin_filter( $default ) {
+ /**
+ * Allows sites to opt in for IDC mitigation which blocks the site from syncing to WordPress.com when the home
+ * URL or site URL do not match what WordPress.com expects. The default value is either true, or the value of
+ * JETPACK_SYNC_IDC_OPTIN constant if set.
+ *
+ * @param bool $default Whether the site is opted in to IDC mitigation.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.3.2
+ * @deprecated 0.2.6 Use jetpack_should_handle_idc
+ */
+ return (bool) apply_filters_deprecated( 'jetpack_sync_idc_optin', array( $default ), '0.2.6', 'jetpack_should_handle_idc' );
+ }
+
+ /**
+ * Does the current admin page have help tabs?
+ *
+ * @return bool
+ * @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
+ */
+ public function admin_page_has_help_tabs() {
+ _deprecated_function( __METHOD__, '0.5.0' );
+
+ if ( ! function_exists( 'get_current_screen' ) ) {
+ return false;
+ }
+
+ $current_screen = get_current_screen();
+ $tabs = $current_screen->get_help_tabs();
+
+ return ! empty( $tabs );
+ }
+
+ /**
+ * Renders the non-admin IDC notice.
+ *
+ * @return void
+ * @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
+ */
+ public function display_non_admin_idc_notice() {
+ _deprecated_function( __METHOD__, '0.5.0' );
+
+ $classes = 'jp-idc-notice inline is-non-admin notice notice-warning';
+ if ( isset( self::$current_screen ) && 'toplevel_page_jetpack' !== self::$current_screen->id ) {
+ $classes .= ' is-dismissible';
+ }
+
+ if ( $this->admin_page_has_help_tabs() ) {
+ $classes .= ' has-help-tabs';
+ }
+ ?>
+
+ <div class="<?php echo esc_attr( $classes ); ?>">
+ <?php $this->render_notice_header(); ?>
+ <div class="jp-idc-notice__content-header">
+ <h3 class="jp-idc-notice__content-header__lead">
+ <?php echo $this->get_non_admin_notice_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </h3>
+
+ <p class="jp-idc-notice__content-header__explanation">
+ <?php echo $this->get_non_admin_contact_admin_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </p>
+ </div>
+ </div>
+ <?php
+ }
+
+ /**
+ * First "step" of the IDC mitigation. Will provide some messaging and two options/buttons.
+ * "Confirm Staging" - Dismiss the notice and continue on with our lives in staging mode.
+ * "Fix Jetpack Connection" - Will disconnect the site and start the mitigation...
+ *
+ * @return void
+ * @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
+ */
+ public function display_idc_notice() {
+ _deprecated_function( __METHOD__, '0.5.0' );
+
+ $classes = 'jp-idc-notice inline notice notice-warning';
+ if ( $this->admin_page_has_help_tabs() ) {
+ $classes .= ' has-help-tabs';
+ }
+ ?>
+ <div class="<?php echo esc_attr( $classes ); ?>">
+ <?php $this->render_notice_header(); ?>
+ <?php $this->render_notice_first_step(); ?>
+ <?php $this->render_notice_second_step(); ?>
+ </div>
+ <?php
+ }
+
+ /**
+ * Enqueue CSS for the admin bar.
+ *
+ * @return void
+ * @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
+ */
+ public function enqueue_admin_bar_css() {
+ _deprecated_function( __METHOD__, '0.5.0' );
+ }
+
+ /**
+ * Enqueue scripts for the notice.
+ *
+ * @return void
+ * @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
+ */
+ public function enqueue_idc_notice_files() {
+ _deprecated_function( __METHOD__, '0.5.0' );
+
+ // Register and Enqueue jp-tracks-functions.
+ Tracking::register_tracks_functions_scripts( true );
+ }
+
+ /**
+ * Renders the notice header.
+ *
+ * @return void
+ * @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
+ */
+ public function render_notice_header() {
+ _deprecated_function( __METHOD__, '0.5.0' );
+
+ ?>
+ <div class="jp-idc-notice__header">
+ <div class="jp-idc-notice__header__emblem">
+ <?php
+ $jetpack_logo = new Jetpack_Logo();
+ echo $jetpack_logo->get_jp_emblem(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ ?>
+ </div>
+ <p class="jp-idc-notice__header__text">
+ <?php esc_html_e( 'Jetpack Safe Mode', 'jetpack-idc' ); ?>
+ </p>
+ </div>
+
+ <div class="jp-idc-notice__separator"></div>
+ <?php
+ }
+
+ /**
+ * Is a container for the error notices.
+ * Will be shown/controlled by jQuery in idc-notice.js.
+ *
+ * @return void
+ */
+ public function render_error_notice() {
+ ?>
+ <div class="jp-idc-error__notice dops-notice is-error">
+ <svg class="gridicon gridicons-notice dops-notice__icon" height="24" width="24" viewBox="0 0 24 24">
+ <g>
+ <path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2l-.5-6h3l-.5 6z"></path>
+ </g>
+ </svg>
+ <div class="dops-notice__content">
+ <span class="dops-notice__text">
+ <?php esc_html_e( 'Something went wrong:', 'jetpack-idc' ); ?>
+ <span class="jp-idc-error__desc"></span>
+ </span>
+ <a class="dops-notice__action" href="javascript:void(0);">
+ <span id="jp-idc-error__action">
+ <?php esc_html_e( 'Try Again', 'jetpack-idc' ); ?>
+ </span>
+ </a>
+ </div>
+ </div>
+ <?php
+ }
+
+ /**
+ * Renders the first step notice.
+ *
+ * @return void
+ */
+ public function render_notice_first_step() {
+ ?>
+ <div class="jp-idc-notice__first-step">
+ <div class="jp-idc-notice__content-header">
+ <h3 class="jp-idc-notice__content-header__lead">
+ <?php echo $this->get_first_step_header_lead(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </h3>
+
+ <p class="jp-idc-notice__content-header__explanation">
+ <?php echo $this->get_first_step_header_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </p>
+ </div>
+
+ <?php $this->render_error_notice(); ?>
+
+ <div class="jp-idc-notice__actions">
+ <div class="jp-idc-notice__action">
+ <p class="jp-idc-notice__action__explanation">
+ <?php echo $this->get_confirm_safe_mode_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </p>
+ <button id="jp-idc-confirm-safe-mode-action" class="dops-button">
+ <?php echo $this->get_confirm_safe_mode_button_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </button>
+ </div>
+
+ <div class="jp-idc-notice__action">
+ <p class="jp-idc-notice__action__explanation">
+ <?php echo $this->get_first_step_fix_connection_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </p>
+ <button id="jp-idc-fix-connection-action" class="dops-button">
+ <?php echo $this->get_first_step_fix_connection_button_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </button>
+ </div>
+ </div>
+ </div>
+ <?php
+ }
+
+ /**
+ * Renders the second step notice.
+ *
+ * @return void
+ */
+ public function render_notice_second_step() {
+ ?>
+ <div class="jp-idc-notice__second-step">
+ <div class="jp-idc-notice__content-header">
+ <h3 class="jp-idc-notice__content-header__lead">
+ <?php echo $this->get_second_step_header_lead(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </h3>
+ </div>
+
+ <?php $this->render_error_notice(); ?>
+
+ <div class="jp-idc-notice__actions">
+ <div class="jp-idc-notice__action">
+ <p class="jp-idc-notice__action__explanation">
+ <?php echo $this->get_migrate_site_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </p>
+ <button id="jp-idc-migrate-action" class="dops-button">
+ <?php echo $this->get_migrate_site_button_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </button>
+ </div>
+
+ <div class="jp-idc-notice__action">
+ <p class="jp-idc-notice__action__explanation">
+ <?php echo $this->get_start_fresh_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </p>
+ <button id="jp-idc-reconnect-site-action" class="dops-button">
+ <?php echo $this->get_start_fresh_button_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </button>
+ </div>
+
+ </div>
+
+ <p class="jp-idc-notice__unsure-prompt">
+ <?php echo $this->get_unsure_prompt(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ </p>
+ </div>
+ <?php
+ }
+
+ /**
+ * Returns the first step header lead.
+ *
+ * @return string
+ */
+ public function get_first_step_header_lead() {
+ $html = wp_kses(
+ sprintf(
+ /* translators: %s: Safe mode docs URL and site URL. */
+ __( 'Jetpack has been placed into <a href="%1$s">Safe mode</a> because we noticed this is an exact copy of <a href="%2$s">%3$s</a>.', 'jetpack-idc' ),
+ esc_url( self::get_safe_mod_doc_url() ),
+ esc_url( self::$wpcom_home_url ),
+ self::prepare_url_for_display( esc_url_raw( self::$wpcom_home_url ) )
+ ),
+ array( 'a' => array( 'href' => array() ) )
+ );
+
+ /**
+ * Allows overriding of the default header text in the first step of the Safe Mode notice.
+ *
+ * @param string $html The HTML to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_first_step_header_lead', $html );
+ }
+
+ /**
+ * Returns the first step header explanation.
+ *
+ * @return string
+ */
+ public function get_first_step_header_explanation() {
+ $html = wp_kses(
+ sprintf(
+ /* translators: %s: Safe mode docs URL. */
+ __( 'Please confirm Safe Mode or fix the Jetpack connection. Select one of the options below or <a href="%1$s">learn more about Safe Mode</a>.', 'jetpack-idc' ),
+ esc_url( self::get_safe_mod_doc_url() )
+ ),
+ array( 'a' => array( 'href' => array() ) )
+ );
+
+ /**
+ * Allows overriding of the default header explanation text in the first step of the Safe Mode notice.
+ *
+ * @param string $html The HTML to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_first_step_header_explanation', $html );
+ }
+
+ /**
+ * Returns the confirm safe mode explanation.
+ *
+ * @return string
+ */
+ public function get_confirm_safe_mode_action_explanation() {
+ $html = wp_kses(
+ sprintf(
+ /* translators: %s: Site URL. */
+ __( 'Is this website a temporary duplicate of <a href="%1$s">%2$s</a> for the purposes of testing, staging or development? If so, we recommend keeping it in Safe Mode.', 'jetpack-idc' ),
+ esc_url( untrailingslashit( self::$wpcom_home_url ) ),
+ self::prepare_url_for_display( esc_url( self::$wpcom_home_url ) )
+ ),
+ array( 'a' => array( 'href' => array() ) )
+ );
+
+ /**
+ * Allows overriding of the default text used to explain the confirm safe mode action.
+ *
+ * @param string $html The HTML to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_confirm_safe_mode_explanation', $html );
+ }
+
+ /**
+ * Returns the confirm safe mode button text.
+ *
+ * @return string
+ */
+ public function get_confirm_safe_mode_button_text() {
+ $string = esc_html__( 'Confirm Safe Mode', 'jetpack-idc' );
+
+ /**
+ * Allows overriding of the default text used for the confirm safe mode action button.
+ *
+ * @param string $string The string to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_confirm_safe_mode_button_text', $string );
+ }
+
+ /**
+ * Returns the first step fix connection action explanation.
+ *
+ * @return string
+ */
+ public function get_first_step_fix_connection_action_explanation() {
+ $html = wp_kses(
+ sprintf(
+ /* translators: %s: Site URL. */
+ __( 'If this is a separate and new website, or the new home of <a href="%1$s">%2$s</a>, we recommend turning Safe Mode off, and re-establishing your connection to WordPress.com.', 'jetpack-idc' ),
+ esc_url( untrailingslashit( self::$wpcom_home_url ) ),
+ self::prepare_url_for_display( esc_url( self::$wpcom_home_url ) )
+ ),
+ array( 'a' => array( 'href' => array() ) )
+ );
+
+ /**
+ * Allows overriding of the default text used to explain the fix Jetpack connection action.
+ *
+ * @param string $html The HTML to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_first_fix_connection_explanation', $html );
+ }
+
+ /**
+ * Returns the first step fix connection button text.
+ *
+ * @return string
+ */
+ public function get_first_step_fix_connection_button_text() {
+ $string = esc_html__( "Fix Jetpack's Connection", 'jetpack-idc' );
+
+ /**
+ * Allows overriding of the default text used for the fix Jetpack connection action button.
+ *
+ * @param string $string The string to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_first_step_fix_connection_button_text', $string );
+ }
+
+ /**
+ * Returns the second step header lead.
+ *
+ * @return string
+ */
+ public function get_second_step_header_lead() {
+ $string = sprintf(
+ /* translators: %s: Site URL. */
+ esc_html__( 'Is %1$s the new home of %2$s?', 'jetpack-idc' ),
+ untrailingslashit( self::normalize_url_protocol_agnostic( get_home_url() ) ),
+ untrailingslashit( self::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) )
+ );
+
+ /**
+ * Allows overriding of the default header text in the second step of the Safe Mode notice.
+ *
+ * @param string $html The HTML to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_second_step_header_lead', $string );
+ }
+
+ /**
+ * Returns the site action explanation.
+ *
+ * @return string
+ */
+ public function get_migrate_site_action_explanation() {
+ $html = wp_kses(
+ sprintf(
+ /* translators: %s: Site URL. */
+ __( 'Yes. <a href="%1$s">%2$s</a> is replacing <a href="%3$s">%4$s</a>. I would like to migrate my stats and subscribers from <a href="%3$s">%4$s</a> to <a href="%1$s">%2$s</a>.', 'jetpack-idc' ),
+ esc_url( get_home_url() ),
+ self::prepare_url_for_display( get_home_url() ),
+ esc_url( self::$wpcom_home_url ),
+ untrailingslashit( self::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) )
+ ),
+ array( 'a' => array( 'href' => array() ) )
+ );
+
+ /**
+ * Allows overriding of the default text for explaining the migrate site action.
+ *
+ * @param string $html The HTML to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_migrate_site_explanation', $html );
+ }
+
+ /**
+ * Returns the migrate site button text.
+ *
+ * @return string
+ */
+ public function get_migrate_site_button_text() {
+ $string = esc_html__( 'Migrate Stats &amp; Subscribers', 'jetpack-idc' );
+
+ /**
+ * Allows overriding of the default text used for the migrate site action button.
+ *
+ * @param string $string The string to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_migrate_site_button_text', $string );
+ }
+
+ /**
+ * Returns the start fresh explanation.
+ *
+ * @return string
+ */
+ public function get_start_fresh_action_explanation() {
+ $html = wp_kses(
+ sprintf(
+ /* translators: %s: Site URL. */
+ __( 'No. <a href="%1$s">%2$s</a> is a new and different website that\'s separate from <a href="%3$s">%4$s</a>. It requires a new connection to WordPress.com for new stats and subscribers.', 'jetpack-idc' ),
+ esc_url( get_home_url() ),
+ self::prepare_url_for_display( get_home_url() ),
+ esc_url( self::$wpcom_home_url ),
+ untrailingslashit( self::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) )
+ ),
+ array( 'a' => array( 'href' => array() ) )
+ );
+
+ /**
+ * Allows overriding of the default text for explaining the start fresh action.
+ *
+ * @param string $html The HTML to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_start_fresh_explanation', $html );
+ }
+
+ /**
+ * Returns the start fresh button text.
+ *
+ * @return string
+ */
+ public function get_start_fresh_button_text() {
+ $string = esc_html__( 'Start Fresh &amp; Create New Connection', 'jetpack-idc' );
+
+ /**
+ * Allows overriding of the default text used for the start fresh action button.
+ *
+ * @param string $string The string to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_start_fresh_button_text', $string );
+ }
+
+ /**
+ * Returns the unsure prompt text.
+ *
+ * @return string
+ */
+ public function get_unsure_prompt() {
+ $html = wp_kses(
+ sprintf(
+ /* translators: %s: Safe mode docs URL. */
+ __( 'Unsure what to do? <a href="%1$s">Read more about Jetpack Safe Mode</a>', 'jetpack-idc' ),
+ esc_url( self::get_safe_mod_doc_url() )
+ ),
+ array( 'a' => array( 'href' => array() ) )
+ );
+
+ /**
+ * Allows overriding of the default text using in the "Unsure what to do?" prompt.
+ *
+ * @param string $html The HTML to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_unsure_prompt', $html );
+ }
+
+ /**
+ * Returns the non-admin notice text.
+ *
+ * @return string
+ * @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
+ */
+ public function get_non_admin_notice_text() {
+ _deprecated_function( __METHOD__, '0.5.0' );
+
+ $html = wp_kses(
+ sprintf(
+ /* translators: %s: Safe mode docs URL. */
+ __( 'Jetpack has been placed into Safe Mode. Learn more about <a href="%1$s">Safe Mode</a>.', 'jetpack-idc' ),
+ esc_url( self::get_safe_mod_doc_url() )
+ ),
+ array( 'a' => array( 'href' => array() ) )
+ );
+
+ /**
+ * Allows overriding of the default text that is displayed to non-admin on the Jetpack admin page.
+ *
+ * @param string $html The HTML to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_non_admin_notice_text', $html );
+ }
+
+ /**
+ * Returns the non-admin contact admin text.
+ *
+ * @return string
+ * @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
+ */
+ public function get_non_admin_contact_admin_text() {
+ _deprecated_function( __METHOD__, '0.5.0' );
+
+ $string = esc_html__( 'An administrator of this site can take Jetpack out of Safe Mode.', 'jetpack-idc' );
+
+ /**
+ * Allows overriding of the default text that is displayed to non-admins prompting them to contact an admin.
+ *
+ * @param string $string The string to be displayed.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ */
+ return apply_filters( 'jetpack_idc_non_admin_contact_admin_text', $string );
+ }
+
+ /**
+ * Whether the site is undergoing identity crisis.
+ *
+ * @return bool
+ */
+ public static function has_identity_crisis() {
+ return false !== static::check_identity_crisis() && ! static::$is_safe_mode_confirmed;
+ }
+
+ /**
+ * Whether an admin has confirmed safe mode.
+ * Unlike `static::$is_safe_mode_confirmed` this function always returns the actual flag value.
+ *
+ * @return bool
+ */
+ public static function safe_mode_is_confirmed() {
+ return Jetpack_Options::get_option( 'safe_mode_confirmed' );
+ }
+
+ /**
+ * Returns the mismatched URLs.
+ *
+ * @return array|bool The mismatched urls, or false if the site is not connected, offline, in safe mode, or the IDC error is not valid.
+ */
+ public static function get_mismatched_urls() {
+ if ( ! static::has_identity_crisis() ) {
+ return false;
+ }
+
+ $data = static::check_identity_crisis();
+
+ if ( ! $data ||
+ ! isset( $data['error_code'] ) ||
+ ! isset( $data['wpcom_home'] ) ||
+ ! isset( $data['home'] ) ||
+ ! isset( $data['wpcom_siteurl'] ) ||
+ ! isset( $data['siteurl'] )
+ ) {
+ // The jetpack_sync_error_idc option is missing a key.
+ return false;
+ }
+
+ if ( 'jetpack_site_url_mismatch' === $data['error_code'] ) {
+ return array(
+ 'wpcom_url' => $data['wpcom_siteurl'],
+ 'current_url' => $data['siteurl'],
+ );
+ }
+
+ return array(
+ 'wpcom_url' => $data['wpcom_home'],
+ 'current_url' => $data['home'],
+ );
+ }
+}
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-rest-endpoints.php b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-rest-endpoints.php
new file mode 100644
index 00000000..496f53fa
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-rest-endpoints.php
@@ -0,0 +1,188 @@
+<?php
+/**
+ * Identity_Crisis package.
+ *
+ * @package automattic/jetpack-identity-crisis
+ */
+
+namespace Automattic\Jetpack\IdentityCrisis;
+
+use Automattic\Jetpack\Connection\Manager as Connection_Manager;
+use Jetpack_Options;
+use WP_Error;
+use WP_REST_Server;
+
+/**
+ * This class will handle Identity Crisis Endpoints
+ *
+ * @since 0.2.0
+ */
+class REST_Endpoints {
+
+ /**
+ * Initialize REST routes.
+ */
+ public static function initialize_rest_api() {
+
+ // Confirm that a site in identity crisis should be in staging mode.
+ register_rest_route(
+ 'jetpack/v4',
+ '/identity-crisis/confirm-safe-mode',
+ array(
+ 'methods' => WP_REST_Server::EDITABLE,
+ 'callback' => __CLASS__ . '::confirm_safe_mode',
+ 'permission_callback' => __CLASS__ . '::identity_crisis_mitigation_permission_check',
+ )
+ );
+
+ // Handles the request to migrate stats and subscribers during an identity crisis.
+ register_rest_route(
+ 'jetpack/v4',
+ 'identity-crisis/migrate',
+ array(
+ 'methods' => WP_REST_Server::EDITABLE,
+ 'callback' => __CLASS__ . '::migrate_stats_and_subscribers',
+ 'permission_callback' => __CLASS__ . '::identity_crisis_mitigation_permission_check',
+ )
+ );
+
+ // IDC resolve: create an entirely new shadow site for this URL.
+ register_rest_route(
+ 'jetpack/v4',
+ '/identity-crisis/start-fresh',
+ array(
+ 'methods' => WP_REST_Server::EDITABLE,
+ 'callback' => __CLASS__ . '::start_fresh_connection',
+ 'permission_callback' => __CLASS__ . '::identity_crisis_mitigation_permission_check',
+ 'args' => array(
+ 'redirect_uri' => array(
+ 'description' => __( 'URI of the admin page where the user should be redirected after connection flow', 'jetpack-idc' ),
+ 'type' => 'string',
+ ),
+ ),
+ )
+ );
+
+ }
+
+ /**
+ * Handles identity crisis mitigation, confirming safe mode for this site.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ *
+ * @return bool | WP_Error True if option is properly set.
+ */
+ public static function confirm_safe_mode() {
+ $updated = Jetpack_Options::update_option( 'safe_mode_confirmed', true );
+ if ( $updated ) {
+ return rest_ensure_response(
+ array(
+ 'code' => 'success',
+ )
+ );
+ }
+
+ return new WP_Error(
+ 'error_setting_jetpack_safe_mode',
+ esc_html__( 'Could not confirm safe mode.', 'jetpack-idc' ),
+ array( 'status' => 500 )
+ );
+ }
+
+ /**
+ * Handles identity crisis mitigation, migrating stats and subscribers from old url to this, new url.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ *
+ * @return bool | WP_Error True if option is properly set.
+ */
+ public static function migrate_stats_and_subscribers() {
+ if ( Jetpack_Options::get_option( 'sync_error_idc' ) && ! Jetpack_Options::delete_option( 'sync_error_idc' ) ) {
+ return new WP_Error(
+ 'error_deleting_sync_error_idc',
+ esc_html__( 'Could not delete sync error option.', 'jetpack-idc' ),
+ array( 'status' => 500 )
+ );
+ }
+
+ if ( Jetpack_Options::get_option( 'migrate_for_idc' ) || Jetpack_Options::update_option( 'migrate_for_idc', true ) ) {
+ return rest_ensure_response(
+ array(
+ 'code' => 'success',
+ )
+ );
+ }
+ return new WP_Error(
+ 'error_setting_jetpack_migrate',
+ esc_html__( 'Could not confirm migration.', 'jetpack-idc' ),
+ array( 'status' => 500 )
+ );
+ }
+
+ /**
+ * This IDC resolution will disconnect the site and re-connect to a completely new
+ * and separate shadow site than the original.
+ *
+ * It will first will disconnect the site without phoning home as to not disturb the production site.
+ * It then builds a fresh connection URL and sends it back along with the response.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ *
+ * @param \WP_REST_Request $request The request sent to the WP REST API.
+ *
+ * @return \WP_REST_Response|WP_Error
+ */
+ public static function start_fresh_connection( $request ) {
+ /**
+ * Fires when Users have requested through Identity Crisis for the connection to be reset.
+ * Should be used to disconnect any connections and reset options.
+ *
+ * @since 0.2.0
+ */
+ do_action( 'jetpack_idc_disconnect' );
+
+ $connection = new Connection_Manager();
+ $result = $connection->try_registration( true );
+
+ // early return if site registration fails.
+ if ( ! $result || is_wp_error( $result ) ) {
+ return rest_ensure_response( $result );
+ }
+
+ $redirect_uri = $request->get_param( 'redirect_uri' ) ? admin_url( $request->get_param( 'redirect_uri' ) ) : null;
+
+ /**
+ * Filters the connection url that users should be redirected to for re-establishing their connection.
+ *
+ * @since 0.2.0
+ *
+ * @param \WP_REST_Response|WP_Error $connection_url Connection URL user should be redirected to.
+ */
+ return apply_filters( 'jetpack_idc_authorization_url', rest_ensure_response( $connection->get_authorization_url( null, $redirect_uri ) ) );
+ }
+
+ /**
+ * Verify that user can mitigate an identity crisis.
+ *
+ * @since 0.2.0
+ * @since-jetpack 4.4.0
+ *
+ * @return true|WP_Error True if the user has capability 'jetpack_disconnect', an error object otherwise.
+ */
+ public static function identity_crisis_mitigation_permission_check() {
+ if ( current_user_can( 'jetpack_disconnect' ) ) {
+ return true;
+ }
+ $error_msg = esc_html__(
+ 'You do not have the correct user permissions to perform this action.
+ Please contact your site admin if you think this is a mistake.',
+ 'jetpack-idc'
+ );
+
+ return new WP_Error( 'invalid_user_permission_identity_crisis', $error_msg, array( 'status' => rest_authorization_required_code() ) );
+ }
+
+}
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-ui.php b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-ui.php
new file mode 100644
index 00000000..a3c2694a
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-identity-crisis/src/class-ui.php
@@ -0,0 +1,151 @@
+<?php
+/**
+ * Identity_Crisis package.
+ *
+ * @package automattic/jetpack-identity-crisis
+ */
+
+namespace Automattic\Jetpack\IdentityCrisis;
+
+use Automattic\Jetpack\Assets;
+use Automattic\Jetpack\Identity_Crisis;
+use Automattic\Jetpack\Tracking as Tracking;
+use Jetpack_Tracks_Client;
+
+/**
+ * The Identity Crisis UI handling.
+ */
+class UI {
+
+ /**
+ * Initialization.
+ */
+ public static function init() {
+ if ( did_action( 'jetpack_identity_crisis_ui_init' ) ) {
+ return;
+ }
+
+ /**
+ * Action called after initializing Identity Crisis UI.
+ *
+ * @since 0.6.0
+ */
+ do_action( 'jetpack_identity_crisis_ui_init' );
+
+ $idc_data = Identity_Crisis::check_identity_crisis();
+
+ if ( false === $idc_data ) {
+ return;
+ }
+
+ add_action( 'admin_enqueue_scripts', array( static::class, 'enqueue_scripts' ) );
+
+ Tracking::register_tracks_functions_scripts( true );
+ }
+
+ /**
+ * Enqueue scripts!
+ */
+ public static function enqueue_scripts() {
+ if ( is_admin() ) {
+ Assets::register_script(
+ 'jp_identity_crisis_banner',
+ '../build/index.js',
+ __FILE__,
+ array(
+ 'in_footer' => true,
+ 'textdomain' => 'jetpack-idc',
+ )
+ );
+ Assets::enqueue_script( 'jp_identity_crisis_banner' );
+ wp_add_inline_script( 'jp_identity_crisis_banner', static::get_initial_state(), 'before' );
+
+ add_action( 'admin_notices', array( static::class, 'render_container' ) );
+ }
+ }
+
+ /**
+ * Create the container element for the IDC banner.
+ */
+ public static function render_container() {
+ ?>
+ <div id="jp-identity-crisis-container"></div>
+ <?php
+ }
+
+ /**
+ * Return the rendered initial state JavaScript code.
+ *
+ * @return string
+ */
+ private static function get_initial_state() {
+ return 'var JP_IDENTITY_CRISIS__INITIAL_STATE=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( static::get_initial_state_data() ) ) . '"));';
+ }
+
+ /**
+ * Get the initial state data.
+ *
+ * @return array
+ */
+ private static function get_initial_state_data() {
+ $idc_urls = Identity_Crisis::get_mismatched_urls();
+ $current_screen = get_current_screen();
+ $is_admin = current_user_can( 'jetpack_disconnect' );
+
+ return array(
+ 'WP_API_root' => esc_url_raw( rest_url() ),
+ 'WP_API_nonce' => wp_create_nonce( 'wp_rest' ),
+ 'wpcomHomeUrl' => ( is_array( $idc_urls ) && array_key_exists( 'wpcom_url', $idc_urls ) ) ? $idc_urls['wpcom_url'] : null,
+ 'currentUrl' => ( is_array( $idc_urls ) && array_key_exists( 'current_url', $idc_urls ) ) ? $idc_urls['current_url'] : null,
+ 'redirectUri' => str_replace( '/wp-admin/', '/', $_SERVER['REQUEST_URI'] ),
+ 'tracksUserData' => Jetpack_Tracks_Client::get_connected_user_tracks_identity(),
+ 'tracksEventData' => array(
+ 'isAdmin' => $is_admin,
+ 'currentScreen' => $current_screen ? $current_screen->id : false,
+ ),
+ 'isSafeModeConfirmed' => Identity_Crisis::$is_safe_mode_confirmed,
+ 'consumerData' => static::get_consumer_data(),
+ 'isAdmin' => $is_admin,
+ );
+ }
+
+ /**
+ * Get the package consumer data.
+ *
+ * @return array
+ */
+ private static function get_consumer_data() {
+ $consumers = apply_filters( 'jetpack_idc_consumers', array() );
+
+ if ( ! $consumers ) {
+ return array();
+ }
+
+ usort(
+ $consumers,
+ function ( $c1, $c2 ) {
+ $priority1 = ( array_key_exists( 'priority', $c1 ) && (int) $c1['priority'] ) ? (int) $c1['priority'] : 10;
+ $priority2 = ( array_key_exists( 'priority', $c2 ) && (int) $c2['priority'] ) ? (int) $c2['priority'] : 10;
+
+ return $priority1 > $priority2 ? 1 : -1;
+ }
+ );
+
+ $consumer_chosen = null;
+ $consumer_url_length = 0;
+
+ foreach ( $consumers as $consumer ) {
+ if ( empty( $consumer['admin_page'] ) || ! is_string( $consumer['admin_page'] ) ) {
+ continue;
+ }
+
+ if ( 0 === strpos( $_SERVER['REQUEST_URI'], $consumer['admin_page'] ) && strlen( $consumer['admin_page'] ) > $consumer_url_length ) {
+ $consumer_chosen = $consumer;
+ $consumer_url_length = strlen( $consumer['admin_page'] );
+ }
+ }
+
+ return $consumer_chosen ? $consumer_chosen : array_shift( $consumers );
+ }
+
+}