1. When a new search is made (the user types at least 4 characters), AJAX POST request should be sent to the specified API endpoint and then returned results should be added to the page (this works now using jQuery, should work using only vanilla JS).
2. No additional libraries/dependencies/files may be required to run this code after you make your changes.
3. Serverside (PHP) code is OK, it will not be modified and should not be affected by this JS code change.
4. All endpoints, URLs, included HTML code, CSS class names, comments and variable names (wherever possible) should remain unmodified. The main thing is to convert the jQuery functions and logic to Vanilla JS.
5. In the code there are some texts which are in Polish. Do not translate or change them in any way, leave as is.
I attach a JS file with the code be converted and - for your reference, no need to update it - second file with example of HTML code for search input and results area.