oVirt 3.5 Test Day 1 Results
by Adam Litke
I tested:
* [RFE] Prevent host fencing while kdumping
- http://www.ovirt.org/Fence_kdump
* hosted-engine-setup
Results:
Bug 1115123 -- hosted-engine-setup fails with ioprocess oop_impl enabled
Adding a host with Detect kdump flow set to on and without crashkernel
command line parameter results in a warning in the log as expected.
I ran out of time before I was able to configure crash dump detection
for my host VMs correctly. Looking forward to more thorough testing
on the next test day.
--
Adam Litke
10 years, 4 months
Update on UI column sort infra issues
by Vojtech Szocs
Hi guys,
just a quick update on issues related to UI column sort infra.
The client-side sorting fix [1] is now merged in master branch.
The server-side sorting fix [2] is pending review.
Also note that Lior merged a patch [3] which greatly simplifies
code when making text-based columns *client-side* sortable, for
example:
TextColumnWithTooltip<SomeEntity> nameColumn = ...
instead of this:
// for text-based columns, need to provide separate Comparator
// that (typically) uses LexoNumericComparator for comparison
nameColumn.makeSortable(someEntityPropertyComparator);
you can do this:
// uses LexoNumericComparator to compare column's text values
nameColumn.makeSortable();
--
[1] http://gerrit.ovirt.org/#/c/28392/ ... where items would
disappear from grid when activating client-side column sorting
[2] http://gerrit.ovirt.org/#/c/28557/ ... where triggering
server-side sorting on a given column might corrupt the actual
search query dispatched by the model
[3] http://gerrit.ovirt.org/#/c/28670/
--
Regards,
Vojtech
10 years, 4 months
ovirt-engine-3.5 branching
by Oved Ourfali
Hi all,
The test day revealed a large amount of issues. These issues are being addressed in the last few days.
To avoid the need to back-port each and every one of them to the ovirt-engine-3.5 stable branch, I suggest to give a few days for that effort,
and revisit it on mid next week, to asses it again and decide whether to do the branching then.
I ask the different maintainers not to push 3.6 relevant material into master in the next few days, until the branching is done.
To my knowledge no major (or any) patch related to 3.6 has been merge on master, but please correct me if I'm wrong.
Thanks all for your efforts in stabilizing the version.
Regards,
Oved
10 years, 4 months
oVirt Node Weekly Meeting Minutes - July 8 2014
by Fabian Deutsch
Minutes: http://ovirt.org/meetings/ovirt/2014/ovirt.2014-07-08-13.03.html
Minutes (text): http://ovirt.org/meetings/ovirt/2014/ovirt.2014-07-08-13.03.txt
Log: http://ovirt.org/meetings/ovirt/2014/ovirt.2014-07-08-13.03.log.html
=================================
#ovirt: oVirt Node Weekly Meeting
=================================
Meeting started by fabiand at 13:03:55 UTC. The full logs are available
at http://ovirt.org/meetings/ovirt/2014/ovirt.2014-07-08-13.03.log.html
.
Meeting summary
---------------
* Agenda (fabiand, 13:05:00)
* Action Item Review (fabiand, 13:05:38)
* Upcoming Release (3.1) (fabiand, 13:05:44)
* Testing (fabiand, 13:05:54)
* Other Items (fabiand, 13:05:57)
* Action Item Review (fabiand, 13:11:53)
* LINK:
http://resources.ovirt.org/meetings/ovirt/2014/ovirt.2014-07-01-13.02.txt
(fabiand, 13:12:02)
* rbarry created a jenkins job for the hosted-engine plugin (fabiand,
13:12:57)
* Upcoming Release (3.1) (fabiand, 13:13:20)
* Many patches merged for 3.1 (fabiand, 13:14:04)
* ISO with merged patches, based on master, for testign is ready,
announcement pending (fabiand, 13:14:58)
* Testing (fabiand, 13:15:28)
* Testing has priority now that all features (official and unoffical
ones) are merged (fabiand, 13:16:40)
* ACTION: fabiand and rbarry to test the iso (fabiand, 13:17:02)
* Other Items (fabiand, 13:17:14)
Meeting ended at 13:19:22 UTC.
Action Items
------------
* fabiand and rbarry to test the iso
Action Items, by person
-----------------------
* fabiand
* fabiand and rbarry to test the iso
* rbarry
* fabiand and rbarry to test the iso
* **UNASSIGNED**
* (none)
People Present (lines said)
---------------------------
* fabiand (55)
* apuimedo (4)
* rbarry (3)
* bkp (3)
* ovirtbot (2)
Generated by `MeetBot`_ 0.1.4
.. _`MeetBot`: http://wiki.debian.org/MeetBot
10 years, 4 months
oVirt.js GWT wrapper prototype
by Vojtech Szocs
------=_Part_26595393_401944553.1403609366320
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Hello everyone,
following the announcement of oVirt.js prototype, I've developed a sample
GWT wrapper that provides Java API to oVirt.js for all GWT applications.
Please find the GWT wrapper patch attached. It bundles oVirt.js & Lo-Dash
libraries via GWT module (SdkGwtWrapper) providing Java-like API based on
oVirt.js.
In order for WebAdmin to use oVirt.js GWT wrapper, all we have to do is
add following into WebAdmin.gwt.xml (GWT module descriptor):
<inherits name="org.ovirt.engine.sdk.gwt.SdkGwtWrapper" />
and add following into pom.xml (Maven project descriptor):
<dependency>
<groupId>${engine.groupId}</groupId>
<artifactId>ovirt-js-gwt-wrapper</artifactId>
<version>${engine.version}</version>
<scope>provided</scope>
</dependency>
and that's it.
The Java API takes inspiration from oVirt.js API. For example, to add
new DataCenter:
// Create data object template, 'name' and 'local' are required.
DataCenterTemplate dcTemplate = DataCenterTemplate.create(
"test-dc", // name
false // local
);
// Set optional parameters such as 'description', if necessary.
dcTemplate.setDescription("my-desc");
// Obtain DataCenter resource collection.
ResourceCollection<DataCenter> dcColl = Sdk.get().api().getDataCenters();
// Add new DataCenter by running 'add' operation on 'dcColl'.
dcColl.add(dcTemplate).success(new SuccessCallback<DataCenter>() {
@Override
public void onSuccess(DataCenter dc) {
Window.alert("Added: " + dc.getName());
}
}).run();
The concept of resource, resource collection and operation is the same
as presented in oVirt.js.
dc.setName("test-dc-updated");
dc.setDescription("test")
dc.update().run(); // we could register 'success' callback here
You can see the full example by looking at SdkGwtWrapperTest class,
located in WebAdmin codebase (org.ovirt.engine.ui.webadmin.sdk_test).
Note that 'DataCenter' and 'DataCenterTemplate' will probably be
auto-generated from oVirt Engine REST API definition (XSD/RSDL).
As mentioned in my previous email, oVirt.js GWT wrapper ("overlay")
can be initially part of ovirt-engine repo, while oVirt.js project
deserves (in my opinion) a separate repo on its own.
Regards,
Vojtech
------=_Part_26595393_401944553.1403609366320
Content-Type: text/x-patch; name=oVirt.js-GWT-wrapper-prototype.patch
Content-Disposition: attachment;
filename=oVirt.js-GWT-wrapper-prototype.patch
Content-Transfer-Encoding: base64
RnJvbSAxNDViMTAwNzYwODlhODlkYWVlM2M3NzI4ZjBkMDFjMmQzZmNmYjBjIE1vbiBTZXAgMTcg
MDA6MDA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gIDxpbmNsdWRlcz4KKyAgICAgICAgICAgICAgICAgICAgPGluY2x1ZGU+Kiov
Ki5qYXZhPC9pbmNsdWRlPgorICAgICAgICAgICAgICAgIDwvaW5jbHVkZXM+CisgICAgICAgICAg
ICA8L3Jlc291cmNlPgorICAgICAgICA8L3Jlc291cmNlcz4KKyAgICAgICAgPHBsdWdpbnM+Cisg
ICAgICAgICAgICA8cGx1Z2luPgorICAgICAgICAgICAgICAgIDxncm91cElkPm9yZy5jb2RlaGF1
cy5tb2pvPC9ncm91cElkPgorICAgICAgICAgICAgICAgIDxhcnRpZmFjdElkPmd3dC1tYXZlbi1w
bHVnaW48L2FydGlmYWN0SWQ+CisgICAgICAgICAgICAgICAgPGV4ZWN1dGlvbnM+CisgICAgICAg
ICAgICAgICAgICAgIDxleGVjdXRpb24+CisgICAgICAgICAgICAgICAgICAgICAgICA8cGhhc2U+
cHJvY2Vzcy1yZXNvdXJjZXM8L3BoYXNlPgorICAgICAgICAgICAgICAgICAgICAgICAgPGdvYWxz
PgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxnb2FsPnJlc291cmNlczwvZ29hbD4KKyAg
ICAgICAgICAgICAgICAgICAgICAgIDwvZ29hbHM+CisgICAgICAgICAgICAgICAgICAgIDwvZXhl
Y3V0aW9uPgorICAgICAgICAgICAgICAgIDwvZXhlY3V0aW9ucz4KKyAgICAgICAgICAgIDwvcGx1
Z2luPgorICAgICAgICAgICAgPHBsdWdpbj4KKyAgICAgICAgICAgICAgICA8Z3JvdXBJZD5vcmcu
YXBhY2hlLm1hdmVuLnBsdWdpbnM8L2dyb3VwSWQ+CisgICAgICAgICAgICAgICAgPGFydGlmYWN0
SWQ+bWF2ZW4tamF2YWRvYy1wbHVnaW48L2FydGlmYWN0SWQ+CisgICAgICAgICAgICAgICAgPHZl
cnNpb24+Mi45PC92ZXJzaW9uPiA8IS0tIFRPRE8gZGVmaW5lIHZlcnNpb24gaW4gcm9vdCBwb20u
eG1sIC0tPgorICAgICAgICAgICAgICAgIDxjb25maWd1cmF0aW9uPgorICAgICAgICAgICAgICAg
ICAgICA8ZW5jb2Rpbmc+JHtwcm9qZWN0LmJ1aWxkLnNvdXJjZUVuY29kaW5nfTwvZW5jb2Rpbmc+
CisgICAgICAgICAgICAgICAgICAgIDxsb2NhbGU+ZW48L2xvY2FsZT4KKyAgICAgICAgICAgICAg
ICAgICAgPGxpbmtzb3VyY2U+dHJ1ZTwvbGlua3NvdXJjZT4KKyAgICAgICAgICAgICAgICAgICAg
PHZhbGlkYXRlTGlua3M+dHJ1ZTwvdmFsaWRhdGVMaW5rcz4KKyAgICAgICAgICAgICAgICA8L2Nv
bmZpZ3VyYXRpb24+CisgICAgICAgICAgICAgICAgPGV4ZWN1dGlvbnM+CisgICAgICAgICAgICAg
ICAgICAgIDxleGVjdXRpb24+CisgICAgICAgICAgICAgICAgICAgICAgICA8cGhhc2U+cGFja2Fn
ZTwvcGhhc2U+CisgICAgICAgICAgICAgICAgICAgICAgICA8Z29hbHM+CisgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgPGdvYWw+amFyPC9nb2FsPgorICAgICAgICAgICAgICAgICAgICAgICAg
PC9nb2Fscz4KKyAgICAgICAgICAgICAgICAgICAgPC9leGVjdXRpb24+CisgICAgICAgICAgICAg
ICAgPC9leGVjdXRpb25zPgorICAgICAgICAgICAgPC9wbHVnaW4+CisgICAgICAgIDwvcGx1Z2lu
cz4KKyAgICA8L2J1aWxkPgorPC9wcm9qZWN0PgpkaWZmIC0tZ2l0IGEvZnJvbnRlbmQvd2ViYWRt
aW4vbW9kdWxlcy9vdmlydC1qcy1nd3Qtd3JhcHBlci9zcmMvbWFpbi9qYXZhL29yZy9vdmlydC9l
bmdpbmUvc2RrL2d3dC9jbGllbnQvU2RrLmphdmEgYi9mcm9udGVuZC93ZWJhZG1pbi9tb2R1bGVz
L292aXJ0LWpzLWd3dC13cmFwcGVyL3NyYy9tYWluL2phdmEvb3JnL292aXJ0L2VuZ2luZS9zZGsv
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ICAgICAgIHRoaXMubGFzdEluZGV4ID0gYXJyYXkubGVuZ3RoKCk7CisgICAgICAgIH0KKwor
ICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gaGFzTmV4dCgpIHsKKyAg
ICAgICAgICAgIHJldHVybiBpbmRleCA8IGxhc3RJbmRleDsKKyAgICAgICAgfQorCisgICAgICAg
IEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgVCBuZXh0KCkgeworICAgICAgICAgICAgaWYgKCFo
YXNOZXh0KCkpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTm9TdWNoRWxlbWVudEV4Y2Vw
dGlvbigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGFycmF5LmdldChpbmRl
eCsrKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9p
ZCByZW1vdmUoKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVW5zdXBwb3J0ZWRPcGVyYXRpb25F
eGNlcHRpb24oInJlbW92ZSgpIG1ldGhvZCBpcyBub3Qgc3VwcG9ydGVkIik7CisgICAgICAgIH0K
KworICAgIH0KKworICAgIHByb3RlY3RlZCBJdGVyYWJsZUpzQXJyYXkoKSB7CisgICAgfQorCisg
ICAgQE92ZXJyaWRlCisgICAgcHVibGljIEl0ZXJhdG9yPFQ+IGl0ZXJhdG9yKCkgeworICAgICAg
ICByZXR1cm4gbmV3IEpzQXJyYXlJdGVyYXRvcjxUPih0aGlzKTsKKyAgICB9CisKK30KZGlmZiAt
LWdpdCBhL2Zyb250ZW5kL3dlYmFkbWluL21vZHVsZXMvb3ZpcnQtanMtZ3d0LXdyYXBwZXIvc3Jj
L21haW4vamF2YS9vcmcvb3ZpcnQvZW5naW5lL3Nkay9nd3QvY2xpZW50L2dvb2RpZXMvSnNPYmpl
Y3RPdmVybGF5LmphdmEgYi9mcm9udGVuZC93ZWJhZG1pbi9tb2R1bG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Kwor
ICAvKioKKyAgICogR2V0cyBhbiBvYmplY3QgZnJvbSB0aGUgb2JqZWN0IHBvb2wgb3IgY3JlYXRl
cyBhIG5ldyBvbmUgaWYgdGhlIHBvb2wgaXMgZW1wdHkuCisgICAqCisgICAqIEBwcml2YXRlCisg
ICAqIEByZXR1cm5zIHtPYmplY3R9IFRoZSBvYmplY3QgZnJvbSB0aGUgcG9vbC4KKyAgICovCisg
IGZ1bmN0aW9uIGdldE9iamVjdCgpIHsKKyAgICByZXR1cm4gb2JqZWN0UG9vbC5wb3AoKSB8fCB7
CisgICAgICAnYXJyYXknOiBudWxsLAorICAgICAgJ2NhY2hlJzogbnVsbCwKKyAgICAgICdjcml0
ZXJpYSc6IG51bGwsCisgICAgICAnZmFsc2UnOiBmYWxzZSwKKyAgICAgICdpbmRleCc6IDAsCisg
ICAgICAnbnVsbCc6IGZhbHNlLAorICAgICAgJ251bWJlcic6IG51bGwsCisgICAgICAnb2JqZWN0
JzogbnVsbCwKKyAgICAgICdwdXNoJzogbnVsbCwKKyAgICAgICdzdHJpbmcnOiBudWxsLAorICAg
ICAgJ3RydWUnOiBmYWxzZSwKKyAgICAgICd1bmRlZmluZWQnOiBmYWxzZSwKKyAgICAgICd2YWx1
ZSc6IG51bGwKKyAgICB9OworICB9CisKKyAgLyoqCisgICAqIFJlbGVhc2VzIHRoZSBnaXZlbiBh
cnJheSBiYWNrIHRvIHRoZSBhcnJheSBwb29sLgorICAgKgorICAgKiBAcHJpdmF0ZQorICAgKiBA
cGFyYW0ge0FycmF5fSBbYXJyYXldIFRoZSBhcnJheSB0byByZWxlYXNlLgorICAgKi8KKyAgZnVu
Y3Rpb24gcmVsZWFzZUFycmF5KGFycmF5KSB7CisgICAgYXJyYXkubGVuZ3RoID0gMDsKKyAgICBp
ZiAoYXJyYXlQb29sLmxlbmd0aCA8IG1heFBvb2xTaXplKSB7CisgICAgICBhcnJheVBvb2wucHVz
aChhcnJheSk7CisgICAgfQorICB9CisKKyAgLyoqCisgIC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R5cGVFcnJvciA9IGNvbnRleHQuVHlwZUVycm9y
OworCisgICAgLyoqCisgICAgICogVXNlZCBmb3IgYEFycmF5YCBtZXRob2QgcmVmZXJlbmNlcy4K
KyAgICAgKgorICAgICAqIE5vcm1hbGx5IGBBcnJheS5wcm90b3R5cGVgIHdvdWxkIHN1ZmZpY2Us
IGhvd2V2ZXIsIHVzaW5nIGFuIGFycmF5IGxpdGVyYWwKKyAgICAgKiBhdm9pZHMgaXNzdWVzIGlu
IE5hcndoYWwuCisgICAgICovCisgICAgdmFyIGFycmF5UmVmID0gW107CisKKyAgICAvKiogVXNl
ZCBmb3IgbmF0aXZlIG1ldGhvZCByZWZlcmVuY2VzICovCisgICAgdmFyIG9iamVjdFByb3RvID0g
T2JqZWN0LnByb3RvdHlwZTsKKworICAgIC8qKiBVc2VkIHRvIHJlc3RvcmUgdGhlIG9yaWdpbmFs
IGBfYCByZWZlcmVuY2UgaW4gYG5vQ29uZmxpY3RgICovCisgICAgdmFyIG9sZERhc2ggPSBjb250
ZXh0Ll87CisKKyAgICAvKiogVXNlZCB0byByZXNvbHZlIHRoZSBpbnRlcm5hbCBbW0NsYXNzXV0g
b2YgdmFsdWVzICovCisgICAgdmFyIHRvU3RyaW5nID0gb2JqZWN0UHJvdG8udG9TdHJpbmc7CisK
KyAgICAvKiogVXNlZCB0byBkZXRlY3QgaWYgYSBtZXRob2QgaXMgbmF0aXZlICovCisgICAgdmFy
IHJlTmF0aXZlID0gUmVnRXhwKCdeJyArCisgICAgICBTdHJpbmcodG9TdHJpbmcpCisgICAgICAg
IC5yZXBsYWNlKC9bLiorP14ke30oKXxbXF1cXF0vZywgJ1xcJCYnKQorICAgICAgICAucmVwbGFj
ZSgvdG9TdHJpbmd8IGZvciBbXlxdXSsvZywgJy4qPycpICsgJyQnCisgICAgKTsKKworICAgIC8q
KiBOYXRpdmUgbWV0aG9kIHNob3J0Y3V0cyAqLworICAgIHZhciBjZWlsID0gTWF0aC5jZWlsLAor
ICAgICAgICB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IGVuYWJsZWQgYnkgdXNpbmcgdGhlIGBfLmNoYWluYCBtZXRob2QuCisgICAgICoKKyAgICAgKiBA
bmFtZSBfCisgICAgICogQGNvbnN0cnVjdG9yCisgICAgICogQGNhdGVnb3J5IENoYWluaW5nCisg
ICAgICogQHBhcmFtIHsqfSB2YWx1ZSBUaGUgdmFsdWUgdG8gd3JhcCBpbiBhIGBsb2Rhc2hgIGlu
c3RhbmNlLgorICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgYSBgbG9kYXNoYCBpbnN0
YW5jZS4KKyAgICAgKiBAZXhhbXBsZQorICAgICAqCisgICAgICogdmFyIHdyYXBwZWQgPSBfKFsx
LCAyLCAzXSk7CisgICAgICoKKyAgICAgKiAvLyByZXR1cm5zIGFuIHVud3JhcHBlZCB2YWx1ZQor
ICAgICAqIHdyYXBwZWQucmVkdWNlKGZ1bmN0aW9uKHN1bSwgbnVtKSB7CisgICAgICogICByZXR1
cm4gc3VtICsgbnVtOworICAgICAqIH0pOworICAgICAqIC8vID0+IDYKKyAgICAgKgorICAgICAq
IC8vIHJldHVybnMgYSB3cmFwcGVkIHZhbHVlCisgICAgICogdmFyIHNxdWFyZXMgPSB3cmFwcGVk
Lm1hcChmdW5jdGlvbihudW0pIHsKKyAgICAgKiAgIHJldHVybiBudW0gKiBudW07CisgICAgICog
fSk7CisgICAgICoKKyAgICAgKiBfLmlzQXJyYXkoc3F1YXJlcyk7CisgICAgICogLy8gPT4gZmFs
c2UKKyAgICAgKgorICAgICAqIF8uaXNBcnJheShzcXVhcmVzLnZhbHVlKCkpOworICAgICAqIC8v
ID0+IHRydWUKKyAgICAgKi8KKyAgICBmdW5jdGlvbiBsb2Rhc2godmFsdWUpIHsKKyAgICAgIC8v
IGRvbid0IHdyYXAgaWYgYWxyZWFkeSB3cmFwcGVkLCBldmVuIGlmIHdyYXBwZWQgYnkgYSBkaWZm
ZXJlbnQgYGxvZGFzaGAgY29uc3RydWN0b3IKKyAgICAgIHJldHV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ICAgICAqIEBtZW1iZXJPZiBfCisgICAgICogQHR5cGUgT2JqZWN0CisgICAgICovCisgICAg
bG9kYXNoLnRlbXBsYXRlU2V0dGluZ3MgPSB7CisKKyAgICAgIC8qKgorICAgICAgICogVXNlZCB0
byBkZXRlY3QgYGRhdGFgIHByb3BlcnR5IHZhbHVlcyB0byBiZSBIVE1MLWVzY2FwZWQuCisgICAg
ICAgKgorICAgICAgICogQG1lbWJlck9mIF8udGVtcGxhdGVTZXR0aW5ncworICAgICAgICogQHR5
cGUgUmVnRXhwCisgICAgICAgKi8KKyAgICAgICdlc2NhcGUnOiAvPCUtKFtcc1xTXSs/KSU+L2cs
CisKKyAgICAgIC8qKgorICAgICAgICogVXNlZCB0byBkZXRlY3QgY29kZSB0byBiZSBldmFsdWF0
ZWQuCisgICAgICAgKgorICAgICAgICogQG1lbWJlck9mIF8udGVtcGxhdGVTZXR0aW5ncworICAg
ICAgICogQHR5cGUgUmVnRXhwCisgICAgICAgKi8KKyAgICAgICdldmFsdWF0ZSc6IC88JShbXHNc
U10rPyklPi9nLAorCisgICAgICAvKioKKyAgICAgICAqIFVzZWQgdG8gZGV0ZWN0IGBkYXRhYCBw
cm9wZXJ0eSB2YWx1ZXMgdG8gaW5qZWN0LgorICAgICAgICoKKyAgICAgICAqIEBtZW1iZXJPZiBf
LnRlbXBsYXRlU2V0dGluZ3MKKyAgICAgICAqIEB0eXBlIFJlZ0V4cAorICAgICAgICovCisgICAg
ICAnaW50ZXJwb2xhdGUnOiByZUludGVycG9sYXRlLAorCisgICAgICAvKioKKyAgICAgICAqIFVz
ZWQgdG8gcmVmZXJlbmNlIHRoZSBkYXRhIG9iamVjdCBpbiB0aGUgdGVtcGxhdGUgdGV4dC4KKyAg
ICAgICAqCisgICAgICAgKiBAbWVtYmVyT2YgXy50ZW1wbGF0ZVNldHRpbmdzCisgICAgICAgKiBA
dHlwZSBzdHJpbmcKKyAgICAgICAqLworICAgICAgJ3ZhcmlhYmxlJzogJycsCisKKyAgICAgIC8q
KgorICAgICAgICogVXNlZCB0byBpbXBvcnQgdmFyaWFibGVzIGludG8gdGhlIGNvbXBpbGVkIHRl
bXBsYXRlLgorICAgICAgICoKKyAgICAgICAqIEBtZW1iZXJPZiBfLnRlbXBsYXRlU2V0dGluZ3MK
KyAgICAgICAqIEB0eXBlIE9iamVjdAorICAgICAgICovCisgICAgICAnaW1wb3J0cyc6IHsKKwor
ICAgICAgICAvKioKKyAgICAgICAgICogQSByZWZlcmVuY2UgdG8gdGhlIGBsb2Rhc2hgIGZ1bmN0
aW9uLgorICAgICAgICAgKgorICAgICAgICAgKiBAbWVtYmVyT2YgXy50ZW1wbGF0ZVNldHRpbmdz
LmltcG9ydHMKKyAgICAgICAgICogQHR5cGUgRnVuY3Rpb24KKyAgICAgICAgICovCisgICAgICAg
ICdfJzogbG9kYXNoCisgICAgICB9CisgICAgfTsKKworICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0q
LworCisgICAgLyoqCisgICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8uYmluZGAg
dGhhdCBjcmVhdGVzIHRoZSBib3VuZCBmdW5jdGlvbiBhbmQKKyAgICAgKiBzZXRzIGl0cyBtZXRh
IGRhdGEuCisgICAgICoKKyAgICAgKiBAcHJpdmF0ZQorICAgICAqIEBwYXJhbSB7QXJyYXl9IGJp
bmREYXRhIFRoZSBiaW5kIGRhdGEgYXJyYXkuCisgICAgICogQHJldHVybnMge0Z1bmN0aW9ufSBS
ZXR1cm5zIHRoZSBuZXcgYm91bmQgZnVuY3Rpb24uCisgICAgICovCisgICAgZnVuY3Rpb24gYmFz
ZUJpbmQoYmluZERhdGEpIHsKKyAgICAgIHZhciBmdW5jID0gYmluZERhdGFbMF0sCisgICAgICAg
ICAgcGFydGlhbEFyZ3MgPSBiaW5kRGF0YVsyXSwKKy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GJhY2sodmFsdWUpOworICAgICAgICBpZiAodHlwZW9mIHJlc3VsdCAh
PSAndW5kZWZpbmVkJykgeworICAgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgICAgIH0KKyAg
ICAgIH0KKyAgICAgIC8vIGluc3BlY3QgW1tDbGFzc11dCisgICAgICB2YXIgaXNPYmogPSBpc09i
amVjdCh2YWx1ZSk7CisgICAgICBpZiAoaXNPYmopIHsKKyAgICAgICAgdmFyIGNsYXNzTmFtZSA9
IHRvU3RyaW5nLmNhbGwodmFsdWUpOworICAgICAgICBpZiAoIWNsb25lYWJsZUNsYXNzZXNbY2xh
c3NOYW1lXSkgeworICAgICAgICAgIHJldHVybiB2YWx1ZTsKKyAgICAgICAgfQorICAgICAgICB2
YXIgY3RvciA9IGN0b3JCeUNsYXNzW2NsYXNzTmFtZV07CisgICAgICAgIHN3aXRjaCAoY2xhc3NO
YW1lKSB7CisgICAgICAgICAgY2FzZSBib29sQ2xhc3M6CisgICAgICAgICAgY2FzZSBkYXRlQ2xh
c3M6CisgICAgICAgICAgICByZXR1cm4gbmV3IGN0b3IoK3ZhbHVlKTsKKworICAgICAgICAgIGNh
c2UgbnVtYmVyQ2xhc3M6CisgICAgICAgICAgY2FzZSBzdHJpbmdDbGFzczoKKyAgICAgICAgICAg
IHJldHVybiBuZXcgY3Rvcih2YWx1ZSk7CisKKyAgICAgICAgICBjYXNlIHJlZ2V4cENsYXNzOgor
ICAgICAgICAgICAgcmVzdWx0ID0gY3Rvcih2YWx1ZS5zb3VyY2UsIHJlRmxhZ3MuZXhlYyh2YWx1
ZSkpOworICAgICAgICAgICAgcmVzdWx0Lmxhc3RJbmRleCA9IHZhbHVlLmxhc3RJbmRleDsKKyAg
ICAgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgICAgIH0KKyAgICAgIH0gZWxzZSB7CisgICAg
ICAgIHJldHVybiB2YWx1ZTsKKyAgICAgIH0KKyAgICAgIHZhciBpc0FyciA9IGlzQXJyYXkodmFs
d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AgICog
QHJldHVybnMge09iamVjdH0gUmV0dXJucyB0aGUgbmV3IG9iamVjdC4KKyAgICAgKi8KKyAgICBm
dW5jdGlvbiBiYXNlQ3JlYXRlKHByb3RvdHlwZSwgcHJvcGVydGllcykgeworICAgICAgcmV0dXJu
IGlzT2JqZWN0KHByb3RvdHlwZSkgPyBuYXRpdmVDcmVhdGUocHJvdG90eXBlKSA6IHt9OworICAg
IH0KKyAgICAvLyBmYWxsYmFjayBmb3IgYnJvd3NlcnMgd2l0aG91dCBgT2JqZWN0LmNyZWF0ZWAK
KyAgICBpZiAoIW5hdGl2ZUNyZWF0ZSkgeworICAgICAgYmFzZUNyZWF0ZSA9IChmdW5jdGlvbigp
IHsKKyAgICAgICAgZnVuY3Rpb24gT2JqZWN0KCkge30KKyAgICAgICAgcmV0dXJuIGZ1bmN0aW9u
KHByb3RvdHlwZSkgeworICAgICAgICAgIGlmIChpc09iamVjdChwcm90b3R5cGUpKSB7CisgICAg
ICAgICAgICBPYmplY3QucHJvdG90eXBlID0gcHJvdG90eXBlOworICAgICAgICAgICAgdmFyIHJl
c3VsdCA9IG5ldyBPYmplY3Q7CisgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlID0gbnVsbDsK
KyAgICAgICAgICB9CisgICAgICAgICAgcmV0dXJuIHJlc3VsdCB8fCBjb250ZXh0Lk9iamVjdCgp
OworICAgICAgICB9OworICAgICAgfSgpKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGUg
YmFzZSBpbXBsZW1lbnRhdGlvbiBvZiBgXy5jcmVhdGVDYWxsYmFja2Agd2l0aG91dCBzdXBwb3J0
IGZvciBjcmVhdGluZworICAgICAqICJfLnBsdWNrIiBvciAiXy53aGVyZSIgc3R5bGUgY2FsbGJh
Y2tzLgorICAgICAqCisgICAgICogQHByaXZhdGUKKyAgICAgKiBAcGFyYW0geyp9IFtmdW5jPWlk
ZW50aXR5XSBUaGUgdmFsdWUgdG8gY29udmVydCB0byBhIGNhbGxiYWN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Z3RoIDogMCwKKyAgICAgICAgICBpc0xhcmdlID0gbGVuZ3RoID49IGxhcmdlQXJyYXlT
aXplICYmIGluZGV4T2YgPT09IGJhc2VJbmRleE9mLAorICAgICAgICAgIHJlc3VsdCA9IFtdOwor
CisgICAgICBpZiAoaXNMYXJnZSkgeworICAgICAgICB2YXIgY2FjaGUgPSBjcmVhdGVDYWNoZSh2
YWx1ZXMpOworICAgICAgICBpZiAoY2FjaGUpIHsKKyAgICAgICAgICBpbmRleE9mID0gY2FjaGVJ
bmRleE9mOworICAgICAgICAgIHZhbHVlcyA9IGNhY2hlOworICAgICAgICB9IGVsc2UgeworICAg
ICAgICAgIGlzTGFyZ2UgPSBmYWxzZTsKKyAgICAgICAgfQorICAgICAgfQorICAgICAgd2hpbGUg
KCsraW5kZXggPCBsZW5ndGgpIHsKKyAgICAgICAgdmFyIHZhbHVlID0gYXJyYXlbaW5kZXhdOwor
ICAgICAgICBpZiAoaW5kZXhPZih2YWx1ZXMsIHZhbHVlKSA8IDApIHsKKyAgICAgICAgICByZXN1
bHQucHVzaCh2YWx1ZSk7CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIGlmIChpc0xhcmdlKSB7
CisgICAgICAgIHJlbGVhc2VPYmplY3QodmFsdWVzKTsKKyAgICAgIH0KKyAgICAgIHJldHVybiBy
ZXN1bHQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24g
b2YgYF8uZmxhdHRlbmAgd2l0aG91dCBzdXBwb3J0IGZvciBjYWxsYmFjaworICAgICAqIHNob3J0
aGFuZHMgb3IgYHRoaXNBcmdgIGJpbmRpbmcuCisgICAgICoKKyAgICAgKiBAcHJpdmF0ZQorICAg
ICAqIEBwYXJhbSB7QXJyYXl9IGFycmF5IFRoZSBhcnJheSB0byBmbGF0dGVuLgorICAgICAqIEBw
YXJhbSB7Ym9vbGVhbn0gW2lzU2hhbGxvdz1mYWxzZV0gQSBmbGFnIHRvIHJlc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Wtl
IHByaW1pdGl2ZSB2YWx1ZXMKKyAgICAgIGlmIChhID09PSBhICYmCisgICAgICAgICAgIShhICYm
IG9iamVjdFR5cGVzW3R5cGVdKSAmJgorICAgICAgICAgICEoYiAmJiBvYmplY3RUeXBlc1tvdGhl
clR5cGVdKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICB9CisgICAgICAvLyBleGl0
IGVhcmx5IGZvciBgbnVsbGAgYW5kIGB1bmRlZmluZWRgIGF2b2lkaW5nIEVTMydzIEZ1bmN0aW9u
I2NhbGwgYmVoYXZpb3IKKyAgICAgIC8vIGh0dHA6Ly9lczUuZ2l0aHViLmlvLyN4MTUuMy40LjQK
KyAgICAgIGlmIChhID09IG51bGwgfHwgYiA9PSBudWxsKSB7CisgICAgICAgIHJldHVybiBhID09
PSBiOworICAgICAgfQorICAgICAgLy8gY29tcGFyZSBbW0NsYXNzXV0gbmFtZXMKKyAgICAgIHZh
ciBjbGFzc05hbWUgPSB0b1N0cmluZy5jYWxsKGEpLAorICAgICAgICAgIG90aGVyQ2xhc3MgPSB0
b1N0cmluZy5jYWxsKGIpOworCisgICAgICBpZiAoY2xhc3NOYW1lID09IGFyZ3NDbGFzcykgewor
ICAgICAgICBjbGFzc05hbWUgPSBvYmplY3RDbGFzczsKKyAgICAgIH0KKyAgICAgIGlmIChvdGhl
ckNsYXNzID09IGFyZ3NDbGFzcykgeworICAgICAgICBvdGhlckNsYXNzID0gb2JqZWN0Q2xhc3M7
CisgICAgICB9CisgICAgICBpZiAoY2xhc3NOYW1lICE9IG90aGVyQ2xhc3MpIHsKKyAgICAgICAg
cmV0dXJuIGZhbHNlOworICAgICAgfQorICAgICAgc3dpdGNoIChjbGFzc05hbWUpIHsKKyAgICAg
ICAgY2FzZSBib29sQ2xhc3M6CisgICAgICAgIGNhc2UgZGF0ZUNsYXNzOgorICAgICAgICAgIC8v
IGNvZXJjZSBkYXRlcyBhbmQgYm9vbGVhbnMgdG8gbnVtYmVycywgZGF0ZXMgdG8gbWlsbGlzZWNv
bmRzIGFuZCBib29sZWFucworICAgICAgICAgIC8vIHRvIGAxYCBvciBgMGAgdHJlYXRpbmcgaW52
YWxpZCBkYXRlcyBjb2VyY2VkIHRvIGBOYU5gIGFzIG5vdCBlcXVhbAorICAgICAgICAgIHJldHVy
biArYSA9PSArYjsKKworICAgICAgICBjYXNlIG51bWJlckNsYXNzOgorICAgICAgICAgIC8vIHRy
ZWF0IGBOYU5gIHZzLiBgTmFOYCBhcyBlcXVhbAorICAgICAgICAgIHJldHVybiAoYSAhPSArYSkK
KyAgICAgICAgICAgID8gYiAhPSArYgorICAgICAgICAgICAgLy8gYnV0IHRyZWF0IGArMGAgdnMu
IGAtMGAgYXMgbm90IGVxdWFsCisgICAgICAgICAgICA6IChhID09IDAgPyAoMSAvIGEgPT0gMSAv
IGIpIDogYSA9PSArYik7CisKKyAgICAgICAgY2FzZSByZWdleHBDbGFzczoKKyAgICAgICAgY2Fz
ZSBzdHJpbmdDbGFzczoKKyAgICAgICAgICAvLyBjb2VyY2UgcmVnZXhlcyB0byBzdHJpbmdzICho
dHRwOi8vZXM1LmdpdGh1Yi5pby8jeDE1LjEwLjYuNCkKKyAgICAgICAgICAvLyB0cmVhdCBzdHJp
bmcgcHJpbWl0aXZlcyBhbmQgdGhlaXIgY29ycmVzcG9uZGluZyBvYmplY3QgaW5zdGFuY2VzIGFz
IGVxdWFsCisgICAgICAgICAgcmV0dXJuIGEgPT0gU3RyaW5nKGIpOworICAgICAgfQorICAgICAg
dmFyIGlzQXJyID0gY2xhc3NOYW1lID09IGFycmF5Q2xhc3M7CisgICAgICBpZiAoIWlzQXJyKSB7
CisgICAgICAgIC8vIHVud3JhcCBhbnkgYGxvZGFzaGAgd3JhcHBlZCB2YWx1ZXMKKyAgICAgICAg
dmFyIGFXcmFwcGVkID0gaGFzT3duUHJvcGVydHkuY2FsbChhLCAnX193cmFwcGVkX18nKSwKKyAg
ICAgICAgICAgIGJXcmFwcGVkID0gaGFzT3duU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VuZ3RoID0gYS5sZW5ndGg7CisgICAg
ICAgIHNpemUgPSBiLmxlbmd0aDsKKyAgICAgICAgcmVzdWx0ID0gc2l6ZSA9PSBsZW5ndGg7CisK
KyAgICAgICAgaWYgKHJlc3VsdCB8fCBpc1doZXJlKSB7CisgICAgICAgICAgLy8gZGVlcCBjb21w
YXJlIHRoZSBjb250ZW50cywgaWdub3Jpbmcgbm9uLW51bWVyaWMgcHJvcGVydGllcworICAgICAg
ICAgIHdoaWxlIChzaXplLS0pIHsKKyAgICAgICAgICAgIHZhciBpbmRleCA9IGxlbmd0aCwKKyAg
ICAgICAgICAgICAgICB2YWx1ZSA9IGJbc2l6ZV07CisKKyAgICAgICAgICAgIGlmIChpc1doZXJl
KSB7CisgICAgICAgICAgICAgIHdoaWxlIChpbmRleC0tKSB7CisgICAgICAgICAgICAgICAgaWYg
KChyZXN1bHQgPSBiYXNlSXNFcXVhbChhW2luZGV4XSwgdmFsdWUsIGNhbGxiYWNrLCBpc1doZXJl
LCBzdGFja0EsIHN0YWNrQikpKSB7CisgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAg
ICAgICAgICB9CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSBpZiAoIShyZXN1
bHQgPSBiYXNlSXNFcXVhbChhW3NpemVdLCB2YWx1ZSwgY2FsbGJhY2ssIGlzV2hlcmUsIHN0YWNr
QSwgc3RhY2tCKSkpIHsKKyAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAg
ICAgICAgfQorICAgICAgICB9CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgLy8gZGVl
cCBjb21wYXJlIG9iamVjdHMgdXNpbmcgYGZvckluYCwgaW5zdGVhZCBvZiBgZm9yT3duYCwgdG8g
YXZvaWQgYE9iamVjdC5rZXlzYAorICAgICAgICAvLyB3aGljaCwgaW4gdGhpcyBjYXNlLCBpcyBt
b3JlIGNvc3RseQorICAgICAgICBmb3JJbihiLCBmdW5jdGlvbih2YWx1ZSwga2V5LCBiKSB7Cisg
ICAgICAgICAgaWYgKGhhc093blByb3BlcnR5LmNhbGwoYiwga2V5KSkgeworICAgICAgICAgICAg
Ly8gY291bnQgdGhlIG51bWJlciBvZiBwcm9wZXJ0aWVzLgorICAgICAgICAgICAgc2l6ZSsrOwor
ICAgICAgICAgICAgLy8gZGVlcCBjb21wYXJlIGVhY2ggcHJvcGVydHkgdmFsdWUuCisgICAgICAg
ICAgICByZXR1cm4gKHJlc3VsdCA9IGhhc093blByb3BlcnR5LmNhbGwoYSwga2V5KSAmJiBiYXNl
SXNFcXVhbChhW2tleV0sIHZhbHVlLCBjYWxsYmFjaywgaXNXaGVyZSwgc3RhY2tBLCBzdGFja0Ip
KTsKKyAgICAgICAgICB9CisgICAgICAgIH0pOworCisgICAgICAgIGlmIChyZXN1bHQgJiYgIWlz
V2hlcmUpIHsKKyAgICAgICAgICAvLyBlbnN1cmUgYm90aCBvYmplY3RzIGhhdmUgdGhlIHNhbWUg
bnVtYmVyIG9mIHByb3BlcnRpZXMKKyAgICAgICAgICBmb3JJbihhLCBmdW5jdGlvbih2YWx1ZSwg
a2V5LCBhKSB7CisgICAgICAgICAgICBpZiAoaGFzT3duUHJvcGVydHkuY2FsbChhLCBrZXkpKSB7
CisgICAgICAgICAgICAgIC8vIGBzaXplYCB3aWxsIGJlIGAtMWAgaWYgYGFgIGhhcyBtb3JlIHBy
b3BlcnRpZXMgdGhhbiBgYmAKKyAgICAgICAgICAgICAgcmV0dXJuIChyZXN1bHQgPSAtLXNpemUg
PiAtMSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgfSk7CisgICAgICAgIH0KKyAgICAgIH0K
KyAgICAgIHN0YWNrQS5wb3AoKTsKKyAgICAgIHN0YWNrQi5wb3AoKTsKKworICAgICAgaWYgKGlu
aXRlZFN0YWNrKSB7CisgICAgICAgIHJlbGVhc2VBcnJheShzdGFja0EpOworICAgICAgICByZWxl
YXNlQXJyYXkoc3RhY2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c291cmNlKSkgfHwgaXNQ
bGFpbk9iamVjdChzb3VyY2UpKSkgeworICAgICAgICAgIC8vIGF2b2lkIG1lcmdpbmcgcHJldmlv
dXNseSBtZXJnZWQgY3ljbGljIHNvdXJjZXMKKyAgICAgICAgICB2YXIgc3RhY2tMZW5ndGggPSBz
dGFja0EubGVuZ3RoOworICAgICAgICAgIHdoaWxlIChzdGFja0xlbmd0aC0tKSB7CisgICAgICAg
ICAgICBpZiAoKGZvdW5kID0gc3RhY2tBW3N0YWNrTGVuZ3RoXSA9PSBzb3VyY2UpKSB7CisgICAg
ICAgICAgICAgIHZhbHVlID0gc3RhY2tCW3N0YWNrTGVuZ3RoXTsKKyAgICAgICAgICAgICAgYnJl
YWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgfQorICAgICAgICAgIGlmICghZm91bmQpIHsK
KyAgICAgICAgICAgIHZhciBpc1NoYWxsb3c7CisgICAgICAgICAgICBpZiAoY2FsbGJhY2spIHsK
KyAgICAgICAgICAgICAgcmVzdWx0ID0gY2FsbGJhY2sodmFsdWUsIHNvdXJjZSk7CisgICAgICAg
ICAgICAgIGlmICgoaXNTaGFsbG93ID0gdHlwZW9mIHJlc3VsdCAhPSAndW5kZWZpbmVkJykpIHsK
KyAgICAgICAgICAgICAgICB2YWx1ZSA9IHJlc3VsdDsKKyAgICAgICAgICAgICAgfQorICAgICAg
ICAgICAgfQorICAgICAgICAgICAgaWYgKCFpc1NoYWxsb3cpIHsKKyAgICAgICAgICAgICAgdmFs
dWUgPSBpc0FycgorICAgICAgICAgICAgICAgID8gKGlzQXJyYXkodmFsdWUpID8gdmFsdWUgOiBb
XSkKKyAgICAgICAgICAgICAgICA6IChpc1BsYWluT2JqZWN0KHZhbHVlKSA/IHZhbHVlIDoge30p
OworICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gYWRkIGBzb3VyY2VgIGFuZCBhc3NvY2lh
dGVkIGB2YWx1ZWAgdG8gdGhlIHN0YWNrIG9mIHRyYXZlcnNlZCBvYmplY3RzCisgICAgICAgICAg
ICBzdGFja0EucHVzaChzb3VyY2UpOworICAgICAgICAgICAgc3RhY2tCLnB1c2godmFsdWUpOwor
CisgICAgICAgICAgICAvLyByZWN1cnNpdmVseSBtZXJnZSBvYmplY3RzIGFuZCBhcnJheXMgKHN1
c2NlcHRpYmxlIHRvIGNhbGwgc3RhY2sgbGltaXRzKQorICAgICAgICAgICAgaWYgKCFpc1NoYWxs
b3cpIHsKKyAgICAgICAgICAgICAgYmFzZU1lcmdlKHZhbHVlLCBzb3VyY2UsIGNhbGxiYWNrLCBz
dGFja0EsIHN0YWNrQik7CisgICAgICAgICAgICB9CisgICAgICAgICAgfQorICAgICAgICB9Cisg
ICAgICAgIGVsc2UgeworICAgICAgICAgIGlmIChjYWxsYmFjaykgeworICAgICAgICAgICAgcmVz
dWx0ID0gY2FsbGJhY2sodmFsdWUsIHNvdXJjZSk7CisgICAgICAgICAgICBpZiAodHlwZW9mIHJl
c3VsdCA9PSAndW5kZWZpbmVkJykgeworICAgICAgICAgICAgICByZXN1bHQgPSBzb3VyY2U7Cisg
ICAgICAgICAgICB9CisgICAgICAgICAgfQorICAgICAgICAgIGlmICh0eXBlb2YgcmVzdWx0ICE9
ICd1bmRlZmluZWQnKSB7CisgICAgICAgICAgICB2YWx1ZSA9IHJlc3VsdDsKKyAgICAgICAgICB9
CisgICAgICAgIH0KKyAgICAgICAgb2JqZWN0W2tleV0gPSB2YWx1ZTsKKyAgICAgIH0pOworICAg
IH0KKworICAgIC8qKgorICAgICAqIFRoZSBiYXNlIGltcGxlbWVudGF0aW9uIG9mIGBfLnJhbmRv
bWAgd2l0aG91dCBhcmd1bWVudCBqdWdnbGluZyBvciBzdXBwb3J0CisgICAgICogZm9yIHJldHVy
bmluZyBmbG9hdGluZy1wb2ludCBudW1iZXJzLgorICAgICAqCisgICAgICogQHByaXZhdGUKKyAg
ICAgKiBAcGFyYW0ge251bWJlcn0gbWluIFRoZSBtaW5pbXVtIHBvc3NpYmxlI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VsdCA9IFtdOworCisgICAgICB2YXIgaXNMYXJnZSA9ICFpc1Nv
cnRlZCAmJiBsZW5ndGggPj0gbGFyZ2VBcnJheVNpemUgJiYgaW5kZXhPZiA9PT0gYmFzZUluZGV4
T2YsCisgICAgICAgICAgc2VlbiA9IChjYWxsYmFjayB8fCBpc0xhcmdlKSA/IGdldEFycmF5KCkg
OiByZXN1bHQ7CisKKyAgICAgIGlmIChpc0xhcmdlKSB7CisgICAgICAgIHZhciBjYWNoZSA9IGNy
ZWF0ZUNhY2hlKHNlZW4pOworICAgICAgICBpbmRleE9mID0gY2FjaGVJbmRleE9mOworICAgICAg
ICBzZWVuID0gY2FjaGU7CisgICAgICB9CisgICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkg
eworICAgICAgICB2YXIgdmFsdWUgPSBhcnJheVtpbmRleF0sCisgICAgICAgICAgICBjb21wdXRl
ZCA9IGNhbGxiYWNrID8gY2FsbGJhY2sodmFsdWUsIGluZGV4LCBhcnJheSkgOiB2YWx1ZTsKKwor
ICAgICAgICBpZiAoaXNTb3J0ZWQKKyAgICAgICAgICAgICAgPyAhaW5kZXggfHwgc2VlbltzZWVu
Lmxlbmd0aCAtIDFdICE9PSBjb21wdXRlZAorICAgICAgICAgICAgICA6IGluZGV4T2Yoc2Vlbiwg
Y29tcHV0ZWQpIDwgMAorICAgICAgICAgICAgKSB7CisgICAgICAgICAgaWYgKGNhbGxiYWNrIHx8
IGlzTGFyZ2UpIHsKKyAgICAgICAgICAgIHNlZW4ucHVzaChjb21wdXRlZCk7CisgICAgICAgICAg
fQorICAgICAgICAgIHJlc3VsdC5wdXNoKHZhbHVlKTsKKyAgICAgICAgfQorICAgICAgfQorICAg
ICAgaWYgKGlzTGFyZ2UpIHsKKyAgICAgICAgcmVsZWFzZUFycmF5KHNlZW4uYXJyYXkpOworICAg
ICAgICByZWxlYXNlT2JqZWN0KHNlZW4pOworICAgICAgfSBlbHNlIGlmIChjYWxsYmFjaykgewor
ICAgICAg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DgsCisg
ICAgICAgICAgaXNQYXJ0aWFsID0gYml0bWFzayAmIDE2LAorICAgICAgICAgIGlzUGFydGlhbFJp
Z2h0ID0gYml0bWFzayAmIDMyOworCisgICAgICBpZiAoIWlzQmluZEtleSAmJiAhaXNGdW5jdGlv
bihmdW5jKSkgeworICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yOworICAgICAgfQorICAgICAg
aWYgKGlzUGFydGlhbCAmJiAhcGFydGlhbEFyZ3MubGVuZ3RoKSB7CisgICAgICAgIGJpdG1hc2sg
Jj0gfjE2OworICAgICAgICBpc1BhcnRpYWwgPSBwYXJ0aWFsQXJncyA9IGZhbHNlOworICAgICAg
fQorICAgICAgaWYgKGlzUGFydGlhbFJpZ2h0ICYmICFwYXJ0aWFsUmlnaHRBcmdzLmxlbmd0aCkg
eworICAgICAgICBiaXRtYXNrICY9IH4zMjsKKyAgICAgICAgaXNQYXJ0aWFsUmlnaHQgPSBwYXJ0
aWFsUmlnaHRBcmdzID0gZmFsc2U7CisgICAgICB9CisgICAgICB2YXIgYmluZERhdGEgPSBmdW5j
ICYmIGZ1bmMuX19iaW5kRGF0YV9fOworICAgICAgaWYgKGJpbmREYXRhICYmIGJpbmREYXRhICE9
PSB0cnVlKSB7CisgICAgICAgIC8vIGNsb25lIGBiaW5kRGF0YWAKKyAgICAgICAgYmluZERhdGEg
PSBzbGljZShiaW5kRGF0YSk7CisgICAgICAgIGlmIChiaW5kRGF0YVsyXSkgeworICAgICAgICAg
IGJpbmREYXRhWzJdID0gc2xpY2UoYmluZERhdGFbMl0pOworICAgICAgICB9CisgICAgICAgIGlm
IChiaW5kRGF0YVszXSkgeworICAgICAgICAgIGJpbmREYXRhWzNdID0gc2xpY2UoYmluZERhdGFb
M10pOworICAgICAgICB9CisgICAgICAgIC8vIHNldCBgdGhpc0JpbmRpbmdgIGlzIG5vdCBwcmV2
aW91c2x5IGJvdW5kCisgICAgICAgIGlmIChpc0JpbmQgJiYgIShiaW5kRGF0YVsxXSAmIDEpKSB7
CisgICAgICAgICAgYmluZERhdGFbNF0gPSB0aGlzQXJnOworICAgICAgICB9CisgICAgICAgIC8v
IHNldCBpZiBwcmV2aW91c2x5IGJvdW5kIGJ1dCBub3QgY3VycmVudGx5IChzdWJzZXF1ZW50IGN1
cnJpZWQgZnVuY3Rpb25zKQorICAgICAgICBpZiAoIWlzQmluZCAmJiBiaW5kRGF0YVsxXSAmIDEp
IHsKKyAgICAgICAgICBiaXRtYXNrIHw9IDg7CisgICAgICAgIH0KKyAgICAgICAgLy8gc2V0IGN1
cnJpZWQgYXJpdHkgaWYgbm90IHlldCBzZXQKKyAgICAgICAgaWYgKGlzQ3VycnkgJiYgIShiaW5k
RGF0YVsxXSAmIDQpKSB7CisgICAgICAgICAgYmluZERhdGFbNV0gPSBhcml0eTsKKyAgICAgICAg
fQorICAgICAgICAvLyBhcHBlbmQgcGFydGlhbCBsZWZ0IGFyZ3VtZW50cworICAgICAgICBpZiAo
aXNQYXJ0aWFsKSB7CisgICAgICAgICAgcHVzaC5hcHBseShiaW5kRGF0YVsyXSB8fCAoYmluZERh
dGFbMl0gPSBbXSksIHBhcnRpYWxBcmdzKTsKKyAgICAgICAgfQorICAgICAgICAvLyBhcHBlbmQg
cGFydGlhbCByaWdodCBhcmd1bWVudHMKKyAgICAgICAgaWYgKGlzUGFydGlhbFJpZ2h0KSB7Cisg
ICAgICAgICAgdW5zaGlmdC5hcHBseShiaW5kRGF0YVszXSB8fCAoYmluZERhdGFbM10gPSBbXSks
IHBhcnRpYWxSaWdodEFyZ3MpOworICAgICAgICB9CisgICAgICAgIC8vIG1lcmdlIGZsYWdzCisg
ICAgICAgIGJpbmREYXRhWzFdIHw9IGJpdG1hc2s7CisgICAgICAgIHJldHVybiBjcmVhdGVXcmFw
cGVyLmFwcGx5KG51bGwsIGJpbmREYXRhKTsKKyAgICAgIH0KKyAgICAgIC8vIGZhc3QgcGF0aCBm
b3IgYF8uYmluZGAKKyAgICAgIHZhciBjcmVhdGVyID0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mxlID0gb2JqZWN0LCByZXN1bHQgPSBb
XTsKKyAgICAgIGlmICghaXRlcmFibGUpIHJldHVybiByZXN1bHQ7CisgICAgICBpZiAoIShvYmpl
Y3RUeXBlc1t0eXBlb2Ygb2JqZWN0XSkpIHJldHVybiByZXN1bHQ7CisgICAgICAgIGZvciAoaW5k
ZXggaW4gaXRlcmFibGUpIHsKKyAgICAgICAgICBpZiAoaGFzT3duUHJvcGVydHkuY2FsbChpdGVy
YWJsZSwgaW5kZXgpKSB7CisgICAgICAgICAgICByZXN1bHQucHVzaChpbmRleCk7CisgICAgICAg
ICAgfQorICAgICAgICB9CisgICAgICByZXR1cm4gcmVzdWx0CisgICAgfTsKKworICAgIC8qKgor
ICAgICAqIENyZWF0ZXMgYW4gYXJyYXkgY29tcG9zZWQgb2YgdGhlIG93biBlbnVtZXJhYmxlIHBy
b3BlcnR5IG5hbWVzIG9mIGFuIG9iamVjdC4KKyAgICAgKgorICAgICAqIEBzdGF0aWMKKyAgICAg
KiBAbWVtYmVyT2YgXworICAgICAqIEBjYXRlZ29yeSBPYmplY3RzCisgICAgICogQHBhcmFtIHtP
YmplY3R9IG9iamVjdCBUaGUgb2JqZWN0IHRvIGluc3BlY3QuCisgICAgICogQHJldHVybnMge0Fy
cmF5fSBSZXR1cm5zIGFuIGFycmF5IG9mIHByb3BlcnR5IG5hbWVzLgorICAgICAqIEBleGFtcGxl
CisgICAgICoKKyAgICAgKiBfLmtleXMoeyAnb25lJzogMSwgJ3R3byc6IDIsICd0aHJlZSc6IDMg
fSk7CisgICAgICogLy8gPT4gWydvbmUnLCAndHdvJywgJ3RocmVlJ10gKHByb3BlcnR5IG9yZGVy
IGlzIG5vdCBndWFyYW50ZWVkIGFjcm9zcyBlbnZpcm9ubWVudHMpCisgICAgICovCisgICAgdmFy
IGtleXMgPSAhbmF0aXZlS2V5cyA/IHNoaW1LZXlzIDogZnVuY3Rpb24ob2JqZWN0KSB7CisgICAg
ICBpZiAoIWlzT2JqZWN0KG9iam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Z3VhcmQpIHsKKyAgICAgIHZhciBpbmRleCwgaXRlcmFibGUgPSBv
YmplY3QsIHJlc3VsdCA9IGl0ZXJhYmxlOworICAgICAgaWYgKCFpdGVyYWJsZSkgcmV0dXJuIHJl
c3VsdDsKKyAgICAgIHZhciBhcmdzID0gYXJndW1lbnRzLAorICAgICAgICAgIGFyZ3NJbmRleCA9
IDAsCisgICAgICAgICAgYXJnc0xlbmd0aCA9IHR5cGVvZiBndWFyZCA9PSAnbnVtYmVyJyA/IDIg
OiBhcmdzLmxlbmd0aDsKKyAgICAgIHdoaWxlICgrK2FyZ3NJbmRleCA8IGFyZ3NMZW5ndGgpIHsK
KyAgICAgICAgaXRlcmFibGUgPSBhcmdzW2FyZ3NJbmRleF07CisgICAgICAgIGlmIChpdGVyYWJs
ZSAmJiBvYmplY3RUeXBlc1t0eXBlb2YgaXRlcmFibGVdKSB7CisgICAgICAgIHZhciBvd25JbmRl
eCA9IC0xLAorICAgICAgICAgICAgb3duUHJvcHMgPSBvYmplY3RUeXBlc1t0eXBlb2YgaXRlcmFi
bGVdICYmIGtleXMoaXRlcmFibGUpLAorICAgICAgICAgICAgbGVuZ3RoID0gb3duUHJvcHMgPyBv
d25Qcm9wcy5sZW5ndGggOiAwOworCisgICAgICAgIHdoaWxlICgrK293bkluZGV4IDwgbGVuZ3Ro
KSB7CisgICAgICAgICAgaW5kZXggPSBvd25Qcm9wc1tvd25JbmRleF07CisgICAgICAgICAgaWYg
KHR5cGVvZiByZXN1bHRbaW5kZXhdID09ICd1bmRlZmluZWQnKSByZXN1bHRbaW5kZXhdID0gaXRl
cmFibGVbaW5kZXhdOworICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIHJldHVy
biByZXN1bHQKKyAgICB9OworCisgICAgLyoqCisgICAgICogVGhpcyBtZXRob2QgaXMgbGlrZSBg
Xy5maW5kSW5kZXhgIGV4Y2VwdCB0aGF0IGl0IHJldHVybnMgdGhlIGtleSBvZiB0aGUKKyAgIC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KiB9KTsKKyAgICAgKiAvLyA9PiByZXR1cm5zIGBwZWJibGVzYCwgYXNzdW1p
bmcgYF8uZmluZEtleWAgcmV0dXJucyBgYmFybmV5YAorICAgICAqCisgICAgICogLy8gdXNpbmcg
Il8ud2hlcmUiIGNhbGxiYWNrIHNob3J0aGFuZAorICAgICAqIF8uZmluZExhc3RLZXkoY2hhcmFj
dGVycywgeyAnYWdlJzogNDAgfSk7CisgICAgICogLy8gPT4gJ2ZyZWQnCisgICAgICoKKyAgICAg
KiAvLyB1c2luZyAiXy5wbHVjayIgY2FsbGJhY2sgc2hvcnRoYW5kCisgICAgICogXy5maW5kTGFz
dEtleShjaGFyYWN0ZXJzLCAnYmxvY2tlZCcpOworICAgICAqIC8vID0+ICdwZWJibGVzJworICAg
ICAqLworICAgIGZ1bmN0aW9uIGZpbmRMYXN0S2V5KG9iamVjdCwgY2FsbGJhY2ssIHRoaXNBcmcp
IHsKKyAgICAgIHZhciByZXN1bHQ7CisgICAgICBjYWxsYmFjayA9IGxvZGFzaC5jcmVhdGVDYWxs
YmFjayhjYWxsYmFjaywgdGhpc0FyZywgMyk7CisgICAgICBmb3JPd25SaWdodChvYmplY3QsIGZ1
bmN0aW9uKHZhbHVlLCBrZXksIG9iamVjdCkgeworICAgICAgICBpZiAoY2FsbGJhY2sodmFsdWUs
IGtleSwgb2JqZWN0KSkgeworICAgICAgICAgIHJlc3VsdCA9IGtleTsKKyAgICAgICAgICByZXR1
cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICAgIH0pOworICAgICAgcmV0dXJuIHJlc3VsdDsKKyAg
ICB9CisKKyAgICAvKioKKyAgICAgKiBJdGVyYXRlcyBvdmVyIG93biBhbmQgaW5oZXJpdGVkIGVu
dW1lcmFibGUgcHJvcGVydGllcyBvZiBhbiBvYmplY3QsCisgICAgICogZXhlY3V0aW5nIHRoZSBj
YWxsYmFjayBmb3IgZWFjaCBwcm9wZXJ0eS4gVGhlIGNhbGxiYWNrIGlzIGJvdW5kIHR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N0fSBvYmplY3QgVGhlIG9iamVjdCB0byBpdGVyYXRl
IG92ZXIuCisgICAgICogQHBhcmFtIHtGdW5jdGlvbn0gW2NhbGxiYWNrPWlkZW50aXR5XSBUaGUg
ZnVuY3Rpb24gY2FsbGVkIHBlciBpdGVyYXRpb24uCisgICAgICogQHBhcmFtIHsqfSBbdGhpc0Fy
Z10gVGhlIGB0aGlzYCBiaW5kaW5nIG9mIGBjYWxsYmFja2AuCisgICAgICogQHJldHVybnMge09i
amVjdH0gUmV0dXJucyBgb2JqZWN0YC4KKyAgICAgKiBAZXhhbXBsZQorICAgICAqCisgICAgICog
ZnVuY3Rpb24gU2hhcGUoKSB7CisgICAgICogICB0aGlzLnggPSAwOworICAgICAqICAgdGhpcy55
ID0gMDsKKyAgICAgKiB9CisgICAgICoKKyAgICAgKiBTaGFwZS5wcm90b3R5cGUubW92ZSA9IGZ1
bmN0aW9uKHgsIHkpIHsKKyAgICAgKiAgIHRoaXMueCArPSB4OworICAgICAqICAgdGhpcy55ICs9
IHk7CisgICAgICogfTsKKyAgICAgKgorICAgICAqIF8uZm9ySW5SaWdodChuZXcgU2hhcGUsIGZ1
bmN0aW9uKHZhbHVlLCBrZXkpIHsKKyAgICAgKiAgIGNvbnNvbGUubG9nKGtleSk7CisgICAgICog
fSk7CisgICAgICogLy8gPT4gbG9ncyAnbW92ZScsICd5JywgYW5kICd4JyBhc3N1bWluZyBgXy5m
b3JJbiBgIGxvZ3MgJ3gnLCAneScsIGFuZCAnbW92ZScKKyAgICAgKi8KKyAgICBmdW5jdGlvbiBm
b3JJblJpZ2h0KG9iamVjdCwgY2FsbGJhY2ssIHRoaXNBcmcpIHsKKyAgICAgIHZhciBwYWlycyA9
IFtdOworCisgICAgICBmb3JJbihvYmplY3QsIGZ1bmN0aW9uKHZhbHVlLCBrZXkpIHsKKyAgICAg
ICAgcGFpcnMucHVzaChrZXksIHZhbHVlKTsKKyAgICAgIH0pOworCisgICAgICB2YXIgbGVuZ3Ro
ID0gcG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Zm9yT3duYCBsb2dzICcwJywgJzEnLCBhbmQg
J2xlbmd0aCcKKyAgICAgKi8KKyAgICBmdW5jdGlvbiBmb3JPd25SaWdodChvYmplY3QsIGNhbGxi
YWNrLCB0aGlzQXJnKSB7CisgICAgICB2YXIgcHJvcHMgPSBrZXlzKG9iamVjdCksCisgICAgICAg
ICAgbGVuZ3RoID0gcHJvcHMubGVuZ3RoOworCisgICAgICBjYWxsYmFjayA9IGJhc2VDcmVhdGVD
YWxsYmFjayhjYWxsYmFjaywgdGhpc0FyZywgMyk7CisgICAgICB3aGlsZSAobGVuZ3RoLS0pIHsK
KyAgICAgICAgdmFyIGtleSA9IHByb3BzW2xlbmd0aF07CisgICAgICAgIGlmIChjYWxsYmFjayhv
YmplY3Rba2V5XSwga2V5LCBvYmplY3QpID09PSBmYWxzZSkgeworICAgICAgICAgIGJyZWFrOwor
ICAgICAgICB9CisgICAgICB9CisgICAgICByZXR1cm4gb2JqZWN0OworICAgIH0KKworICAgIC8q
KgorICAgICAqIENyZWF0ZXMgYSBzb3J0ZWQgYXJyYXkgb2YgcHJvcGVydHkgbmFtZXMgb2YgYWxs
IGVudW1lcmFibGUgcHJvcGVydGllcywKKyAgICAgKiBvd24gYW5kIGluaGVyaXRlZCwgb2YgYG9i
amVjdGAgdGhhdCBoYXZlIGZ1bmN0aW9uIHZhbHVlcy4KKyAgICAgKgorICAgICAqIEBzdGF0aWMK
KyAgICAgKiBAbWVtYmVyT2YgXworICAgICAqIEBhbGlhcyBtZXRob2RzCisgICAgICogQGNhdGVn
b3J5IE9iamVjdHMKKyAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBvYmplY3QgdG8g
aW5zcGVjdC4KKyAgICAgKiBAcmV0dXJucyB7QXJyYXl9IFJldHVybnMgYW4gYXJyYXkgb2YgcHJv
cGVydHkgbmFtZXMgdGhhdCBoYXZlIGZ1bmN0aW9uIHZhbHVlcy4KKyAgICAgKiBAZXhhbXBsZQor
ICAgICAqCisg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y8gPT4gdHJ1ZQorICAg
ICAqLworICAgIGZ1bmN0aW9uIGhhcyhvYmplY3QsIGtleSkgeworICAgICAgcmV0dXJuIG9iamVj
dCA/IGhhc093blByb3BlcnR5LmNhbGwob2JqZWN0LCBrZXkpIDogZmFsc2U7CisgICAgfQorCisg
ICAgLyoqCisgICAgICogQ3JlYXRlcyBhbiBvYmplY3QgY29tcG9zZWQgb2YgdGhlIGludmVydGVk
IGtleXMgYW5kIHZhbHVlcyBvZiB0aGUgZ2l2ZW4gb2JqZWN0LgorICAgICAqCisgICAgICogQHN0
YXRpYworICAgICAqIEBtZW1iZXJPZiBfCisgICAgICogQGNhdGVnb3J5IE9iamVjdHMKKyAgICAg
KiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBvYmplY3QgdG8gaW52ZXJ0LgorICAgICAqIEBy
ZXR1cm5zIHtPYmplY3R9IFJldHVybnMgdGhlIGNyZWF0ZWQgaW52ZXJ0ZWQgb2JqZWN0LgorICAg
ICAqIEBleGFtcGxlCisgICAgICoKKyAgICAgKiBfLmludmVydCh7ICdmaXJzdCc6ICdmcmVkJywg
J3NlY29uZCc6ICdiYXJuZXknIH0pOworICAgICAqIC8vID0+IHsgJ2ZyZWQnOiAnZmlyc3QnLCAn
YmFybmV5JzogJ3NlY29uZCcgfQorICAgICAqLworICAgIGZ1bmN0aW9uIGludmVydChvYmplY3Qp
IHsKKyAgICAgIHZhciBpbmRleCA9IC0xLAorICAgICAgICAgIHByb3BzID0ga2V5cyhvYmplY3Qp
LAorICAgICAgICAgIGxlbmd0aCA9IHByb3BzLmxlbmd0aCwKKyAgICAgICAgICByZXN1bHQgPSB7
fTsKKworICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHsKKyAgICAgICAgdmFyIGtleSA9
IHByb3BzW2luZGV4XTsKKyAgICAgICAgcmVzdWx0W29iamVjdFtrZXldXSA9IGtleTsKKyAgICAg
IH0KKyAgICAgIHJldHVybiByZXN1bHQ7CisgICAgf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1lbWJlck9mIF8KKyAgICAgKiBAY2F0ZWdv
cnkgT2JqZWN0cworICAgICAqIEBwYXJhbSB7QXJyYXl8T2JqZWN0fHN0cmluZ30gdmFsdWUgVGhl
IHZhbHVlIHRvIGluc3BlY3QuCisgICAgICogQHJldHVybnMge2Jvb2xlYW59IFJldHVybnMgYHRy
dWVgIGlmIHRoZSBgdmFsdWVgIGlzIGVtcHR5LCBlbHNlIGBmYWxzZWAuCisgICAgICogQGV4YW1w
bGUKKyAgICAgKgorICAgICAqIF8uaXNFbXB0eShbMSwgMiwgM10pOworICAgICAqIC8vID0+IGZh
bHNlCisgICAgICoKKyAgICAgKiBfLmlzRW1wdHkoe30pOworICAgICAqIC8vID0+IHRydWUKKyAg
ICAgKgorICAgICAqIF8uaXNFbXB0eSgnJyk7CisgICAgICogLy8gPT4gdHJ1ZQorICAgICAqLwor
ICAgIGZ1bmN0aW9uIGlzRW1wdHkodmFsdWUpIHsKKyAgICAgIHZhciByZXN1bHQgPSB0cnVlOwor
ICAgICAgaWYgKCF2YWx1ZSkgeworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgfQorICAg
ICAgdmFyIGNsYXNzTmFtZSA9IHRvU3RyaW5nLmNhbGwodmFsdWUpLAorICAgICAgICAgIGxlbmd0
aCA9IHZhbHVlLmxlbmd0aDsKKworICAgICAgaWYgKChjbGFzc05hbWUgPT0gYXJyYXlDbGFzcyB8
fCBjbGFzc05hbWUgPT0gc3RyaW5nQ2xhc3MgfHwgY2xhc3NOYW1lID09IGFyZ3NDbGFzcyApIHx8
CisgICAgICAgICAgKGNsYXNzTmFtZSA9PSBvYmplY3RDbGFzcyAmJiB0eXBlb2YgbGVuZ3RoID09
ICdudW1iZXInICYmIGlzRnVuY3Rpb24odmFsdWUuc3BsaWNlKSkpIHsKKyAgICAgICAgcmV0dXJu
ICFsZW5ndGg7CisgICAgICB9CisgICAgICBmb3JPd24odmFsdWUsIGZ1bmN0aW9uKCkgeworICAg
ICAgICByZXR1cm4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ICAgICogXy5pc051bGwobnVsbCk7Cisg
ICAgICogLy8gPT4gdHJ1ZQorICAgICAqCisgICAgICogXy5pc051bGwodW5kZWZpbmVkKTsKKyAg
ICAgKiAvLyA9PiBmYWxzZQorICAgICAqLworICAgIGZ1bmN0aW9uIGlzTnVsbCh2YWx1ZSkgewor
ICAgICAgcmV0dXJuIHZhbHVlID09PSBudWxsOworICAgIH0KKworICAgIC8qKgorICAgICAqIENo
ZWNrcyBpZiBgdmFsdWVgIGlzIGEgbnVtYmVyLgorICAgICAqCisgICAgICogTm90ZTogYE5hTmAg
aXMgY29uc2lkZXJlZCBhIG51bWJlci4gU2VlIGh0dHA6Ly9lczUuZ2l0aHViLmlvLyN4OC41Lgor
ICAgICAqCisgICAgICogQHN0YXRpYworICAgICAqIEBtZW1iZXJPZiBfCisgICAgICogQGNhdGVn
b3J5IE9iamVjdHMKKyAgICAgKiBAcGFyYW0geyp9IHZhbHVlIFRoZSB2YWx1ZSB0byBjaGVjay4K
KyAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn0gUmV0dXJucyBgdHJ1ZWAgaWYgdGhlIGB2YWx1ZWAg
aXMgYSBudW1iZXIsIGVsc2UgYGZhbHNlYC4KKyAgICAgKiBAZXhhbXBsZQorICAgICAqCisgICAg
ICogXy5pc051bWJlcig4LjQgKiA1KTsKKyAgICAgKiAvLyA9PiB0cnVlCisgICAgICovCisgICAg
ZnVuY3Rpb24gaXNOdW1iZXIodmFsdWUpIHsKKyAgICAgIHJldHVybiB0eXBlb2YgdmFsdWUgPT0g
J251bWJlcicgfHwKKyAgICAgICAgdmFsdWUgJiYgdHlwZW9mIHZhbHVlID09ICdvYmplY3QnICYm
IHRvU3RyaW5nLmNhbGwodmFsdWUpID09IG51bWJlckNsYXNzIHx8IGZhbHNlOworICAgIH0KKwor
ICAgIC8qKgorICAgICAqIENoZWNrcyBpZiBgdmFsdWVgIGlzIGFuIG9iamVjdCBjcmVhdGVkIGJ5
IHRoZSBgT2JqZWN0YCB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tYmVyT2YgXworICAgICAqIEBjYXRlZ29yeSBPYmplY3Rz
CisgICAgICogQHBhcmFtIHtPYmplY3R9IG9iamVjdCBUaGUgZGVzdGluYXRpb24gb2JqZWN0Lgor
ICAgICAqIEBwYXJhbSB7Li4uT2JqZWN0fSBbc291cmNlXSBUaGUgc291cmNlIG9iamVjdHMuCisg
ICAgICogQHBhcmFtIHtGdW5jdGlvbn0gW2NhbGxiYWNrXSBUaGUgZnVuY3Rpb24gdG8gY3VzdG9t
aXplIG1lcmdpbmcgcHJvcGVydGllcy4KKyAgICAgKiBAcGFyYW0geyp9IFt0aGlzQXJnXSBUaGUg
YHRoaXNgIGJpbmRpbmcgb2YgYGNhbGxiYWNrYC4KKyAgICAgKiBAcmV0dXJucyB7T2JqZWN0fSBS
ZXR1cm5zIHRoZSBkZXN0aW5hdGlvbiBvYmplY3QuCisgICAgICogQGV4YW1wbGUKKyAgICAgKgor
ICAgICAqIHZhciBuYW1lcyA9IHsKKyAgICAgKiAgICdjaGFyYWN0ZXJzJzogWworICAgICAqICAg
ICB7ICduYW1lJzogJ2Jhcm5leScgfSwKKyAgICAgKiAgICAgeyAnbmFtZSc6ICdmcmVkJyB9Cisg
ICAgICogICBdCisgICAgICogfTsKKyAgICAgKgorICAgICAqIHZhciBhZ2VzID0geworICAgICAq
ICAgJ2NoYXJhY3RlcnMnOiBbCisgICAgICogICAgIHsgJ2FnZSc6IDM2IH0sCisgICAgICogICAg
IHsgJ2FnZSc6IDQwIH0KKyAgICAgKiAgIF0KKyAgICAgKiB9OworICAgICAqCisgICAgICogXy5t
ZXJnZShuYW1lcywgYWdlcyk7CisgICAgICogLy8gPT4geyAnY2hhcmFjdGVycyc6IFt7ICduYW1l
JzogJ2Jhcm5leScsICdhZ2UnOiAzNiB9LCB7ICduYW1lJzogJ2ZyZWQnLCAnYWdlJzogNDAgfV0g
fQorICAgICAqCisgICAgICogdmFyIGZvb2QgPSB7CisgICAgICogICAnZnJ1aXRzJzogWydhcHBs
ZSdd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yAg
ICBmdW5jdGlvbiBvbWl0KG9iamVjdCwgY2FsbGJhY2ssIHRoaXNBcmcpIHsKKyAgICAgIHZhciBy
ZXN1bHQgPSB7fTsKKyAgICAgIGlmICh0eXBlb2YgY2FsbGJhY2sgIT0gJ2Z1bmN0aW9uJykgewor
ICAgICAgICB2YXIgcHJvcHMgPSBbXTsKKyAgICAgICAgZm9ySW4ob2JqZWN0LCBmdW5jdGlvbih2
YWx1ZSwga2V5KSB7CisgICAgICAgICAgcHJvcHMucHVzaChrZXkpOworICAgICAgICB9KTsKKyAg
ICAgICAgcHJvcHMgPSBiYXNlRGlmZmVyZW5jZShwcm9wcywgYmFzZUZsYXR0ZW4oYXJndW1lbnRz
LCB0cnVlLCBmYWxzZSwgMSkpOworCisgICAgICAgIHZhciBpbmRleCA9IC0xLAorICAgICAgICAg
ICAgbGVuZ3RoID0gcHJvcHMubGVuZ3RoOworCisgICAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVu
Z3RoKSB7CisgICAgICAgICAgdmFyIGtleSA9IHByb3BzW2luZGV4XTsKKyAgICAgICAgICByZXN1
bHRba2V5XSA9IG9iamVjdFtrZXldOworICAgICAgICB9CisgICAgICB9IGVsc2UgeworICAgICAg
ICBjYWxsYmFjayA9IGxvZGFzaC5jcmVhdGVDYWxsYmFjayhjYWxsYmFjaywgdGhpc0FyZywgMyk7
CisgICAgICAgIGZvckluKG9iamVjdCwgZnVuY3Rpb24odmFsdWUsIGtleSwgb2JqZWN0KSB7Cisg
ICAgICAgICAgaWYgKCFjYWxsYmFjayh2YWx1ZSwga2V5LCBvYmplY3QpKSB7CisgICAgICAgICAg
ICByZXN1bHRba2V5XSA9IHZhbHVlOworICAgICAgICAgIH0KKyAgICAgICAgfSk7CisgICAgICB9
CisgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIC8qKgorICAgICAqIENyZWF0ZXMg
YSB0d28gZGltZW5zaW9uYWwgYXJyYXkgb2YgYW4gb2JqZWN0J3Mga2V5LXZhbHVlIHBhaXJzLAor
ICAgICAqIGkuZS4gYFtba2V5MSwgdmFsdWUxXSwgW2tleTIsIHZhbHVlMl1dYC4KKyAgICAgKgor
ICAgICAqIEBzdGF0aWMKKyAgICAgKiBAbWVtYmVyT2YgXworICAgICAqIEBjYXRlZ29yeSBPYmpl
Y3RzCisgICAgICogQHBhcmFtIHtPYmplY3R9IG9iamVjdCBUaGUgb2JqZWN0IHRvIGluc3BlY3Qu
CisgICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIG5ldyBhcnJheSBvZiBrZXktdmFsdWUg
cGFpcnMuCisgICAgICogQGV4YW1wbGUKKyAgICAgKgorICAgICAqIF8ucGFpcnMoeyAnYmFybmV5
JzogMzYsICdmcmVkJzogNDAgfSk7CisgICAgICogLy8gPT4gW1snYmFybmV5JywgMzZdLCBbJ2Zy
ZWQnLCA0MF1dIChwcm9wZXJ0eSBvcmRlciBpcyBub3QgZ3VhcmFudGVlZCBhY3Jvc3MgZW52aXJv
bm1lbnRzKQorICAgICAqLworICAgIGZ1bmN0aW9uIHBhaXJzKG9iamVjdCkgeworICAgICAgdmFy
IGluZGV4ID0gLTEsCisgICAgICAgICAgcHJvcHMgPSBrZXlzKG9iamVjdCksCisgICAgICAgICAg
bGVuZ3RoID0gcHJvcHMubGVuZ3RoLAorICAgICAgICAgIHJlc3VsdCA9IEFycmF5KGxlbmd0aCk7
CisKKyAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoKSB7CisgICAgICAgIHZhciBrZXkgPSBw
cm9wc1tpbmRleF07CisgICAgICAgIHJlc3VsdFtpbmRleF0gPSBba2V5LCBvYmplY3Rba2V5XV07
CisgICAgICB9CisgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIC8qKgorICAgICAq
IENyZWF0ZXMgYSBzaGFsbG93IGNsb25lIG9mIGBvYmplY3RgIGNvbXBvc2VkIG9mIHRoZSBzcGVj
aWZpZWQgcHJvcGVydGllcy4KKyAgICAgKi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gorICAgICAqIEBleGFtcGxlCisgICAg
ICoKKyAgICAgKiBfLnBpY2soeyAnbmFtZSc6ICdmcmVkJywgJ191c2VyaWQnOiAnZnJlZDEnIH0s
ICduYW1lJyk7CisgICAgICogLy8gPT4geyAnbmFtZSc6ICdmcmVkJyB9CisgICAgICoKKyAgICAg
KiBfLnBpY2soeyAnbmFtZSc6ICdmcmVkJywgJ191c2VyaWQnOiAnZnJlZDEnIH0sIGZ1bmN0aW9u
KHZhbHVlLCBrZXkpIHsKKyAgICAgKiAgIHJldHVybiBrZXkuY2hhckF0KDApICE9ICdfJzsKKyAg
ICAgKiB9KTsKKyAgICAgKiAvLyA9PiB7ICduYW1lJzogJ2ZyZWQnIH0KKyAgICAgKi8KKyAgICBm
dW5jdGlvbiBwaWNrKG9iamVjdCwgY2FsbGJhY2ssIHRoaXNBcmcpIHsKKyAgICAgIHZhciByZXN1
bHQgPSB7fTsKKyAgICAgIGlmICh0eXBlb2YgY2FsbGJhY2sgIT0gJ2Z1bmN0aW9uJykgeworICAg
ICAgICB2YXIgaW5kZXggPSAtMSwKKyAgICAgICAgICAgIHByb3BzID0gYmFzZUZsYXR0ZW4oYXJn
dW1lbnRzLCB0cnVlLCBmYWxzZSwgMSksCisgICAgICAgICAgICBsZW5ndGggPSBpc09iamVjdChv
YmplY3QpID8gcHJvcHMubGVuZ3RoIDogMDsKKworICAgICAgICB3aGlsZSAoKytpbmRleCA8IGxl
bmd0aCkgeworICAgICAgICAgIHZhciBrZXkgPSBwcm9wc1tpbmRleF07CisgICAgICAgICAgaWYg
KGtleSBpbiBvYmplY3QpIHsKKyAgICAgICAgICAgIHJlc3VsdFtrZXldID0gb2JqZWN0W2tleV07
CisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICB9IGVsc2UgeworICAgICAgICBjYWxsYmFj
ayA9IGxvZGFzaC5jcmVhdGVDYWxsYmFjayhjYWxsYmFjaywgdGhpc0FyZywgMyk7CisgICAgICAg
IGZvckluKG9iamVjdCwgZnVuY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GlzQXJyKSB7CisgICAgICAgICAgYWNjdW11bGF0b3IgPSBbXTsKKyAgICAg
ICAgfSBlbHNlIHsKKyAgICAgICAgICB2YXIgY3RvciA9IG9iamVjdCAmJiBvYmplY3QuY29uc3Ry
dWN0b3IsCisgICAgICAgICAgICAgIHByb3RvID0gY3RvciAmJiBjdG9yLnByb3RvdHlwZTsKKwor
ICAgICAgICAgIGFjY3VtdWxhdG9yID0gYmFzZUNyZWF0ZShwcm90byk7CisgICAgICAgIH0KKyAg
ICAgIH0KKyAgICAgIGlmIChjYWxsYmFjaykgeworICAgICAgICBjYWxsYmFjayA9IGxvZGFzaC5j
cmVhdGVDYWxsYmFjayhjYWxsYmFjaywgdGhpc0FyZywgNCk7CisgICAgICAgIChpc0FyciA/IGZv
ckVhY2ggOiBmb3JPd24pKG9iamVjdCwgZnVuY3Rpb24odmFsdWUsIGluZGV4LCBvYmplY3QpIHsK
KyAgICAgICAgICByZXR1cm4gY2FsbGJhY2soYWNjdW11bGF0b3IsIHZhbHVlLCBpbmRleCwgb2Jq
ZWN0KTsKKyAgICAgICAgfSk7CisgICAgICB9CisgICAgICByZXR1cm4gYWNjdW11bGF0b3I7Cisg
ICAgfQorCisgICAgLyoqCisgICAgICogQ3JlYXRlcyBhbiBhcnJheSBjb21wb3NlZCBvZiB0aGUg
b3duIGVudW1lcmFibGUgcHJvcGVydHkgdmFsdWVzIG9mIGBvYmplY3RgLgorICAgICAqCisgICAg
ICogQHN0YXRpYworICAgICAqIEBtZW1iZXJPZiBfCisgICAgICogQGNhdGVnb3J5IE9iamVjdHMK
KyAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBvYmplY3QgdG8gaW5zcGVjdC4KKyAg
ICAgKiBAcmV0dXJucyB7QXJyYXl9IFJldHVybnMgYW4gYXJyYXkgb2YgcHJvcGVydHkgdmFsdWVz
LgorICAgICAqIEBleGFtcGxlCisgICAgICoKKyAgICAgKiBfLnZhbHVlcyh7ICdvbmUnOiAxLC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cmVkJywgJ2FnZSc6IDQwIH0sICdmcmVkJyk7CisgICAgICog
Ly8gPT4gdHJ1ZQorICAgICAqCisgICAgICogXy5jb250YWlucygncGViYmxlcycsICdlYicpOwor
ICAgICAqIC8vID0+IHRydWUKKyAgICAgKi8KKyAgICBmdW5jdGlvbiBjb250YWlucyhjb2xsZWN0
aW9uLCB0YXJnZXQsIGZyb21JbmRleCkgeworICAgICAgdmFyIGluZGV4ID0gLTEsCisgICAgICAg
ICAgaW5kZXhPZiA9IGdldEluZGV4T2YoKSwKKyAgICAgICAgICBsZW5ndGggPSBjb2xsZWN0aW9u
ID8gY29sbGVjdGlvbi5sZW5ndGggOiAwLAorICAgICAgICAgIHJlc3VsdCA9IGZhbHNlOworCisg
ICAgICBmcm9tSW5kZXggPSAoZnJvbUluZGV4IDwgMCA/IG5hdGl2ZU1heCgwLCBsZW5ndGggKyBm
cm9tSW5kZXgpIDogZnJvbUluZGV4KSB8fCAwOworICAgICAgaWYgKGlzQXJyYXkoY29sbGVjdGlv
bikpIHsKKyAgICAgICAgcmVzdWx0ID0gaW5kZXhPZihjb2xsZWN0aW9uLCB0YXJnZXQsIGZyb21J
bmRleCkgPiAtMTsKKyAgICAgIH0gZWxzZSBpZiAodHlwZW9mIGxlbmd0aCA9PSAnbnVtYmVyJykg
eworICAgICAgICByZXN1bHQgPSAoaXNTdHJpbmcoY29sbGVjdGlvbikgPyBjb2xsZWN0aW9uLmlu
ZGV4T2YodGFyZ2V0LCBmcm9tSW5kZXgpIDogaW5kZXhPZihjb2xsZWN0aW9uLCB0YXJnZXQsIGZy
b21JbmRleCkpID4gLTE7CisgICAgICB9IGVsc2UgeworICAgICAgICBmb3JPd24oY29sbGVjdGlv
biwgZnVuY3Rpb24odmFsdWUpIHsKKyAgICAgICAgICBpZiAoKytpbmRleCA+PSBmcm9tSW5kZXgp
IHsKKyAgICAgICAgICAgIHJldHVybiAhKHJlc3VsdCA9IHZhbHVlID09PSB0YXJnZXQpOworICAg
ICAgICAgI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gICogXy5ldmVyeShjaGFyYWN0ZXJzLCAnYWdlJyk7CisgICAg
ICogLy8gPT4gdHJ1ZQorICAgICAqCisgICAgICogLy8gdXNpbmcgIl8ud2hlcmUiIGNhbGxiYWNr
IHNob3J0aGFuZAorICAgICAqIF8uZXZlcnkoY2hhcmFjdGVycywgeyAnYWdlJzogMzYgfSk7Cisg
ICAgICogLy8gPT4gZmFsc2UKKyAgICAgKi8KKyAgICBmdW5jdGlvbiBldmVyeShjb2xsZWN0aW9u
LCBjYWxsYmFjaywgdGhpc0FyZykgeworICAgICAgdmFyIHJlc3VsdCA9IHRydWU7CisgICAgICBj
YWxsYmFjayA9IGxvZGFzaC5jcmVhdGVDYWxsYmFjayhjYWxsYmFjaywgdGhpc0FyZywgMyk7CisK
KyAgICAgIHZhciBpbmRleCA9IC0xLAorICAgICAgICAgIGxlbmd0aCA9IGNvbGxlY3Rpb24gPyBj
b2xsZWN0aW9uLmxlbmd0aCA6IDA7CisKKyAgICAgIGlmICh0eXBlb2YgbGVuZ3RoID09ICdudW1i
ZXInKSB7CisgICAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoKSB7CisgICAgICAgICAgaWYg
KCEocmVzdWx0ID0gISFjYWxsYmFjayhjb2xsZWN0aW9uW2luZGV4XSwgaW5kZXgsIGNvbGxlY3Rp
b24pKSkgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgfQorICAgICAgICB9CisgICAg
ICB9IGVsc2UgeworICAgICAgICBmb3JPd24oY29sbGVjdGlvbiwgZnVuY3Rpb24odmFsdWUsIGlu
ZGV4LCBjb2xsZWN0aW9uKSB7CisgICAgICAgICAgcmV0dXJuIChyZXN1bHQgPSAhIWNhbGxiYWNr
KHZhbHVlLCBpbmRleCwgY29sbGVjdGlvbikpOworICAgICAgICB9KTsKKyAgICAgIH0KKyAgICAg
IHJldHVybiByZXN1bHQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogSXRlcmF0ZXMgb3ZlciBl
bGVtZW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yb25tZW50cykKKyAgICAgKgorICAgICAq
IHZhciBjaGFyYWN0ZXJzID0gWworICAgICAqICAgeyAnbmFtZSc6ICdiYXJuZXknLCAnYWdlJzog
MzYgfSwKKyAgICAgKiAgIHsgJ25hbWUnOiAnZnJlZCcsICAgJ2FnZSc6IDQwIH0KKyAgICAgKiBd
OworICAgICAqCisgICAgICogLy8gdXNpbmcgIl8ucGx1Y2siIGNhbGxiYWNrIHNob3J0aGFuZAor
ICAgICAqIF8ubWFwKGNoYXJhY3RlcnMsICduYW1lJyk7CisgICAgICogLy8gPT4gWydiYXJuZXkn
LCAnZnJlZCddCisgICAgICovCisgICAgZnVuY3Rpb24gbWFwKGNvbGxlY3Rpb24sIGNhbGxiYWNr
LCB0aGlzQXJnKSB7CisgICAgICB2YXIgaW5kZXggPSAtMSwKKyAgICAgICAgICBsZW5ndGggPSBj
b2xsZWN0aW9uID8gY29sbGVjdGlvbi5sZW5ndGggOiAwOworCisgICAgICBjYWxsYmFjayA9IGxv
ZGFzaC5jcmVhdGVDYWxsYmFjayhjYWxsYmFjaywgdGhpc0FyZywgMyk7CisgICAgICBpZiAodHlw
ZW9mIGxlbmd0aCA9PSAnbnVtYmVyJykgeworICAgICAgICB2YXIgcmVzdWx0ID0gQXJyYXkobGVu
Z3RoKTsKKyAgICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHsKKyAgICAgICAgICByZXN1
bHRbaW5kZXhdID0gY2FsbGJhY2soY29sbGVjdGlvbltpbmRleF0sIGluZGV4LCBjb2xsZWN0aW9u
KTsKKyAgICAgICAgfQorICAgICAgfSBlbHNlIHsKKyAgICAgICAgcmVzdWx0ID0gW107CisgICAg
ICAgIGZvck93bihjb2xsZWN0aW9uLCBmdW5jdGlvbih2YWx1ZSwga2V5LCBjb2xsZWN0aW9uKSB7
CisgICAgICAgICAgcmVzdWx0WysraW5kZXhdID0gY2FsbGJhY2sodmFsdWUsIGtleSwgY29sbGVj
dGlvbik7CisgICAgICAgIH0pO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yZWF0ZUNhY2hlKGFyZ3NJbmRleCA/IGFy
Z3NbYXJnc0luZGV4XSA6IHNlZW4pKTsKKyAgICAgICAgfQorICAgICAgfQorICAgICAgdmFyIGFy
cmF5ID0gYXJnc1swXSwKKyAgICAgICAgICBpbmRleCA9IC0xLAorICAgICAgICAgIGxlbmd0aCA9
IGFycmF5ID8gYXJyYXkubGVuZ3RoIDogMCwKKyAgICAgICAgICByZXN1bHQgPSBbXTsKKworICAg
ICAgb3V0ZXI6CisgICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkgeworICAgICAgICB2YXIg
Y2FjaGUgPSBjYWNoZXNbMF07CisgICAgICAgIHZhbHVlID0gYXJyYXlbaW5kZXhdOworCisgICAg
ICAgIGlmICgoY2FjaGUgPyBjYWNoZUluZGV4T2YoY2FjaGUsIHZhbHVlKSA6IGluZGV4T2Yoc2Vl
biwgdmFsdWUpKSA8IDApIHsKKyAgICAgICAgICBhcmdzSW5kZXggPSBhcmdzTGVuZ3RoOworICAg
ICAgICAgIChjYWNoZSB8fCBzZWVuKS5wdXNoKHZhbHVlKTsKKyAgICAgICAgICB3aGlsZSAoLS1h
cmdzSW5kZXgpIHsKKyAgICAgICAgICAgIGNhY2hlID0gY2FjaGVzW2FyZ3NJbmRleF07CisgICAg
ICAgICAgICBpZiAoKGNhY2hlID8gY2FjaGVJbmRleE9mKGNhY2hlLCB2YWx1ZSkgOiBpbmRleE9m
KGFyZ3NbYXJnc0luZGV4XSwgdmFsdWUpKSA8IDApIHsKKyAgICAgICAgICAgICAgY29udGludWUg
b3V0ZXI7CisgICAgICAgICAgICB9CisgICAgICAgICAgfQorICAgICAgICAgIHJlc3VsdC5wdXNo
KHZhbHVlKTsKKyAgICAgICAgfQorICAgICAgfQorICAgICAgd2hpbGUgKGFyZ3NMZW5ndGgtLSkg
eworICAgICAgICBjYWNoZSA9IGNhY2hlc1thcmdzTGVuZ3RoXTsKKyAgICAgICAgaWYgKGNhY2hl
KSB7CisgICAgICAgIC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iAnc2xhdGUnIH0sCisgICAgICogICB7ICduYW1lJzogJ2ZyZWQnLCAgICAnYmxvY2tlZCc6IHRy
dWUsICAnZW1wbG95ZXInOiAnc2xhdGUnIH0sCisgICAgICogICB7ICduYW1lJzogJ3BlYmJsZXMn
LCAnYmxvY2tlZCc6IHRydWUsICAnZW1wbG95ZXInOiAnbmEnIH0KKyAgICAgKiBdOworICAgICAq
CisgICAgICogLy8gdXNpbmcgIl8ucGx1Y2siIGNhbGxiYWNrIHNob3J0aGFuZAorICAgICAqIF8u
cGx1Y2soXy5sYXN0KGNoYXJhY3RlcnMsICdibG9ja2VkJyksICduYW1lJyk7CisgICAgICogLy8g
PT4gWydmcmVkJywgJ3BlYmJsZXMnXQorICAgICAqCisgICAgICogLy8gdXNpbmcgIl8ud2hlcmUi
IGNhbGxiYWNrIHNob3J0aGFuZAorICAgICAqIF8ubGFzdChjaGFyYWN0ZXJzLCB7ICdlbXBsb3ll
cic6ICduYScgfSk7CisgICAgICogLy8gPT4gW3sgJ25hbWUnOiAncGViYmxlcycsICdibG9ja2Vk
JzogdHJ1ZSwgJ2VtcGxveWVyJzogJ25hJyB9XQorICAgICAqLworICAgIGZ1bmN0aW9uIGxhc3Qo
YXJyYXksIGNhbGxiYWNrLCB0aGlzQXJnKSB7CisgICAgICB2YXIgbiA9IDAsCisgICAgICAgICAg
bGVuZ3RoID0gYXJyYXkgPyBhcnJheS5sZW5ndGggOiAwOworCisgICAgICBpZiAodHlwZW9mIGNh
bGxiYWNrICE9ICdudW1iZXInICYmIGNhbGxiYWNrICE9IG51bGwpIHsKKyAgICAgICAgdmFyIGlu
ZGV4ID0gbGVuZ3RoOworICAgICAgICBjYWxsYmFjayA9IGxvZGFzaC5jcmVhdGVDYWxsYmFjayhj
YWxsYmFjaywgdGhpc0FyZywgMyk7CisgICAgICAgIHdoaWxlIChpbmRleC0tICYmIGNhbGxiYWNr
KGFycmF5W2luZGV4XSwgaW5kZXgsIGFycmF5KSkgeworICAgICAgICAgIG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ZWxzZSBgZmFsc2VgLgorICAgICAqCisgICAgICogQHN0YXRpYworICAgICAqIEBtZW1iZXJPZiBf
CisgICAgICogQGNhdGVnb3J5IEFycmF5cworICAgICAqIEBwYXJhbSB7QXJyYXl9IGFycmF5IFRo
ZSBhcnJheSB0byBzZWFyY2guCisgICAgICogQHBhcmFtIHsqfSB2YWx1ZSBUaGUgdmFsdWUgdG8g
c2VhcmNoIGZvci4KKyAgICAgKiBAcGFyYW0ge251bWJlcn0gW2Zyb21JbmRleD1hcnJheS5sZW5n
dGgtMV0gVGhlIGluZGV4IHRvIHNlYXJjaCBmcm9tLgorICAgICAqIEByZXR1cm5zIHtudW1iZXJ9
IFJldHVybnMgdGhlIGluZGV4IG9mIHRoZSBtYXRjaGVkIHZhbHVlIG9yIGAtMWAuCisgICAgICog
QGV4YW1wbGUKKyAgICAgKgorICAgICAqIF8ubGFzdEluZGV4T2YoWzEsIDIsIDMsIDEsIDIsIDNd
LCAyKTsKKyAgICAgKiAvLyA9PiA0CisgICAgICoKKyAgICAgKiBfLmxhc3RJbmRleE9mKFsxLCAy
LCAzLCAxLCAyLCAzXSwgMiwgMyk7CisgICAgICogLy8gPT4gMQorICAgICAqLworICAgIGZ1bmN0
aW9uIGxhc3RJbmRleE9mKGFycmF5LCB2YWx1ZSwgZnJvbUluZGV4KSB7CisgICAgICB2YXIgaW5k
ZXggPSBhcnJheSA/IGFycmF5Lmxlbmd0aCA6IDA7CisgICAgICBpZiAodHlwZW9mIGZyb21JbmRl
eCA9PSAnbnVtYmVyJykgeworICAgICAgICBpbmRleCA9IChmcm9tSW5kZXggPCAwID8gbmF0aXZl
TWF4KDAsIGluZGV4ICsgZnJvbUluZGV4KSA6IG5hdGl2ZU1pbihmcm9tSW5kZXgsIGluZGV4IC0g
MSkpICsgMTsKKyAgICAgIH0KKyAgICAgIHdoaWxlIChpbmRleC0tKSB7CisgICAgICAgIGlmIChh
cnJheVtpbmRleF0gPT09IHZhbHVlKSB7CisgICAgICAgICAgcmV0dXJuIGluZGV4OworICAgICAg
ICB9CisgICAgICB9CisgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgLyoqCisgICAgICog
UmVtb3ZlcyBhbGwgcHJvdmlkZWQgdmFsdWVzIGZyb20gdGhlIGdpdmVuIGFycmF5IHVzaW5nIHN0
cmljdCBlcXVhbGl0eSBmb3IKKyAgICAgKiBjb21wYXJpc29ucywgaS5lLiBgPT09YC4KKyAgICAg
KgorICAgICAqIEBzdGF0aWMKKyAgICAgKiBAbWVtYmVyT2YgXworICAgICAqIEBjYXRlZ29yeSBB
cnJheXMKKyAgICAgKiBAcGFyYW0ge0FycmF5fSBhcnJheSBUaGUgYXJyYXkgdG8gbW9kaWZ5Lgor
ICAgICAqIEBwYXJhbSB7Li4uKn0gW3ZhbHVlXSBUaGUgdmFsdWVzIHRvIHJlbW92ZS4KKyAgICAg
KiBAcmV0dXJucyB7QXJyYXl9IFJldHVybnMgYGFycmF5YC4KKyAgICAgKiBAZXhhbXBsZQorICAg
ICAqCisgICAgICogdmFyIGFycmF5ID0gWzEsIDIsIDMsIDEsIDIsIDNdOworICAgICAqIF8ucHVs
bChhcnJheSwgMiwgMyk7CisgICAgICogY29uc29sZS5sb2coYXJyYXkpOworICAgICAqIC8vID0+
IFsxLCAxXQorICAgICAqLworICAgIGZ1bmN0aW9uIHB1bGwoYXJyYXkpIHsKKyAgICAgIHZhciBh
cmdzID0gYXJndW1lbnRzLAorICAgICAgICAgIGFyZ3NJbmRleCA9IDAsCisgICAgICAgICAgYXJn
c0xlbmd0aCA9IGFyZ3MubGVuZ3RoLAorICAgICAgICAgIGxlbmd0aCA9IGFycmF5ID8gYXJyYXku
bGVuZ3RoIDogMDsKKworICAgICAgd2hpbGUgKCsrYXJnc0luZGV4IDwgYXJnc0xlbmd0aCkgewor
ICAgICAgICB2YXIgaW5kZXggPSAtMSwKKyAgICAgICAgICAgIHZhbHVlID0gYXJnc1thcmdzSW5k
ZXhdOworICAgICAgICB3aGlsZSAoKytp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yAgICAgKi8KKyAgICBmdW5jdGlv
biBzb3J0ZWRJbmRleChhcnJheSwgdmFsdWUsIGNhbGxiYWNrLCB0aGlzQXJnKSB7CisgICAgICB2
YXIgbG93ID0gMCwKKyAgICAgICAgICBoaWdoID0gYXJyYXkgPyBhcnJheS5sZW5ndGggOiBsb3c7
CisKKyAgICAgIC8vIGV4cGxpY2l0bHkgcmVmZXJlbmNlIGBpZGVudGl0eWAgZm9yIGJldHRlciBp
bmxpbmluZyBpbiBGaXJlZm94CisgICAgICBjYWxsYmFjayA9IGNhbGxiYWNrID8gbG9kYXNoLmNy
ZWF0ZUNhbGxiYWNrKGNhbGxiYWNrLCB0aGlzQXJnLCAxKSA6IGlkZW50aXR5OworICAgICAgdmFs
dWUgPSBjYWxsYmFjayh2YWx1ZSk7CisKKyAgICAgIHdoaWxlIChsb3cgPCBoaWdoKSB7CisgICAg
ICAgIHZhciBtaWQgPSAobG93ICsgaGlnaCkgPj4+IDE7CisgICAgICAgIChjYWxsYmFjayhhcnJh
eVttaWRdKSA8IHZhbHVlKQorICAgICAgICAgID8gbG93ID0gbWlkICsgMQorICAgICAgICAgIDog
aGlnaCA9IG1pZDsKKyAgICAgIH0KKyAgICAgIHJldHVybiBsb3c7CisgICAgfQorCisgICAgLyoq
CisgICAgICogQ3JlYXRlcyBhbiBhcnJheSBvZiB1bmlxdWUgdmFsdWVzLCBpbiBvcmRlciwgb2Yg
dGhlIHByb3ZpZGVkIGFycmF5cyB1c2luZworICAgICAqIHN0cmljdCBlcXVhbGl0eSBmb3IgY29t
cGFyaXNvbnMsIGkuZS4gYD09PWAuCisgICAgICoKKyAgICAgKiBAc3RhdGljCisgICAgICogQG1l
bWJlck9mIF8KKyAgICAgKiBAY2F0ZWdvcnkgQXJyYXlzCisgICAgICogQHBhcmFtIHsuLi5BcnJh
eX0gW2FycmF5XSBUaGUgYXJyYXlzIHRvIGluc3BlY3QuCisgICAgICogQHJldHVybnMge0FycmF5
fSBSZXR1cm5zIGFuIGFyc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sKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDcmVhdGVzIGFuIGFycmF5
IHRoYXQgaXMgdGhlIHN5bW1ldHJpYyBkaWZmZXJlbmNlIG9mIHRoZSBwcm92aWRlZCBhcnJheXMu
CisgICAgICogU2VlIGh0dHA6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvU3ltbWV0cmljX2RpZmZl
cmVuY2UuCisgICAgICoKKyAgICAgKiBAc3RhdGljCisgICAgICogQG1lbWJlck9mIF8KKyAgICAg
KiBAY2F0ZWdvcnkgQXJyYXlzCisgICAgICogQHBhcmFtIHsuLi5BcnJheX0gW2FycmF5XSBUaGUg
YXJyYXlzIHRvIGluc3BlY3QuCisgICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIGFuIGFy
cmF5IG9mIHZhbHVlcy4KKyAgICAgKiBAZXhhbXBsZQorICAgICAqCisgICAgICogXy54b3IoWzEs
IDIsIDNdLCBbNSwgMiwgMSwgNF0pOworICAgICAqIC8vID0+IFszLCA1LCA0XQorICAgICAqCisg
ICAgICogXy54b3IoWzEsIDIsIDVdLCBbMiwgMywgNV0sIFszLCA0LCA1XSk7CisgICAgICogLy8g
PT4gWzEsIDQsIDVdCisgICAgICovCisgICAgZnVuY3Rpb24geG9yKCkgeworICAgICAgdmFyIGlu
ZGV4ID0gLTEsCisgICAgICAgICAgbGVuZ3RoID0gYXJndW1lbnRzLmxlbmd0aDsKKworICAgICAg
d2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHsKKyAgICAgICAgdmFyIGFycmF5ID0gYXJndW1lbnRz
W2luZGV4XTsKKyAgICAgICAgaWYgKGlzQXJyYXkoYXJyYXkpIHx8IGlzQXJndW1lbnRzKGFycmF5
KSkgeworICAgICAgICAgIHZhciByZXN1bHQgPSByZXN1bHQKKyAgICAgICAgICAgID8gYmFzZVVu
aXEoYmFzZURpZmZlcmVuY2UocmVzdWx0LCBhcnJheSkuY29uY2F0KGJhc2VEaWZmZXJlbmNlKGFy
cmF5LCByZXN1bHQpKSkKKyAgICAgICAgICAgIDogYXJyYXk7CisgICAgICAgIH0KKyAgICAgIH0K
KyAgICAgIHJldHVybiByZXN1bHQgfHwgW107CisgICAgfQorCisgICAgLyoqCisgICAgICogQ3Jl
YXRlcyBhbiBhcnJheSBvZiBncm91cGVkIGVsZW1lbnRzLCB0aGUgZmlyc3Qgb2Ygd2hpY2ggY29u
dGFpbnMgdGhlIGZpcnN0CisgICAgICogZWxlbWVudHMgb2YgdGhlIGdpdmVuIGFycmF5cywgdGhl
IHNlY29uZCBvZiB3aGljaCBjb250YWlucyB0aGUgc2Vjb25kCisgICAgICogZWxlbWVudHMgb2Yg
dGhlIGdpdmVuIGFycmF5cywgYW5kIHNvIG9uLgorICAgICAqCisgICAgICogQHN0YXRpYworICAg
ICAqIEBtZW1iZXJPZiBfCisgICAgICogQGFsaWFzIHVuemlwCisgICAgICogQGNhdGVnb3J5IEFy
cmF5cworICAgICAqIEBwYXJhbSB7Li4uQXJyYXl9IFthcnJheV0gQXJyYXlzIHRvIHByb2Nlc3Mu
CisgICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIGEgbmV3IGFycmF5IG9mIGdyb3VwZWQg
ZWxlbWVudHMuCisgICAgICogQGV4YW1wbGUKKyAgICAgKgorICAgICAqIF8uemlwKFsnZnJlZCcs
ICdiYXJuZXknXSwgWzMwLCA0MF0sIFt0cnVlLCBmYWxzZV0pOworICAgICAqIC8vID0+IFtbJ2Zy
ZWQnLCAzMCwgdHJ1ZV0sIFsnYmFybmV5JywgNDAsIGZhbHNlXV0KKyAgICAgKi8KKyAgICBmdW5j
dGlvbiB6aXAoKSB7CisgICAgICB2YXIgYXJyYXkgPSBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFy
Z3VtZW50cyA6IGFyZ3VtZW50c1swXSwKKyAgICAgICAgICBpbmRleCA9IC0xLAorICAgICAgICAg
IGxlbmd0aCA9IGFycmF5ID8gbWF4KHBsdWNrKGFycmF5LCAnbGV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ICogQHBh
cmFtIHsuLi5GdW5jdGlvbn0gW2Z1bmNdIEZ1bmN0aW9ucyB0byBjb21wb3NlLgorICAgICAqIEBy
ZXR1cm5zIHtGdW5jdGlvbn0gUmV0dXJucyB0aGUgbmV3IGNvbXBvc2VkIGZ1bmN0aW9uLgorICAg
ICAqIEBleGFtcGxlCisgICAgICoKKyAgICAgKiB2YXIgcmVhbE5hbWVNYXAgPSB7CisgICAgICog
ICAncGViYmxlcyc6ICdwZW5lbG9wZScKKyAgICAgKiB9OworICAgICAqCisgICAgICogdmFyIGZv
cm1hdCA9IGZ1bmN0aW9uKG5hbWUpIHsKKyAgICAgKiAgIG5hbWUgPSByZWFsTmFtZU1hcFtuYW1l
LnRvTG93ZXJDYXNlKCldIHx8IG5hbWU7CisgICAgICogICByZXR1cm4gbmFtZS5jaGFyQXQoMCku
dG9VcHBlckNhc2UoKSArIG5hbWUuc2xpY2UoMSkudG9Mb3dlckNhc2UoKTsKKyAgICAgKiB9Owor
ICAgICAqCisgICAgICogdmFyIGdyZWV0ID0gZnVuY3Rpb24oZm9ybWF0dGVkKSB7CisgICAgICog
ICByZXR1cm4gJ0hpeWEgJyArIGZvcm1hdHRlZCArICchJzsKKyAgICAgKiB9OworICAgICAqCisg
ICAgICogdmFyIHdlbGNvbWUgPSBfLmNvbXBvc2UoZ3JlZXQsIGZvcm1hdCk7CisgICAgICogd2Vs
Y29tZSgncGViYmxlcycpOworICAgICAqIC8vID0+ICdIaXlhIFBlbmVsb3BlIScKKyAgICAgKi8K
KyAgICBmdW5jdGlvbiBjb21wb3NlKCkgeworICAgICAgdmFyIGZ1bmNzID0gYXJndW1lbnRzLAor
ICAgICAgICAgIGxlbmd0aCA9IGZ1bmNzLmxlbmd0aDsKKworICAgICAgd2hpbGUgKGxlbmd0aC0t
KSB7CisgICAgICAgIGlmICghaXNGdW5jdGlvbihmdW5jc1tsZW5ndGhdKSkgeworICAgICAgICAg
IHRocm93IG5ldyBUeXBlRXJyb3I7CisgICAgICAg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2UoYmF0Y2hMb2csIDI1MCwgeworICAgICAqICAgJ21heFdhaXQn
OiAxMDAwCisgICAgICogfSwgZmFsc2UpOworICAgICAqLworICAgIGZ1bmN0aW9uIGRlYm91bmNl
KGZ1bmMsIHdhaXQsIG9wdGlvbnMpIHsKKyAgICAgIHZhciBhcmdzLAorICAgICAgICAgIG1heFRp
bWVvdXRJZCwKKyAgICAgICAgICByZXN1bHQsCisgICAgICAgICAgc3RhbXAsCisgICAgICAgICAg
dGhpc0FyZywKKyAgICAgICAgICB0aW1lb3V0SWQsCisgICAgICAgICAgdHJhaWxpbmdDYWxsLAor
ICAgICAgICAgIGxhc3RDYWxsZWQgPSAwLAorICAgICAgICAgIG1heFdhaXQgPSBmYWxzZSwKKyAg
ICAgICAgICB0cmFpbGluZyA9IHRydWU7CisKKyAgICAgIGlmICghaXNGdW5jdGlvbihmdW5jKSkg
eworICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yOworICAgICAgfQorICAgICAgd2FpdCA9IG5h
dGl2ZU1heCgwLCB3YWl0KSB8fCAwOworICAgICAgaWYgKG9wdGlvbnMgPT09IHRydWUpIHsKKyAg
ICAgICAgdmFyIGxlYWRpbmcgPSB0cnVlOworICAgICAgICB0cmFpbGluZyA9IGZhbHNlOworICAg
ICAgfSBlbHNlIGlmIChpc09iamVjdChvcHRpb25zKSkgeworICAgICAgICBsZWFkaW5nID0gb3B0
aW9ucy5sZWFkaW5nOworICAgICAgICBtYXhXYWl0ID0gJ21heFdhaXQnIGluIG9wdGlvbnMgJiYg
KG5hdGl2ZU1heCh3YWl0LCBvcHRpb25zLm1heFdhaXQpIHx8IDApOworICAgICAgICB0cmFpbGlu
ZyA9ICd0cmFpbGluZycgaW4gb3B0aW9ucyA/IG9wdGlvbnMudHJhaWxpbmcgOiB0cmFpbGluZzsK
KyAgICAgIH0KKyAgICAgIHZhciBkZWxheWVkID0gZnVuY3Rpb24oKSB7CisgICAgICAgIHZhciBy
ZW1haW5pbmcgPSB3YWl0IC0gKG5vdygpIC0gc3RhbXApOworICAgICAgICBpZiAocmVtYWluaW5n
IDw9IDApIHsKKyAgICAgICAgICBpZiAobWF4VGltZW91dElkKSB7CisgICAgICAgICAgICBjbGVh
clRpbWVvdXQobWF4VGltZW91dElkKTsKKyAgICAgICAgICB9CisgICAgICAgICAgdmFyIGlzQ2Fs
bGVkID0gdHJhaWxpbmdDYWxsOworICAgICAgICAgIG1heFRpbWVvdXRJZCA9IHRpbWVvdXRJZCA9
IHRyYWlsaW5nQ2FsbCA9IHVuZGVmaW5lZDsKKyAgICAgICAgICBpZiAoaXNDYWxsZWQpIHsKKyAg
ICAgICAgICAgIGxhc3RDYWxsZWQgPSBub3coKTsKKyAgICAgICAgICAgIHJlc3VsdCA9IGZ1bmMu
YXBwbHkodGhpc0FyZywgYXJncyk7CisgICAgICAgICAgICBpZiAoIXRpbWVvdXRJZCAmJiAhbWF4
VGltZW91dElkKSB7CisgICAgICAgICAgICAgIGFyZ3MgPSB0aGlzQXJnID0gbnVsbDsKKyAgICAg
ICAgICAgIH0KKyAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgdGltZW91
dElkID0gc2V0VGltZW91dChkZWxheWVkLCByZW1haW5pbmcpOworICAgICAgICB9CisgICAgICB9
OworCisgICAgICB2YXIgbWF4RGVsYXllZCA9IGZ1bmN0aW9uKCkgeworICAgICAgICBpZiAodGlt
ZW91dElkKSB7CisgICAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVvdXRJZCk7CisgICAgICAgIH0K
KyAgICAgICAgbWF4VGltZW91dElkID0gdGltZW91dElkID0gdHJhaWxpbmdDYWxsID0gdW5kZWZp
bmVkOworICAgICAgICBpZiAodHJhaWxpbmcgfHwgKG1heFdhaXQgIT09IHdhaXQpKSB7CisgICAg
ICAgICAgbGFzdENhbGxlZCA9IG5vdygpOworICAgICAgICAgIHJlc3VsdCA9IGZ1bmMuYXBwbHko
dGhpc0FyZywgYXJncyk7CisgICAgICAgICAgaWYgKCF0aW1lb3V0SWQgJiYgIW1heFRpbWVvdXRJ
ZCkgeworICAgICAgICAgICAgYXJncyA9IHRoaXNBcmcgPSBudWxsOworICAgICAgICAgIH0KKyAg
ICAgICAgfQorICAgICAgfTsKKworICAgICAgcmV0dXJuIGZ1bmN0aW9uKCkgeworICAgICAgICBh
cmdzID0gYXJndW1lbnRzOworICAgICAgICBzdGFtcCA9IG5vdygpOworICAgICAgICB0aGlzQXJn
ID0gdGhpczsKKyAgICAgICAgdHJhaWxpbmdDYWxsID0gdHJhaWxpbmcgJiYgKHRpbWVvdXRJZCB8
fCAhbGVhZGluZyk7CisKKyAgICAgICAgaWYgKG1heFdhaXQgPT09IGZhbHNlKSB7CisgICAgICAg
ICAgdmFyIGxlYWRpbmdDYWxsID0gbGVhZGluZyAmJiAhdGltZW91dElkOworICAgICAgICB9IGVs
c2UgeworICAgICAgICAgIGlmICghbWF4VGltZW91dElkICYmICFsZWFkaW5nKSB7CisgICAgICAg
ICAgICBsYXN0Q2FsbGVkID0gc3RhbXA7CisgICAgICAgICAgfQorICAgICAgICAgIHZhciByZW1h
aW5pbmcgPSBtYXhXYWl0IC0gKHN0YW1wIC0gbGFzdENhbGxlZCksCisgICAgICAgICAgICAgIGlz
Q2FsbGVkID0gcmVtYWluaW5nIDw9IDA7CisKKyAgICAgICAgICBpZiAoaXNDYWxsZWQpIHsKKyAg
ICAgICAgICAgIGlmIChtYXhUaW1lb3V0SWQpIHsKKyAgICAgICAgICAgICAgbWF4VGltZW91dElk
ID0gY2xlYXJUaW1lb3V0KG1heFRpbWVvdXRJZCk7CisgICAgICAgICAgICB9CisgICAgICAgICAg
ICBsYXN0Q2FsbGVkID0gc3RhbXA7CisgICAgICAgICAgICByZXN1bHQgPSBmdW5jLmFwcGx5KHRo
aXNBcmcsIGFyZ3MpOworICAgICAgICAgIH0KKyAgICAgICAgICBlbHNlIGlmICghbWF4VGltZW91
dElkKSB7CisgICAgICAgICAgICBtYXhUaW1lb3V0SWQgPSBzZXRUaW1lb3V0KG1heERlbGF5ZWQs
IHJlbWFpbmluZyk7CisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChpc0NhbGxl
ZCAmJiB0aW1lb3V0SWQpIHsKKyAgICAgICAgICB0aW1lb3V0SWQgPSBjbGVhclRpbWVvdXQodGlt
ZW91dElkKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmICghdGltZW91dElkICYmIHdhaXQg
IT09IG1heFdhaXQpIHsKKyAgICAgICAgICB0aW1lb3V0SWQgPSBzZXRUaW1lb3V0KGRlbGF5ZWQs
IHdhaXQpOworICAgICAgICB9CisgICAgICAgIGlmIChsZWFkaW5nQ2FsbCkgeworICAgICAgICAg
IGlzQ2FsbGVkID0gdHJ1ZTsKKyAgICAgICAgICByZXN1bHQgPSBmdW5jLmFwcGx5KHRoaXNBcmcs
IGFyZ3MpOworICAgICAgICB9CisgICAgICAgIGlmIChpc0NhbGxlZCAmJiAhdGltZW91dElkICYm
ICFtYXhUaW1lb3V0SWQpIHsKKyAgICAgICAgICBhcmdzID0gdGhpc0FyZyA9IG51bGw7CisgICAg
ICAgIH0KKyAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICAgIH07CisgICAgfQorCisgICAgLyoq
CisgICAgICogRGVmZXJzIGV4ZWN1dGluZyB0aGUgYGZ1bmNgIGZ1bmN0aW9uIHVudGlsIHRoZSBj
dXJyZW50IGNhbGwgc3RhY2sgaGFzIGNsZWFyZWQuCisgICAgICogQWRkaXRpb25hbCBhcmd1bWVu
dHMgd2lsbCBiZSBwcm92aWRlZCB0byBgZnVuY2Agd2hlbiBpdCBpcyBpbnZva2VkLgorICAgICAq
CisgICAgICogQHN0YXRpYworICAgICAqIEBtZW1iZXJPZiBfCisgICAgICogQGNhdGVnb3J5IEZ1
bmN0aW9ucworICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IGZ1bmMgVGhlIGZ1bmN0aW9uIHRvIGRl
ZmVyLgorICAgICAqIEBwYXJhb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ncGViYmxl
cycsICdhZ2UnOiAxIH0KKyAgICAgKiB9OworICAgICAqCisgICAgICogLy8gbW9kaWZ5aW5nIHRo
ZSByZXN1bHQgY2FjaGUKKyAgICAgKiB2YXIgZ2V0ID0gXy5tZW1vaXplKGZ1bmN0aW9uKG5hbWUp
IHsgcmV0dXJuIGRhdGFbbmFtZV07IH0sIF8uaWRlbnRpdHkpOworICAgICAqIGdldCgncGViYmxl
cycpOworICAgICAqIC8vID0+IHsgJ25hbWUnOiAncGViYmxlcycsICdhZ2UnOiAxIH0KKyAgICAg
KgorICAgICAqIGdldC5jYWNoZS5wZWJibGVzLm5hbWUgPSAncGVuZWxvcGUnOworICAgICAqIGdl
dCgncGViYmxlcycpOworICAgICAqIC8vID0+IHsgJ25hbWUnOiAncGVuZWxvcGUnLCAnYWdlJzog
MSB9CisgICAgICovCisgICAgZnVuY3Rpb24gbWVtb2l6ZShmdW5jLCByZXNvbHZlcikgeworICAg
ICAgaWYgKCFpc0Z1bmN0aW9uKGZ1bmMpKSB7CisgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3I7
CisgICAgICB9CisgICAgICB2YXIgbWVtb2l6ZWQgPSBmdW5jdGlvbigpIHsKKyAgICAgICAgdmFy
IGNhY2hlID0gbWVtb2l6ZWQuY2FjaGUsCisgICAgICAgICAgICBrZXkgPSByZXNvbHZlciA/IHJl
c29sdmVyLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykgOiBrZXlQcmVmaXggKyBhcmd1bWVudHNbMF07
CisKKyAgICAgICAgcmV0dXJuIGhhc093blByb3BlcnR5LmNhbGwoY2FjaGUsIGtleSkKKyAgICAg
ICAgICA/IGNhY2hlW2tleV0KKyAgICAgICAgICA6IChjYWNoZVtrZXldID0gZnVuYy5hcHBseSh0
aGlzLCBhcmd1bWVudHMpKTsKKyAgICAgIH0KKyAgICAgIG1lbW9pemVkLmNhY2hlID0ge307Cisg
ICAgICByZXR1cm4gbWVtb2l6ZWQ7CisgICAgfQorCisgICAgL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LAorICAgICAgICAgIGtleSA9IHByb3BzWzBdLAor
ICAgICAgICAgIGEgPSBmdW5jW2tleV07CisKKyAgICAgIC8vIGhhbmRsZSAiXy53aGVyZSIgc3R5
bGUgY2FsbGJhY2sgc2hvcnRoYW5kcworICAgICAgaWYgKHByb3BzLmxlbmd0aCA9PSAxICYmIGEg
PT09IGEgJiYgIWlzT2JqZWN0KGEpKSB7CisgICAgICAgIC8vIGZhc3QgcGF0aCB0aGUgY29tbW9u
IGNhc2Ugb2YgcHJvdmlkaW5nIGFuIG9iamVjdCB3aXRoIGEgc2luZ2xlCisgICAgICAgIC8vIHBy
b3BlcnR5IGNvbnRhaW5pbmcgYSBwcmltaXRpdmUgdmFsdWUKKyAgICAgICAgcmV0dXJuIGZ1bmN0
aW9uKG9iamVjdCkgeworICAgICAgICAgIHZhciBiID0gb2JqZWN0W2tleV07CisgICAgICAgICAg
cmV0dXJuIGEgPT09IGIgJiYgKGEgIT09IDAgfHwgKDEgLyBhID09IDEgLyBiKSk7CisgICAgICAg
IH07CisgICAgICB9CisgICAgICByZXR1cm4gZnVuY3Rpb24ob2JqZWN0KSB7CisgICAgICAgIHZh
ciBsZW5ndGggPSBwcm9wcy5sZW5ndGgsCisgICAgICAgICAgICByZXN1bHQgPSBmYWxzZTsKKwor
ICAgICAgICB3aGlsZSAobGVuZ3RoLS0pIHsKKyAgICAgICAgICBpZiAoIShyZXN1bHQgPSBiYXNl
SXNFcXVhbChvYmplY3RbcHJvcHNbbGVuZ3RoXV0sIGZ1bmNbcHJvcHNbbGVuZ3RoXV0sIG51bGws
IHRydWUpKSkgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgfQorICAgICAgICB9Cisg
ICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgICB9OworICAgIH0KKworICAgIC8qKgorICAgICAq
IENvbnZlcnRzIHRoZSBjaGFyYWN0ZXJzIGAmYCwgYDxgLCBgPmAsIGAiYCwgYW5kIGAnYCBpbiBg
c3RyaW5nYCB0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dGFsaXplKCdmcmVkJyk7CisgICAgICogLy8gPT4gJ0ZyZWQnCisgICAgICoKKyAgICAg
KiBfKCdmcmVkJykuY2FwaXRhbGl6ZSgpLnZhbHVlKCk7CisgICAgICogLy8gPT4gJ0ZyZWQnCisg
ICAgICoKKyAgICAgKiBfLm1peGluKHsgJ2NhcGl0YWxpemUnOiBjYXBpdGFsaXplIH0sIHsgJ2No
YWluJzogZmFsc2UgfSk7CisgICAgICogXygnZnJlZCcpLmNhcGl0YWxpemUoKTsKKyAgICAgKiAv
LyA9PiAnRnJlZCcKKyAgICAgKi8KKyAgICBmdW5jdGlvbiBtaXhpbihvYmplY3QsIHNvdXJjZSwg
b3B0aW9ucykgeworICAgICAgdmFyIGNoYWluID0gdHJ1ZSwKKyAgICAgICAgICBtZXRob2ROYW1l
cyA9IHNvdXJjZSAmJiBmdW5jdGlvbnMoc291cmNlKTsKKworICAgICAgaWYgKCFzb3VyY2UgfHwg
KCFvcHRpb25zICYmICFtZXRob2ROYW1lcy5sZW5ndGgpKSB7CisgICAgICAgIGlmIChvcHRpb25z
ID09IG51bGwpIHsKKyAgICAgICAgICBvcHRpb25zID0gc291cmNlOworICAgICAgICB9CisgICAg
ICAgIGN0b3IgPSBsb2Rhc2hXcmFwcGVyOworICAgICAgICBzb3VyY2UgPSBvYmplY3Q7CisgICAg
ICAgIG9iamVjdCA9IGxvZGFzaDsKKyAgICAgICAgbWV0aG9kTmFtZXMgPSBmdW5jdGlvbnMoc291
cmNlKTsKKyAgICAgIH0KKyAgICAgIGlmIChvcHRpb25zID09PSBmYWxzZSkgeworICAgICAgICBj
aGFpbiA9IGZhbHNlOworICAgICAgfSBlbHNlIGlmIChpc09iamVjdChvcHRpb25zKSAmJiAnY2hh
aW4nIGluIG9wdGlvbnMpIHsKKyAgICAgICAgY2hhaW4gPSBvcHRpb25zLmNoYWluOworICAgICAg
fQorICAgICAgdmFyIGN0b3IgPSBvYmplY3QsCisgICAgICAgICAgaXNGdW5jID0gaXNGdW5jdGlv
bihjdG9yKTsKKworICAgICAgZm9yRWFjaChtZXRob2ROYW1lcywgZnVuY3Rpb24obWV0aG9kTmFt
ZSkgeworICAgICAgICB2YXIgZnVuYyA9IG9iamVjdFttZXRob2ROYW1lXSA9IHNvdXJjZVttZXRo
b2ROYW1lXTsKKyAgICAgICAgaWYgKGlzRnVuYykgeworICAgICAgICAgIGN0b3IucHJvdG90eXBl
W21ldGhvZE5hbWVdID0gZnVuY3Rpb24oKSB7CisgICAgICAgICAgICB2YXIgY2hhaW5BbGwgPSB0
aGlzLl9fY2hhaW5fXywKKyAgICAgICAgICAgICAgICB2YWx1ZSA9IHRoaXMuX193cmFwcGVkX18s
CisgICAgICAgICAgICAgICAgYXJncyA9IFt2YWx1ZV07CisKKyAgICAgICAgICAgIHB1c2guYXBw
bHkoYXJncywgYXJndW1lbnRzKTsKKyAgICAgICAgICAgIHZhciByZXN1bHQgPSBmdW5jLmFwcGx5
KG9iamVjdCwgYXJncyk7CisgICAgICAgICAgICBpZiAoY2hhaW4gfHwgY2hhaW5BbGwpIHsKKyAg
ICAgICAgICAgICAgaWYgKHZhbHVlID09PSByZXN1bHQgJiYgaXNPYmplY3QocmVzdWx0KSkgewor
ICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOworICAgICAgICAgICAgICB9CisgICAgICAgICAg
ICAgIHJlc3VsdCA9IG5ldyBjdG9yKHJlc3VsdCk7CisgICAgICAgICAgICAgIHJlc3VsdC5fX2No
YWluX18gPSBjaGFpbkFsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiByZXN1
bHQ7CisgICAgICAgICAgfTsKKyAgICAgICAgfQorICAgICAgfSk7CisgICAgfQorCisgICAgLyoq
CisgICAgICogUmV2ZXJ0cyB0aGUgJ18nIHZhcmlhYmxlIHRvIGl0cyBwcmV2aW91cyB2YWx1ZSBh
bmQgcmV0dXJucyBhIHJlZmVyZW5jZSB0bworICAgICAqIHRoZSBgbG9kYXNoYCBmdW5jdGlvbi4K
KyAgICAgKgorICAgICAqIEBzdGF0aWMKKyAgICAgKiBAbWVtYmVyT2YgXworICAgICAqIEBjYXRl
Z29yeSBVdGlsaXRpZXMKKyAgICAgKiBAcmV0dXJucyB7RnVuY3Rpb259IFJldHVybnMgdGhlIGBs
b2Rhc2hgIGZ1bmN0aW9uLgorICAgICAqIEBleGFtcGxlCisgICAgICoKKyAgICAgKiB2YXIgbG9k
YXNoID0gXy5ub0NvbmZsaWN0KCk7CisgICAgICovCisgICAgZnVuY3Rpb24gbm9Db25mbGljdCgp
IHsKKyAgICAgIGNvbnRleHQuXyA9IG9sZERhc2g7CisgICAgICByZXR1cm4gdGhpczsKKyAgICB9
CisKKyAgICAvKioKKyAgICAgKiBBIG5vLW9wZXJhdGlvbiBmdW5jdGlvbi4KKyAgICAgKgorICAg
ICAqIEBzdGF0aWMKKyAgICAgKiBAbWVtYmVyT2YgXworICAgICAqIEBjYXRlZ29yeSBVdGlsaXRp
ZXMKKyAgICAgKiBAZXhhbXBsZQorICAgICAqCisgICAgICogdmFyIG9iamVjdCA9IHsgJ25hbWUn
OiAnZnJlZCcgfTsKKyAgICAgKiBfLm5vb3Aob2JqZWN0KSA9PT0gdW5kZWZpbmVkOworICAgICAq
IC8vID0+IHRydWUKKyAgICAgKi8KKyAgICBmdW5jdGlvbiBub29wKCkgeworICAgICAgLy8gbm8g
b3BlcmF0aW9uIHBlcmZvcm1lZAorICAgIH0KKworICAgIC8qKgorICAgICAqIEdldHMgdGhlIG51
bWJlciBvZiBtaWxsaXNlY29uZHMgdGhhdCBoYXZlIGVsYXBzZWQgc2luY2UgdGhlIFVuaXggZXBv
Y2gKKyAgICAgKiAoMSBKYW51YXJ5IDE5NzAgMDA6MDA6MDAgVVRDKS4KKyAgICAgKgorICAgICAq
IEBzdGF0aWMKKyAgICAgKiBAbWVtYmVyT2YgXworICAgICAqIEBjYXRlZ29yeSBVdGlsaXRpZXMK
KyAgICAgKiBAZXhhbXBsZQorICAgICAqCisgICAgICogdm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W5nID09IG51bGwpIHsKKyAgICAgICAgaWYgKHR5cGVvZiBtaW4gPT0gJ2Jvb2xlYW4nICYm
IG5vTWF4KSB7CisgICAgICAgICAgZmxvYXRpbmcgPSBtaW47CisgICAgICAgICAgbWluID0gMTsK
KyAgICAgICAgfQorICAgICAgICBlbHNlIGlmICghbm9NYXggJiYgdHlwZW9mIG1heCA9PSAnYm9v
bGVhbicpIHsKKyAgICAgICAgICBmbG9hdGluZyA9IG1heDsKKyAgICAgICAgICBub01heCA9IHRy
dWU7CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIGlmIChub01pbiAmJiBub01heCkgeworICAg
ICAgICBtYXggPSAxOworICAgICAgfQorICAgICAgbWluID0gK21pbiB8fCAwOworICAgICAgaWYg
KG5vTWF4KSB7CisgICAgICAgIG1heCA9IG1pbjsKKyAgICAgICAgbWluID0gMDsKKyAgICAgIH0g
ZWxzZSB7CisgICAgICAgIG1heCA9ICttYXggfHwgMDsKKyAgICAgIH0KKyAgICAgIGlmIChmbG9h
dGluZyB8fCBtaW4gJSAxIHx8IG1heCAlIDEpIHsKKyAgICAgICAgdmFyIHJhbmQgPSBuYXRpdmVS
YW5kb20oKTsKKyAgICAgICAgcmV0dXJuIG5hdGl2ZU1pbihtaW4gKyAocmFuZCAqIChtYXggLSBt
aW4gKyBwYXJzZUZsb2F0KCcxZS0nICsgKChyYW5kICsnJykubGVuZ3RoIC0gMSkpKSksIG1heCk7
CisgICAgICB9CisgICAgICByZXR1cm4gYmFzZVJhbmRvbShtaW4sIG1heCk7CisgICAgfQorCisg
ICAgLyoqCisgICAgICogUmVzb2x2ZXMgdGhlIHZhbHVlIG9mIHByb3BlcnR5IGBrZXlgIG9uIGBv
YmplY3RgLiBJZiBga2V5YCBpcyBhIGZ1bmN0aW9uCisgICAgICogaXQgd2lsbCBiZSBpbnZva2Vk
IHdpdGggdGhlIGB0aGlzYCBiaW5kaW5nIG9mIGBvYmplY3RgIGFuZCBpdHMgcmVzdWx0IHJldHVy
bmVkLAorICAgICAqIGVsc2UgdGhlIHByb3BlcnR5IHZhbHVlIGlzIHJldHVybmVkLiBJZiBgb2Jq
ZWN0YCBpcyBmYWxzZXkgdGhlbiBgdW5kZWZpbmVkYAorICAgICAqIGlzIHJldHVybmVkLgorICAg
ICAqCisgICAgICogQHN0YXRpYworICAgICAqIEBtZW1iZXJPZiBfCisgICAgICogQGNhdGVnb3J5
IFV0aWxpdGllcworICAgICAqIEBwYXJhbSB7T2JqZWN0fSBvYmplY3QgVGhlIG9iamVjdCB0byBp
bnNwZWN0LgorICAgICAqIEBwYXJhbSB7c3RyaW5nfSBrZXkgVGhlIG5hbWUgb2YgdGhlIHByb3Bl
cnR5IHRvIHJlc29sdmUuCisgICAgICogQHJldHVybnMgeyp9IFJldHVybnMgdGhlIHJlc29sdmVk
IHZhbHVlLgorICAgICAqIEBleGFtcGxlCisgICAgICoKKyAgICAgKiB2YXIgb2JqZWN0ID0gewor
ICAgICAqICAgJ2NoZWVzZSc6ICdjcnVtcGV0cycsCisgICAgICogICAnc3R1ZmYnOiBmdW5jdGlv
bigpIHsKKyAgICAgKiAgICAgcmV0dXJuICdub25zZW5zZSc7CisgICAgICogICB9CisgICAgICog
fTsKKyAgICAgKgorICAgICAqIF8ucmVzdWx0KG9iamVjdCwgJ2NoZWVzZScpOworICAgICAqIC8v
ID0+ICdjcnVtcGV0cycKKyAgICAgKgorICAgICAqIF8ucmVzdWx0KG9iamVjdCwgJ3N0dWZmJyk7
CisgICAgICogLy8gPT4gJ25vbnNlbnNlJworICAgICAqLworICAgIGZ1bmN0aW9uIHJlc3VsdChv
YmplY3QsIGtleSkgeworICAgICAgaWYgKG9iamVjdCkgeworICAgICAgICB2YXIgdmFsdWUgPSBv
YmplY3Rba2V5XTsKKyAgICAgICAgcmV0dXJuIGlzRnVuY3Rpb24odmFsdWUpID8gb2JqZWN0W2tl
eV0oKSA6IHZhbHVlOworICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEEgbWljcm8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QZWJibGVzJworICAgICAqLworICAg
IGZ1bmN0aW9uIHVuZXNjYXBlKHN0cmluZykgeworICAgICAgcmV0dXJuIHN0cmluZyA9PSBudWxs
ID8gJycgOiBTdHJpbmcoc3RyaW5nKS5yZXBsYWNlKHJlRXNjYXBlZEh0bWwsIHVuZXNjYXBlSHRt
bENoYXIpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEdlbmVyYXRlcyBhIHVuaXF1ZSBJRC4g
SWYgYHByZWZpeGAgaXMgcHJvdmlkZWQgdGhlIElEIHdpbGwgYmUgYXBwZW5kZWQgdG8gaXQuCisg
ICAgICoKKyAgICAgKiBAc3RhdGljCisgICAgICogQG1lbWJlck9mIF8KKyAgICAgKiBAY2F0ZWdv
cnkgVXRpbGl0aWVzCisgICAgICogQHBhcmFtIHtzdHJpbmd9IFtwcmVmaXhdIFRoZSB2YWx1ZSB0
byBwcmVmaXggdGhlIElEIHdpdGguCisgICAgICogQHJldHVybnMge3N0cmluZ30gUmV0dXJucyB0
aGUgdW5pcXVlIElELgorICAgICAqIEBleGFtcGxlCisgICAgICoKKyAgICAgKiBfLnVuaXF1ZUlk
KCdjb250YWN0XycpOworICAgICAqIC8vID0+ICdjb250YWN0XzEwNCcKKyAgICAgKgorICAgICAq
IF8udW5pcXVlSWQoKTsKKyAgICAgKiAvLyA9PiAnMTA1JworICAgICAqLworICAgIGZ1bmN0aW9u
IHVuaXF1ZUlkKHByZWZpeCkgeworICAgICAgdmFyIGlkID0gKytpZENvdW50ZXI7CisgICAgICBy
ZXR1cm4gU3RyaW5nKHByZWZpeCA9PSBudWxsID8gJycgOiBwcmVmaXgpICsgaWQ7CisgICAgfQor
CisgICAgLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSovCisKKyAgICAvKioKKyAgICAgKiBDcmVhdGVzIGEg
YGxvZGFzaGAgb2JqZWN0IHRoYXQgd3JhcHMgdGhlIGdpdmVuIHZhbHVlIHdpdGggZXhwbGljaXQK
KyAgICAgKiBtZXRob2QgY2hhaW5pbmcgZW5hYmxlZC4KKyAgICAgKgorICAgICAqIEBzdGF0aWMK
KyAgICAgKiBAbWVtYmVyT2YgXworICAgICAqIEBjYXRlZ29yeSBDaGFpbmluZworICAgICAqIEBw
YXJhbSB7Kn0gdmFsdWUgVGhlIHZhbHVlIHRvIHdyYXAuCisgICAgICogQHJldHVybnMge09iamVj
dH0gUmV0dXJucyB0aGUgd3JhcHBlciBvYmplY3QuCisgICAgICogQGV4YW1wbGUKKyAgICAgKgor
ICAgICAqIHZhciBjaGFyYWN0ZXJzID0gWworICAgICAqICAgeyAnbmFtZSc6ICdiYXJuZXknLCAg
J2FnZSc6IDM2IH0sCisgICAgICogICB7ICduYW1lJzogJ2ZyZWQnLCAgICAnYWdlJzogNDAgfSwK
KyAgICAgKiAgIHsgJ25hbWUnOiAncGViYmxlcycsICdhZ2UnOiAxIH0KKyAgICAgKiBdOworICAg
ICAqCisgICAgICogdmFyIHlvdW5nZXN0ID0gXy5jaGFpbihjaGFyYWN0ZXJzKQorICAgICAqICAg
ICAuc29ydEJ5KCdhZ2UnKQorICAgICAqICAgICAubWFwKGZ1bmN0aW9uKGNocikgeyByZXR1cm4g
Y2hyLm5hbWUgKyAnIGlzICcgKyBjaHIuYWdlOyB9KQorICAgICAqICAgICAuZmlyc3QoKQorICAg
ICAqICAgICAudmFsdWUoKTsKKyAgICAgKiAvLyA9PiAncGViYmxlcyBpcyAxJworICAgICAqLwor
ICAgIGZ1bmN0aW9uIGNoYWluKHZhbHVlKSB7CisgICAgICB2YWx1ZSA9IG5ldyBsb2Rhc2hXcmFw
cGVyKHZhbHVlKTsKKyAgICAgIHZhbHVlLl9fY2hhaW5fXyA9IHRydWU7CisgICAgICByZXR1cm4g
dmFsdWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogSW52b2tlcyBgaW50ZXJjZXB0b3JgIHdp
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gorICAgICAqIEBtZW1iZXJPZiBfCisgICAgICogQGNhdGVn
b3J5IENoYWluaW5nCisgICAgICogQHJldHVybnMgeyp9IFJldHVybnMgdGhlIHdyYXBwZXIgb2Jq
ZWN0LgorICAgICAqIEBleGFtcGxlCisgICAgICoKKyAgICAgKiB2YXIgY2hhcmFjdGVycyA9IFsK
KyAgICAgKiAgIHsgJ25hbWUnOiAnYmFybmV5JywgJ2FnZSc6IDM2IH0sCisgICAgICogICB7ICdu
YW1lJzogJ2ZyZWQnLCAgICdhZ2UnOiA0MCB9CisgICAgICogXTsKKyAgICAgKgorICAgICAqIC8v
IHdpdGhvdXQgZXhwbGljaXQgY2hhaW5pbmcKKyAgICAgKiBfKGNoYXJhY3RlcnMpLmZpcnN0KCk7
CisgICAgICogLy8gPT4geyAnbmFtZSc6ICdiYXJuZXknLCAnYWdlJzogMzYgfQorICAgICAqCisg
ICAgICogLy8gd2l0aCBleHBsaWNpdCBjaGFpbmluZworICAgICAqIF8oY2hhcmFjdGVycykuY2hh
aW4oKQorICAgICAqICAgLmZpcnN0KCkKKyAgICAgKiAgIC5waWNrKCdhZ2UnKQorICAgICAqICAg
LnZhbHVlKCk7CisgICAgICogLy8gPT4geyAnYWdlJzogMzYgfQorICAgICAqLworICAgIGZ1bmN0
aW9uIHdyYXBwZXJDaGFpbigpIHsKKyAgICAgIHRoaXMuX19jaGFpbl9fID0gdHJ1ZTsKKyAgICAg
IHJldHVybiB0aGlzOworICAgIH0KKworICAgIC8qKgorICAgICAqIFByb2R1Y2VzIHRoZSBgdG9T
dHJpbmdgIHJlc3VsdCBvZiB0aGUgd3JhcHBlZCB2YWx1ZS4KKyAgICAgKgorICAgICAqIEBuYW1l
IHRvU3RyaW5nCisgICAgICogQG1lbWJlck9mIF8KKyAgICAgKiBAY2F0ZWdvcnkgQ2hhaW5pbmcK
KyAgICAgKiBAcmV0dXJucyB7c3RyaW5nfSBSZXR1cm5zIHRoZSBzdHJpbmcgcmVzdWx0LgorICAg
ICAq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xlciBmdW5jdGlvbi4KKyAgICAgICAgICAgICAgICAgICAgaWYgKHhoclN1Y2Nlc3MgJiYgXy5p
c0Z1bmN0aW9uKG9uU3VjY2VzcykpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG9uU3VjY2Vz
cyh4aHIucmVzcG9uc2VUZXh0KTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgheGhy
U3VjY2VzcyAmJiBfLmlzRnVuY3Rpb24ob25FcnJvcikpIHsKKyAgICAgICAgICAgICAgICAgICAg
ICAgIG9uRXJyb3IoeGhyLnN0YXR1cyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAg
ICAgICAgICB9CisgICAgICAgICAgICB9OworCisgICAgICAgICAgICAvLyBSZXNvbHZlIEhUVFAg
cmVxdWVzdCBwYXJhbWV0ZXJzLgorICAgICAgICAgICAgdmFyIG1ldGhvZCA9IGh0dHBQYXJhbXMu
bWV0aG9kIHx8ICdHRVQnOworICAgICAgICAgICAgdmFyIHVybCA9IGh0dHBQYXJhbXMudXJsIHx8
ICcnOworICAgICAgICAgICAgdmFyIGhlYWRlcnMgPSBodHRwUGFyYW1zLmhlYWRlcnMgfHwge307
CisgICAgICAgICAgICB2YXIgYm9keSA9IGh0dHBQYXJhbXMuYm9keSB8fCBudWxsOworCisgICAg
ICAgICAgICAvLyBJbml0aWF0ZSBuZXcgcmVxdWVzdC4KKyAgICAgICAgICAgIHhoci5vcGVuKG1l
dGhvZCwgdXJsLCB0cnVlKTsKKworICAgICAgICAgICAgLy8gSW5jbHVkZSBjcmVkZW50aWFscyBz
dWNoIGFzIEhUVFAgYXV0aCBpbmZvcm1hdGlvbiBhbmQgY29va2llcyBpbiBjcm9zcy1zaXRlIHJl
cXVlc3RzLgorICAgICAgICAgICAgeGhyLndpdGhDcmVkZW50aWFscyA9IHRydWU7CisKKyAgICAg
ICAgICAgIC8vIEFwcGx5IHJlcXVlc3QgaGVhZGVycy4KKyAgICAgICAgICAgIE9iamVj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sKKworICAg
ICAgICAgICAgLy8gUmVzb2x2ZSBkZXBlbmRlbmNpZXMgYW5kIGF1Z21lbnQgJ215Jy4KKyAgICAg
ICAgICAgIGRlcHMuZm9yRWFjaChmdW5jdGlvbiAobmFtZSkgeworICAgICAgICAgICAgICAgIG15
W25hbWVdID0gc2VydmljZXNbbmFtZV07CisgICAgICAgICAgICB9KTsKKworICAgICAgICAgICAg
Ly8gQXBwbHkgbWl4aW5zIG9uICd0aGF0JywgYmluZGluZyAndGhpcycgdG8gJ3RoYXQnLgorICAg
ICAgICAgICAgbWl4aW5zLmZvckVhY2goZnVuY3Rpb24gKGZuKSB7CisgICAgICAgICAgICAgICAg
Zm4uY2FsbCh0aGF0LCB0aGF0LCBzcGVjLCBteSk7CisgICAgICAgICAgICB9KTsKKworICAgICAg
ICAgICAgcmV0dXJuIHRoYXQ7CisgICAgICAgIH0sCisKKyAgICAgICAgLy8gTWl4aW4gZm9yIG9i
amVjdHMgaGF2aW5nIGFyYml0cmFyeSBvcHRpb25zLgorICAgICAgICB3aXRoT3B0aW9uczogZnVu
Y3Rpb24gKHRoYXQsIHNwZWMpIHsKKyAgICAgICAgICAgIHZhciBvcHRpb25zID0gc3BlYy5vcHRp
b25zIHx8IHt9OworCisgICAgICAgICAgICAvLyBBY2Nlc3Mgb3B0aW9ucyB2aWEgZ2V0dGVyL3Nl
dHRlciBmdW5jdGlvbiB3aXRoIG1lcmdlLW9uLXNldCBiZWhhdmlvci4KKyAgICAgICAgICAgIHRo
YXQub3B0aW9ucyA9IHV0aWxpdGllcy5mbnMubWFrZUdldFNldE1lcmdlRm4odGhhdCwgb3B0aW9u
cyk7CisKKyAgICAgICAgICAgIHJldHVybiB0aGF0OworICAgICAgICB9CisgICAgfTsKKworICAg
IC8vIFV0aWxpdHkgZm9yIHdvcmtpbmcgd2l0aCBmdW5jdGlvbnMuCisgICAgdXRpbGl0aWVzLmZu
cyA9IHsKKyAgICAgICAgLy8gTWFrZSBhIGZ1bmN0aW9uIGF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dGUpIHsKKyAgICAgICAgICAgIHZhciBjbG9uZSA9IF8uY2xvbmVEZWVwKHNv
dXJjZSk7CisgICAgICAgICAgICByZXR1cm4gXy5tZXJnZShjbG9uZSwgdXBkYXRlKTsKKyAgICAg
ICAgfQorICAgIH07CisKKyAgICByZXR1cm4gdXRpbGl0aWVzOworfSkob3ZpcnQuc3ZjKTsKKwor
Ly8gRXhwb3NlIEFQSSBhcyB0aGUgbWFpbiBlbnRyeSBwb2ludCB0byBTREsgZnVuY3Rpb25hbGl0
eS4KK292aXJ0LmFwaSA9IChmdW5jdGlvbiAodXRpbGl0aWVzKSB7CisgICAgJ3VzZSBzdHJpY3Qn
OworCisgICAgdmFyIG1peGlucyA9IHV0aWxpdGllcy5taXhpbnM7CisgICAgdmFyIG9iamVjdHMg
PSB1dGlsaXRpZXMub2JqZWN0czsKKyAgICB2YXIgZm5zID0gdXRpbGl0aWVzLmZuczsKKworICAg
IC8vIE1peGluIGZvciBvYmplY3RzIHJlcHJlc2VudGluZyBhIFJFU1RmdWwgcmVzb3VyY2UgY29s
bGVjdGlvbi4KKyAgICBmdW5jdGlvbiBhc1Jlc291cmNlQ29sbGVjdGlvbiAodGhhdCwgc3BlYykg
eworICAgICAgICB0aGF0LmdldCA9IGZ1bmN0aW9uIChpZCwgb3B0aW9ucykgeworICAgICAgICAg
ICAgcmV0dXJuIG1ha2VPcGVyYXRpb24ob2JqZWN0cy5kZWVwQ2xvbmVBbmRNZXJnZShzcGVjLCB7
CisgICAgICAgICAgICAgICAgb3B0aW9uczogb3B0aW9ucywKKyAgICAgICAgICAgICAgICBodHRw
TWV0aG9kOiAnR0VUJywKKyAgICAgICAgICAgICAgICBhcGlDb250ZXh0UGF0aDogc3BlYy5hcGlD
b250ZXh0UGF0aCArICcvJyArIGlkLAorICAgICAgICAgICAgICAgIHRyYW5zZm9ybVJlc3VsdDog
ZnVuY3Rpb24gKGRhdGEpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1ha2VSZXNvdXJj
ZSh7CisgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiB0cmFuc2Zvcm1SZXNvdXJjZURhdGEo
ZGF0YSkKKyAgICAgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICAgICAgfQorICAgICAg
ICAgICAgfSkpOworICAgICAgICB9OworCisgICAgICAgIC8vIFJldHVybiBvcGVyYXRpb24gdG8g
bGlzdCByZXNvdXJjZXMgZ3JvdXBlZCBieSB0aGlzIHJlc291cmNlIGNvbGxlY3Rpb24uCisgICAg
ICAgIHRoYXQubGlzdCA9IGZ1bmN0aW9uIChvcHRpb25zKSB7CisgICAgICAgICAgICByZXR1cm4g
bWFrZU9wZXJhdGlvbihvYmplY3RzLmRlZXBDbG9uZUFuZE1lcmdlKHNwZWMsIHsKKyAgICAgICAg
ICAgICAgICBvcHRpb25zOiBvcHRpb25zLAorICAgICAgICAgICAgICAgIGh0dHBNZXRob2Q6ICdH
RVQnLAorICAgICAgICAgICAgICAgIHRyYW5zZm9ybVJlc3VsdDogbWFrZVJlc291cmNlQXJyYXkK
KyAgICAgICAgICAgIH0pKTsKKyAgICAgICAgfTsKKworICAgICAgICAvLyBSZXR1cm4gb3BlcmF0
aW9uIHRvIGFkZCByZXNvdXJjZSByZXByZXNlbnRlZCBieSAnZGF0YScgb2JqZWN0IHRvIHRoaXMg
cmVzb3VyY2UgY29sbGVjdGlvbi4KKyAgICAgICAgdGhhdC5hZGQgPSBmdW5jdGlvbiAoZGF0YSwg
b3B0aW9ucykgeworICAgICAgICAgICAgcmV0dXJuIG1ha2VPcGVyYXRpb24ob2JqZWN0cy5kZWVw
Q2xvbmVBbmRNZXJnZShzcGVjLCB7CisgICAgICAgICAgICAgICAgb3B0aW9uczogb3B0aW9ucywK
KyAgICAgICAgICAgICAgICBodHRwTWV0aG9kOiAnUE9TVCcsCisgICAgICAgICAgICAgICAgaHR0
cEJvZHk6IEpTT04uc3RyaW5naWZ5KGRhdGEpLAorICAgICAgICAgICAgICAgIHRyYW5zZm9ybVJl
c3VsdDogZnVuY3Rpb24gKGRhdGEpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1ha2VS
ZXNvdXJjZSh7CisgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiB0cmFuc2Zvcm1SZXNvdXJj
ZURhdGEoZGF0YSkKKyAgICAgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICAgICAgfQor
ICAgICAgICAgICAgfSkpOworICAgICAgICB9OworICAgIH0KKworICAgIC8vIFRyYW5zZm9ybSBy
YXcgcmVzb3VyY2UgZGF0YSBmb3IgdXNlIGJ5IHJlc291cmNlIG9iamVjdHMuCisgICAgZnVuY3Rp
b24gdHJhbnNmb3JtUmVzb3VyY2VEYXRhIChkYXRhKSB7CisgICAgICAgIGZ1bmN0aW9uIGRlZmlu
ZVByb3BlcnR5UmVhZE9ubHkgKHByb3BOYW1lLCBwcm9wVmFsdWUpIHsKKyAgICAgICAgICAgIE9i
amVjdC5kZWZpbmVQcm9wZXJ0eShkYXRhLCBwcm9wTmFtZSwgeworICAgICAgICAgICAgICAgIHZh
bHVlOiBwcm9wVmFsdWUsCisgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlLAorICAgICAg
ICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKKyAgICAgICAgICAgICAgICBlbnVtZXJhYmxl
OiB0cnVlCisgICAgICAgICAgICB9KTsKKyAgICAgICAgfQorCisgICAgICAgIGZ1bmN0aW9uIHJl
ZHVjZUxpbmtzIChhcnJheSkgeworICAgICAgICAgICAgcmV0dXJuIGFycmF5LnJlZHVjZShmdW5j
dGlvbiAocmVzdWx0LCBsaW5rKSB7CisgICAgICAgICAgICAgICAgcmVzdWx0W2xpbmsucmVsXSA9
IGxpbmsuaHJlZjsKKyAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICAgICAg
fSwge30pOworICAgICAgICB9CisKKyAgICAgICAgLy8gTWFrZSAnaWQnI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sKKyAgICAgICAg
ICAgIE9iamVjdC5rZXlzKG1vZGlmaWVkKS5mb3JFYWNoKGZ1bmN0aW9uIChrZXkpIHsKKyAgICAg
ICAgICAgICAgICB2YXIgcHJvcGVydHlEaWZmOworCisgICAgICAgICAgICAgICAgaWYgKCFvcmln
aW5hbC5oYXNPd25Qcm9wZXJ0eShrZXkpKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIEFkZCBu
ZXcgcHJvcGVydHkgbWlzc2luZyBpbiAnb3JpZ2luYWwnIGF1dG9tYXRpY2FsbHkgaW50byBkaWZm
IG9iamVjdC4KKyAgICAgICAgICAgICAgICAgICAgZGlmZltrZXldID0gbW9kaWZpZWRba2V5XTsK
KyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvLyBPdGhlcndp
c2UsIGNvbXB1dGUgY2hhbmdlIGZvciBleGlzdGluZyBwcm9wZXJ0eSByZWN1cnNpdmVseSBhbmQg
dXBkYXRlIGRpZmYgb2JqZWN0LgorICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eURpZmYgPSBj
b21wdXRlRGlmZihvcmlnaW5hbFtrZXldLCBtb2RpZmllZFtrZXldKTsKKyAgICAgICAgICAgICAg
ICAgICAgaWYgKHByb3BlcnR5RGlmZikgeworICAgICAgICAgICAgICAgICAgICAgICAgZGlmZltr
ZXldID0gcHJvcGVydHlEaWZmOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAg
ICAgfQorICAgICAgICAgICAgfSk7CisgICAgICAgICAgICByZXR1cm4gXy5pc0VxdWFsKGRpZmYs
IHt9KSA/IG51bGwgOiBkaWZmOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJu
IF8uaXNFcXVhbChvcmlnaW5hbCwgbW9kaWZpZWQpID8gbnVsbCA6IG1vZGlmaWVkOworICAgICAg
ICB9CisgICAgfQorCisgICAgLy8gTWl4aW4gZm9yIG9iamVjdHMgcmVwcmVzZW50aW5nIGE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iBvcHRpb25zLAorICAgICAgICAgICAgICAgIGh0dHBN
ZXRob2Q6ICdQVVQnLAorICAgICAgICAgICAgICAgIGh0dHBCb2R5OiBKU09OLnN0cmluZ2lmeShj
b21wdXRlRGlmZihvcmlnaW5hbERhdGEsIGRhdGEpKSwKKyAgICAgICAgICAgICAgICB0cmFuc2Zv
cm1SZXN1bHQ6IGZ1bmN0aW9uIChkYXRhKSB7CisgICAgICAgICAgICAgICAgICAgIGFzc2lnbkRh
dGEodHJhbnNmb3JtUmVzb3VyY2VEYXRhKGRhdGEpKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0
dXJuIHRoYXQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSkpOworICAgICAgICB9
OworCisgICAgICAgIC8vIFJldHVybiBvcGVyYXRpb24gdG8gZGVsZXRlIHRoaXMgcmVzb3VyY2Uu
CisgICAgICAgIHRoYXQuZGVsZXRlID0gZnVuY3Rpb24gKG9wdGlvbnMpIHsKKyAgICAgICAgICAg
IHJldHVybiBtYWtlT3BlcmF0aW9uKG9iamVjdHMuZGVlcENsb25lQW5kTWVyZ2Uoc3BlYywgewor
ICAgICAgICAgICAgICAgIG9wdGlvbnM6IG9wdGlvbnMsCisgICAgICAgICAgICAgICAgaHR0cE1l
dGhvZDogJ0RFTEVURScsCisgICAgICAgICAgICAgICAgaHR0cEJvZHk6ICd7fScKKyAgICAgICAg
ICAgIH0pKTsKKyAgICAgICAgfTsKKworICAgICAgICAvLyBBdWdtZW50IHJlc291cmNlIHdpdGgg
bmVzdGVkIHJlc291cmNlIGNvbGxlY3Rpb25zLgorICAgICAgICB2YXIgc3ViQ29sbGVjdGlvbnMg
PSBkYXRhLnN1YkNvbGxlY3Rpb25zIHx8IHt9OworICAgICAgICBPYmplY3Qua2V5cyhzdWJDb2xs
ZWN0aW9ucykuZm9yRWFjaChmdW5jdGlvbiAobmFtZSkgeworICAgICAgICAgICAgdGhhdFtuYW1l
XSA9IG1ha2VSZXNvdXJjZUNvbGxlY3Rpb24oeworICAgICAgICAgICAgICAgIGFwaUNvbnRleHRQ
YXRoOiBzdWJDb2xsZWN0aW9uc1tuYW1lXQorICAgICAgICAgICAgfSk7CisgICAgICAgIH0pOwor
CisgICAgICAgIC8vIEF1Z21lbnQgcmVzb3VyY2Ugd2l0aCBzdXBwb3J0ZWQgYWN0aW9ucy4KKyAg
ICAgICAgdmFyIGFjdGlvbnMgPSBkYXRhLmFjdGlvbnMgfHwge307CisgICAgICAgIE9iamVjdC5r
ZXlzKGFjdGlvbnMpLmZvckVhY2goZnVuY3Rpb24gKG5hbWUpIHsKKyAgICAgICAgICAgIC8vIFJl
dHVybiBvcGVyYXRpb24gdG8gaW52b2tlIGdpdmVuIGFjdGlvbiB1c2luZyAnYWN0aW9uRGF0YScg
b24gdGhpcyByZXNvdXJjZS4KKyAgICAgICAgICAgIHRoYXRbbmFtZV0gPSBmdW5jdGlvbiAoYWN0
aW9uRGF0YSwgb3B0aW9ucykgeworICAgICAgICAgICAgICAgIHJldHVybiBtYWtlT3BlcmF0aW9u
KG9iamVjdHMuZGVlcENsb25lQW5kTWVyZ2Uoc3BlYywgeworICAgICAgICAgICAgICAgICAgICBv
cHRpb25zOiBvcHRpb25zLAorICAgICAgICAgICAgICAgICAgICBodHRwTWV0aG9kOiAnUE9TVCcs
CisgICAgICAgICAgICAgICAgICAgIGh0dHBCb2R5OiBKU09OLnN0cmluZ2lmeShhY3Rpb25EYXRh
KSwKKyAgICAgICAgICAgICAgICAgICAgYXBpQ29udGV4dFBhdGg6IGFjdGlvbnNbbmFtZV0KKyAg
ICAgICAgICAgICAgICB9KSk7CisgICAgICAgICAgICB9OworICAgICAgICB9KTsKKworICAgICAg
ICAvLyBUT0RPIGV4cG9zZSB0b3AtbGV2ZWwgcmVzb3VyY2UgZGF0YSBwcm9wZXJ0aWVzIGZvciBj
b252ZW5pZW5jZQorICAgIH0KKworICAgIGZ1bmN0aW9uIG1ha2VSZXNvdXJjZSAoc3BlYykgewor
ICA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3JtUmVzdWx0KSkgeworICAgICAgICAgICAgICAgICAg
ICByZXN1bHQgPSBzcGVjLnRyYW5zZm9ybVJlc3VsdChyZXN1bHQpOworICAgICAgICAgICAgICAg
IH0KKworICAgICAgICAgICAgICAgIC8vIEludm9rZSBvcGVyYXRpb24gc3VjY2VzcyBjYWxsYmFj
ay4KKyAgICAgICAgICAgICAgICBvblN1Y2Nlc3MocmVzdWx0KTsKKyAgICAgICAgICAgIH0gY2F0
Y2ggKGUpIHsKKyAgICAgICAgICAgICAgICAvLyBUT0RPIGhhbmRsZSBlcnJvciBwcm9wZXJseQor
ICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCdFcnJvciB3aGlsZSBwYXJzaW5nIHJlc3BvbnNl
OiAnICsgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBmdW5jdGlvbiBo
dHRwRXJyb3IgKHN0YXR1c0NvZGUpIHsKKyAgICAgICAgICAgIC8vIFRPRE8gaGFuZGxlIGVycm9y
IHByb3Blcmx5CisgICAgICAgICAgICBjb25zb2xlLmxvZygnUmVxdWVzdCBmYWlsZWQgd2l0aCBz
dGF0dXMgY29kZSAnICsgc3RhdHVzQ29kZSk7CisgICAgICAgIH0KKworICAgICAgICAvLyBSZWdp
c3RlciBvcGVyYXRpb24gc3VjY2VzcyBjYWxsYmFjay4KKyAgICAgICAgdGhhdC5zdWNjZXNzID0g
ZnVuY3Rpb24gKGNhbGxiYWNrKSB7CisgICAgICAgICAgICBvblN1Y2Nlc3MgPSBnZXRGbk9yTm9v
cChjYWxsYmFjayk7CisgICAgICAgICAgICByZXR1cm4gdGhhdDsKKyAgICAgICAgfTsKKworICAg
ICAgICAvLyBSZWdpc3RlciBvcGVyYXRpb24gZXJyb3IgY2FsbGJhY2suCisgICAgICAgIHRoYXQu
ZXJyb3IgPSBmdW5jdGlvbiAoY2FsbGJhY2spIHsKKyAgICAgICAgICAgIG9uRXJyb3IgPSBnZXRG
bk9yTm9vcChjYWxsYmFjayk7CisgICAgICAgICAgICByZXR1cm4gdGhhdDsKKyAgICAgICAgfTsK
KworICAgICAgICAvLyBSdW4gdGhlIG9wZXJhdGlvbiwgc2VuZGluZyBIVFRQIHJlcXVlc3QgdG8g
cmVtb3RlIHNlcnZlci4KKyAgICAgICAgdGhhdC5ydW4gPSBmdW5jdGlvbiAoKSB7CisgICAgICAg
ICAgICAvLyBQcmVwYXJlIHJlcXVlc3QgaGVhZGVycy4KKyAgICAgICAgICAgIHZhciBoZWFkZXJz
ID0gc3BlYy5odHRwSGVhZGVycyB8fCB7fTsKKyAgICAgICAgICAgIGhlYWRlcnNbJ0FjY2VwdCdd
ID0gJ2FwcGxpY2F0aW9uL2pzb24nOworICAgICAgICAgICAgaGVhZGVyc1snQ29udGVudC1UeXBl
J10gPSAnYXBwbGljYXRpb24vanNvbic7CisgICAgICAgICAgICBoZWFkZXJzWydGaWx0ZXInXSA9
IGFwaS5vcHRpb25zKCkuZmlsdGVyUmVzdWx0czsKKworICAgICAgICAgICAgLy8gUHJlcGFyZSBy
ZXF1ZXN0IHBhcmFtZXRlcnMuCisgICAgICAgICAgICB2YXIgaHR0cFBhcmFtcyA9IHsKKyAgICAg
ICAgICAgICAgICBtZXRob2Q6IHNwZWMuaHR0cE1ldGhvZCwKKyAgICAgICAgICAgICAgICB1cmw6
IGFwaS5vcHRpb25zKCkuZW5naW5lQmFzZVVybCArIHNwZWMuYXBpQ29udGV4dFBhdGgsCisgICAg
ICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycywKKyAgICAgICAgICAgICAgICBib2R5OiBzcGVj
Lmh0dHBCb2R5CisgICAgICAgICAgICB9OworCisgICAgICAgICAgICAvLyBTZW5kIHRoZSByZXF1
ZXN0LgorICAgICAgICAgICAgbXkuaHR0cC5zZW5kKGh0dHBQYXJhbXMsIGh0dHBTdWNjZXNzLCBo
dHRwRXJyb3IpOworICAgICAgICB9OworICAgIH0KKworICAgIGZ1bmN0aW9uIG1ha2VPcGVyYXRp
b24gKH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Wxlcy93ZWJh
ZG1pbi9zcmMvbWFpbi9yZXNvdXJjZXMvb3JnL292aXJ0L2VuZ2luZS91aS93ZWJhZG1pbi9XZWJB
ZG1pbi5nd3QueG1sCmluZGV4IDJjMGU2NWMuLmFkNTFlMTcgMTAwNjQ0Ci0tLSBhL2Zyb250ZW5k
L3dlYmFkbWluL21vZHVsZXMvd2ViYWRtaW4vc3JjL21haW4vcmVzb3VyY2VzL29yZy9vdmlydC9l
bmdpbmUvdWkvd2ViYWRtaW4vV2ViQWRtaW4uZ3d0LnhtbAorKysgYi9mcm9udGVuZC93ZWJhZG1p
bi9tb2R1bGVzL3dlYmFkbWluL3NyYy9tYWluL3Jlc291cmNlcy9vcmcvb3ZpcnQvZW5naW5lL3Vp
L3dlYmFkbWluL1dlYkFkbWluLmd3dC54bWwKQEAgLTYsNiArNiw4IEBACiAgICAgPCEtLSBJbmhl
cml0IG9WaXJ0IGNvbW1vbiBHV1QgbW9kdWxlIC0tPgogICAgIDxpbmhlcml0cyBuYW1lPSJvcmcu
b3ZpcnQuZW5naW5lLnVpLmNvbW1vbi5Hd3RDb21tb24iIC8+CiAKKyAgICA8aW5oZXJpdHMgbmFt
ZT0ib3JnLm92aXJ0LmVuZ2luZS5zZGsuZ3d0LlNka0d3dFdyYXBwZXIiIC8+CisKICAgICA8IS0t
IEluaGVyaXQgdGhlIGRlZmF1bHQgR1dUIHRoZW1lIC0tPgogICAgIDxpbmhlcml0cyBuYW1lPSJj
b20uZ29vZ2xlLmd3dC51c2VyLnRoZW1lLnN0YW5kYXJkLlN0YW5kYXJkIiAvPgogCi0tIAoxLjgu
My4xCgo=
------=_Part_26595393_401944553.1403609366320--
10 years, 4 months
Problem installing a new DB
by Kobi Ianko
Did any of you encountered this problem?
$ $HOME/ovirt-engine/bin/engine-setup
***L:ERROR Internal error: type object 'Stages' has no attribute 'DB_CONNECTION_SETUP'
Do you know how to work around it/fix it?
10 years, 4 months
Re: [ovirt-devel] [ovirt-users] build ovirt-hosted-engine-ha rpm failed
by Sven Kieske
You really want to ask those questions on the "devel" list.
CC'ed
Am 08.07.2014 05:48, schrieb lofyer:
> I'm trying to build rpm of ovirt-hosted-engine-ha on CentOS-6.5, and
> here's my 'make rpm' result:
>
> RPM build errors:
> File not found:
> /home/demo/gerrit/ovirt-hosted-engine-ha/tmp.repos/BUILDROOT/ovirt-hosted-engine-ha-1.2.1-0.1.master.20140708025658.el6.x86_64/usr/local/etc/ovirt-hosted-engine-ha/agent-log.conf
> File not found:
> /home/demo/gerrit/ovirt-hosted-engine-ha/tmp.repos/BUILDROOT/ovirt-hosted-engine-ha-1.2.1-0.1.master.20140708025658.el6.x86_64/usr/local/etc/ovirt-hosted-engine-ha/agent.conf
> File not found:
> /home/demo/gerrit/ovirt-hosted-engine-ha/tmp.repos/BUILDROOT/ovirt-hosted-engine-ha-1.2.1-0.1.master.20140708025658.el6.x86_64/usr/local/etc/ovirt-hosted-engine-ha/broker-log.conf
> File not found:
> /home/demo/gerrit/ovirt-hosted-engine-ha/tmp.repos/BUILDROOT/ovirt-hosted-engine-ha-1.2.1-0.1.master.20140708025658.el6.x86_64/usr/local/etc/ovirt-hosted-engine-ha/broker.conf
> File not found:
> /home/demo/gerrit/ovirt-hosted-engine-ha/tmp.repos/BUILDROOT/ovirt-hosted-engine-ha-1.2.1-0.1.master.20140708025658.el6.x86_64/usr/local/etc/ovirt-hosted-engine-ha/notifications
> File not found by glob:
> /home/demo/gerrit/ovirt-hosted-engine-ha/tmp.repos/BUILDROOT/ovirt-hosted-engine-ha-1.2.1-0.1.master.20140708025658.el6.x86_64/usr/local/etc/ovirt-hosted-engine-ha/notifications/*
> File not found:
> /home/demo/gerrit/ovirt-hosted-engine-ha/tmp.repos/BUILDROOT/ovirt-hosted-engine-ha-1.2.1-0.1.master.20140708025658.el6.x86_64/usr/local/share/ovirt-hosted-engine-ha
> File not found:
> /home/demo/gerrit/ovirt-hosted-engine-ha/tmp.repos/BUILDROOT/ovirt-hosted-engine-ha-1.2.1-0.1.master.20140708025658.el6.x86_64/usr/local/share/ovirt-hosted-engine-ha/ovirt-ha-agent
> File not found:
> /home/demo/gerrit/ovirt-hosted-engine-ha/tmp.repos/BUILDROOT/ovirt-hosted-engine-ha-1.2.1-0.1.master.20140708025658.el6.x86_64/usr/local/share/ovirt-hosted-engine-ha/ovirt-ha-broker
> File not found:
> /home/demo/gerrit/ovirt-hosted-engine-ha/tmp.repos/BUILDROOT/ovirt-hosted-engine-ha-1.2.1-0.1.master.20140708025658.el6.x86_64/usr/local/var/lib/ovirt-hosted-engine-ha/ha.conf
>
> What should I do to the spec file or ... do I miss some dependencies?
--
Mit freundlichen Grüßen / Regards
Sven Kieske
Systemadministrator
Mittwald CM Service GmbH & Co. KG
Königsberger Straße 6
32339 Espelkamp
T: +49-5772-293-100
F: +49-5772-293-333
https://www.mittwald.de
Geschäftsführer: Robert Meyer
St.Nr.: 331/5721/1033, USt-IdNr.: DE814773217, HRA 6640, AG Bad Oeynhausen
Komplementärin: Robert Meyer Verwaltungs GmbH, HRB 13260, AG Bad Oeynhausen
10 years, 4 months
missing 'translations' in 'bundles/AuditLogMessages'
by Martin Mucha
Hi,
I've did some changes in AuditLogDirector.java, triggered by wrong behavior, when some key (AuditLogType) is not present in ResourceBundle 'bundles/AuditLogMessages', and wrote test to alert about missing translations. To be able to merge these changes, I need to supply already missing translations. For all following AuditLogType enums, silently nothing was saved to db when org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector#log(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase) was called.
Can somebody provide me missing translations for those keys?
Also test considers only default locale, should it test 'all existing' ResourceBundles or is testing default one just sufficient? (technically there's no difference at this time, since there's only default translation, but if someone will provide new ResourceBundle currently it will be used but not tested)
---
Key 'UNASSIGNED' is not translated in 'bundles/AuditLogMessages'
Key 'VDS_AUTO_FENCE_STATUS' is not translated in 'bundles/AuditLogMessages'
Key 'VDS_AUTO_FENCE_STATUS_FAILED' is not translated in 'bundles/AuditLogMessages'
Key 'VDS_AUTO_FENCE_FAILED_CALL_FENCE_SPM' is not translated in 'bundles/AuditLogMessages'
Key 'VDS_HIGH_NETWORK_USE' is not translated in 'bundles/AuditLogMessages'
Key 'USER_FAILED_REMOVE_VM' is not translated in 'bundles/AuditLogMessages'
Key 'USER_RUN_UNLOCK_ENTITY_SCRIPT' is not translated in 'bundles/AuditLogMessages'
Key 'VDS_NETWORK_MTU_DIFFER_FROM_LOGICAL_NETWORK' is not translated in 'bundles/AuditLogMessages'
Key 'VDS_HOST_IN_CONNECTING_STATE' is not translated in 'bundles/AuditLogMessages'
Key 'STORAGE_ACTIVATE_ASYNC' is not translated in 'bundles/AuditLogMessages'
Key 'DWH_STOPPED' is not translated in 'bundles/AuditLogMessages'
Key 'DWH_STARTED' is not translated in 'bundles/AuditLogMessages'
Key 'DWH_ERROR' is not translated in 'bundles/AuditLogMessages'
Key 'USER_REMOVE_AUDIT_LOG' is not translated in 'bundles/AuditLogMessages'
Key 'USER_REMOVE_AUDIT_LOG_FAILED' is not translated in 'bundles/AuditLogMessages'
Key 'USER_CLEAR_ALL_DISMISSED_AUDIT_LOG' is not translated in 'bundles/AuditLogMessages'
Key 'USER_CLEAR_ALL_DISMISSED_AUDIT_LOG_FAILED' is not translated in 'bundles/AuditLogMessages'
thanks,
Martin.
10 years, 4 months
oVirt 3.5 Test Day Summary
by Federico Simoncelli
As part of the oVirt 3.5 test day I tested:
- ioprocess, with several storage sanity tests, I hit the known bug
bz1114499 (refreshing iso list fails) and I mostly had problems with
the really verbose logging, filing:
- bz1114908 - Excessive ioprocess logging in vdsm.log
- bz1114924 - Possible missing string terminator in ioprocess logging
- vm migration progress bar, overall the feature is in good shape, I
filed a bug for a currently unhandled corner case:
- bz1114997 - Migration progress bar not cleaned on VM crash
some of the relevant things I verified were:
- fetching the migration progress from vdsm (pass)
- reporting the migration progress in webadmin (pass)
- reporting the migration progress in rest-api (pass)
I also stressed the VM in order to avoid a quick convergence for the
migration (progress bar was rising and falling accordingly).
- command coordinator, in order to test it I prepared an host with
special patches for live-merge (qemu, libvirt and vdsm). I tested
several times the positive flows and few negative flows killing
the engine during the operations. I hit right away an issue that was
introduced quite recently:
- bz1115127 - fail to find constructors for commands
other than that command coordinator and live merge seem in a good
shape
Additionally I also filed:
- bz1115154 - DisconnectHostFromStoragePoolServersCommand failures
--
Federico
10 years, 4 months