| STOCK-BASED COMPENSATION (Tables)
 | 12 Months Ended | 
| Dec. 31, 2018 | 
|---|
| STOCK-BASED COMPENSATION |  | 
| Schedule of stock-based compensation related to all of the entity's share-based payments |  
		
			Total stock‑based compensation expense related to all of our stock‑based awards was as follows (in thousands):
		 
			 
		 
			
				| 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  |  
				| 
						  | 
						  | 
						  | 
						Year Ended December 31,  | 
						  |  
				| 
						  | 
						  | 
						  | 
						2018 | 
						     | 
						2017 | 
						     | 
						2016 | 
						  |  
				| 
						Selling, general and administrative | 
						  | 
						  | 
						$ | 
						 5,383 | 
						  | 
						$ | 
						 4,490 | 
						  | 
						$ | 
						 4,230 | 
						  |  
				| 
						Research and development | 
						  | 
						  | 
						  | 
						 2,321 | 
						  | 
						  | 
						 1,497 | 
						  | 
						  | 
						 3,103 | 
						  |  
				| 
						Restructuring charges | 
						  | 
						  | 
						  | 
						  — | 
						  | 
						  | 
						  — | 
						  | 
						  | 
						 499 | 
						  |  
				| 
						Total stock-based compensation expense | 
						  | 
						  | 
						$ | 
						 7,704 | 
						  | 
						$ | 
						 5,987 | 
						  | 
						$ | 
						 7,832 | 
						  | 
			 
		 | 
| Summary of weighted-average assumptions relating to options granted pursuant to equity incentive plans |  
		
			
				| 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  |  
				| 
						  | 
						  | 
						  | 
						Year Ended  | 
						  |  
				| 
						  | 
						  | 
						  | 
						December 31,  | 
						  |  
				| 
						  | 
						     | 
						     | 
						2018 | 
						     | 
						2017 | 
						     | 
						2016 | 
						  |  
				| 
						Risk-free interest rate | 
						  | 
						  | 2.7 | 
						%   | 2.2 | 
						%   | 1.8 | 
						% |  
				| 
						Expected term (in years) | 
						  | 
						  | 6.7 | 
						  | 6.6 | 
						  | 6.2 | 
						  |  
				| 
						Dividend yield | 
						  | 
						  | 0.0 | 
						%   | 0.0 | 
						%   | 0.0 | 
						% |  
				| 
						Expected volatility | 
						  | 
						  | 65.1 | 
						%   | 63.5 | 
						%   | 61.1 | 
						% | 
			 
		 | 
| Schedule of option activity under equity incentive plans |  
		
			
				| 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  |  
				| 
						  | 
						     | 
						  | 
						     | 
						  | 
						     | 
						  | 
						  | 
						     | 
						Weighted- | 
						     | 
						  | 
						  | 
						  |  
				| 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						Average | 
						  | 
						  | 
						  | 
						  |  
				| 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						Remaining | 
						  | 
						  | 
						  | 
						  |  
				| 
						  | 
						  | 
						Shares Available | 
						  | 
						Number of Shares | 
						  | 
						Weighted-Average | 
						  | 
						Contractual Term | 
						  | 
						Aggregate | 
						  |  
				| 
						  | 
						  | 
						For Grant | 
						  | 
						Underlying Options | 
						  | 
						Exercise Price | 
						  | 
						(in years) | 
						  | 
						Intrinsic Value | 
						  |  
				| 
						Outstanding at January 1, 2018 | 
						  | 
						 11,696,696 | 
						  | 
						 20,408,140 | 
						  | 
						$ | 
						 5.45 | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  |  
				| 
						Authorized for grant | 
						  | 
						 4,878,124 | 
						  | 
						— | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  |  
				| 
						Granted | 
						  | 
						 (4,594,225) | 
						  | 
						 4,594,225 | 
						  | 
						$ | 
						 4.19 | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  |  
				| 
						Exercised | 
						  | 
						— | 
						  | 
						 (1,172,615) | 
						  | 
						$ | 
						 2.75 | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  |  
				| 
						Cancelled | 
						  | 
						 3,116,419 | 
						  | 
						 (3,116,419) | 
						  | 
						$ | 
						 12.87 | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  |  
				| 
						Outstanding at December 31, 2018 | 
						  | 
						 15,097,014 | 
						  | 
						 20,713,331 | 
						  | 
						$ | 
						 4.20 | 
						  | 
						 5.96 | 
						  | 
						$ | 
						 701,842 | 
						  |  
				| 
						Vested and expected to vest at December 31, 2018 | 
						  | 
						  | 
						  | 
						 20,513,331 | 
						  | 
						$ | 
						 4.21 | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  |  
				| 
						Exercisable at December 31, 2018 | 
						  | 
						  | 
						  | 
						 14,750,561 | 
						  | 
						$ | 
						 4.39 | 
						  | 
						 4.84 | 
						  | 
						$ | 
						 580,787 | 
						  | 
			 
		 | 
