Medau Therapy Services GmbH | Schloss Hohenfels | 96450 Coburg
Medau Therapy Services GmbH | Schloss Hohenfels | 96450 Coburg
MEDAUtherapie Hygiene neu

MEDAUphysio Praxen für Physiotherapie & Krankengymnastik

Ihr Partner für die ganzheitliche physiotherapeutische Behandlung

In den MEDAUphysio Praxen werden Sie von erfahrenen Therapeuten und Therapeutinnen behandelt, die Expertinnen in ihrem jeweiligen Fachgebiet sind. In Kooperation mit der Berufsfachschule für Physiotherapie, der Medau-Schule garantieren wir Ihnen eine optimale Behandlung nach aktuellen wissenschaftlichen Leitlinien. 

OpenStreetMap

Mit dem Laden der Karte akzeptieren Sie die Datenschutzerklärung von OpenStreetMap Foundation.
Mehr erfahren

Karte laden

PGRpdiBjbGFzcz0ibGVhZmxldC1tYXAgV1BMZWFmbGV0TWFwIiBzdHlsZT0iaGVpZ2h0OjUwMHB4OyB3aWR0aDoxMDAlOyI+PC9kaXY+PHNjcmlwdD4Kd2luZG93LldQTGVhZmxldE1hcFBsdWdpbiA9IHdpbmRvdy5XUExlYWZsZXRNYXBQbHVnaW4gfHwgW107CndpbmRvdy5XUExlYWZsZXRNYXBQbHVnaW4ucHVzaChmdW5jdGlvbiAoKSB7Lyo8c2NyaXB0PiovCnZhciBiYXNlVXJsID0gJ2h0dHBzOi8ve3N9LnRpbGUub3BlbnN0cmVldG1hcC5vcmcve3p9L3t4fS97eX0ucG5nJzsKdmFyIGJhc2UgPSAoIWJhc2VVcmwgJiYgd2luZG93Lk1RKSA/IAogICAgd2luZG93Lk1RLm1hcExheWVyKCkgOiBMLnRpbGVMYXllcihiYXNlVXJsLCAKICAgICAgICBMLlV0aWwuZXh0ZW5kKHt9LCB7CiAgICAgICAgICAgIGRldGVjdFJldGluYTogMCwKICAgICAgICAgICAgbWluWm9vbTogMCwKICAgICAgICAgICAgbWF4Wm9vbTogMjAsCiAgICAgICAgfSwgCiAgICAgICAgeyJzdWJkb21haW5zIjoiYWJjIiwibm9XcmFwIjpmYWxzZX0gICAgICAg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RDdXJyZW50R3JvdXAoKTsKdmFyIG1hcmtlcl9vcHRpb25zID0gKGZ1bmN0aW9uICgpIHsKICAgIHZhciBfb3B0aW9ucyA9IHsiaWNvblVybCI6Ilwvd3AtY29udGVudFwvdXBsb2Fkc1wvMjAxN1wvMTBcL21hcmtlci1mbXctcGh5c2lvLnBuZyIsImljb25TaXplIjpbIjUxLDUxIl0sImljb25BbmNob3IiOlsiMjUuNSw1MSJdfTsKICAgIHZhciBpY29uQXJyYXlzID0gWwogICAgICAgICdpY29uU2l6ZScsIAogICAgICAgICdpY29uQW5jaG9yJywgCiAgICAgICAgJ3NoYWRvd1NpemUnLCAKICAgICAgICAnc2hhZG93QW5jaG9yJywKICAgICAgICAncG9wdXBBbmNob3InCiAgICBdOwogICAgdmFyIGRlZmF1bHRfaWNvbiA9IEwuSWNvbi5EZWZhdWx0LnByb3RvdHlwZS5vcHRpb25zOwogICAgaWYgKF9vcHRpb25zLmljb25VcmwpIHsKICAgICAgICAvLyBhcnJheXMgYXJlIHN0cmluZ3MsIHVuZm9ydHVuYXRlbHkuLi4KICAgICAgICBmb3IgKHZhciBpID0gMCwgbGVuID0gaWNvbkFycmF5cy5sZW5ndGg7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgICB2YXIgb3B0aW9uX25hbWUgPSBpY29uQXJyYXlzW2ldOwogICAgICAgICAgICB2YXIgb3B0aW9uID0gX29wdGlvbnNbIG9wdGlvbl9uYW1lIF07CiAgICAgICAgICAgIC8vIGNvbnZlcnQgIjEsMiIgdG8gWzEsIDJdOwogICAgICAgICAgICBpZiAob3B0aW9uKSB7CiAgICAgICAgICAgICAgICB2YXIgYXJyID0gb3B0aW9uLmpvaW4oJycpLnNwbGl0KCcsJyk7CiAgICAgICAgICAgICAgICAvLyBhcnJheS5tYXAgZm9yIGllPDkKICAgICAgICAgICAgICAgIGZvciAodmFyIGogPSAwLCBsZW5KID0gYXJyLmxlbmd0aDsgaiA8IGxlbko7IGorKykgewogICAgICAgICAgICAgICAgICAgIGFycltqXSA9IE51bWJlcihhcnJbal0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgX29wdGlvbnNbIG9wdGlvbl9uYW1lIF0gPSBhcnI7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgLy8gZGVmYXVsdCBwb3B1cEFuY2hvcgogICAgICAgIGlmICghX29wdGlvbnMucG9wdXBBbmNob3IpIHsKICAgICAgICAgICAgLy8gc2V0IChyb3VnaGx5KSB0byBzaXplIG9mIGljb24KICAgICAgICAgICAgX29wdGlvbnMucG9wdXBBbmNob3IgPSAoZnVuY3Rpb24gKGlfc2l6ZSkgewogICAgICAgICAgICAgICAgLy8gY29weSBhcnJheQogICAgICAgICAgICAgICAgaV9zaXplID0gaV9zaXplLnNsaWNlKCk7CiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC8vIGludmVyc2UgY29vcmRpbmF0ZXMKICAgICAgICAgICAgICAgIGlfc2l6ZVswXSA9IDA7CiAgICAgICAgICAgICAgICBpX3NpemVbMV0gKj0gLTE7CiAgICAgICAgICAgICAgICAvLyBib3R0b20gcG9zaXRpb24gb24gcG9wdXAgaXMgN3B4CiAgICAgICAgICAgICAgICBpX3NpemVbMV0gLT0gMzsKICAgICAgICAgICAgICAgIHJldHVybiBpX3NpemU7CiAgICAgICAgICAgIH0pKF9vcHRpb25zLmljb25TaXplIHx8IGRlZmF1bHRfaWNvbi5pY29uU2l6ZSk7CiAgICAgICAgfQogICAgICAgIF9vcHRpb25zLmljb24gPSBuZXcgTC5JY29uKCBfb3B0aW9ucyApOwogICAgfQogICAgcmV0dXJuIF9vcHRpb25zOwp9KSgpOwp2YXIgbWFya2VyID0gTC5tYXJrZXIoCiAgICBbNTAuMjU1MDE3LDEwLjk2MjIzNl0sIAogICAgbWFya2VyX29wdGlvbnMKKTsKdmFyIGlzX2ltYWdlID0gbWFwLmlzX2ltYWdlX21hcDsKaWYgKG1hcmtlcl9vcHRpb25zLmRyYWdnYWJsZ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wdD4Kd2luZG93LldQTGVhZmxldE1hcFBsdWdpbiA9IHdpbmRvdy5XUExlYWZsZXRNYXBQbHVnaW4gfHwgW107CndpbmRvdy5XUExlYWZsZXRNYXBQbHVnaW4ucHVzaChmdW5jdGlvbiAoKSB7Lyo8c2NyaXB0PiovCnZhciBtYXAgPSB3aW5kb3cuV1BMZWFmbGV0TWFwUGx1Z2luLmdldEN1cnJlbnRNYXAoKTsKdmFyIGdyb3VwID0gd2luZG93LldQTGVhZmxldE1hcFBsdWdpbi5nZXRDdXJyZW50R3JvdXAoKTsKdmFyIG1hcmtlcl9vcHRpb25zID0gKGZ1bmN0aW9uICgpIHsKICAgIHZhciBfb3B0aW9ucyA9IHsiaWNvblVybCI6Ilwvd3AtY29udGVudFwvdXBsb2Fkc1wvMjAxN1wvMTBcL21hcmtlci1mbXctcGh5c2lvLnBuZyIsImljb25TaXplIjpbIjUxLDUxIl0sImljb25BbmNob3IiOlsiMjUuNSw1MSJdfTsKICAgIHZhciBpY29uQXJyYXlzID0gWwogICAgICAgICdpY29uU2l6ZScsIAogICAgICAgICdpY29uQW5jaG9yJywgCiAgICAgICAgJ3NoYWRvd1NpemUnLCAKICAgICAgICAnc2hhZG93QW5jaG9yJywKICAgICAgICAncG9wdXBBbmNob3InCiAgICBdOwogICAgdmFyIGRlZmF1bHRfaWNvbiA9IEwuSWNvbi5EZWZhdWx0LnByb3RvdHlwZS5vcHRpb25zOwogICAgaWYgKF9vcHRpb25zLmljb25VcmwpIHsKICAgICAgICAvLyBhcnJheXMgYXJlIHN0cmluZ3MsIHVuZm9ydHVuYXRlbHkuLi4KICAgICAgICBmb3IgKHZhciBpID0gMCwgbGVuID0gaWNvbkFycmF5cy5sZW5ndGg7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgICB2YXIgb3B0aW9uX25hbWUgPSBpY29uQXJyYXlzW2ldOwogICAgICAgICAgICB2YXIgb3B0aW9uID0gX29wdGlvbnNbIG9wdGlvbl9uYW1lIF07CiAgICAgICAgICAgIC8vIGNvbnZlcnQgIjEsMiIgdG8gWzEsIDJdOwogICAgICAgICAgICBpZiAob3B0aW9uKSB7CiAgICAgICAgICAgICAgICB2YXIgYXJyID0gb3B0aW9uLmpvaW4oJycpLnNwbGl0KCcsJyk7CiAgICAgICAgICAgICAgICAvLyBhcnJheS5tYXAgZm9yIGllPDkKICAgICAgICAgICAgICAgIGZvciAodmFyIGogPSAwLCBsZW5KID0gYXJyLmxlbmd0aDsgaiA8IGxlbko7IGorKykgewogICAgICAgICAgICAgICAgICAgIGFycltqXSA9IE51bWJlcihhcnJbal0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgX29wdGlvbnNbIG9wdGlvbl9uYW1lIF0gPSBhcnI7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgLy8gZGVmYXVsdCBwb3B1cEFuY2hvcgogICAgICAgIGlmICghX29wdGlvbnMucG9wdXBBbmNob3IpIHsKICAgICAgICAgICAgLy8gc2V0IChyb3VnaGx5KSB0byBzaXplIG9mIGljb24KICAgICAgICAgICAgX29wdGlvbnMucG9wdXBBbmNob3IgPSAoZnVuY3Rpb24gKGlfc2l6ZSkgewogICAgICAgICAgICAgICAgLy8gY29weSBhcnJheQogICAgICAgICAgICAgICAgaV9zaXplID0gaV9zaXplLnNsaWNlKCk7CiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC8vIGludmVyc2UgY29vcmRpbmF0ZXMKICAgICAgICAgICAgICAgIGlfc2l6ZVswXSA9IDA7CiAgICAgICAgICAgICAgICBpX3NpemVbMV0gKj0gLTE7CiAgICAgICAgICAgICAgICAvLyBib3R0b20gcG9zaXRpb24gb24gcG9wdXAgaXMgN3B4CiAgICAgICAgICAgICAgICBpX3NpemVbMV0gLT0gMzsKICAgICAgICAgICAgICAgIHJldHVybiBpX3NpemU7CiAgICAgICAgICAgIH0pKF9vcHRpb25zLmljb25TaXplIHx8IGRlZmF1bHRfaWNvbi5pY29uU2l6ZSk7CiAgIC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hvcicsCiAgICAgICAgJ3BvcHVwQW5jaG9yJwogICAgXTsKICAgIHZhciBkZWZhdWx0X2ljb24gPSBMLkljb24uRGVmYXVsdC5wcm90b3R5cGUub3B0aW9uczsKICAgIGlmIChfb3B0aW9ucy5pY29uVXJsKSB7CiAgICAgICAgLy8gYXJyYXlzIGFyZSBzdHJpbmdzLCB1bmZvcnR1bmF0ZWx5Li4uCiAgICAgICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IGljb25BcnJheXMubGVuZ3RoOyBpIDwgbGVuOyBpKyspIHsKICAgICAgICAgICAgdmFyIG9wdGlvbl9uYW1lID0gaWNvbkFycmF5c1tpXTsKICAgICAgICAgICAgdmFyIG9wdGlvbiA9IF9vcHRpb25zWyBvcHRpb25fbmFtZSBdOwogICAgICAgICAgICAvLyBjb252ZXJ0ICIxLDIiIHRvIFsxLCAyXTsKICAgICAgICAgICAgaWYgKG9wdGlvbikgewogICAgICAgICAgICAgICAgdmFyIGFyciA9IG9wdGlvbi5qb2luKCcnKS5zcGxpdCgnLCcpOwogICAgICAgICAgICAgICAgLy8gYXJyYXkubWFwIGZvciBpZTw5CiAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgbGVuSiA9IGFyci5sZW5ndGg7IGogPCBsZW5KOyBqKyspIHsKICAgICAgICAgICAgICAgICAgICBhcnJbal0gPSBOdW1iZXIoYXJyW2pdKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIF9vcHRpb25zWyBvcHRpb25fbmFtZSBdID0gYXJyOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIC8vIGRlZmF1bHQgcG9wdXBBbmNob3IKICAgICAgICBpZiAoIV9vcHRpb25zLnBvcHVwQW5jaG9yKSB7CiAgICAgICAgICAgIC8vIHNldCAocm91Z2hseSkgdG8gc2l6ZSBvZiBpY29uCiAgICAgICAgICAgIF9vcHRpb25zLnBvcHVwQW5jaG9yID0gKGZ1bmN0aW9uIChpX3NpemUpIHsKICAgICAgICAgICAgICAgIC8vIGNvcHkgYXJyYXkKICAgICAgICAgICAgICAgIGlfc2l6ZSA9IGlfc2l6ZS5zbGljZSgpOwogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAvLyBpbnZlcnNlIGNvb3JkaW5hdGVzCiAgICAgICAgICAgICAgICBpX3NpemVbMF0gPSAwOwogICAgICAgICAgICAgICAgaV9zaXplWzFdICo9IC0xOwogICAgICAgICAgICAgICAgLy8gYm90dG9tIHBvc2l0aW9uIG9uIHBvcHVwIGlzIDdweAogICAgICAgICAgICAgICAgaV9zaXplWzFdIC09IDM7CiAgICAgICAgICAgICAgICByZXR1cm4gaV9zaXplOwogICAgICAgICAgICB9KShfb3B0aW9ucy5pY29uU2l6ZSB8fCBkZWZhdWx0X2ljb24uaWNvblNpemUpOwogICAgICAgIH0KICAgICAgICBfb3B0aW9ucy5pY29uID0gbmV3IEwuSWNvbiggX29wdGlvbnMgKTsKICAgIH0KICAgIHJldHVybiBfb3B0aW9uczsKfSkoKTsKdmFyIG1hcmtlciA9IEwubWFya2VyKAogICAgWzUwLjI2NjUxNTA1NDMxOTQxLDEwLjk0OTI2MzQ2NjY1NjQ3NV0sIAogICAgbWFya2VyX29wdGlvbnMKKTsKdmFyIGlzX2ltYWdlID0gbWFwLmlzX2ltYWdlX21hcDsKaWYgKG1hcmtlcl9vcHRpb25zLmRyYWdnYWJsZSkgewogICAgbWFya2VyLm9uKCdkcmFnZW5kJywgZnVuY3Rpb24gKCkgewogICAgICAgIHZhciBsYXRsbmcgPSB0aGlzLmdldExhdExuZygpOwogICAgICAgIHZhciBsYXQgPSBsYXRsbmcubGF0OwogICAgICAgIHZhciBsbmcgPSBsYXRsbmcubG5nOwogICAgICAgIGlmIChpc19pbWFnZSkgewogICAgICAgICAgICBjb25zb2xlLmxvZygnbGVhZmxldC1tYXJrZXIgeT0nICsgbGF0ICsgJyB4PScgKyBsbmcpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGNvbnN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XkubWFwIGZvciBpZTw5CiAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgbGVuSiA9IGFyci5sZW5ndGg7IGogPCBsZW5KOyBqKyspIHsKICAgICAgICAgICAgICAgICAgICBhcnJbal0gPSBOdW1iZXIoYXJyW2pdKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIF9vcHRpb25zWyBvcHRpb25fbmFtZSBdID0gYXJyOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIC8vIGRlZmF1bHQgcG9wdXBBbmNob3IKICAgICAgICBpZiAoIV9vcHRpb25zLnBvcHVwQW5jaG9yKSB7CiAgICAgICAgICAgIC8vIHNldCAocm91Z2hseSkgdG8gc2l6ZSBvZiBpY29uCiAgICAgICAgICAgIF9vcHRpb25zLnBvcHVwQW5jaG9yID0gKGZ1bmN0aW9uIChpX3NpemUpIHsKICAgICAgICAgICAgICAgIC8vIGNvcHkgYXJyYXkKICAgICAgICAgICAgICAgIGlfc2l6ZSA9IGlfc2l6ZS5zbGljZSgpOwogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAvLyBpbnZlcnNlIGNvb3JkaW5hdGVzCiAgICAgICAgICAgICAgICBpX3NpemVbMF0gPSAwOwogICAgICAgICAgICAgICAgaV9zaXplWzFdICo9IC0xOwogICAgICAgICAgICAgICAgLy8gYm90dG9tIHBvc2l0aW9uIG9uIHBvcHVwIGlzIDdweAogICAgICAgICAgICAgICAgaV9zaXplWzFdIC09IDM7CiAgICAgICAgICAgICAgICByZXR1cm4gaV9zaXplOwogICAgICAgICAgICB9KShfb3B0aW9ucy5pY29uU2l6ZSB8fCBkZWZhdWx0X2ljb24uaWNvblNpemUpOwogICAgICAgIH0KICAgICAgICBfb3B0aW9ucy5pY29uID0gbmV3IEwuSWNvbiggX29wdGlvbnMgKTsKICAgIH0KICAgIHJldHVybiBfb3B0aW9uczsKfSkoKTsKdmFyIG1hcmtlciA9IEwubWFya2VyKAogICAgWzUwLjI0Nz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BzdHJpbmdzLCB1bmZvcnR1bmF0ZWx5Li4uCiAgICAgICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IGljb25BcnJheXMubGVuZ3RoOyBpIDwgbGVuOyBpKyspIHsKICAgICAgICAgICAgdmFyIG9wdGlvbl9uYW1lID0gaWNvbkFycmF5c1tpXTsKICAgICAgICAgICAgdmFyIG9wdGlvbiA9IF9vcHRpb25zWyBvcHRpb25fbmFtZSBdOwogICAgICAgICAgICAvLyBjb252ZXJ0ICIxLDIiIHRvIFsxLCAyXTsKICAgICAgICAgICAgaWYgKG9wdGlvbikgewogICAgICAgICAgICAgICAgdmFyIGFyciA9IG9wdGlvbi5qb2luKCcnKS5zcGxpdCgnLCcpOwogICAgICAgICAgICAgICAgLy8gYXJyYXkubWFwIGZvciBpZTw5CiAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgbGVuSiA9IGFyci5sZW5ndGg7IGogPCBsZW5KOyBqKyspIHsKICAgICAgICAgICAgICAgICAgICBhcnJbal0gPSBOdW1iZXIoYXJyW2pdKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIF9vcHRpb25zWyBvcHRpb25fbmFtZSBdID0gYXJyOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIC8vIGRlZmF1bHQgcG9wdXBBbmNob3IKICAgICAgICBpZiAoIV9vcHRpb25zLnBvcHVwQW5jaG9yKSB7CiAgICAgICAgICAgIC8vIHNldCAocm91Z2hseSkgdG8gc2l6ZSBvZiBpY29uCiAgICAgICAgICAgIF9vcHRpb25zLnBvcHVwQW5jaG9yID0gKGZ1bmN0aW9uIChpX3NpemUpIHsKICAgICAgICAgICAgICAgIC8vIGNvcHkgYXJyYXkKICAgICAgICAgICAgICAgIGlfc2l6ZSA9IGlfc2l6ZS5zbGljZSgpOwogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAvLyBpbnZlcnNlIGNvb3JkaW5hdGVzCiAgICAgICAgICAgICAgICBpX3NpemVbMF0gPSAwOwogICAgICAgICAgICAgICAgaV9zaXplWzFdICo9IC0xOwogICAgICAgICAgICAgICAgLy8gYm90dG9tIHBvc2l0aW9uIG9uIHBvcHVwIGlzIDdweAogICAgICAgICAgICAgICAgaV9zaXplWzFdIC09IDM7CiAgICAgICAgICAgICAgICByZXR1cm4gaV9zaXplOwogICAgICAgICAgICB9KShfb3B0aW9ucy5pY29uU2l6ZSB8fCBkZWZhdWx0X2ljb24uaWNvblNpemUpOwogICAgICAgIH0KICAgICAgICBfb3B0aW9ucy5pY29uID0gbmV3IEwuSWNvbiggX29wdGlvbnMgKTsKICAgIH0KICAgIHJldHVybiBfb3B0aW9uczsKfSkoKTsKdmFyIG1hcmtlciA9IEwubWFya2VyKAogICAgWzUwLjI2NjE5MzIsMTAuOTY5ODI3OV0sIAogICAgbWFya2VyX29wdGlvbnMKKTsKdmFyIGlzX2ltYWdlID0gbWFwLmlzX2ltYWdlX21hcDsKaWYgKG1hcmtlcl9vcHRpb25zLmRyYWdnYWJsZSkgewogICAgbWFya2VyLm9uKCdkcmFnZW5kJywgZnVuY3Rpb24gKCkgewogICAgICAgIHZhciBsYXRsbmcgPSB0aGlzLmdldExhdExuZygpOwogICAgICAgIHZhciBsYXQgPSBsYXRsbmcubGF0OwogICAgICAgIHZhciBsbmcgPSBsYXRsbmcubG5nOwogICAgICAgIGlmIChpc19pbWFnZSkgewogICAgICAgICAgICBjb25zb2xlLmxvZygnbGVhZmxldC1tYXJrZXIgeT0nICsgbGF0ICsgJyB4PScgKyBsbmcpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGNvbnNvbGUubG9nKCdsZWFmbGV0LW1hcmtlciBsYXQ9JyArIGxhdCArICcgbG5nPScgKyBsbmcpOwogICAgICAgIH0KICAgIH0pOwp9Cm1hcmtlci5hZGRUbyggZ3JvdXAgKTsKbWFya2VyLmJpbmRQb3B1cCh3aW5kb3cuV1BMZWFmbGV0TWFwUGx1Z2luLnVuZXNjYXBlKCcmbH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AgICAgICAnaWNvblNpemUnLCAKICAgICAgICAnaWNvbkFuY2hvcicsIAogICAgICAgICdzaGFkb3dTaXplJywgCiAgICAgICAgJ3NoYWRvd0FuY2hvcicsCiAgICAgICAgJ3BvcHVwQW5jaG9yJwogICAgXTsKICAgIHZhciBkZWZhdWx0X2ljb24gPSBMLkljb24uRGVmYXVsdC5wcm90b3R5cGUub3B0aW9uczsKICAgIGlmIChfb3B0aW9ucy5pY29uVXJsKSB7CiAgICAgICAgLy8gYXJyYXlzIGFyZSBzdHJpbmdzLCB1bmZvcnR1bmF0ZWx5Li4uCiAgICAgICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IGljb25BcnJheXMubGVuZ3RoOyBpIDwgbGVuOyBpKyspIHsKICAgICAgICAgICAgdmFyIG9wdGlvbl9uYW1lID0gaWNvbkFycmF5c1tpXTsKICAgICAgICAgICAgdmFyIG9wdGlvbiA9IF9vcHRpb25zWyBvcHRpb25fbmFtZSBdOwogICAgICAgICAgICAvLyBjb252ZXJ0ICIxLDIiIHRvIFsxLCAyXTsKICAgICAgICAgICAgaWYgKG9wdGlvbikgewogICAgICAgICAgICAgICAgdmFyIGFyciA9IG9wdGlvbi5qb2luKCcnKS5zcGxpdCgnLCcpOwogICAgICAgICAgICAgICAgLy8gYXJyYXkubWFwIGZvciBpZTw5CiAgICAgICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgbGVuSiA9IGFyci5sZW5ndGg7IGogPCBsZW5KOyBqKyspIHsKICAgICAgICAgICAgICAgICAgICBhcnJbal0gPSBOdW1iZXIoYXJyW2pdKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIF9vcHRpb25zWyBvcHRpb25fbmFtZSBdID0gYXJyOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIC8vIGRlZmF1bHQgcG9wdXBBbmNob3IKICAgICAgICBpZiAoIV9vcHRpb25zLnBvcHVwQW5jaG9yKSB7CiAgICAgICAgICAgIC8vIHNldCAocm91Z2hseSkgdG8gc2l6ZSBvZiBpY29uCiAgICAgICAgICAgIF9vcHRpb25zLnBvcHVwQW5jaG9yID0gKGZ1bmN0aW9uIChpX3NpemUpIHsKICAgICAgICAgICAgICAgIC8vIGNvcHkgYXJyYXkKICAgICAgICAgICAgICAgIGlfc2l6ZSA9IGlfc2l6ZS5zbGljZSgpOwogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAvLyBpbnZlcnNlIGNvb3JkaW5hdGVzCiAgICAgICAgICAgICAgICBpX3NpemVbMF0gPSAwOwogICAgICAgICAgICAgICAgaV9zaXplWzFdICo9IC0xOwogICAgICAgICAgICAgICAgLy8gYm90dG9tIHBvc2l0aW9uIG9uIHBvcHVwIGlzIDdweAogICAgICAgICAgICAgICAgaV9zaXplWzFdIC09IDM7CiAgICAgICAgICAgICAgICByZXR1cm4gaV9zaXplOwogICAgICAgICAgICB9KShfb3B0aW9ucy5pY29uU2l6ZSB8fCBkZWZhdWx0X2ljb24uaWNvblNpemUpOwogICAgICAgIH0KICAgICAgICBfb3B0aW9ucy5pY29uID0gbmV3IEwuSWNvbiggX29wdGlvbnMgKTsKICAgIH0KICAgIHJldHVybiBfb3B0aW9uczsKfSkoKTsKdmFyIG1hcmtlciA9IEwubWFya2VyKAogICAgWzUwLjIxNzc0ODEsMTEuMTQxNTk1OF0sIAogICAgbWFya2VyX29wdGlvbnMKKTsKdmFyIGlzX2ltYWdlID0gbWFwLmlzX2ltYWdlX21hcDsKaWYgKG1hcmtlcl9vcHRpb25zLmRyYWdnYWJsZSkgewogICAgbWFya2VyLm9uKCdkcmFnZW5kJywgZnVuY3Rpb24gKCkgewogICAgICAgIHZhciBsYXRsbmcgPSB0aGlzLmdldExhdExuZygpOwogICAgICAgIHZhciBsYXQgPSBsYXRsbmcubGF0OwogICAgICAgIHZhciBsbmcgPSBsYXRsbmcubG5nOwogICAgICAgIGlmIChpc19pbWFnZSkgewogICAgICAgICAgICBjb25zb2xlLmxvZygnbGVhZmxldC1tYXJr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