If you have the skillz to translate JS to PHP, that would be a great solution. PHP running server side would fully protect the source code, provided the server is properly configured.
I kind of hate to bring it up, but given the nature of calculators, couldn’t it be reverse engineered? The result will be an original work that would not violate any copyright protections of the original work, provided the original source code was never seen. (IANAL, I could be wrong on that) But would anyone bother? Probably not. For example, I’ve created a rather unique calculator where the JS code if free to be reused for non-commercial purposes. AFAIK, no one has done so, they all simply link to my site where it’s available for use. And this is where the source code is available. Reverse engineering is far more work.
I don’t think it’s an issue, but something you ought to at least be aware of.