(function(){"use strict";Promise.withResolver=function withResolver(){let resolver;const promise=new Promise((resolve,reject)=>{resolver=resolve});return[promise,resolver]};"use strict";Djblets.buildURL=function(){let options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};let url=options.baseURL||"";const queryData=options.queryData;if(queryData){let queryString;if(typeof queryData==="string"){queryString=queryData;if(queryString.indexOf("?")===0){queryString=queryString.substr(1)}}else{queryString=$.param(queryData)}if(queryString){url+=`?${queryString}`}}const anchor=options.anchor;if(anchor){if(anchor.indexOf("#")===0){url+=anchor}else{url+=`#${anchor}`}}return url};Djblets.parseQueryString=function(url){let options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};const allowMultiValue=options.allowMultiValue;let j=url.indexOf("?");let queryString;if(j===-1){queryString=url}else{queryString=url.substr(j+1)}const query={};if(queryString.length===0){return query}const queryParams=queryString.split("&");for(let i=0;i<queryParams.length;i++){const queryParam=queryParams[i];let key;let value;j=queryParam.indexOf("=");if(j===-1){key=decodeURIComponent(queryParam);value=null}else{key=decodeURIComponent(queryParam.substr(0,j));value=decodeURIComponent(queryParam.substr(j+1))}if(allowMultiValue&&query.hasOwnProperty(key)){if(_.isArray(query[key])){query[key].push(value)}else{query[key]=[query[key],value]}}else{query[key]=value}}return query}}).call(this);