| Schedule of stock options by exercise price |  
		
			Details of our stock options by exercise price are as follows as of December 31, 2018: 
		 
			 
		 
			
				| 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  |  
				| 
						  | 
						  | 
						Options Outstanding | 
						  | 
						Options Exercisable | 
						  |  
				| 
						  | 
						     | 
						Number of | 
						     | 
						Weighted-Average | 
						     | 
						  | 
						  | 
						     | 
						  | 
						     | 
						  | 
						  | 
						  |  
				| 
						  | 
						  | 
						Outstanding | 
						  | 
						Remaining | 
						  | 
						Weighted-Average | 
						  | 
						Number of | 
						  | 
						Weighted-Average | 
						  |  
				| 
						Exercise Price | 
						  | 
						Options | 
						  | 
						Contractual Life (in years) | 
						  | 
						Exercise Price | 
						  | 
						Options | 
						  | 
						Exercise Price | 
						  |  
				| 
						$1.68 - $2.14 | 
						  | 
						 3,879,555 | 
						  | 
						 6.68 | 
						  | 
						$ | 
						 2.12 | 
						  | 
						 3,278,782 | 
						  | 
						$ | 
						 2.12 | 
						  |  
				| 
						$2.15 - $2.76 | 
						  | 
						 3,344,004 | 
						  | 
						 6.92 | 
						  | 
						  | 
						 2.61 | 
						  | 
						 2,756,548 | 
						  | 
						  | 
						 2.65 | 
						  |  
				| 
						$2.77 - $3.67 | 
						  | 
						 3,532,086 | 
						  | 
						 6.12 | 
						  | 
						  | 
						 3.49 | 
						  | 
						 2,433,716 | 
						  | 
						  | 
						 3.48 | 
						  |  
				| 
						$3.68 - $4.49 | 
						  | 
						 4,893,668 | 
						  | 
						 8.79 | 
						  | 
						  | 
						 4.25 | 
						  | 
						 1,217,498 | 
						  | 
						  | 
						 4.10 | 
						  |  
				| 
						$4.50 - $7.60 | 
						  | 
						 3,326,279 | 
						  | 
						 1.94 | 
						  | 
						  | 
						 6.57 | 
						  | 
						 3,326,279 | 
						  | 
						  | 
						 6.57 | 
						  |  
				| 
						$7.61 - $9.80 | 
						  | 
						 1,737,739 | 
						  | 
						 1.97 | 
						  | 
						  | 
						 8.71 | 
						  | 
						 1,737,739 | 
						  | 
						  | 
						 8.71 | 
						  |  
				| 
						$1.68 - $9.80 | 
						  | 
						 20,713,331 | 
						  | 
						 5.96 | 
						  | 
						  | 
						 4.20 | 
						  | 
						 14,750,562 | 
						  | 
						  | 
						 4.39 | 
						  | 
			 
		 | 
| Summary of weighted-average assumptions used to calculate fair value of purchase rights granted under Employee Stock Purchase Plan |  
		
			
				| 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  | 
						  |  
				| 
						  | 
						  | 
						Year Ended  | 
						  |  
				| 
						  | 
						  | 
						December 31,  | 
						  |  
				| 
						  | 
						     | 
						2018 | 
						     | 
						2017 | 
						     | 
						2016 | 
						  |  
				| 
						Risk-free interest rate | 
						  | 
						 2.4 | 
						%   | 
						 0.5 | 
						%   | 
						 0.5 | 
						% |  
				| 
						Expected term (in years) | 
						  | 
						 1.3 | 
						  | 
						 1.5 | 
						  | 
						 1.5 | 
						  |  
				| 
						Dividend yield | 
						  | 0.0 | 
						%   | 0.0 | 
						%   | 0.0 | 
						% |  
				| 
						Expected volatility | 
						  | 
						 66.2 | 
						%   | 
						 63.1 | 
						%   | 
						 62.9 | 
						% | 
			 
		 |