[JSEP] Fix outputSize calculation causing duplicate indices. (#24650)
### Description
Fix the outputSize computation causing duplicate indices. The outputSize
should be the size of indices tensor without counting the last
dimension.
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
Fix the issue https://github.com/microsoft/onnxruntime/issues/24070